From 1b55cabf505902af2275a5ae796acacae7073882 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 31 Dec 1999 08:29:02 +0000 Subject: [PATCH] Added wxEditor from Dirc Holtwic Some tweaks and fixes Some distrib updates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/wxPython/BUILD.txt | 39 +- utils/wxPython/CHANGES.txt | 3 + utils/wxPython/demo/Main.py | 4 +- utils/wxPython/demo/wxEditor.py | 42 ++ utils/wxPython/demo/wxFloatBar.py | 20 +- utils/wxPython/distrib/autobuild.py | 164 +++++++ utils/wxPython/distrib/wise.aut | 7 + utils/wxPython/distrib/wxPython.rsp | 2 + utils/wxPython/distrib/wxPython.wse | 20 + utils/wxPython/distrib/wxPython.wsm | Bin 33 -> 33 bytes utils/wxPython/lib/editor/.cvsignore | 4 + utils/wxPython/lib/editor/__init__.py | 18 + utils/wxPython/lib/editor/editor.py | 619 +++++++++++++++++++++++++ utils/wxPython/lib/editor/py_editor.py | 210 +++++++++ utils/wxPython/lib/editor/tokenizer.py | 60 +++ utils/wxPython/src/msw/windows.cpp | 106 ++++- utils/wxPython/src/msw/windows.py | 9 + utils/wxPython/src/windows.i | 3 + 18 files changed, 1304 insertions(+), 26 deletions(-) create mode 100644 utils/wxPython/demo/wxEditor.py create mode 100644 utils/wxPython/distrib/autobuild.py create mode 100644 utils/wxPython/distrib/wise.aut create mode 100644 utils/wxPython/lib/editor/.cvsignore create mode 100644 utils/wxPython/lib/editor/__init__.py create mode 100644 utils/wxPython/lib/editor/editor.py create mode 100644 utils/wxPython/lib/editor/py_editor.py create mode 100644 utils/wxPython/lib/editor/tokenizer.py diff --git a/utils/wxPython/BUILD.txt b/utils/wxPython/BUILD.txt index 0e58de5372..210a1e1a15 100644 --- a/utils/wxPython/BUILD.txt +++ b/utils/wxPython/BUILD.txt @@ -37,7 +37,7 @@ below.) You can use whatever flags you want, but these work for me. For Win32 systems I use Visual C++ 6.0, but 5.0 should work. The - build utility currently does not support any other win32 + wxPython build utility currently does not support any other win32 compilers. Be sure to copy include/wx/msw/setup0.h to include/wx/msw/setup.h and edit it for the options you want. @@ -46,13 +46,14 @@ below.) variable named WXWIN to be the path to the top of the wxWindows tree. + 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 6 + expects to find it by creating a file named build.local (see step 7 for more examples about build.local,) containing something like this: @@ -60,7 +61,7 @@ below.) 4. At this point you may want to make an alias or symlink, script, - batch file, whatever on the PATH that invokes + 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: @@ -71,16 +72,25 @@ below.) 5. Change into the $(WXWIN)/utils/wxPython/src directory. -6. Type "build -b" to build wxPython and "build -i" to install it. +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: + + touch gtk/*.cpp gtk/*.py + + +7. Type "build -b" to build wxPython and "build -i" to install it. 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 be able to override configuration options in a file named - build.local. For example, you can set a new TARGETDIR just by - creating a file named build.local in your wxPython source directory - and assign a value to it, like this: + build.local. For example, you can set a new TARGETDIR (the + installation directory) just by creating a file named build.local + in your wxPython source directory and assign a value to it, like + this: TARGETDIR = "/usr/local/lib/python1.5/site-packages/wxPython" @@ -88,20 +98,23 @@ below.) creative things there if you need to. -7. To build and install the add-on modules, change to the appropriate +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. -8. Change to the $WXWIN/utils/wxPython/demo directory. +9. Change to the $WXWIN/utils/wxPython/demo directory. -9. Try executing the demo program. For example: +10. Try executing the demo program. For example: python demo.py -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. + 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/utils/wxPython/CHANGES.txt index 9ed776e60b..704e4bc728 100644 --- a/utils/wxPython/CHANGES.txt +++ b/utils/wxPython/CHANGES.txt @@ -72,6 +72,9 @@ http://starship.python.net:9673/crew/da/Code/PyOpenGL. Added some missing EVT_ functions. +Added Dirk Holtwic's editor classes to the wxPython.lib.editor +package. + diff --git a/utils/wxPython/demo/Main.py b/utils/wxPython/demo/Main.py index 1030ed5d73..fea3339ceb 100644 --- a/utils/wxPython/demo/Main.py +++ b/utils/wxPython/demo/Main.py @@ -23,7 +23,7 @@ _useNestedSplitter = true _treeList = [ ('New since last release', ['wxMVCTree', 'wxVTKRenderWindow', 'FileBrowseButton', 'GenericButtons', - 'wxMask']), + 'wxMask', 'wxEditor']), ('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']), @@ -53,7 +53,7 @@ _treeList = [ ('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog', 'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar', 'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow', - 'FileBrowseButton', 'GenericButtons']), + 'FileBrowseButton', 'GenericButtons', 'wxEditor']), ('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']), diff --git a/utils/wxPython/demo/wxEditor.py b/utils/wxPython/demo/wxEditor.py new file mode 100644 index 0000000000..ffbea7d2ee --- /dev/null +++ b/utils/wxPython/demo/wxEditor.py @@ -0,0 +1,42 @@ + +from wxPython.wx import * +from wxPython.lib.editor import wxEditor, wxPyEditor + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = wxPanel(nb, -1) + ed = wxEditor(win) + pyed = wxPyEditor(win) + box = wxBoxSizer(wxVERTICAL) + box.Add(ed, 1, wxALL|wxGROW, 5) + box.Add(pyed, 1, wxALL|wxGROW, 5) + win.SetSizer(box) + win.SetAutoLayout(true) + + ed.SetText(["", + "This is a simple text editor, the class name is", + "wxEditor. Type a few lines and try it out."]) + + pyed.SetText(["# This one is a derived class named wxPyEditor.", + "# It adds syntax highlighting, folding (press", + "# F12 on the \"def\" line below) and other stuff.", + "import sys", + "def hello():", + " print 'hello'", + " for x in sys.path:", + " print x", + ""]) + return win + +#---------------------------------------------------------------------- + + + + + +overview = """\ +""" + + + diff --git a/utils/wxPython/demo/wxFloatBar.py b/utils/wxPython/demo/wxFloatBar.py index 48c85f4a3d..e61426abdc 100644 --- a/utils/wxPython/demo/wxFloatBar.py +++ b/utils/wxPython/demo/wxFloatBar.py @@ -17,24 +17,24 @@ class TestFloatBar(wxFrame): tb.SetFloatable(1) tb.SetTitle("Floating!") self.CreateStatusBar() - tb.AddTool(10, wxBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP), - wxNullBitmap, false, -1, -1, "New", "Long help for 'New'") + tb.AddSimpleTool(10, wxBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP), + "New", "Long help for 'New'") EVT_TOOL(self, 10, self.OnToolClick) EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick) - tb.AddTool(20, wxBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP), - wxNullBitmap, false, -1, -1, "Open") + tb.AddSimpleTool(20, wxBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP), + "Open") EVT_TOOL(self, 20, self.OnToolClick) EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick) tb.AddSeparator() - tb.AddTool(30, wxBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP), - wxNullBitmap, false, -1, -1, "Copy") + tb.AddSimpleTool(30, wxBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP), + "Copy") EVT_TOOL(self, 30, self.OnToolClick) EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick) - tb.AddTool(40, wxBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP), - wxNullBitmap, false, -1, -1, "Paste") + tb.AddSimpleTool(40, wxBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP), + "Paste") EVT_TOOL(self, 40, self.OnToolClick) EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick) @@ -42,8 +42,8 @@ class TestFloatBar(wxFrame): tb.AddTool(60, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP), - wxBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP), - true, -1, -1, "Toggle with 2 bitmaps") + wxBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP), + shortHelpString="Toggle with 2 bitmaps", toggle=true) EVT_TOOL(self, 60, self.OnToolClick) EVT_TOOL_RCLICKED(self, 60, self.OnToolRClick) tb.Realize() diff --git a/utils/wxPython/distrib/autobuild.py b/utils/wxPython/distrib/autobuild.py new file mode 100644 index 0000000000..d7472339ff --- /dev/null +++ b/utils/wxPython/distrib/autobuild.py @@ -0,0 +1,164 @@ + + +import sys, os, string, time +from ftplib import FTP + + +logfile = 'e:\\temp\\autobuild.log' +WXDIR = os.environ['WXWIN'] +dllVer = '21_11' +wxpVer = '2.1.11' +dateSt = time.strftime("%Y%m%d", time.localtime(time.time())) + +#---------------------------------------------------------------------- + +def do(cmd): + st = " " + cmd + " >> " + logfile + print st + f = open(logfile, "at") + f.write(st + '\n') + f.close() + os.system(cmd + " >>& " + logfile) + +#---------------------------------------------------------------------- + +def logTruncate(): + f = open(logfile, "wt") + f.close() + + +def logSeparator(msg=None, f=None, recurse=1): + if not f: + f = open(logfile, "at") + f.write('\n') + f.write('--' * 35) + f.write('\n') + if msg: + f.write(msg) + f.write('\n') + f.write('--' * 35) + f.write('\n') + if recurse: + logSeparator(msg, sys.stdout, 0) + +#---------------------------------------------------------------------- + +def validateFile(file): + if not os.path.exists(file): + logSeparator("***** %s does not exist, exiting! *****" % file) + raise SystemExit + else: + logSeparator("%s found, continuing..." % file, recurse=0) + + +#---------------------------------------------------------------------- + +def main(): + logTruncate() + + try: + 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') + + logSeparator("Building wxWindows and 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("Copying wxPython workspace to build directory...") + do("copy /s %s %s" % ('e:\\projects\\wxPython\*.*', WXDIR+'\\utils\\wxPython')) + os.chdir(WXDIR + '/utils/wxPython') + 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') + + + + 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') + + + logSeparator("Building installer executable...") + os.chdir(WXDIR+'\\utils\\wxPython\\distrib') + do("autoit2 wise.aut") + srcName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-'+wxpVer+'.EXE' + destName = WXDIR+'\\utils\\wxPython\\distrib\\wxPython-'+wxpVer+'-'+dateSt+'.EXE' + validateFile(srcName) + try: + os.rename(srcName, destName) + except: + pass + + + logSeparator("Building source zip file...") + 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' + validateFile(srcZName) + try: + os.rename(srcZName, destZName) + except: + pass + + + logSeparator("Uploading to website...") + do('python d:\util32\sendwxp.py %s' % destName) + do('python d:\util32\sendwxp.py %s' % destZName) + os.unlink(destName) + os.unlink(destZName) + + + logSeparator("Finished!!!") + + finally: + os.system("list " + logfile) + pass + + + + + + +if __name__ == '__main__': + main() diff --git a/utils/wxPython/distrib/wise.aut b/utils/wxPython/distrib/wise.aut new file mode 100644 index 0000000000..6abb399e38 --- /dev/null +++ b/utils/wxPython/distrib/wise.aut @@ -0,0 +1,7 @@ + +run, e:\\Tools\\Wise\\WISE32.EXE wxPython.wse +winwaitactive, wxPython.wse - Wise Installation System +send, !ic +sleep, 1000 +winwaitactive, wxPython.wse - Wise Installation System +send, !fx diff --git a/utils/wxPython/distrib/wxPython.rsp b/utils/wxPython/distrib/wxPython.rsp index bb4f379802..9f1f3fd005 100644 --- a/utils/wxPython/distrib/wxPython.rsp +++ b/utils/wxPython/distrib/wxPython.rsp @@ -18,6 +18,8 @@ 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 diff --git a/utils/wxPython/distrib/wxPython.wse b/utils/wxPython/distrib/wxPython.wse index f090501d39..81bc8ccee0 100644 --- a/utils/wxPython/distrib/wxPython.wse +++ b/utils/wxPython/distrib/wxPython.wse @@ -849,6 +849,12 @@ item: Install File Description=wxPython Standard Library Flags=0000000010000010 end +item: Install File + Source=e:\Projects\wx\utils\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 Destination=%MAINDIR%\wxPython\demo @@ -1133,6 +1139,20 @@ item: Create Shortcut Key Type=1536 Flags=00000001 end +item: Create Shortcut + Source=%MAINDIR%\wxPython\README.txt + Destination=%CGROUPDIR%\%CGROUP_SAVE%\ReadMe.lnk + Icon Number=0 + Key Type=1536 + Flags=00000001 +end +item: Create Shortcut + Source=%MAINDIR%\wxPython\CHANGES.txt + Destination=%CGROUPDIR%\%CGROUP_SAVE%\Changes.lnk + Icon Number=0 + Key Type=1536 + Flags=00000001 +end item: Create Shortcut Source=%UNINSTALL_PATH% Destination=%CGROUPDIR%\%CGROUP_SAVE%\Uninstall %APPTITLE%.lnk diff --git a/utils/wxPython/distrib/wxPython.wsm b/utils/wxPython/distrib/wxPython.wsm index 66a1c6507b27db63f819c871db6ea050d8a00f27..16ffb01726ff7b40183f537dd966985df430adc4 100644 GIT binary patch literal 33 mcmWF!_BGq8#lXPGFh%`*?#FrN3{0|23?RT5TCS4l$^Zb7zXyW= literal 33 lcmWF!_B9jGU|?Wm$XA~m-Eh^6Ay9^i0R$LB%T*Fx831+u28I9t diff --git a/utils/wxPython/lib/editor/.cvsignore b/utils/wxPython/lib/editor/.cvsignore new file mode 100644 index 0000000000..dd21cbd860 --- /dev/null +++ b/utils/wxPython/lib/editor/.cvsignore @@ -0,0 +1,4 @@ +__init__.pyc +editor.pyc +py_editor.pyc +tokenizer.pyc diff --git a/utils/wxPython/lib/editor/__init__.py b/utils/wxPython/lib/editor/__init__.py new file mode 100644 index 0000000000..30bd0310d0 --- /dev/null +++ b/utils/wxPython/lib/editor/__init__.py @@ -0,0 +1,18 @@ +#---------------------------------------------------------------------- +# Name: wxPython.lib.editor +# Purpose: A package containing a colourizable text editror +# +# Author: Robin Dunn +# +# Created: 30-Dec-1999 +# RCS-ID: $Id$ +# Copyright: (c) 1999 by Total Control Software +# Licence: wxWindows license +#---------------------------------------------------------------------- + +# This file makes this directory into a Python package + + +# import the main classes into the package namespace. +from editor import wxEditor +from py_editor import wxPyEditor diff --git a/utils/wxPython/lib/editor/editor.py b/utils/wxPython/lib/editor/editor.py new file mode 100644 index 0000000000..3b0df9c4c9 --- /dev/null +++ b/utils/wxPython/lib/editor/editor.py @@ -0,0 +1,619 @@ +#---------------------------------------------------------------------- +# Name: wxPython.lib.editor.wxEditor +# Purpose: An intelligent text editor with colorization capabilities. +# +# Author: Dirk Holtwic, Robin Dunn +# +# Created: 15-Dec-1999 +# RCS-ID: $Id$ +# Copyright: (c) 1999 by Dirk Holtwick, 1999 +# Licence: wxWindows license +#---------------------------------------------------------------------- + +from wxPython.wx import * +from string import * +from keyword import * +from regsub import * +from tokenizer import * + +#--------------------------------------------------------------------------- + +#EDITOR_STD_LINE = ("", [], (0,0,0)) + +#--------- + +class Line: + def __init__(self, text=""): + self.text = text # the string itself + self.syntax = [] # the colors of the line + self.editable = true # edit? + self.visible = 0 # will be incremented if not + self.indent = 0 # not used yet + +#---------------------------------------------------------------------- + +class wxEditor(wxScrolledWindow): + + def __init__(self, parent, id=-1): + ############################################################### + """ + Alles hat einen Anfang + """ + + wxScrolledWindow.__init__(self, parent, id, + wxDefaultPosition, wxSize(500,400), + wxSUNKEN_BORDER|wxWANTS_CHARS) + + # the syntax informations, if they don't exist, + # all syntax stuff will be ignored + + # cursor pos + self.cx = 0 + self.cy = 0 + + # the lines that are visible + self.lines = [] + self.line = 0 + self.len = 0 + + self.ocy = 0 + + # border pos + #self.bx = 0 + #self.by = 0 + + # screen + self.sx = 0 + self.sy = 0 + self.sw = 0 + self.sh = 0 + + # font + dc = wxClientDC(self) + + #if wxPlatform == "__WXMSW__": + self.font = wxFont(12, wxMODERN, wxNORMAL, wxNORMAL) + #else: + # self.font = wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, false) + dc.SetFont(self.font) + + # font weight, height + self.fw = dc.GetCharWidth() + self.fh = dc.GetCharHeight() + + # back, for colour + self.bcol = wxNamedColour('white') + self.fcol = wxNamedColour('black') + + self.cfcol = wxNamedColour('black') + self.cbcol = wxNamedColour('red') + + # nicht edierbare zeile (hintergrund) + self.nedcol = wxNamedColour('grey') + + self.SetBackgroundColour(self.bcol) + #dc.SetForegroundColour(self.fcol) + + # events + EVT_LEFT_DOWN(self, self.OnMouseClick) + EVT_RIGHT_DOWN(self, self.OnMouseClick) + EVT_SCROLLWIN(self, self.OnScroll) + + self.o_cx = self.cx + self.o_cy = self.cy + self.o_sx = self.sx + self.o_sy = self.sy + self.o_line = self.line + self.sco_x = 0 + self.sco_y = 0 + + self.tabsize = 4 + + self.update = true + self.in_scroll =FALSE + + bw,bh = self.GetSizeTuple() + # double buffering + self.mdc = wxMemoryDC() + self.mdc.SelectObject(wxEmptyBitmap(bw,bh)) + # disable physical scrolling because invisible parts are not drawn + self.EnableScrolling(FALSE, FALSE) + + # the ordinary text as it is + self.SetText() + self.SetFocus() + + +#--------------------------------------------------------------------------- + + def CalcLines(self): + ############################################################### + self.lines = [] + x =maxlen =0 + for line in self.text: + if line.visible==0: + self.lines.append(x) + else: + if len(line.text) >maxlen: + maxlen =len(line.text) + x = x + 1 + self.len = len(self.lines) + self.max_linelength =maxlen + + def SetFontTab(self, fonttab): + ############################################################### + """ Fonttabelle zum schnellen Zugriff """ + self.ftab = fonttab + + def SetText(self, text = [""]): + ############################################################### + """ Text mittels Liste setzen """ + self.cx = 0 + self.cy = 0 + self.text = [] + + for t in text: + self.text.append(Line(t)) + + for l in range(0,len(text)-1): + #self.UpdateSyntax(l) + self.OnUpdateHighlight(l) + + self.OnInit() + + self.update = true + self.UpdateView(None, true) + + # show new text + def GetText(self): + ############################################################### + """ Der gesamte Text als Liste """ + text = [] + for line in self.text: + text.append(line.text) + return text + + def IsEmpty(self): + ############################################################### + """see if at least one text line is not empty""" + for line in self.text: + if line.text: return 0 + return 1 + + def IsLine(self, line): + ############################################################### + """ Schauen, ob alles im grünen Bereich ist """ + return (line>=0) and (line Cursor setzen + """ + self.SetFocus() + + self.cy = self.sy + (event.GetY() / self.fh) + if self.cy >= self.len: self.cy =max(self.len -1, 0) + linelen =len(self.text[self.GetLine(self.cy)].text) + self.cx = self.sx + (event.GetX() / self.fw) + # allow positioning right behind the last character + if self.cx > linelen: self.cx =linelen + if event.GetEventType() ==wxEVT_RIGHT_DOWN: + self.update = true + self.OnFold() + self.UpdateView() + + + def DrawCursor(self, dc = None): + ############################################################### + """ + Auch der Cursor muß ja irgendwie gezeichnet werden + """ + if not dc: + dc = wxClientDC(self) + + if (self.len)(self.max_linelength -self.sw +1): + self.sx =self.max_linelength -self.sw +1 + if self.sx <0: self.sx =0 + if self.cx >(self.sx +self.sw -1): self.cx =self.sx +self.sw -1 + if self.cx (self.len -self.sh +1): + self.sy =self.len -self.sh +1 + if self.sy <0: self.sy =0 + if self.cy >(self.sy +self.sh -1): self.cy =self.sy +self.sh -1 + if self.cy