Compare commits
1 Commits
wxPython-2
...
wxPython-2
Author | SHA1 | Date | |
---|---|---|---|
|
818ffd7cb5 |
@@ -1,9 +1,5 @@
|
||||
*.py
|
||||
*.pyc
|
||||
*.pyc
|
||||
*.pyd
|
||||
*.pyd
|
||||
*.pyo
|
||||
*.pyo
|
||||
*.zip
|
||||
.cvsignore
|
||||
@@ -14,7 +10,6 @@ __init__.pyc
|
||||
__init__.pyc
|
||||
__init__.pyo
|
||||
__init__.pyo
|
||||
build.local
|
||||
cmndlgs.py
|
||||
cmndlgs.py
|
||||
cmndlgs.pyc
|
||||
@@ -40,7 +35,6 @@ events.pyc
|
||||
events.pyc
|
||||
events.pyo
|
||||
events.pyo
|
||||
filelist
|
||||
frames.py
|
||||
frames.py
|
||||
frames.pyc
|
||||
@@ -105,7 +99,6 @@ wx.py
|
||||
wx.pyc
|
||||
wx.pyc
|
||||
wx.pyo
|
||||
wxPython.doc
|
||||
wxc.ilk
|
||||
wxc.pdb
|
||||
wxc.pyd
|
||||
@@ -115,3 +108,7 @@ wxp.pyo
|
||||
wxpc.ilk
|
||||
wxpc.pdb
|
||||
wxpc.pyd
|
||||
*.py
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
|
@@ -45,107 +45,6 @@ Or you can send mail directly to the list using this address:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
What's new in 2.1b3
|
||||
--------------------
|
||||
|
||||
This release is syncronized with release 2.1 snapshot 9 of wxWindows.
|
||||
|
||||
Switched to using SWIG from CVS (see http://swig.cs.uchicago.edu/cvs.html)
|
||||
for some of the new features and such. Also they have encorporated my
|
||||
patches so there is really no reason to stick with the current (very
|
||||
old) release... This version of SWIG gives the following new
|
||||
features:
|
||||
|
||||
1. Keyword arguments. You no longer have to specify all the
|
||||
parameters with defaults to a method just to specify a
|
||||
non-default value on the end. You can now do this instead:
|
||||
|
||||
win = wxWindow(parent, -1, style = mystyle)
|
||||
|
||||
2. There is now an an equivalence between Python's None and C++'s
|
||||
NULL. This means that any methods that might return NULL will
|
||||
now return None and you can use none where wxWindows might be
|
||||
expecting NULL. This makes things much more snake-ish.
|
||||
|
||||
|
||||
There is a new build system based on a new Python program instead of
|
||||
raw makefiles. Now wxPython builds are virtually the same on MSW or
|
||||
Unix systems. See the end of this file for new build instructions and
|
||||
see distrib/build.py for more details.
|
||||
|
||||
wxDC.Bilt now includes the useMask parameter, and has been split into
|
||||
two different versions. wxDC.BlitXY is like what was there before and
|
||||
takes raw coordinants and sizes, and the new wxDC.Blit is for the new
|
||||
interface using wxPoints and a wxSize.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
What's new in 2.1b2
|
||||
--------------------
|
||||
|
||||
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.
|
||||
|
||||
I fixed a bunch of stuff in the C++ version of wxGrid so it wouldn't
|
||||
make wxPython look bad.
|
||||
|
||||
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.
|
||||
|
||||
Fixed wxImage GetData and SetData to properly use String objects for
|
||||
data transfer.
|
||||
|
||||
Added access methods to wxGridEvent.
|
||||
|
||||
New Makefile/Setup files supporting multiple dynamic extension modules
|
||||
for unix systems.
|
||||
|
||||
Fixes for the wxGLCanvas demo to work around a strange bug in gtk.
|
||||
|
||||
SWIG support routines now compiled separately instead of being bundled
|
||||
in wx.cpp.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
What's new in 2.1b1
|
||||
--------------------
|
||||
@@ -333,59 +232,42 @@ me. You don't need SWIG to build the extension module as all the
|
||||
generated C++ code is included under the src directory.
|
||||
|
||||
I added a few minor features to SWIG to control some of the code
|
||||
generation. If you want to play around with this you will need to get
|
||||
a recent version of SWIG from their CVS or from a daily build. See
|
||||
http://www.swig.org/ for details.
|
||||
generation. If you want to playaround with this the patches are in
|
||||
wxPython/SWIG.patches and they should be applied to the 1.1p5 version
|
||||
of SWIG. These new patches are documented at
|
||||
http://starship.skyport.net/crew/robind/#swig, and they should also
|
||||
end up in the 1.2 version of SWIG.
|
||||
|
||||
wxPython is organized as a Python package. This means that the
|
||||
directory containing the results of the build process should be a
|
||||
subdirectory of a directory on the PYTHONPATH. (And preferably should
|
||||
be named wxPython.) You can control where the build process will dump
|
||||
wxPython by setting the TARGETDIR variable for the build utility, (see
|
||||
below.)
|
||||
wxPython by setting the TARGETDIR makefile variable. The default is
|
||||
$(WXWIN)/utils/wxPython, where this README.txt is located. If you
|
||||
leave it here then you should add $(WXWIN)/utils to your PYTHONPATH.
|
||||
However, you may prefer to use something that is already on your
|
||||
PYTHONPATH, such as the site-packages directory on Unix systems.
|
||||
|
||||
|
||||
1. Build wxWindows as described in its BuildCVS.txt file. For *nix
|
||||
systems I run configure with these flags:
|
||||
Win32
|
||||
-----
|
||||
|
||||
--with-gtk
|
||||
--with-libjpeg
|
||||
--without-odbc
|
||||
--enable-unicode=no
|
||||
--enable-threads=yes
|
||||
--enable-socket=yes
|
||||
--enable-static=no
|
||||
--enable-shared=yes
|
||||
--disable-std_iostreams
|
||||
1. Build wxWindows with wxUSE_RESOURCE_LOADING_IN_MSW set to 1 in
|
||||
include/wx/msw/setup.h so icons can be loaded dynamically. While
|
||||
there, make sure wxUSE_OWNER_DRAWN is also set to 1.
|
||||
|
||||
You can use whatever flags you want, but I know these work.
|
||||
2. Change into the $(WXWIN)/utils/wxPython/src directory.
|
||||
|
||||
For Win32 systems I use Visual C++ 6.0, but 5.0 should work. The
|
||||
build utility currently does not support any other win32 compilers.
|
||||
3. Edit makefile.vc and specify where your python installation is at.
|
||||
You may also want to fiddle with the TARGETDIR variable as described
|
||||
above.
|
||||
|
||||
2. At this point you may want to make an alias or symlink, script,
|
||||
batch file, 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:
|
||||
4. Run nmake -f makefile.vc
|
||||
|
||||
python $(WXWIN)/utils/wxPython/distrib/build.py %1 %2 %3 %4 %5 %6
|
||||
|
||||
|
||||
3. Change into the $(WXWIN)/utils/wxPython/src directory.
|
||||
|
||||
4. 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.
|
||||
|
||||
5. To build and install the add-on modules, change to the appropriate
|
||||
directory under $(WXWIN)/utils/wxPython/modules and run the build
|
||||
utility again.
|
||||
5. If it builds successfully, congratulations! Move on to the next
|
||||
step. If not then you can try mailing me for help. Also, I will
|
||||
always have a pre-built win32 version of this extension module at
|
||||
http://alldunn.com/wxPython/.
|
||||
|
||||
6. Change to the $(WXWIN)/utils/wxPython/demo directory.
|
||||
|
||||
@@ -393,19 +275,44 @@ below.)
|
||||
|
||||
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, you can use the pythonw.exe
|
||||
version of Python either from the command line or from a shortcut.
|
||||
|
||||
|
||||
|
||||
Unix
|
||||
----
|
||||
0. I configure wxWindows like this, YMMV:
|
||||
|
||||
./configure --with-gtk --without-shared --with-threads --without-unicode --with-libjpeg
|
||||
|
||||
|
||||
1. Change into the $(WXWIN)/utils/wxPython/src directory.
|
||||
|
||||
2. Edit Setup.in and ensure that the flags, directories, and toolkit
|
||||
options are correct. See the above commentary about TARGETDIR. There
|
||||
are a few sample Setup.in.[platform] files provided.
|
||||
|
||||
3. Run this command to generate a makefile:
|
||||
|
||||
make -f Makefile.pre.in boot
|
||||
|
||||
4. Run these commands to build and then install the wxPython extension
|
||||
module:
|
||||
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
5. Change to the $(WXWIN)/utils/wxPython/demo directory.
|
||||
|
||||
6. Try executing the demo program. For example:
|
||||
|
||||
python demo.py
|
||||
|
||||
----------------
|
||||
Robin Dunn
|
||||
robin@alldunn.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,38 +1,38 @@
|
||||
*** swig.h.old Wed Feb 04 15:59:40 1998
|
||||
--- swig.h Fri Aug 28 15:46:32 1998
|
||||
*** swig.h.old Wed Feb 04 14:59:40 1998
|
||||
--- swig.h Fri Aug 28 14: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
|
||||
*
|
||||
@@ -44,15 +44,15 @@
|
||||
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
|
||||
@@ -74,9 +74,9 @@
|
||||
+ 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);
|
||||
@@ -86,54 +86,12 @@
|
||||
+ 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.
|
||||
* Revision 1.1 1998/10/03 05:56:02 RD
|
||||
* *** empty log message ***
|
||||
*
|
||||
|
@@ -1,9 +1,8 @@
|
||||
*** python.cxx.old Fri Jan 02 23:17:40 1998
|
||||
--- python.cxx Fri Aug 28 15:49:18 1998
|
||||
*** python.cxx.old Fri Jan 02 22:17:40 1998
|
||||
--- python.cxx Fri Aug 28 14:49:18 1998
|
||||
***************
|
||||
*** 1678,1685 ****
|
||||
--- 1678,1702 ----
|
||||
fprintf(stderr,"%s : Line %d. Unable to locate file %s\n", input_file, line_number, value);
|
||||
*** 1679,1684 ****
|
||||
--- 1679,1701 ----
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +15,7 @@
|
||||
+ 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);
|
||||
@@ -27,80 +26,65 @@
|
||||
} 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
|
||||
*** python.h.old Thu Jul 24 22:18:50 1997
|
||||
--- python.h Fri Aug 28 14:46:08 1998
|
||||
***************
|
||||
*** 184,191 ****
|
||||
--- 184,203 ----
|
||||
void cpp_declare_const(char *name, char *iname, DataType *type, char *value);
|
||||
*** 185,191 ****
|
||||
--- 185,203 ----
|
||||
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
|
||||
|
||||
*** pycpp.cxx.old Fri Jan 02 20:23:22 1998
|
||||
--- pycpp.cxx Fri Aug 28 16:01:46 1998
|
||||
***************
|
||||
*** 275,282 ****
|
||||
--- 275,283 ----
|
||||
#endif
|
||||
*** 276,281 ****
|
||||
--- 276,282 ----
|
||||
}
|
||||
}
|
||||
// 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 ----
|
||||
}
|
||||
*** 394,399 ****
|
||||
--- 395,401 ----
|
||||
}
|
||||
*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"
|
||||
*** 494,502 ****
|
||||
*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"
|
||||
--- 496,503 ----
|
||||
*pyclass << tab4 << "def __del__(self):\n"
|
||||
<< tab8 << "if self.thisown == 1 :\n"
|
||||
<< tab8 << tab4 << module << "." << name_destroy(realname) << "(self.this)\n";
|
||||
! emitAddPragmas(*pyclass, "__del__", tab8);
|
||||
@@ -108,27 +92,23 @@
|
||||
if (doc_entry) {
|
||||
doc_entry->usage = "";
|
||||
doc_entry->usage << "del this";
|
||||
}
|
||||
***************
|
||||
*** 551,558 ****
|
||||
--- 552,561 ----
|
||||
repr << tab4 << "def __repr__(self):\n"
|
||||
*** 552,557 ****
|
||||
--- 553,560 ----
|
||||
<< 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)));
|
||||
*** 747,752 ****
|
||||
--- 750,777 ----
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+ // --------------------------------------------------------------------------------
|
||||
+ // PYTHON::emitAddPragmas(String& output, char* name, char* spacing);
|
||||
+ //
|
||||
@@ -136,13 +116,13 @@
|
||||
+ // 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];
|
||||
@@ -151,52 +131,6 @@
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
|
||||
/*********************************************************************************
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
|
@@ -1,12 +1,12 @@
|
||||
*** cplus.cxx.old Mon Feb 02 15:55:42 1998
|
||||
--- cplus.cxx Fri Aug 28 13:02:50 1998
|
||||
*** cplus.cxx.old Mon Feb 02 14:55:42 1998
|
||||
--- cplus.cxx Fri Aug 28 12: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
|
||||
@@ -28,7 +28,7 @@
|
||||
- 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);
|
||||
@@ -37,12 +37,12 @@
|
||||
--- 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);
|
||||
@@ -53,20 +53,20 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// 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)
|
||||
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)
|
||||
***************
|
||||
@@ -74,7 +74,7 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// 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;
|
||||
@@ -84,7 +84,7 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// 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;
|
||||
@@ -95,7 +95,7 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// Inherit. Put all the declarations associated with this class into the current
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
! void inherit_decls(int mode) {
|
||||
CPP_member *m;
|
||||
m = members;
|
||||
@@ -105,7 +105,7 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// Inherit. Put all the declarations associated with this class into the current
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
! void CPP_class::inherit_decls(int mode) {
|
||||
CPP_member *m;
|
||||
m = members;
|
||||
@@ -114,9 +114,9 @@
|
||||
***************
|
||||
*** 696,704 ****
|
||||
// ------------------------------------------------------------------------------
|
||||
// Emit all of the declarations associated with this class
|
||||
// Emit all of the declarations associated with this class
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
! void emit_decls() {
|
||||
CPP_member *m = members;
|
||||
int last_scope = name_scope(0);
|
||||
@@ -126,7 +126,7 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// Emit all of the declarations associated with this class
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
! void CPP_class::emit_decls() {
|
||||
CPP_member *m = members;
|
||||
int last_scope = name_scope(0);
|
||||
@@ -134,10 +134,10 @@
|
||||
while (m) {
|
||||
***************
|
||||
*** 713,721 ****
|
||||
// ------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------
|
||||
// Search for a given class in the list
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
! static CPP_class *search(char *name) {
|
||||
CPP_class *c;
|
||||
c = classlist;
|
||||
@@ -147,7 +147,7 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// Search for a given class in the list
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
! CPP_class *CPP_class::search(char *name) {
|
||||
CPP_class *c;
|
||||
c = classlist;
|
||||
@@ -158,22 +158,22 @@
|
||||
// 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 ****
|
||||
// ------------------------------------------------------------------------------
|
||||
@@ -182,21 +182,21 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
- 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
|
||||
*** vector.cxx.old Fri Aug 28 14:23:16 1998
|
||||
--- vector.cxx Fri Aug 28 14:46:52 1998
|
||||
***************
|
||||
*** 0 ****
|
||||
--- 1,182 ----
|
||||
+
|
||||
+
|
||||
+ /*******************************************************************************
|
||||
+ * Simplified Wrapper and Interface Generator (SWIG)
|
||||
+ *
|
||||
@@ -237,9 +237,9 @@
|
||||
+ * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
+ *
|
||||
+ *******************************************************************************/
|
||||
+
|
||||
+
|
||||
+ #include "internal.h"
|
||||
+
|
||||
+
|
||||
+ /*******************************************************************************
|
||||
+ * $Header$
|
||||
+ *
|
||||
@@ -249,9 +249,9 @@
|
||||
+ * successful. Should be made more robust...
|
||||
+ *
|
||||
+ *******************************************************************************/
|
||||
+
|
||||
+
|
||||
+ void* Vector::s_nullPtr = NULL;
|
||||
+
|
||||
+
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+ // Vector::Vector(size_t allocSize = 8)
|
||||
+ //
|
||||
@@ -263,7 +263,7 @@
|
||||
+ //
|
||||
+ // Side Effects : None
|
||||
+ // -----------------------------------------------------------------------------
|
||||
+
|
||||
+
|
||||
+ Vector::Vector(size_t allocSize)
|
||||
+ : m_size(allocSize),
|
||||
+ m_count(0),
|
||||
@@ -276,27 +276,27 @@
|
||||
+ 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)
|
||||
+ //
|
||||
@@ -306,48 +306,48 @@
|
||||
+ // 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)
|
||||
+ //
|
||||
@@ -355,176 +355,145 @@
|
||||
+ // 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:
|
||||
+ * Revision 1.2 1999/04/30 03:28:35 RD
|
||||
+ * wxPython 2.0b9, first phase (win32)
|
||||
+ * Added gobs of stuff, see wxPython/README.txt for details
|
||||
+ *
|
||||
+ * Added the missing wxWindow.GetUpdateRegion() method.
|
||||
+ * Revision 1.1.4.1 1999/03/27 23:28:59 RD
|
||||
+ *
|
||||
+ * 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.
|
||||
+ * wxPython 2.0b8
|
||||
+ * Python thread support
|
||||
+ * various minor additions
|
||||
+ * various minor fixes
|
||||
+ *
|
||||
+ * 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.
|
||||
+ * Revision 1.1 1998/10/03 05:56:03 RD
|
||||
+ * *** empty log message ***
|
||||
+ *
|
||||
+ *
|
||||
+ ***********************************************************************/
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
*** makefile.msc.old Mon Jun 23 16:15:32 1997
|
||||
--- makefile.msc Fri Aug 28 11:21:58 1998
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
*** makefile.msc.old Mon Jun 23 15:15:32 1997
|
||||
--- makefile.msc Fri Aug 28 10: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
|
||||
*** makefile.bc.old Sun Jan 04 12:49:24 1998
|
||||
--- makefile.bc Fri Aug 28 14: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
|
||||
*** Makefile.in.old Wed May 28 22:56:56 1997
|
||||
--- Makefile.in Fri Aug 28 14: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
|
||||
|
@@ -1,3 +1,15 @@
|
||||
#!/bin/env python
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: ColorPanel.py
|
||||
# Purpose: Testing lots of stuff, controls, window types, etc.
|
||||
#
|
||||
# Author: Robin Dunn & Gary Dumer
|
||||
#
|
||||
# Created:
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1998 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
@@ -10,4 +22,4 @@ class ColoredPanel(wxWindow):
|
||||
wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER)
|
||||
self.SetBackgroundColour(color)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/bin/env python
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: DialogUnits.py
|
||||
# Purpose: A minimal wxPython program that is a bit smarter than test1.
|
||||
@@ -46,9 +46,6 @@ class MyFrame(wxFrame):
|
||||
wxDLG_SZE(panel, wxSize(36, -1)),
|
||||
wxTE_READONLY)
|
||||
|
||||
print wxDLG_PNT(panel, wxPoint(24, 4)), wxDLG_SZE(panel, wxSize(36, -1))
|
||||
print wxDLG_PNT(panel, wxPoint(24, 16)),wxDLG_SZE(panel, wxSize(36, -1))
|
||||
|
||||
|
||||
# This method is called automatically when the CLOSE event is
|
||||
# sent to this window
|
||||
|
@@ -43,7 +43,7 @@ _treeList = [
|
||||
('wxPython Library', ['Sizers', 'Layoutf', 'wxScrolledMessageDialog',
|
||||
'wxMultipleChoiceDialog', 'wxPlotCanvas']),
|
||||
|
||||
('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
|
||||
('Cool Contribs', ['pyTree', 'hangman', 'SlashDot']),
|
||||
|
||||
]
|
||||
|
||||
@@ -109,20 +109,21 @@ class wxPythonDemo(wxFrame):
|
||||
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 = wxTextCtrl(self.nb, -1, '', wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE|wxTE_READONLY)
|
||||
self.nb.AddPage(self.ovr, "Overview")
|
||||
|
||||
|
||||
# Set up a TextCtrl on the Demo Code Notebook page
|
||||
self.txt = wxTextCtrl(self.nb, -1,
|
||||
style = wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
|
||||
self.txt = wxTextCtrl(self.nb, -1, '', wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
|
||||
self.txt.SetFont(wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false))
|
||||
self.nb.AddPage(self.txt, "Demo Code")
|
||||
|
||||
|
||||
# Set up a log on the View Log Notebook page
|
||||
self.log = wxTextCtrl(splitter2, -1,
|
||||
style = wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
|
||||
self.log = wxTextCtrl(splitter2, -1, '', wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
|
||||
(w, self.charHeight) = self.log.GetTextExtent('X')
|
||||
#self.WriteText('wxPython Demo Log:\n')
|
||||
|
||||
@@ -152,8 +153,7 @@ class wxPythonDemo(wxFrame):
|
||||
w, h = self.log.GetClientSizeTuple()
|
||||
numLines = h/self.charHeight
|
||||
x, y = self.log.PositionToXY(self.log.GetLastPosition())
|
||||
self.log.ShowPosition(self.log.XYToPosition(x, y-numLines))
|
||||
##self.log.ShowPosition(self.log.GetLastPosition())
|
||||
self.log.ShowPosition(self.log.XYToPosition(x, y-numLines+1))
|
||||
self.log.SetInsertionPointEnd()
|
||||
|
||||
def write(self, txt):
|
||||
@@ -218,7 +218,7 @@ class wxPythonDemo(wxFrame):
|
||||
# self.txt.WriteText("Cannot open %s file." % filename)
|
||||
try:
|
||||
self.txt.SetValue(open(filename).read())
|
||||
except IOError:
|
||||
except IOException:
|
||||
self.txt.WriteText("Cannot open %s file." % filename)
|
||||
|
||||
|
||||
|
@@ -111,17 +111,21 @@ def makeSimpleBorder3(win):
|
||||
def makeBoxInBox(win):
|
||||
box = wxBoxSizer(wxVERTICAL)
|
||||
|
||||
box.Add(wxButton(win, 1010, "one"))
|
||||
btn = wxButton(win, 1010, "one")
|
||||
box.Add(btn)
|
||||
|
||||
box2 = wxBoxSizer(wxHORIZONTAL)
|
||||
box2.AddMany([ wxButton(win, 1010, "two"),
|
||||
wxButton(win, 1010, "three"),
|
||||
wxButton(win, 1010, "four"),
|
||||
wxButton(win, 1010, "five"),
|
||||
])
|
||||
btn = wxButton(win, 1010, "two")
|
||||
box2.Add(btn)
|
||||
btn = wxButton(win, 1010, "three")
|
||||
box2.Add(btn)
|
||||
btn = wxButton(win, 1010, "four")
|
||||
box2.Add(btn)
|
||||
btn = wxButton(win, 1010, "five")
|
||||
box2.Add(btn)
|
||||
|
||||
box3 = wxBoxSizer(wxVERTICAL)
|
||||
box3.AddMany([ (wxButton(win, 1010, "six"), 0),
|
||||
box3.AddMany([ (wxButton(win, 1010, "six"), 1),
|
||||
(wxButton(win, 1010, "seven"), 2),
|
||||
(wxButton(win, 1010, "eight"), 1),
|
||||
(wxButton(win, 1010, "nine"), 1),
|
||||
@@ -130,7 +134,8 @@ def makeBoxInBox(win):
|
||||
box2.Add(box3, 1)
|
||||
box.Add(box2, 1)
|
||||
|
||||
box.Add(wxButton(win, 1010, "ten"))
|
||||
btn = wxButton(win, 1010, "ten")
|
||||
box.Add(btn)
|
||||
|
||||
return box
|
||||
|
||||
@@ -149,11 +154,11 @@ def makeBorderInBox(win):
|
||||
insideBox = wxBoxSizer(wxHORIZONTAL)
|
||||
|
||||
box2 = wxBoxSizer(wxHORIZONTAL)
|
||||
box2.AddMany([ wxButton(win, 1010, "one"),
|
||||
wxButton(win, 1010, "two"),
|
||||
wxButton(win, 1010, "three"),
|
||||
wxButton(win, 1010, "four"),
|
||||
wxButton(win, 1010, "five"),
|
||||
box2.AddMany([ (wxButton(win, 1010, "one"), 0),
|
||||
(wxButton(win, 1010, "two"), 0),
|
||||
(wxButton(win, 1010, "three"), 0),
|
||||
(wxButton(win, 1010, "four"), 0),
|
||||
(wxButton(win, 1010, "five"), 0),
|
||||
])
|
||||
|
||||
insideBox.Add(box2, 0)
|
||||
@@ -163,7 +168,7 @@ def makeBorderInBox(win):
|
||||
insideBox.Add(bdr, 1)
|
||||
|
||||
box3 = wxBoxSizer(wxVERTICAL)
|
||||
box3.AddMany([ (wxButton(win, 1010, "six"), 0),
|
||||
box3.AddMany([ (wxButton(win, 1010, "six"), 1),
|
||||
(wxButton(win, 1010, "seven"), 2),
|
||||
(wxButton(win, 1010, "eight"), 1),
|
||||
(wxButton(win, 1010, "nine"), 1),
|
||||
|
@@ -1,66 +0,0 @@
|
||||
|
||||
import string
|
||||
|
||||
from wxPython.wx import *
|
||||
try:
|
||||
from xml.parsers import pyexpat
|
||||
haveXML = true
|
||||
except ImportError:
|
||||
haveXML = false
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if not haveXML:
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wxMessageDialog(frame, 'This demo requires the XML package. See http://www.python.org/sigs/xml-sig/',
|
||||
'Sorry', wxOK | wxICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
else:
|
||||
|
||||
class XMLTree(wxTreeCtrl):
|
||||
def __init__(self, parent, ID):
|
||||
wxTreeCtrl.__init__(self, parent, ID)
|
||||
self.nodeStack = [self.AddRoot("Root")]
|
||||
|
||||
# Define a handler for start element events
|
||||
def StartElement(self, name, attrs ):
|
||||
self.nodeStack.append(self.AppendItem(self.nodeStack[-1], name))
|
||||
|
||||
def EndElement(self, name ):
|
||||
self.nodeStack = self.nodeStack[:-1]
|
||||
|
||||
def CharacterData(self, data ):
|
||||
if string.strip(data):
|
||||
self.AppendItem(self.nodeStack[-1], data)
|
||||
|
||||
|
||||
def LoadTree(self, filename):
|
||||
# Create a parser
|
||||
Parser = pyexpat.ParserCreate()
|
||||
|
||||
# Tell the parser what the start element handler is
|
||||
Parser.StartElementHandler = self.StartElement
|
||||
Parser.EndElementHandler = self.EndElement
|
||||
Parser.CharacterDataHandler = self.CharacterData
|
||||
|
||||
# Parse the XML File
|
||||
ParserStatus = Parser.Parse(open(filename,'r').read(), 1)
|
||||
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = XMLTree(nb, -1)
|
||||
win.LoadTree("paper.xml")
|
||||
return win
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
"""
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/bin/env python
|
||||
|
||||
import Main
|
||||
Main.main()
|
||||
|
@@ -1,121 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#---------------------------------------------------------------------------
|
||||
"""
|
||||
This demo attempts to override the C++ MainLoop and implement it
|
||||
in Python. This is not part of the demo framework.
|
||||
|
||||
|
||||
THIS FEATURE IS STILL EXPERIMENTAL...
|
||||
"""
|
||||
|
||||
|
||||
from wxPython.wx import *
|
||||
import time
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MyFrame(wxFrame):
|
||||
|
||||
def __init__(self, parent, id, title):
|
||||
wxFrame.__init__(self, parent, id, title,
|
||||
wxPoint(100, 100), wxSize(160, 150))
|
||||
|
||||
EVT_SIZE(self, self.OnSize)
|
||||
EVT_MOVE(self, self.OnMove)
|
||||
EVT_CLOSE(self, self.OnCloseWindow)
|
||||
EVT_IDLE(self, self.OnIdle)
|
||||
|
||||
self.count = 0
|
||||
|
||||
panel = wxPanel(self, -1)
|
||||
wxStaticText(panel, -1, "Size:",
|
||||
wxDLG_PNT(panel, wxPoint(4, 4)), wxDefaultSize)
|
||||
wxStaticText(panel, -1, "Pos:",
|
||||
wxDLG_PNT(panel, wxPoint(4, 16)), wxDefaultSize)
|
||||
|
||||
wxStaticText(panel, -1, "Idle:",
|
||||
wxDLG_PNT(panel, wxPoint(4, 28)), wxDefaultSize)
|
||||
|
||||
self.sizeCtrl = wxTextCtrl(panel, -1, "",
|
||||
wxDLG_PNT(panel, wxPoint(24, 4)),
|
||||
wxDLG_SZE(panel, wxSize(36, -1)),
|
||||
wxTE_READONLY)
|
||||
|
||||
self.posCtrl = wxTextCtrl(panel, -1, "",
|
||||
wxDLG_PNT(panel, wxPoint(24, 16)),
|
||||
wxDLG_SZE(panel, wxSize(36, -1)),
|
||||
wxTE_READONLY)
|
||||
|
||||
self.idleCtrl = wxTextCtrl(panel, -1, "",
|
||||
wxDLG_PNT(panel, wxPoint(24, 28)),
|
||||
wxDLG_SZE(panel, wxSize(36, -1)),
|
||||
wxTE_READONLY)
|
||||
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
app.keepGoing = false
|
||||
self.Destroy()
|
||||
|
||||
def OnIdle(self, event):
|
||||
self.idleCtrl.SetValue(str(self.count))
|
||||
self.count = self.count + 1
|
||||
|
||||
def OnSize(self, event):
|
||||
size = event.GetSize()
|
||||
self.sizeCtrl.SetValue("%s, %s" % (size.width, size.height))
|
||||
event.Skip()
|
||||
|
||||
def OnMove(self, event):
|
||||
pos = event.GetPosition()
|
||||
self.posCtrl.SetValue("%s, %s" % (pos.x, pos.y))
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MyApp(wxApp):
|
||||
def MainLoop(self):
|
||||
# This outer loop determines when to exit the application, for
|
||||
# this example we let the main frame reset this flag when it
|
||||
# closes.
|
||||
while self.keepGoing:
|
||||
# At this point in the outer loop you could do whatever you
|
||||
# implemented your own MainLoop for. It should be quick and
|
||||
# non-blocking, otherwise your GUI will freeze. For example,
|
||||
# call Fnorb's reactor.do_one_event(0), etc.
|
||||
|
||||
# call_your_code_here()
|
||||
|
||||
|
||||
# This inner loop will process any GUI events until there
|
||||
# are no more waiting.
|
||||
while self.Pending():
|
||||
self.Dispatch()
|
||||
|
||||
# Send idle events to idle handlers. You may want to throtle
|
||||
# this back a bit so there is not too much CPU time spent in
|
||||
# the idle handlers. For this example, I'll just snooze a
|
||||
# little...
|
||||
time.sleep(0.25)
|
||||
self.ProcessIdle()
|
||||
|
||||
|
||||
|
||||
def OnInit(self):
|
||||
frame = MyFrame(NULL, -1, "This is a test")
|
||||
frame.Show(true)
|
||||
self.SetTopWindow(frame)
|
||||
|
||||
self.keepGoing = true
|
||||
|
||||
return true
|
||||
|
||||
|
||||
app = MyApp(0)
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -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()
|
@@ -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()
|
@@ -1,85 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE gcapaper SYSTEM "gcapap-X.dtd" [
|
||||
<!ENTITY footprint SYSTEM "footprint.tif" NDATA tiff >
|
||||
<!ENTITY footprint SYSTEM "footprint.eps" NDATA eps >
|
||||
<!ENTITY shoes SYSTEM "shoes.tif" NDATA tiff >
|
||||
<!ENTITY super1 "Z">
|
||||
]>
|
||||
|
||||
<gcapaper><front><title>Using SGML to make footprints in the sand
|
||||
</title><keyword>footprints</keyword><keyword>sand</keyword>
|
||||
<author><fname>Jane</fname><surname>Doe</surname>
|
||||
<jobtitle>Empress</jobtitle>
|
||||
<address><affil>Universe Corporation</affil>
|
||||
<aline>1 Main Street</aline>
|
||||
<city>Perfect City</city>
|
||||
<province>Dorado</province>
|
||||
<cntry>Neutral</cntry><postcode>999999</postcode>
|
||||
<phone>+55 555 555 5550</phone>
|
||||
<fax>+55 555 555 5555</fax>
|
||||
<email>jane@universe.com</email>
|
||||
<web>www.universe.com</web>
|
||||
</address>
|
||||
<bio><para>Jane Doe is the Empress of the Universe <bibref refloc="jd000"/>, a position to which she has always aspired.</para></bio>
|
||||
</author>
|
||||
<author><fname>Fred</fname><surname>Bloggs</surname>
|
||||
<jobtitle>Designer</jobtitle>
|
||||
<address><affil>Fred (The Shoe) Bloggs Ltd</affil>
|
||||
<aline>1 Shoe Lane</aline>
|
||||
<city>Perfect City</city>
|
||||
<province>Dorado</province>
|
||||
<cntry>Neutral</cntry><postcode>999999</postcode>
|
||||
<phone>+55 555 555 1122</phone>
|
||||
<fax>+55 555 555 1133</fax>
|
||||
<email>fred@shoebloggs.com</email>
|
||||
<web>www.shoebloggs.com</web></address>
|
||||
<bio><para>Fred has always wanted to create the perfect shoe for making footprints in the sand. Now with SGML and XML, he has been able to document his design.</para></bio>
|
||||
</author>
|
||||
<abstract>
|
||||
<para><keyword>ease</keyword><keyword>documentation</keyword>It's not easy being an Empress of the Universe (<a href="http://www.universe.com"/>), but with the right pair of shoes and the right documentation on how to make footprints in the sand of life, it's easier than it was. Since the introduction of <acronym.grp><acronym>SGML</acronym><expansion>Standard Generalized Markup Language</expansion></acronym.grp> and <acronym.grp><acronym>XML</acronym><expansion>Extensible Markup Language</expansion></acronym.grp> it is now possible to identify and manage the key bits of information on this process.</para>
|
||||
</abstract>
|
||||
</front>
|
||||
<body><section id="jd001"><title>Introduction</title>
|
||||
<para><keyword>documentation</keyword>Since its inception, the Universe has always had sand, now it has an Empress, a good shoe design, and <acronym>SGML</acronym> / <acronym>XML</acronym> documentation. The time is now ripe for making <highlight style="ital">footprints</highlight> in the sand.</para></section>
|
||||
<section id="jd002"><title>Footprints - truly a push technology</title><keyword>push</keyword>
|
||||
<para>One could safely say that making footprints is a push technology. This is even more true when the footprint maker is the Empress of the Universe. </para>
|
||||
<subsec1 id="jd003"><title>The sands of time</title><keyword>time</keyword>
|
||||
<para>The 1<super>st</super> think to remember about the Universe is the time/space continuum to which it conforms. This then confuses the sands of time to be something more like the sands of time/space continuum because if you wait on those sands long enough they may be somewhere else - not necessarily because of the time/space continuum but because the winds will <highlight style="ital">push</highlight> them down the beach.</para></subsec1>
|
||||
<subsec1 id="jd004"><title>Identifying the footprints</title>
|
||||
<para>In order to truly understand who has walked on the sands and left the footprints, it is important to identify the <keyword>characteristics</keyword>characteristics of the footprint. In the graphic <xref refloc="jd005" type="title"/>, we can see the footprints are large, well shaped, and evenly distributed from front to back and side to side.</para>
|
||||
<figure id="jd005"><title>Footprint in Sand</title><caption><para>Note the evenly distributed shape and indention</para></caption><graphic figname="footprint"/></figure>
|
||||
<para>This footprint begs the question, 'What kind of remarkable <keyword>shoe</keyword>shoe could make such a wonderful footprint?'</para>
|
||||
<table id="t1">
|
||||
<tgroup cols="2">
|
||||
<thead><row><entry>Shoe Type</entry><entry>Remarkability Rating</entry></row></thead>
|
||||
<tbody><row><entry>Acme Shoe</entry><entry>Unremarkable</entry></row>
|
||||
<row><entry>Budget Shoe</entry><entry>Not worth remarking on</entry></row>
|
||||
<row><entry>Super Duper Shoe</entry><entry>Absolutely Remarkable</entry></row></tbody>
|
||||
</tgroup></table></subsec1>
|
||||
<subsec1 id="jd006"><title>The Shoe What Made the Footprint</title>
|
||||
<para>The remarkable footprint is made by a combination of a terrific shoe worn on a fantastic foot propelled by a one-of-a-kind Empress. As can be seen in Figure <xref refloc="jd007" type="number"/>, the shoe is worthy of an Empress.</para>
|
||||
<figure id="jd007"><title>The Terrific Shoe</title><graphic figname="shoes"/></figure>
|
||||
<para>The design goals of the shoe were:
|
||||
<randlist style = "bulleted">
|
||||
<li><para>to minimize time-consuming manual tasks such as shoelace tying;</para></li>
|
||||
<li><para>to allow different decorations to be placed on the toes; and</para></li>
|
||||
<li><para>to enforce a good arch.</para></li></randlist></para></subsec1></section>
|
||||
<section id="jd008"><title>Documenting the Shoe</title>
|
||||
<para>Documenting the shoe was the best part for Fred Bloggs. His superior design could be captured for all time in a neutrally-encoded, content-specific manner. An excerpt from his DTD gives an insight into the type of information he captured in his documentation.</para>
|
||||
<code.block><!DOCTYPE shoedoc [
|
||||
<!ELEMENT shoedoc - - (design, mfg, care, recycle) >
|
||||
<!ATTLIST shoedoc designer CDATA #REQUIRED
|
||||
date CDATA #REQUIRED>
|
||||
<!ELEMENT design - - (specs, desc) >
|
||||
etc.
|
||||
</code.block>
|
||||
<para>An excerpt from the documentation also gives us insights.</para>
|
||||
<code.block><![CDATA[<design>
|
||||
<specs sizerange="4-12" widthrange="aa-d" color="navy black white red taupe">
|
||||
<para>The arch shall be high. The toe shall be narrow, but not pinch. The heel shall not come off in grates. Sand shall not get in.</para></specs>]]>
|
||||
</code.block>
|
||||
</section></body>
|
||||
<rear><acknowl>
|
||||
<para>The authors wish to express our thanks to the Universe for being there and to gravity for holding the sand down long enough to see the footprints.</para></acknowl>
|
||||
<bibliog>
|
||||
<bibitem id="jd000"><bib>Barrett 00</bib><pub>Barrett, B., Being Empress Made Easy, Galaxy Division of Universal Publishers. 0000</pub></bibitem></bibliog></rear></gcapaper>
|
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE quotations [
|
||||
<!ELEMENT collection (quotation)*>
|
||||
|
||||
<!ELEMENT em (#PCDATA) >
|
||||
<!ELEMENT foreign (#PCDATA) >
|
||||
<!ELEMENT cite (#PCDATA) >
|
||||
<!ELEMENT author (#PCDATA)>
|
||||
<!ELEMENT source (#PCDATA|cite)*>
|
||||
|
||||
<!ELEMENT quotation (#PCDATA|author|source)* >
|
||||
]>
|
||||
<collection><quotation>We will perhaps eventually be writing only small modules which are identified by name as they are used to build larger ones, so that devices like indentation, rather than delimiters, might become feasible for expressing local structure in the source language. <source>Donald E. Knuth, "Structured Programming with goto Statements", Computing Surveys, Vol 6 No 4, Dec. 1974</source> </quotation> <quotation> The infinities aren't contagious except in that they often appear that way due to to their large size. <source>Tim Peters on the IEEE 754 floating point standard, 27 Apr 1998</source> </quotation> </collection>
|
@@ -15,9 +15,9 @@ class TestComboBox(wxPanel):
|
||||
wxPoint(8, 10))
|
||||
|
||||
wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(75, 18))
|
||||
wxComboBox(self, 500, "default value", wxPoint(80, 50), wxSize(95, -1),
|
||||
wxComboBox(self, 50, "default value", wxPoint(80, 50), wxSize(95, 20),
|
||||
sampleList, wxCB_DROPDOWN)
|
||||
EVT_COMBOBOX(self, 500, self.EvtComboBox)
|
||||
EVT_COMBOBOX(self, 50, self.EvtComboBox)
|
||||
|
||||
|
||||
def EvtComboBox(self, event):
|
||||
|
@@ -8,7 +8,7 @@ def runTest(frame, nb, log):
|
||||
|
||||
wxStaticText(win, -1, "This is a wxDialog", wxPoint(20, 20))
|
||||
wxButton(win, wxID_OK, " OK ", wxPoint(75, 120), wxDefaultSize).SetDefault()
|
||||
wxButton(win, wxID_CANCEL, " Cancel ", wxPoint(200, 120), wxDefaultSize)
|
||||
wxButton(win, wxID_CANCEL, " Cancel ", wxPoint(150, 120), wxDefaultSize)
|
||||
|
||||
val = win.ShowModal()
|
||||
if val == wxID_OK:
|
||||
|
@@ -19,13 +19,8 @@ else:
|
||||
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
#win = TestGLCanvas(nb)
|
||||
#return win
|
||||
win = wxFrame(frame, -1, "GL Cube", wxDefaultPosition, wxSize(400,300))
|
||||
canvas = TestGLCanvas(win)
|
||||
frame.otherWin = win
|
||||
win.Show(true)
|
||||
return None
|
||||
win = TestGLCanvas(nb)
|
||||
return win
|
||||
|
||||
|
||||
|
||||
@@ -145,7 +140,7 @@ overview = """\
|
||||
def _test():
|
||||
class MyApp(wxApp):
|
||||
def OnInit(self):
|
||||
frame = wxFrame(NULL, -1, "GL Cube", wxDefaultPosition, wxSize(400,300))
|
||||
frame = wxFrame(NULL, -1, "HELP ME!!")
|
||||
win = TestGLCanvas(frame)
|
||||
frame.Show(TRUE)
|
||||
self.SetTopWindow(frame)
|
||||
|
@@ -25,8 +25,6 @@ class TestGrid(wxGrid):
|
||||
EVT_GRID_CELL_LCLICK(self, self.OnCellClick)
|
||||
EVT_GRID_LABEL_LCLICK(self, self.OnLabelClick)
|
||||
|
||||
self.SetEditInPlace(true)
|
||||
#print self.GetCells()
|
||||
|
||||
|
||||
def OnSelectCell(self, event):
|
||||
|
@@ -48,7 +48,6 @@ class TestListCtrlPanel(wxPanel):
|
||||
|
||||
self.currentItem = 0
|
||||
EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
|
||||
EVT_LIST_DELETE_ITEM(self, tID, self.OnItemDelete)
|
||||
EVT_LEFT_DCLICK(self.list, self.OnDoubleClick)
|
||||
EVT_RIGHT_DOWN(self.list, self.OnRightDown)
|
||||
|
||||
@@ -69,10 +68,6 @@ class TestListCtrlPanel(wxPanel):
|
||||
self.currentItem = event.m_itemIndex
|
||||
self.log.WriteText("OnItemSelected: %s\n" % self.list.GetItemText(self.currentItem))
|
||||
|
||||
def OnItemDelete(self, event):
|
||||
self.log.WriteText("OnItemDelete\n")
|
||||
|
||||
|
||||
def OnDoubleClick(self, event):
|
||||
self.log.WriteText("OnDoubleClick item %s\n" % self.list.GetItemText(self.currentItem))
|
||||
|
||||
@@ -83,16 +78,13 @@ class TestListCtrlPanel(wxPanel):
|
||||
tPopupID1 = 0
|
||||
tPopupID2 = 1
|
||||
tPopupID3 = 2
|
||||
tPopupID4 = 3
|
||||
self.menu.Append(tPopupID1, "One")
|
||||
self.menu.Append(tPopupID2, "Two")
|
||||
self.menu.Append(tPopupID3, "Three")
|
||||
self.menu.Append(tPopupID4, "DeleteAllItems")
|
||||
EVT_MENU(self, tPopupID1, self.OnPopupOne)
|
||||
EVT_MENU(self, tPopupID2, self.OnPopupTwo)
|
||||
EVT_MENU(self, tPopupID3, self.OnPopupThree)
|
||||
EVT_MENU(self, tPopupID4, self.OnPopupFour)
|
||||
self.PopupMenu(self.menu, wxPoint(self.x, self.y))
|
||||
self.PopupMenu(self.menu, self.x, self.y)
|
||||
|
||||
def OnPopupOne(self, event):
|
||||
self.log.WriteText("Popup one\n")
|
||||
@@ -103,9 +95,6 @@ class TestListCtrlPanel(wxPanel):
|
||||
def OnPopupThree(self, event):
|
||||
self.log.WriteText("Popup three\n")
|
||||
|
||||
def OnPopupFour(self, event):
|
||||
self.list.DeleteAllItems()
|
||||
|
||||
def OnSize(self, event):
|
||||
w,h = self.GetClientSizeTuple()
|
||||
self.list.SetDimensions(0, 0, w, h)
|
||||
|
@@ -12,11 +12,6 @@ class TestRadioButtons(wxPanel):
|
||||
'six', 'seven', 'eight']
|
||||
|
||||
rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(35, 30), wxDefaultSize,
|
||||
sampleList, 3, wxRA_SPECIFY_COLS)
|
||||
EVT_RADIOBOX(self, 30, self.EvtRadioBox)
|
||||
|
||||
|
||||
rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(35, 120), wxDefaultSize,
|
||||
sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER)
|
||||
EVT_RADIOBOX(self, 30, self.EvtRadioBox)
|
||||
|
||||
|
@@ -29,7 +29,7 @@ class TestTimerWin(wxPanel):
|
||||
wxPoint(15, 30))
|
||||
|
||||
wxButton(self, 11101, ' Start ', wxPoint(15, 75), wxDefaultSize)
|
||||
wxButton(self, 11102, ' Stop ', wxPoint(115, 75), wxDefaultSize)
|
||||
wxButton(self, 11102, ' Stop ', wxPoint(77, 75), wxDefaultSize)
|
||||
EVT_BUTTON(self, 11101, self.OnStart)
|
||||
EVT_BUTTON(self, 11102, self.OnStop)
|
||||
|
||||
|
@@ -1,8 +1,6 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import string
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestTreeCtrlPanel(wxPanel):
|
||||
@@ -12,23 +10,19 @@ class TestTreeCtrlPanel(wxPanel):
|
||||
self.log = log
|
||||
tID = NewId()
|
||||
|
||||
self.tree = wxTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS)
|
||||
|
||||
self.root = self.tree.AddRoot("The Root Item")
|
||||
self.tree = wxTreeCtrl(self, tID)
|
||||
root = self.tree.AddRoot("The Root Item")
|
||||
for x in range(15):
|
||||
child = self.tree.AppendItem(self.root, "Item %d" % x)
|
||||
child = self.tree.AppendItem(root, "Item %d" % x)
|
||||
for y in range(5):
|
||||
last = self.tree.AppendItem(child, "item %d-%s" % (x, chr(ord("a")+y)))
|
||||
for z in range(5):
|
||||
self.tree.AppendItem(last, "item %d-%s-%d" % (x, chr(ord("a")+y), z))
|
||||
|
||||
self.tree.Expand(self.root)
|
||||
self.tree.Expand(root)
|
||||
EVT_TREE_ITEM_EXPANDED (self, tID, self.OnItemExpanded)
|
||||
EVT_TREE_ITEM_COLLAPSED (self, tID, self.OnItemCollapsed)
|
||||
EVT_TREE_SEL_CHANGED (self, tID, self.OnSelChanged)
|
||||
EVT_TREE_BEGIN_LABEL_EDIT(self, tID, self.OnBeginEdit)
|
||||
EVT_TREE_END_LABEL_EDIT (self, tID, self.OnEndEdit)
|
||||
|
||||
EVT_LEFT_DCLICK(self.tree, self.OnLeftDClick)
|
||||
EVT_RIGHT_DOWN(self.tree, self.OnRightClick)
|
||||
@@ -43,30 +37,7 @@ class TestTreeCtrlPanel(wxPanel):
|
||||
def OnRightUp(self, event):
|
||||
(x,y) = event.Position();
|
||||
item = self.tree.HitTest(wxPoint(x,y))
|
||||
self.log.WriteText("OnRightUp: %s (manually starting label edit)\n"
|
||||
% self.tree.GetItemText(item))
|
||||
self.tree.EditLabel(item)
|
||||
|
||||
|
||||
|
||||
def OnBeginEdit(self, event):
|
||||
self.log.WriteText("OnBeginEdit\n")
|
||||
# show how to prevent edit...
|
||||
if self.tree.GetItemText(event.GetItem()) == "The Root Item":
|
||||
wxBell()
|
||||
self.log.WriteText("You can't edit this one...\n")
|
||||
event.Veto()
|
||||
|
||||
def OnEndEdit(self, event):
|
||||
self.log.WriteText("OnEndEdit\n")
|
||||
# show how to reject edit, we'll not allow any digits
|
||||
for x in event.GetLabel():
|
||||
if x in string.digits:
|
||||
self.log.WriteText("You can't enter digits...\n")
|
||||
event.Veto()
|
||||
return
|
||||
|
||||
|
||||
self.log.WriteText("OnRightUp: %s\n" % self.tree.GetItemText(item))
|
||||
|
||||
def OnLeftDClick(self, event):
|
||||
(x,y) = event.Position();
|
||||
@@ -88,8 +59,8 @@ class TestTreeCtrlPanel(wxPanel):
|
||||
self.log.WriteText("OnItemCollapsed: %s\n" % self.tree.GetItemText(item))
|
||||
|
||||
def OnSelChanged(self, event):
|
||||
self.item = event.GetItem()
|
||||
self.log.WriteText("OnSelChanged: %s\n" % self.tree.GetItemText(self.item))
|
||||
item = event.GetItem()
|
||||
self.log.WriteText("OnSelChanged: %s\n" % self.tree.GetItemText(item))
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
*.gz
|
||||
*.rpm
|
||||
*.zip
|
||||
build.pyc
|
||||
filelist
|
||||
wxPython.spec
|
||||
wxp2.wse
|
||||
|
@@ -1,767 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: build.py
|
||||
# Purpose: This script is used to build wxPython. It reads a build
|
||||
# configuration file in the requested project directory and
|
||||
# based on the contents of the file can build Makefiles for
|
||||
# unix or win32, and can execute make with various options
|
||||
# potentially automating the entire build/install/clean process
|
||||
# from a single command.
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 18-Aug-1999
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1999 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
"""
|
||||
build.py
|
||||
|
||||
This script is used to build wxPython. It reads a build configuration
|
||||
file in the requested project directory and based on the contents of
|
||||
the file can build Makefiles for unix or win32, and can execute make
|
||||
with various options potentially automating the entire
|
||||
build/install/clean process from a single command.
|
||||
|
||||
The default action is to build the Makefile and exit.
|
||||
|
||||
Options
|
||||
-C dir CD to dir before doing anything
|
||||
-B file Use file as the build configuration (default ./build.cfg)
|
||||
-M file Use file as the name of the makefile to create
|
||||
(default Makefile)
|
||||
|
||||
-b Build the module (runs make)
|
||||
-i Install the module (runs make install)
|
||||
-c Cleanup (runs make clean)
|
||||
-u Uninstall (runs make uninstall)
|
||||
|
||||
-h Show help and exit
|
||||
|
||||
|
||||
Configuration Files
|
||||
|
||||
The build configuration file lists targets, source files and options
|
||||
for the the build process. The contents of the build.cfg are used to
|
||||
dynamically generate the Makefile.
|
||||
|
||||
To prevent you from getting screwed when the default build.cfg is
|
||||
updated, you can override the values in build.cfg by putting your
|
||||
custom definitions in a file named build.local. You can also place a
|
||||
build.local file in the parent directory, or even in the grandparent
|
||||
directory for project-wide overrides. Finally, command-line arguments
|
||||
of the form NAME=VALUE can also be used to override simple configuration
|
||||
values. The order of evaluation is:
|
||||
|
||||
0. comman-line flags (-M, -b, etc.)
|
||||
1. ./build.cfg
|
||||
2. ../../build.local (if present)
|
||||
3. ../build.local (if present)
|
||||
4. ./build.local (if present)
|
||||
5. command-line NAME=VALUEs
|
||||
|
||||
The config files are actually just Python files that get exec'ed in a
|
||||
separate namespace which is then used later as a configuration object.
|
||||
This keeps the build script simple in that it doesn't have to parse
|
||||
anything, and the config files can be much more than just names and
|
||||
values as pretty much any python code can be executed. The global
|
||||
variables set in the config namespace are what are used later as
|
||||
configuation values.
|
||||
|
||||
|
||||
Configuration Options
|
||||
|
||||
The following variables can be set in the config files. Only a few are
|
||||
required, the rest will either have suitable defaults or will be
|
||||
calculated from your current Python runtime environment.
|
||||
|
||||
MODULE The name of the extension module to produce
|
||||
SWIGFILES A list of files that should be run through SWIG
|
||||
SWIGFLAGS Flags for SWIG
|
||||
SOURCES Other C/C++ sources that should be part of the module
|
||||
PYFILES Other Python files that should be installed with the module
|
||||
CFLAGS Flags to be used by the compiler
|
||||
LFLAGS Flags to be used at the link step
|
||||
LIBS Libraries to be linked with
|
||||
|
||||
OTHERCFLAGS Extra flags to append to CFLAGS
|
||||
OTHERLFLAGS Extra flags to append to LFLAGS
|
||||
OTHERSWIGFLAGS Extra flags to append to SWIGFLAGS
|
||||
OTHERLIBS Other libraries to be linked with, in addition to LIBS
|
||||
OTHERTARGETS Other targets to be placed on the default rule line
|
||||
OTHERINSTALLTARGETS
|
||||
Other targets to be placed on the install rule line
|
||||
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
|
||||
|
||||
TARGETDIR Destination for the install step
|
||||
|
||||
MAKE The make program to use
|
||||
MAKEFILE The name of the makefile
|
||||
|
||||
runBuild Setting this to 1 is eqivalent to the -b flag
|
||||
runInstall Setting this to 1 is eqivalent to the -i flag
|
||||
runClean Setting this to 1 is eqivalent to the -c flag
|
||||
runUninstall Setting this to 1 is eqivalent to the -u flag
|
||||
|
||||
PYVERSION Version number of Python used in pathnames
|
||||
PYPREFIX The root of the Python install
|
||||
EXECPREFIX The root of the Python install for binary files
|
||||
PYTHONLIB The Python link library
|
||||
|
||||
"""
|
||||
|
||||
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.1b3'
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def main(args):
|
||||
try:
|
||||
opts, args = getopt.getopt(args[1:], 'C:B:M:bicu')
|
||||
except getopt.error:
|
||||
usage()
|
||||
sys.exit(1)
|
||||
|
||||
if not os.environ.has_key('WXWIN'):
|
||||
print "WARNING: WXWIN is not set in the environment. WXDIR may not\n"\
|
||||
" be set properly in the makefile, you will have to \n"\
|
||||
" set the environment variable or override in build.local."
|
||||
|
||||
bldCfg = 'build.cfg'
|
||||
bldCfgLocal = 'build.local'
|
||||
MAKEFILE = 'Makefile'
|
||||
runBuild = 0
|
||||
runInstall = 0
|
||||
runClean = 0
|
||||
runUninstall = 0
|
||||
|
||||
for flag, value in opts:
|
||||
if flag == '-C': os.chdir(value)
|
||||
elif flag == '-B': bldCfgFile = value
|
||||
elif flag == '-M': makefile = value
|
||||
elif flag == '-b': runBuild = 1
|
||||
elif flag == '-c': runClean = 1
|
||||
elif flag == '-i': runInstall = 1
|
||||
elif flag == '-u': runUninstall = 1
|
||||
|
||||
elif flag == '-h': usage(); sys.exit(1)
|
||||
else: usage(); sys.exit(1)
|
||||
|
||||
config = BuildConfig(bldCfg = bldCfg,
|
||||
bldCfgLocal = bldCfgLocal,
|
||||
MAKEFILE = MAKEFILE,
|
||||
runBuild = runBuild,
|
||||
runInstall = runInstall,
|
||||
runClean = runClean,
|
||||
runUninstall = runUninstall)
|
||||
|
||||
if config.readConfigFiles(args):
|
||||
config.doFixups()
|
||||
config.makeMakefile()
|
||||
err = 0
|
||||
|
||||
if config.runBuild:
|
||||
cmd = "%s -f %s" % (config.MAKE, config.MAKEFILE)
|
||||
print "Running:", cmd
|
||||
err = os.system(cmd)
|
||||
|
||||
if not err and config.runInstall:
|
||||
cmd = "%s -f %s install" % (config.MAKE, config.MAKEFILE)
|
||||
print "Running:", cmd
|
||||
err = os.system(cmd)
|
||||
|
||||
|
||||
if not err and config.runClean:
|
||||
cmd = "%s -f %s clean" % (config.MAKE, config.MAKEFILE)
|
||||
print "Running:", cmd
|
||||
err = os.system(cmd)
|
||||
|
||||
if not err and config.runUninstall:
|
||||
cmd = "%s -f %s uninstall" % (config.MAKE, config.MAKEFILE)
|
||||
print "Running:", cmd
|
||||
err = os.system(cmd)
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def usage():
|
||||
print __doc__
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def swapslash(st):
|
||||
if sys.platform != 'win32':
|
||||
st = string.join(string.split(st, '\\'), '/')
|
||||
return st
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def splitlines(st):
|
||||
return string.join(string.split(string.strip(st), ' '), ' \\\n\t')
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
class BuildConfig:
|
||||
def __init__(self, **kw):
|
||||
self.__dict__.update(kw)
|
||||
self.setDefaults()
|
||||
|
||||
#------------------------------------------------------------
|
||||
def setDefaults(self):
|
||||
self.VERSION = __version__
|
||||
self.MODULE = ''
|
||||
self.SWIGFILES = []
|
||||
self.SWIGFLAGS = '-c++ -shadow -python -keyword -dnone -I$(WXPSRCDIR)'
|
||||
self.SOURCES = []
|
||||
self.PYFILES = []
|
||||
self.LFLAGS = ''
|
||||
self.OTHERCFLAGS = ''
|
||||
self.OTHERLFLAGS = ''
|
||||
self.OTHERSWIGFLAGS = ''
|
||||
self.OTHERLIBS = ''
|
||||
self.OTHERTARGETS = ''
|
||||
self.OTHERINSTALLTARGETS = ''
|
||||
self.OTHERUNINSTALLTARGETS = ''
|
||||
self.OTHERRULES = ''
|
||||
self.DEFAULTRULE = 'default: $(GENCODEDIR) $(TARGET)'
|
||||
self.PYVERSION = sys.version[:3]
|
||||
self.PYPREFIX = sys.prefix
|
||||
self.EXECPREFIX = sys.exec_prefix
|
||||
self.WXDIR = '$(WXWIN)'
|
||||
self.FINAL = '0'
|
||||
self.WXP_USE_THREAD = '1'
|
||||
self.WXUSINGDLL = '1'
|
||||
self.OTHERDEP = ''
|
||||
self.WXPSRCDIR = '$(WXDIR)/utils/wxPython/src'
|
||||
|
||||
|
||||
if sys.platform == 'win32':
|
||||
self.MAKE = 'nmake'
|
||||
self.PYTHONLIB = '$(PYPREFIX)\\libs\\python15.lib'
|
||||
self.TARGETDIR = '$(PYPREFIX)\\wxPython'
|
||||
self.LIBS = '$(PYTHONLIB) $(WXPSRCDIR)\wxc.lib'
|
||||
self.GENCODEDIR = 'msw'
|
||||
self.SWIGTOOLKITFLAG = '-D__WXMSW__'
|
||||
self.OBJEXT = '.obj'
|
||||
self.TARGET = '$(MODULE).pyd'
|
||||
self.CFLAGS = '-I$(PYPREFIX)\include -I$(WXPSRCDIR) -I. /Fp$(MODULE).pch /YXhelpers.h -DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) '
|
||||
self.LFLAGS = '$(DEBUGLFLAGS) /DLL /subsystem:windows,3.50 /machine:I386 /nologo'
|
||||
self.RESFILE = ''
|
||||
self.RESRULE = ''
|
||||
self.OVERRIDEFLAGS = '/GX-'
|
||||
self.RMCMD = '-erase '
|
||||
self.WXPSRCDIR = os.path.normpath(self.WXPSRCDIR)
|
||||
|
||||
|
||||
else:
|
||||
self.MAKE = 'make'
|
||||
self.PYLIB = '$(EXECPREFIX)/lib/python$(PYVERSION)'
|
||||
self.LIBPL = '$(PYLIB)/config'
|
||||
self.PYTHONLIB = '$(LIBPL)/libpython$(PYVERSION).a'
|
||||
self.TARGETDIR = '$(EXECPREFIX)/lib/python$(PYVERSION)/site-packages/wxPython'
|
||||
self.TARGET = '$(MODULE)module$(SO)'
|
||||
self.OBJEXT = '.o'
|
||||
self.HELPERLIB = 'wxPyHelpers'
|
||||
self.HELPERLIBDIR = '/usr/local/lib'
|
||||
self.CFLAGS = '-DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) -I. '\
|
||||
'`wx-config --cflags` -I$(PYINCLUDE) -I$(EXECINCLUDE) '\
|
||||
'-I$(WXPSRCDIR)'
|
||||
self.LFLAGS = '-L$(WXPSRCDIR) `wx-config --libs`'
|
||||
self.LIBS = '-l$(HELPERLIB)'
|
||||
self.RMCMD = '-rm -f '
|
||||
|
||||
# **** What to do when I start supporting Motif, etc.???
|
||||
self.GENCODEDIR = 'gtk'
|
||||
self.SWIGTOOLKITFLAG = '-D__WXGTK__'
|
||||
|
||||
# Extract a few things from Python's Makefile...
|
||||
try:
|
||||
filename = os.path.join(self.EXECPREFIX,
|
||||
'lib/python'+self.PYVERSION,
|
||||
'config/Makefile')
|
||||
mfText = string.split(open(filename, 'r').read(), '\n')
|
||||
except IOError:
|
||||
raise SystemExit, "Python development files not found"
|
||||
|
||||
self.CCC = self.findMFValue(mfText, 'CCC')
|
||||
self.CC = self.findMFValue(mfText, 'CC')
|
||||
self.OPT = self.findMFValue(mfText, 'OPT')
|
||||
self.SO = self.findMFValue(mfText, 'SO')
|
||||
self.LDSHARED = self.findMFValue(mfText, 'LDSHARED')
|
||||
self.CCSHARED = self.findMFValue(mfText, 'CCSHARED')
|
||||
#self.LINKFORSHARED = self.findMFValue(mfText, 'LINKFORSHARED')
|
||||
#self. = self.findMFValue(mfText, '')
|
||||
#self. = self.findMFValue(mfText, '')
|
||||
|
||||
|
||||
# The majority of cases will require LDSHARED to be
|
||||
# modified to use the C++ driver instead of the C driver
|
||||
# for linking. We'll try to do it here and if we goof up
|
||||
# then the user can correct it in their build.local file.
|
||||
self.LDSHARED = string.join(['$(CCC)'] +
|
||||
string.split(self.LDSHARED, ' ')[1:],
|
||||
' ')
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
def doFixups(self):
|
||||
# This is called after the config files have been evaluated
|
||||
# so we can do some sanity checking...
|
||||
if sys.platform != 'win32':
|
||||
if not self.CCC:
|
||||
print "Warning: C++ compiler not specified (CCC). Assuming c++"
|
||||
self.CCC = 'c++'
|
||||
if not self.CC:
|
||||
print "Warning: C compiler not specified (CC). Assuming cc"
|
||||
self.CC = 'cc'
|
||||
|
||||
#------------------------------------------------------------
|
||||
def findMFValue(self, mfText, st):
|
||||
# Find line begining with st= and return the value
|
||||
# Regex would probably be to cooler way to do this, but
|
||||
# I think this is the most understandable.
|
||||
for line in mfText:
|
||||
if string.find(line, st+'=') == 0:
|
||||
st = string.strip(line[len(st)+1:])
|
||||
return st
|
||||
return None
|
||||
|
||||
#------------------------------------------------------------
|
||||
def makeMakefile(self):
|
||||
|
||||
# make a list of object file names
|
||||
objects = ""
|
||||
for name in self.SWIGFILES:
|
||||
objects = objects + os.path.splitext(name)[0] + self.OBJEXT + ' '
|
||||
for name in self.SOURCES:
|
||||
obj = os.path.basename(name)
|
||||
objects = objects + os.path.splitext(obj)[0] + self.OBJEXT + ' '
|
||||
self.OBJECTS = splitlines(objects)
|
||||
|
||||
|
||||
# now build the text for the dependencies
|
||||
depends = ""
|
||||
for name in self.SWIGFILES:
|
||||
text = '$(GENCODEDIR)/%s.cpp $(GENCODEDIR)/%s.py : %s.i\n' \
|
||||
'$(TARGETDIR)\\%s.py : $(GENCODEDIR)\\%s.py\n' % \
|
||||
tuple([os.path.splitext(name)[0]] * 5)
|
||||
depends = depends + text
|
||||
for name in self.PYFILES:
|
||||
text = '$(TARGETDIR)\\%s.py : %s.py\n' % \
|
||||
tuple([os.path.splitext(name)[0]] * 2)
|
||||
depends = depends + text
|
||||
self.DEPENDS = swapslash(depends)
|
||||
|
||||
|
||||
# and the list of .py files
|
||||
pymodules = ""
|
||||
for name in self.SWIGFILES:
|
||||
pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0]
|
||||
for name in self.PYFILES:
|
||||
pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0]
|
||||
self.PYMODULES = splitlines(swapslash(pymodules))
|
||||
|
||||
|
||||
# now make a list of the python files that would need uninstalled
|
||||
pycleanup = ""
|
||||
for name in self.SWIGFILES:
|
||||
pycleanup = pycleanup + self.makeCleanupList(name)
|
||||
for name in self.PYFILES:
|
||||
pycleanup = pycleanup + self.makeCleanupList(name)
|
||||
self.PYCLEANUP = swapslash(pycleanup)
|
||||
|
||||
|
||||
# finally, build the makefile
|
||||
if sys.platform == 'win32':
|
||||
if self.RESFILE:
|
||||
self.RESFILE = '$(MODULE).res'
|
||||
self.RESRULE = '$(MODULE).res : $(MODULE).rc $(WXDIR)\\include\\wx\\msw\\wx.rc\n\t'\
|
||||
'$(rc) -r /i$(WXDIR)\\include -fo$@ $(MODULE).rc'
|
||||
text = win32Template % self.__dict__
|
||||
else:
|
||||
text = unixTemplate % self.__dict__
|
||||
f = open(self.MAKEFILE, 'w')
|
||||
f.write(text)
|
||||
f.close()
|
||||
|
||||
print "Makefile created: ", self.MAKEFILE
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
def makeCleanupList(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])
|
||||
st = st + '\t%s$(TARGETDIR)\\%s.pyo\n' % (self.RMCMD, os.path.splitext(name)[0])
|
||||
return st
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
def readConfigFiles(self, args):
|
||||
return self.processFile(self.bldCfg, 1) and \
|
||||
self.processFile(os.path.join('../..', self.bldCfgLocal)) and \
|
||||
self.processFile(os.path.join('..', self.bldCfgLocal)) and \
|
||||
self.processFile(os.path.join('.', self.bldCfgLocal)) and \
|
||||
self.processArgs(args)
|
||||
|
||||
#------------------------------------------------------------
|
||||
def processFile(self, filename, required=0):
|
||||
try:
|
||||
text = open(filename, 'r').read()
|
||||
except IOError:
|
||||
if required:
|
||||
print "Unable to open %s" % filename
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
|
||||
try:
|
||||
exec(text, self.__dict__)
|
||||
except:
|
||||
print "Error evaluating %s" % filename
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
def processArgs(self, args):
|
||||
try:
|
||||
for st in args:
|
||||
pair = string.split(st, '=')
|
||||
name = pair[0]
|
||||
value = pair[1]
|
||||
self.__dict__[name] = value
|
||||
except:
|
||||
print "Error parsing command-line: %s" % st
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
win32Template = '''
|
||||
#----------------------------------------------------------------------
|
||||
# This makefile was autogenerated from build.py. Your changes will be
|
||||
# lost if the generator is run again. You have been warned.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
WXDIR = %(WXDIR)s
|
||||
VERSION = %(VERSION)s
|
||||
MODULE = %(MODULE)s
|
||||
SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s
|
||||
CFLAGS = %(CFLAGS)s
|
||||
LFLAGS = %(LFLAGS)s
|
||||
PYVERSION = %(PYVERSION)s
|
||||
PYPREFIX = %(PYPREFIX)s
|
||||
EXECPREFIX = %(EXECPREFIX)s
|
||||
PYTHONLIB = %(PYTHONLIB)s
|
||||
FINAL = %(FINAL)s
|
||||
WXP_USE_THREAD = %(WXP_USE_THREAD)s
|
||||
WXUSINGDLL = %(WXUSINGDLL)s
|
||||
GENCODEDIR = %(GENCODEDIR)s
|
||||
RESFILE = %(RESFILE)s
|
||||
WXPSRCDIR = %(WXPSRCDIR)s
|
||||
|
||||
|
||||
TARGETDIR = %(TARGETDIR)s
|
||||
|
||||
OBJECTS = %(OBJECTS)s
|
||||
PYMODULES = %(PYMODULES)s
|
||||
TARGET = %(TARGET)s
|
||||
|
||||
|
||||
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
DEBUGLFLAGS = /DEBUG /INCREMENTAL:YES
|
||||
!else
|
||||
DEBUGLFLAGS = /INCREMENTAL:NO
|
||||
!endif
|
||||
!if "$(WXP_USE_THREAD)" == "1"
|
||||
THREAD=-DWXP_USE_THREAD=1
|
||||
!endif
|
||||
|
||||
|
||||
|
||||
|
||||
NOPCH=1
|
||||
OVERRIDEFLAGS=%(OVERRIDEFLAGS)s
|
||||
EXTRAFLAGS = $(CFLAGS) %(OTHERCFLAGS)s
|
||||
|
||||
LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s
|
||||
EXTRALIBS = %(LIBS)s %(OTHERLIBS)s
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
!include $(WXDIR)\\src\\makevc.env
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%(DEFAULTRULE)s %(OTHERTARGETS)s
|
||||
|
||||
|
||||
|
||||
install: $(TARGETDIR) $(TARGETDIR)\\$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s
|
||||
|
||||
clean:
|
||||
-erase *.obj
|
||||
-erase *.exe
|
||||
-erase *.res
|
||||
-erase *.map
|
||||
-erase *.sbr
|
||||
-erase *.pdb
|
||||
-erase *.pch
|
||||
-erase $(MODULE).exp
|
||||
-erase $(MODULE).lib
|
||||
-erase $(MODULE).ilk
|
||||
-erase $(TARGET)
|
||||
|
||||
|
||||
uninstall: %(OTHERUNINSTALLTARGETS)s
|
||||
-erase $(TARGETDIR)\\$(TARGET)
|
||||
%(PYCLEANUP)s
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# implicit rule for compiling .cpp and .c files
|
||||
{}.cpp{}.obj:
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $<
|
||||
<<
|
||||
|
||||
{$(GENCODEDIR)}.cpp{}.obj:
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c /Tp $<
|
||||
<<
|
||||
|
||||
{}.c{}.obj:
|
||||
$(cc) @<<
|
||||
$(CPPFLAGS) /c $<
|
||||
<<
|
||||
|
||||
.SUFFIXES : .i .py
|
||||
|
||||
# Implicit rules to run SWIG
|
||||
{}.i{$(GENCODEDIR)}.cpp:
|
||||
swig $(SWIGFLAGS) -c -o $@ $<
|
||||
|
||||
{}.i{$(GENCODEDIR)}.py:
|
||||
swig $(SWIGFLAGS) -c -o $(GENCODEDIR)\\tmp_wrap.cpp $<
|
||||
-erase $(GENCODEDIR)\\tmp_wrap.cpp
|
||||
|
||||
|
||||
{$(GENCODEDIR)}.py{$(TARGETDIR)}.py:
|
||||
copy $< $@
|
||||
|
||||
{}.py{$(TARGETDIR)}.py:
|
||||
copy $< $@
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
$(TARGET) : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(RESFILE)
|
||||
$(link) @<<
|
||||
/out:$@
|
||||
$(LFLAGS) /def:$(MODULE).def /implib:./$(MODULE).lib
|
||||
$(DUMMYOBJ) $(OBJECTS) $(RESFILE)
|
||||
$(LIBS)
|
||||
<<
|
||||
|
||||
|
||||
%(RESRULE)s
|
||||
|
||||
|
||||
$(TARGETDIR)\\$(TARGET) : $(TARGET)
|
||||
copy $(TARGET) $@
|
||||
|
||||
|
||||
pycfiles : $(PYMODULES)
|
||||
$(EXECPREFIX)\\python $(PYPREFIX)\\Lib\\compileall.py -l $(TARGETDIR)
|
||||
$(EXECPREFIX)\\python -O $(PYPREFIX)\Lib\\compileall.py -l $(TARGETDIR)
|
||||
|
||||
|
||||
$(TARGETDIR) :
|
||||
mkdir $(TARGETDIR)
|
||||
|
||||
$(GENCODEDIR):
|
||||
mkdir $(GENCODEDIR)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%(DEPENDS)s
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
showflags:
|
||||
@echo CPPFLAGS:
|
||||
@echo $(CPPFLAGS)
|
||||
@echo LFLAGS:
|
||||
@echo $(LFLAGS)
|
||||
|
||||
|
||||
|
||||
%(OTHERRULES)s
|
||||
'''
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
unixTemplate = '''
|
||||
#----------------------------------------------------------------------
|
||||
# This makefile was autogenerated from build.py. Your changes will be
|
||||
# lost if the generator is run again. You have been warned.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
WXDIR = %(WXDIR)s
|
||||
VERSION = %(VERSION)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
|
||||
PYINCLUDE = $(PYPREFIX)/include/python$(PYVERSION)
|
||||
EXECINCLUDE = $(EXECPREFIX)/include/python$(PYVERSION)
|
||||
PYLIB = %(PYLIB)s
|
||||
LIBPL = %(LIBPL)s
|
||||
PYTHONLIB = %(PYTHONLIB)s
|
||||
FINAL = %(FINAL)s
|
||||
WXP_USE_THREAD = %(WXP_USE_THREAD)s
|
||||
GENCODEDIR = %(GENCODEDIR)s
|
||||
WXPSRCDIR = %(WXPSRCDIR)s
|
||||
HELPERLIB = %(HELPERLIB)s
|
||||
HELPERLIBDIR = %(HELPERLIBDIR)s
|
||||
|
||||
TARGETDIR = %(TARGETDIR)s
|
||||
|
||||
|
||||
CCC = %(CCC)s
|
||||
CC = %(CC)s
|
||||
OPT = %(OPT)s
|
||||
SO = %(SO)s
|
||||
LDSHARED = %(LDSHARED)s
|
||||
CCSHARED = %(CCSHARED)s
|
||||
|
||||
|
||||
OBJECTS = %(OBJECTS)s
|
||||
PYMODULES = %(PYMODULES)s
|
||||
TARGET = %(TARGET)s
|
||||
|
||||
|
||||
ifeq ($(WXP_USE_THREAD), 1)
|
||||
THREAD=-DWXP_USE_THREAD
|
||||
endif
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%(DEFAULTRULE)s %(OTHERTARGETS)s
|
||||
|
||||
install: $(TARGETDIR) $(TARGETDIR)/$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s
|
||||
|
||||
clean:
|
||||
-rm -f *.o *$(SO) *~
|
||||
-rm -f $(TARGET)
|
||||
|
||||
uninstall: %(OTHERUNINSTALLTARGETS)s
|
||||
-rm -f $(TARGETDIR)/$(TARGET)
|
||||
%(PYCLEANUP)s
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%%.o : %%.cpp
|
||||
$(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
|
||||
|
||||
%%.o : $(GENCODEDIR)/%%.cpp
|
||||
$(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
|
||||
|
||||
%%.o : %%.c
|
||||
$(CC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
|
||||
|
||||
%%.o : $(GENCODEDIR)/%%.c
|
||||
$(CC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $<
|
||||
|
||||
$(GENCODEDIR)/%%.cpp : %%.i
|
||||
swig $(SWIGFLAGS) -c -o $@ $<
|
||||
|
||||
$(GENCODEDIR)/%%.py : %%.i
|
||||
swig $(SWIGFLAGS) -c -o $(GENCODEDIR)/tmp_wrap.cpp $<
|
||||
rm $(GENCODEDIR)/tmp_wrap.cpp
|
||||
|
||||
$(TARGETDIR)/%% : %%
|
||||
cp -f $< $@
|
||||
|
||||
$(TARGETDIR)/%% : $(GENCODEDIR)/%%
|
||||
cp -f $< $@
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
%(DEPENDS)s
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
$(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)
|
||||
|
||||
|
||||
$(TARGETDIR) :
|
||||
mkdir $(TARGETDIR)
|
||||
|
||||
$(GENCODEDIR):
|
||||
mkdir $(GENCODEDIR)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
%(OTHERRULES)s
|
||||
|
||||
|
||||
|
||||
'''
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -12,18 +12,12 @@ fi
|
||||
|
||||
|
||||
|
||||
strip /usr/lib/python1.5/site-packages/wxPython/*.so
|
||||
strip /usr/lib/libwxPyHelpers.so
|
||||
strip /usr/lib/python1.5/site-packages/wxPython/wxcmodule.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
|
||||
|
||||
|
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ~/wx/utils/wxPython
|
||||
|
||||
find . -name "*.py" > filelist
|
||||
find . -name "*.i" >> filelist
|
||||
find . -name "*.h" >> filelist
|
||||
find . -name "*.cpp" >> filelist
|
||||
|
||||
cat filelist | zip -r -u -@ xfer.zip
|
@@ -1,9 +0,0 @@
|
||||
|
||||
|
||||
cd %WXWIN%\utils\wxPython
|
||||
find . -name "*.py" > filelist
|
||||
find . -name "*.i" >> filelist
|
||||
find . -name "*.h" >> filelist
|
||||
find . -name "*.cpp" >> filelist
|
||||
|
||||
cat filelist | zip -r -u -@ xfer.zip
|
@@ -7,9 +7,6 @@ wxPython/demo/bitmaps/*.gif
|
||||
wxPython/demo/bitmaps/*.png
|
||||
wxPython/demo/bitmaps/*.jpg
|
||||
wxPython/demo/README.txt
|
||||
wxPython/demo/*.xml
|
||||
|
||||
wxPython/distrib/build.py
|
||||
|
||||
wxPython/lib/*.py
|
||||
wxPython/lib/*.txt
|
||||
@@ -17,15 +14,16 @@ wxPython/lib/sizers/*.py
|
||||
wxPython/lib/sizers/*.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/makefile.*
|
||||
wxPython/src/Makefile.pre.in
|
||||
wxPython/src/Setup.*
|
||||
|
||||
wxPython/src/msw/*.cpp
|
||||
wxPython/src/msw/*.h
|
||||
@@ -39,64 +37,8 @@ wxpython/src/motif/*.cpp
|
||||
wxPython/src/motif/*.h
|
||||
wxPython/src/motif/*.py
|
||||
|
||||
wxPython/src/qt/*.cpp
|
||||
wxPython/src/qt/*.h
|
||||
wxPython/src/qt/*.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/msw/*.cpp
|
||||
wxPython/modules/html/msw/*.h
|
||||
wxPython/modules/html/msw/*.py
|
||||
wxPython/modules/html/gtk/*.cpp
|
||||
wxPython/modules/html/gtk/*.h
|
||||
wxPython/modules/html/gtk/*.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/msw/*.cpp
|
||||
wxPython/modules/ogl/msw/*.h
|
||||
wxPython/modules/ogl/msw/*.py
|
||||
wxPython/modules/ogl/gtk/*.cpp
|
||||
wxPython/modules/ogl/gtk/*.h
|
||||
wxPython/modules/ogl/gtk/*.py
|
||||
|
||||
wxPython/SWIG.patches/*.patch
|
||||
|
@@ -35,19 +35,7 @@ extension language for applications that need a programmable interface.
|
||||
#%install
|
||||
#make install
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
|
||||
%postun
|
||||
/sbin/ldconfig
|
||||
|
||||
%files
|
||||
%doc /usr/doc/wxPython-__VERSION__
|
||||
/usr/lib/libwxPyHelpers.so
|
||||
%doc /usr/doc/wxPython-__VERSION__/README.txt
|
||||
/usr/lib/python1.5/site-packages/wxPython
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -17,7 +17,7 @@ item: Global
|
||||
Patch Flags=0000000000001001
|
||||
Patch Threshold=85
|
||||
Patch Memory=4000
|
||||
EXE Filename=wxPython-2.1b3.exe
|
||||
EXE Filename=wxPython-2.1b1.exe
|
||||
FTP Cluster Size=20
|
||||
Per-User Version ID=1
|
||||
Dialogs Version=6
|
||||
@@ -314,9 +314,9 @@ item: Custom Dialog Set
|
||||
Text=
|
||||
Text=Click Cancel to quit Setup and close any programs you have running. Click Next to continue with the Setup program .
|
||||
Text=
|
||||
Text=WARNING: Although this program is OpenSource, it is still protected by copyright law and international treaties. See wxWindows Library Licence, Version 3 for details.
|
||||
Text=
|
||||
Text=WARNING: This program is protected by copyright law and international treaties.
|
||||
Text=
|
||||
Text=Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under law.
|
||||
Text French=Il vous est fortement recommand<6E> de fermer tous les programmes Windows avant d'ex<65>cuter le Programme d'Installation
|
||||
Text French=
|
||||
Text French=Cliquez sur Annuler pour quitter l'Installation et fermez tous les programmes actuellement utilis<69>s. Cliquez sur Suivant pour continuer l'installation
|
||||
@@ -822,8 +822,8 @@ item: Install File
|
||||
Flags=0000001010000011
|
||||
end
|
||||
item: Install File
|
||||
Source=e:\projects\wx\lib\wx21b9.dll
|
||||
Destination=%SYS%\wx21b9.dll
|
||||
Source=e:\projects\wx\lib\wx200.dll
|
||||
Destination=%SYS%\wx200.dll
|
||||
Flags=0000001010010010
|
||||
end
|
||||
item: Install File
|
||||
@@ -862,18 +862,6 @@ item: Install File
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=E:\Projects\wx\utils\wxPython\demo\README.txt
|
||||
Destination=%MAINDIR%\wxPython\demo
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=e:\Projects\wx\utils\wxPython\demo\*.xml
|
||||
Destination=%MAINDIR%\wxPython\demo
|
||||
Description=Demos
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=e:\Projects\wx\utils\wxPython\demo\bitmaps\*.bmp
|
||||
Destination=%MAINDIR%\wxPython\demo\bitmaps
|
||||
@@ -912,36 +900,6 @@ item: Install File
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=E:\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
|
||||
Destination=%MAINDIR%\wxPython\docs\licence.txt
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=E:\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
|
||||
Destination=%MAINDIR%\wxPython\docs\lgpl.txt
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Install File
|
||||
Source=E:\PROJECTS\wx\docs\gpl.txt
|
||||
Destination=%MAINDIR%\wxPython\docs\gpl.txt
|
||||
Description=wxPython documentation
|
||||
Flags=0000000010000010
|
||||
end
|
||||
item: Remark
|
||||
end
|
||||
remarked item: If/While Statement
|
||||
|
Binary file not shown.
@@ -19,7 +19,7 @@ class wxScrolledMessageDialog(wxDialog):
|
||||
text.SetConstraints(Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)))
|
||||
ok.SetConstraints(Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self,)))
|
||||
self.SetAutoLayout(TRUE)
|
||||
self.Layout()
|
||||
|
||||
|
||||
|
||||
class wxMultipleChoiceDialog(wxDialog):
|
||||
@@ -47,7 +47,6 @@ class wxMultipleChoiceDialog(wxDialog):
|
||||
cancel.SetConstraints(Layoutf('b=b5#1;x%w75#1;w!80;h!25', (self,)))
|
||||
self.SetAutoLayout(TRUE)
|
||||
self.lst = lst
|
||||
self.Layout()
|
||||
|
||||
def OnSize(self, event):
|
||||
self.Layout()
|
||||
|
@@ -55,8 +55,6 @@ class wxSizer:
|
||||
the Add method.
|
||||
"""
|
||||
for childinfo in widgets:
|
||||
if type(childinfo) != type(()):
|
||||
childinfo = (childinfo, )
|
||||
apply(self.Add, childinfo)
|
||||
|
||||
|
||||
|
@@ -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.
|
@@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#----------------------------------------------------------------------------
|
||||
# Name: buildall.py
|
||||
# Purpose: Invokes the build script for all modules defined in
|
||||
# MODULELIST
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 18-Aug-1999
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 1999 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
import sys, os
|
||||
sys.path.insert(0, '../distrib')
|
||||
import build
|
||||
|
||||
MODULELIST = ['html', 'glcanvas', 'utils', 'lseditor']
|
||||
|
||||
|
||||
|
||||
for module in MODULELIST:
|
||||
cwd = os.getcwd()
|
||||
print "**** Building %s" % module
|
||||
build.main([sys.argv[0], '-C', module] + sys.argv[1:])
|
||||
os.chdir(cwd)
|
@@ -1,13 +0,0 @@
|
||||
|
||||
*.exp
|
||||
*.lib
|
||||
*.obj
|
||||
*.pch
|
||||
Makefile
|
||||
Makefile.pre
|
||||
Setup
|
||||
build.local
|
||||
config.c
|
||||
glcanvasc.ilk
|
||||
glcanvasc.pyd
|
||||
sedscript
|
@@ -1,24 +0,0 @@
|
||||
# -*- python -*-
|
||||
import sys
|
||||
|
||||
MODULE = 'glcanvasc'
|
||||
SWIGFILES = ['glcanvas.i', ]
|
||||
|
||||
|
||||
# Special action; for win32 we require you make the glcanvas lib. The
|
||||
# makefile will copy it to WXWIN\lib
|
||||
# Unix make system isn't so advanced, so we'll go looking for the source
|
||||
# file ourselves...
|
||||
if sys.platform == 'win32':
|
||||
OTHERLIBS = '$(WXDIR)\lib\glcanvas.lib glu32.lib opengl32.lib'
|
||||
OTHERCFLAGS = '-DWITH_GLCANVAS -I$(WXDIR)\utils\glcanvas\win'
|
||||
else:
|
||||
SOURCES = [GENCODEDIR+'/_glcanvas.cpp']
|
||||
print "Warning: Assuming MesaGL libraries. Override OTHERLIBS in build.local\n"\
|
||||
" if you have native GL!"
|
||||
OTHERCFLAGS = '-DWITH_GLCANVAS -I$(WXDIR)\utils\glcanvas\gtk'
|
||||
OTHERLIBS = "-lMesaGL -lMesaGLU"
|
||||
OTHERRULES = """
|
||||
$(GENCODEDIR)/_glcanvas.cpp :
|
||||
cp $(WXDIR)/utils/glcanvas/$(GENCODEDIR)/glcanvas.cpp $@
|
||||
"""
|
@@ -1,2 +0,0 @@
|
||||
*~
|
||||
_glcanvas.cpp
|
@@ -1 +0,0 @@
|
||||
*~
|
@@ -1,13 +0,0 @@
|
||||
|
||||
*.exp
|
||||
*.lib
|
||||
*.obj
|
||||
*.pch
|
||||
Makefile
|
||||
Makefile.pre
|
||||
Setup
|
||||
build.local
|
||||
config.c
|
||||
htmlc.ilk
|
||||
htmlc.pyd
|
||||
sedscript
|
@@ -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?
|
@@ -1,11 +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.
|
||||
|
@@ -1,6 +0,0 @@
|
||||
# -*- python -*-
|
||||
|
||||
MODULE = 'htmlc'
|
||||
SWIGFILES = ['html.i', ]
|
||||
PYFILES = ['htmlhelper.py']
|
||||
|
@@ -1 +0,0 @@
|
||||
*~
|
File diff suppressed because it is too large
Load Diff
@@ -1,121 +0,0 @@
|
||||
# This file was created automatically by SWIG.
|
||||
import htmlc
|
||||
|
||||
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,htmlhelper
|
||||
widget = htmlc
|
||||
class HtmlHistoryItemPtr :
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def GetPos(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.HtmlHistoryItem_GetPos,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetPos(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.HtmlHistoryItem_SetPos,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetPage(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.HtmlHistoryItem_GetPage,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetAnchor(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.HtmlHistoryItem_GetAnchor,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C HtmlHistoryItem instance at %s>" % (self.this,)
|
||||
class HtmlHistoryItem(HtmlHistoryItemPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(htmlc.new_HtmlHistoryItem,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxHtmlWindowPtr(wxScrolledWindowPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def SetPage(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetPage,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def LoadPage(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_LoadPage,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetOpenedPage(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_GetOpenedPage,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetRelatedFrame(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetRelatedFrame,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetRelatedFrame(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_GetRelatedFrame,(self,) + _args, _kwargs)
|
||||
if val: val = wxFramePtr(val)
|
||||
return val
|
||||
def SetRelatedStatusBar(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetRelatedStatusBar,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetFonts(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetFonts,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetTitle(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetTitle,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetBorders(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetBorders,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def HistoryBack(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_HistoryBack,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def HistoryForward(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_HistoryForward,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def HistoryClear(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_HistoryClear,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxHtmlWindow instance at %s>" % (self.this,)
|
||||
class wxHtmlWindow(wxHtmlWindowPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(htmlc.new_wxHtmlWindow,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
wx._StdWindowCallbacks(self)
|
||||
wx._StdOnScrollCallbacks(self)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
@@ -1,259 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: html.i
|
||||
// Purpose: SWIG definitions of html classes
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 25-nov-1998
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
%module html
|
||||
|
||||
%{
|
||||
#include "helpers.h"
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/fs_zip.h>
|
||||
#include <wx/fs_inet.h>
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%include typemaps.i
|
||||
%include my_typemaps.i
|
||||
|
||||
%extern wx.i
|
||||
%extern windows.i
|
||||
%extern _defs.i
|
||||
%extern events.i
|
||||
//%extern windows2.i
|
||||
//%extern windows3.i
|
||||
//%extern frames.i
|
||||
//%extern misc.i
|
||||
//%extern gdi.i
|
||||
//%extern controls.i
|
||||
|
||||
|
||||
%{
|
||||
#ifdef __WXMSW__
|
||||
static wxString wxPyEmptyStr("");
|
||||
static wxPoint wxPyDefaultPosition(wxDefaultPosition);
|
||||
static wxSize wxPyDefaultSize(wxDefaultSize);
|
||||
#endif
|
||||
static PyThreadState* wxPyThreadState;
|
||||
%}
|
||||
|
||||
%pragma(python) code = "import wx,htmlhelper"
|
||||
%pragma(python) code = "widget = htmlc"
|
||||
|
||||
%{
|
||||
|
||||
static PyObject* mod_dict = NULL; // will be set by init
|
||||
|
||||
#include <wx/html/mod_templ.h>
|
||||
|
||||
TAG_HANDLER_BEGIN(PYTHONTAG, "PYTHON")
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
wxWindow *wnd;
|
||||
wxString errmsg;
|
||||
char pbuf[256];
|
||||
|
||||
int fl = 0;
|
||||
|
||||
while (1) {
|
||||
#ifdef WXP_WITH_THREAD
|
||||
PyEval_RestoreThread(wxPyThreadState);
|
||||
#endif
|
||||
if (tag.HasParam("FLOAT"))
|
||||
tag.ScanParam("FLOAT", "%i", &fl);
|
||||
PyObject* pyfunc = PyDict_GetItemString(mod_dict, "WidgetStarter");
|
||||
if (pyfunc == NULL) {
|
||||
errmsg = "Could not find object WidgetStarter";
|
||||
break;
|
||||
}
|
||||
if (! PyCallable_Check(pyfunc)) {
|
||||
errmsg = "WidgetStarter does not appear to be callable";
|
||||
break;
|
||||
}
|
||||
SWIG_MakePtr(pbuf, m_WParser->GetWindow(), "_wxHtmlWindow_p");
|
||||
PyObject* arglist = Py_BuildValue("(s,s)", pbuf,
|
||||
(const char*)tag.GetAllParams());
|
||||
if (! arglist) {
|
||||
errmsg = "Failed making argument list";
|
||||
break;
|
||||
}
|
||||
PyObject* ret = PyEval_CallObject(pyfunc, arglist);
|
||||
Py_DECREF(arglist);
|
||||
if (ret == NULL) {
|
||||
errmsg = "An error occured while calling WidgetStarter";
|
||||
if (PyErr_Occurred())
|
||||
PyErr_Print();
|
||||
break;
|
||||
}
|
||||
wnd = NULL;
|
||||
if (PyString_Check(ret)) {
|
||||
char* thisc = PyString_AsString(ret);
|
||||
SWIG_GetPtr(thisc, (void**)&wnd, "_wxWindow_p");
|
||||
}
|
||||
Py_DECREF(ret);
|
||||
if (! wnd) {
|
||||
errmsg = "Could not make a wxWindow pointer from return ptr";
|
||||
break;
|
||||
}
|
||||
#ifdef WXP_WITH_THREAD
|
||||
PyEval_SaveThread();
|
||||
#endif
|
||||
wnd -> Show(TRUE);
|
||||
m_WParser->OpenContainer()->InsertCell(new wxHtmlWidgetCell(wnd, fl));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* we got out of the loop. Must be an error. Show a box stating it. */
|
||||
|
||||
#ifdef WXP_WITH_THREAD
|
||||
PyEval_SaveThread();
|
||||
#endif
|
||||
|
||||
wnd = new wxTextCtrl( m_WParser -> GetWindow(), -1,
|
||||
errmsg, wxPoint(0,0),
|
||||
wxSize(300, 100), wxTE_MULTILINE );
|
||||
wnd -> Show(TRUE);
|
||||
m_WParser->OpenContainer()->InsertCell(new wxHtmlWidgetCell(wnd, 100));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(PYTHONTAG)
|
||||
|
||||
TAGS_MODULE_BEGIN(PythonTag)
|
||||
|
||||
TAGS_MODULE_ADD(PYTHONTAG)
|
||||
|
||||
TAGS_MODULE_END(PythonTag)
|
||||
|
||||
// Note: see also the init function where we add the module!
|
||||
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// item of history list
|
||||
class HtmlHistoryItem
|
||||
{
|
||||
public:
|
||||
HtmlHistoryItem(const char* p, const char* a);
|
||||
int GetPos() const {return m_Pos;}
|
||||
void SetPos(int p) {m_Pos = p;}
|
||||
const wxString& GetPage() const ;
|
||||
const wxString& GetAnchor() const ;
|
||||
};
|
||||
|
||||
class wxHtmlWindow : public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
wxHtmlWindow(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxPyDefaultPosition,
|
||||
const wxSize& size = wxPyDefaultSize,
|
||||
int flags=wxHW_SCROLLBAR_AUTO,
|
||||
const char* name = "htmlWindow");
|
||||
%pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
|
||||
%pragma(python) addtomethod = "__init__:wx._StdOnScrollCallbacks(self)"
|
||||
|
||||
bool SetPage(const char* source);
|
||||
// Set HTML page and display it. !! source is HTML document itself,
|
||||
// it is NOT address/filename of HTML document. If you want to
|
||||
// specify document location, use LoadPage() istead
|
||||
// Return value : FALSE if an error occured, TRUE otherwise
|
||||
|
||||
bool LoadPage(const char* location);
|
||||
// Load HTML page from given location. Location can be either
|
||||
// a) /usr/wxGTK2/docs/html/wx.htm
|
||||
// b) http://www.somewhere.uk/document.htm
|
||||
// c) ftp://ftp.somesite.cz/pub/something.htm
|
||||
// In case there is no prefix (http:,ftp:), the method
|
||||
// will try to find it itself (1. local file, then http or ftp)
|
||||
// After the page is loaded, the method calls SetPage() to display it.
|
||||
// Note : you can also use path relative to previously loaded page
|
||||
// Return value : same as SetPage
|
||||
|
||||
wxString GetOpenedPage() const {return m_OpenedPage;}
|
||||
// Returns full location of opened page
|
||||
|
||||
void SetRelatedFrame(wxFrame* frame, const char* format);
|
||||
// sets frame in which page title will be displayed. Format is format of
|
||||
// frame title, e.g. "HtmlHelp : %s". It must contain exactly one %s
|
||||
wxFrame* GetRelatedFrame() const;
|
||||
|
||||
void SetRelatedStatusBar(int bar);
|
||||
// after(!) calling SetRelatedFrame, this sets statusbar slot where messages
|
||||
// will be displayed. Default is -1 = no messages.
|
||||
|
||||
void SetFonts(wxString normal_face, int normal_italic_mode, wxString fixed_face, int fixed_italic_mode, int *sizes);
|
||||
// sets fonts to be used when displaying HTML page.
|
||||
// *_italic_mode can be either wxSLANT or wxITALIC
|
||||
|
||||
void SetTitle(const char* title);
|
||||
// Sets the title of the window
|
||||
// (depending on the information passed to SetRelatedFrame() method)
|
||||
|
||||
void SetBorders(int b);
|
||||
// Sets space between text and window borders.
|
||||
|
||||
//virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
|
||||
// saves custom settings into cfg config. it will use the path 'path'
|
||||
// if given, otherwise it will save info into currently selected path.
|
||||
// saved values : things set by SetFonts, SetBorders.
|
||||
//virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
|
||||
// ...
|
||||
|
||||
bool HistoryBack();
|
||||
bool HistoryForward();
|
||||
// Goes to previous/next page (in browsing history)
|
||||
// Returns TRUE if successful, FALSE otherwise
|
||||
void HistoryClear();
|
||||
// Resets history
|
||||
|
||||
//wxHtmlContainerCell* GetInternalRepresentation() const;
|
||||
// Returns pointer to conteiners/cells structure.
|
||||
// It should be used ONLY when printing
|
||||
|
||||
//static void AddFilter(wxHtmlFilter *filter);
|
||||
// Adds input filter
|
||||
|
||||
/* This function needs to be eventified! */
|
||||
//virtual void OnLinkClicked(const char* link);
|
||||
// called when users clicked on hypertext link. Default behavior is to
|
||||
// call LoadPage(loc)
|
||||
|
||||
//static void CleanUpStatics();
|
||||
// cleans static variables
|
||||
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%init %{
|
||||
|
||||
/* This is a bit cheesy. SWIG happens to call the dictionary d...
|
||||
* I save it here, 'cause I don't know how to get it back later! */
|
||||
mod_dict = d;
|
||||
wxPyThreadState = PyThreadState_Get();
|
||||
wxClassInfo::CleanUpClasses();
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
/* specifically add our python tag handler; it doesn't seem to
|
||||
* happen by itself... */
|
||||
wxHtmlWinParser::AddModule(new HTML_ModulePythonTag());
|
||||
|
||||
// Until wxFileSystem is wrapped...
|
||||
#if wxUSE_FS_ZIP
|
||||
wxFileSystem::AddHandler(new wxZipFSHandler);
|
||||
#endif
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
@@ -1,2 +0,0 @@
|
||||
EXPORTS
|
||||
inithtmlc
|
@@ -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
|
@@ -1 +0,0 @@
|
||||
*~
|
File diff suppressed because it is too large
Load Diff
@@ -1,121 +0,0 @@
|
||||
# This file was created automatically by SWIG.
|
||||
import htmlc
|
||||
|
||||
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,htmlhelper
|
||||
widget = htmlc
|
||||
class HtmlHistoryItemPtr :
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def GetPos(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.HtmlHistoryItem_GetPos,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetPos(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.HtmlHistoryItem_SetPos,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetPage(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.HtmlHistoryItem_GetPage,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetAnchor(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.HtmlHistoryItem_GetAnchor,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C HtmlHistoryItem instance at %s>" % (self.this,)
|
||||
class HtmlHistoryItem(HtmlHistoryItemPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(htmlc.new_HtmlHistoryItem,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxHtmlWindowPtr(wxScrolledWindowPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def SetPage(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetPage,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def LoadPage(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_LoadPage,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetOpenedPage(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_GetOpenedPage,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetRelatedFrame(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetRelatedFrame,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetRelatedFrame(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_GetRelatedFrame,(self,) + _args, _kwargs)
|
||||
if val: val = wxFramePtr(val)
|
||||
return val
|
||||
def SetRelatedStatusBar(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetRelatedStatusBar,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetFonts(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetFonts,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetTitle(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetTitle,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetBorders(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_SetBorders,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def HistoryBack(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_HistoryBack,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def HistoryForward(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_HistoryForward,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def HistoryClear(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_HistoryClear,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxHtmlWindow instance at %s>" % (self.this,)
|
||||
class wxHtmlWindow(wxHtmlWindowPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(htmlc.new_wxHtmlWindow,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
wx._StdWindowCallbacks(self)
|
||||
wx._StdOnScrollCallbacks(self)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
@@ -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()
|
@@ -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()
|
@@ -1,13 +0,0 @@
|
||||
|
||||
*.exp
|
||||
*.lib
|
||||
*.obj
|
||||
*.pch
|
||||
Makefile
|
||||
Makefile.pre
|
||||
Setup
|
||||
build.local
|
||||
config.c
|
||||
lseditorc.ilk
|
||||
lseditorc.pyd
|
||||
sedscript
|
@@ -1,6 +0,0 @@
|
||||
Known bugs/features
|
||||
|
||||
editor, all:
|
||||
- (missing feature, really) syntax highlighting data is
|
||||
compile time.
|
||||
|
@@ -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.
|
@@ -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.
|
||||
|
@@ -1,9 +0,0 @@
|
||||
# -*- python -*-
|
||||
|
||||
MODULE = 'lseditorc'
|
||||
SWIGFILES = ['lseditor.i']
|
||||
|
||||
SOURCES = ['finddlg.cpp', 'lseditorpl.cpp', 'markup.cpp', 'plugin.cpp',
|
||||
'sourcepainter.cpp', 'tdefs.cpp']
|
||||
|
||||
|
@@ -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"
|
||||
|
@@ -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
|
@@ -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__
|
@@ -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();
|
||||
}
|
@@ -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
|
@@ -1 +0,0 @@
|
||||
*~
|
File diff suppressed because it is too large
Load Diff
@@ -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 ------------------
|
||||
|
@@ -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();
|
||||
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
@@ -1,2 +0,0 @@
|
||||
EXPORTS
|
||||
initlseditorc
|
@@ -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;
|
||||
}
|
@@ -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__
|
@@ -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;
|
||||
}
|
@@ -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
|
@@ -1 +0,0 @@
|
||||
*~
|
File diff suppressed because it is too large
Load Diff
@@ -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 ------------------
|
||||
|
@@ -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;
|
||||
}
|
@@ -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__
|
@@ -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 );
|
||||
}
|
@@ -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
|
File diff suppressed because it is too large
Load Diff
@@ -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__
|
@@ -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()
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -1,10 +0,0 @@
|
||||
sedscript
|
||||
Makefile.pre
|
||||
Setup
|
||||
config.c
|
||||
Makefile
|
||||
*.obj
|
||||
*.pch
|
||||
*.lib
|
||||
*.exp
|
||||
|
@@ -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.
|
@@ -1 +0,0 @@
|
||||
*~
|
@@ -1 +0,0 @@
|
||||
*~
|
@@ -1,7 +0,0 @@
|
||||
Makefile
|
||||
build.local
|
||||
utilsc.exp
|
||||
utilsc.ilk
|
||||
utilsc.pch
|
||||
utilsc.pyd
|
||||
wxp.pch
|
@@ -1,5 +0,0 @@
|
||||
# -*- python -*-
|
||||
|
||||
MODULE = 'utilsc'
|
||||
SWIGFILES = ['utils.i', ]
|
||||
|
@@ -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 ------------------
|
||||
|
@@ -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 ------------------
|
||||
|
@@ -6,7 +6,6 @@ Setup.in.new
|
||||
Setup.save
|
||||
Setup.save
|
||||
Setup.test
|
||||
build.local
|
||||
compile.py
|
||||
config.c
|
||||
glcanvas.h
|
||||
@@ -25,10 +24,7 @@ wxPython.dsw
|
||||
wxPython.ncb
|
||||
wxPython.opt
|
||||
wxc.exp
|
||||
wxc.ilk
|
||||
wxc.lib
|
||||
wxc.pch
|
||||
wxc.pyd
|
||||
wxc.res
|
||||
wxp.pch
|
||||
wxpc.exp
|
||||
|
429
utils/wxPython/src/Makefile.pre.in
Normal file
429
utils/wxPython/src/Makefile.pre.in
Normal file
@@ -0,0 +1,429 @@
|
||||
# Universal Unix Makefile for Python extensions
|
||||
# =============================================
|
||||
|
||||
# Short Instructions
|
||||
# ------------------
|
||||
|
||||
# 1. Build and install Python (1.5 or newer).
|
||||
# 2. "make -f Makefile.pre.in boot"
|
||||
# 3. "make"
|
||||
# You should now have a shared library.
|
||||
|
||||
# Long Instructions
|
||||
# -----------------
|
||||
|
||||
# Build *and install* the basic Python 1.5 distribution. See the
|
||||
# Python README for instructions. (This version of Makefile.pre.in
|
||||
# only withs with Python 1.5, alpha 3 or newer.)
|
||||
|
||||
# Create a file Setup.in for your extension. This file follows the
|
||||
# format of the Modules/Setup.in file; see the instructions there.
|
||||
# For a simple module called "spam" on file "spammodule.c", it can
|
||||
# contain a single line:
|
||||
# spam spammodule.c
|
||||
# You can build as many modules as you want in the same directory --
|
||||
# just have a separate line for each of them in the Setup.in file.
|
||||
|
||||
# If you want to build your extension as a shared library, insert a
|
||||
# line containing just the string
|
||||
# *shared*
|
||||
# at the top of your Setup.in file.
|
||||
|
||||
# Note that the build process copies Setup.in to Setup, and then works
|
||||
# with Setup. It doesn't overwrite Setup when Setup.in is changed, so
|
||||
# while you're in the process of debugging your Setup.in file, you may
|
||||
# want to edit Setup instead, and copy it back to Setup.in later.
|
||||
# (All this is done so you can distribute your extension easily and
|
||||
# someone else can select the modules they actually want to build by
|
||||
# commenting out lines in the Setup file, without editing the
|
||||
# original. Editing Setup is also used to specify nonstandard
|
||||
# locations for include or library files.)
|
||||
|
||||
# Copy this file (Misc/Makefile.pre.in) to the directory containing
|
||||
# your extension.
|
||||
|
||||
# Run "make -f Makefile.pre.in boot". This creates Makefile
|
||||
# (producing Makefile.pre and sedscript as intermediate files) and
|
||||
# config.c, incorporating the values for sys.prefix, sys.exec_prefix
|
||||
# and sys.version from the installed Python binary. For this to work,
|
||||
# the python binary must be on your path. If this fails, try
|
||||
# make -f Makefile.pre.in Makefile VERSION=1.5 installdir=<prefix>
|
||||
# where <prefix> is the prefix used to install Python for installdir
|
||||
# (and possibly similar for exec_installdir=<exec_prefix>).
|
||||
|
||||
# Note: "make boot" implies "make clobber" -- it assumes that when you
|
||||
# bootstrap you may have changed platforms so it removes all previous
|
||||
# output files.
|
||||
|
||||
# If you are building your extension as a shared library (your
|
||||
# Setup.in file starts with *shared*), run "make" or "make sharedmods"
|
||||
# to build the shared library files. If you are building a statically
|
||||
# linked Python binary (the only solution of your platform doesn't
|
||||
# support shared libraries, and sometimes handy if you want to
|
||||
# distribute or install the resulting Python binary), run "make
|
||||
# python".
|
||||
|
||||
# Note: Each time you edit Makefile.pre.in or Setup, you must run
|
||||
# "make Makefile" before running "make".
|
||||
|
||||
# Hint: if you want to use VPATH, you can start in an empty
|
||||
# subdirectory and say (e.g.):
|
||||
# make -f ../Makefile.pre.in boot srcdir=.. VPATH=..
|
||||
|
||||
|
||||
# === Bootstrap variables (edited through "make boot") ===
|
||||
|
||||
# The prefix used by "make inclinstall libainstall" of core python
|
||||
installdir= /usr/local
|
||||
|
||||
# The exec_prefix used by the same
|
||||
exec_installdir=$(installdir)
|
||||
|
||||
# Source directory and VPATH in case you want to use VPATH.
|
||||
# (You will have to edit these two lines yourself -- there is no
|
||||
# automatic support as the Makefile is not generated by
|
||||
# config.status.)
|
||||
srcdir= .
|
||||
VPATH= .
|
||||
|
||||
# === Variables that you may want to customize (rarely) ===
|
||||
|
||||
# (Static) build target
|
||||
TARGET= python
|
||||
|
||||
# Installed python binary (used only by boot target)
|
||||
PYTHON= python
|
||||
|
||||
# Add more -I and -D options here
|
||||
CFLAGS= $(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS)
|
||||
|
||||
# These two variables can be set in Setup to merge extensions.
|
||||
# See example[23].
|
||||
BASELIB=
|
||||
BASESETUP=
|
||||
|
||||
# === Variables set by makesetup ===
|
||||
|
||||
MODOBJS= _MODOBJS_
|
||||
MODLIBS= _MODLIBS_
|
||||
|
||||
# === Definitions added by makesetup ===
|
||||
|
||||
# === Variables from configure (through sedscript) ===
|
||||
|
||||
VERSION= @VERSION@
|
||||
CC= @CC@
|
||||
LINKCC= @LINKCC@
|
||||
SGI_ABI= @SGI_ABI@
|
||||
OPT= @OPT@
|
||||
LDFLAGS= @LDFLAGS@
|
||||
LDLAST= @LDLAST@
|
||||
DEFS= @DEFS@
|
||||
LIBS= @LIBS@
|
||||
LIBM= @LIBM@
|
||||
LIBC= @LIBC@
|
||||
RANLIB= @RANLIB@
|
||||
MACHDEP= @MACHDEP@
|
||||
SO= @SO@
|
||||
LDSHARED= @LDSHARED@
|
||||
CCSHARED= @CCSHARED@
|
||||
LINKFORSHARED= @LINKFORSHARED@
|
||||
#@SET_CCC@
|
||||
|
||||
# Install prefix for architecture-independent files
|
||||
prefix= /usr/local
|
||||
|
||||
# Install prefix for architecture-dependent files
|
||||
exec_prefix= $(prefix)
|
||||
|
||||
# === Fixed definitions ===
|
||||
|
||||
# Shell used by make (some versions default to the login shell, which is bad)
|
||||
SHELL= /bin/sh
|
||||
|
||||
# Expanded directories
|
||||
BINDIR= $(exec_installdir)/bin
|
||||
LIBDIR= $(exec_prefix)/lib
|
||||
MANDIR= $(installdir)/man
|
||||
INCLUDEDIR= $(installdir)/include
|
||||
SCRIPTDIR= $(prefix)/lib
|
||||
|
||||
# Detailed destination directories
|
||||
BINLIBDEST= $(LIBDIR)/python$(VERSION)
|
||||
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
|
||||
INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
|
||||
EXECINCLUDEPY= $(exec_installdir)/include/python$(VERSION)
|
||||
LIBP= $(exec_installdir)/lib/python$(VERSION)
|
||||
DESTSHARED= $(BINLIBDEST)/site-packages
|
||||
|
||||
LIBPL= $(LIBP)/config
|
||||
|
||||
PYTHONLIBS= $(LIBPL)/libpython$(VERSION).a
|
||||
|
||||
MAKESETUP= $(LIBPL)/makesetup
|
||||
MAKEFILE= $(LIBPL)/Makefile
|
||||
CONFIGC= $(LIBPL)/config.c
|
||||
CONFIGCIN= $(LIBPL)/config.c.in
|
||||
SETUP= $(LIBPL)/Setup
|
||||
|
||||
SYSLIBS= $(LIBM) $(LIBC)
|
||||
|
||||
ADDOBJS= $(LIBPL)/python.o config.o
|
||||
|
||||
# Portable install script (configure doesn't always guess right)
|
||||
INSTALL= $(LIBPL)/install-sh -c
|
||||
# Shared libraries must be installed with executable mode on some systems;
|
||||
# rather than figuring out exactly which, we always give them executable mode.
|
||||
# Also, making them read-only seems to be a good idea...
|
||||
INSTALL_SHARED= ${INSTALL} -m 555
|
||||
|
||||
#---------------------------------------------------
|
||||
# Possibly change some definintions for C++
|
||||
ifdef MY_LDSHARED
|
||||
LDSHARED=$(MY_LDSHARED)
|
||||
endif
|
||||
ifdef MY_LINKCC
|
||||
LINKCC=$(MY_LINKCC)
|
||||
endif
|
||||
|
||||
|
||||
# === Fixed rules ===
|
||||
|
||||
# Default target. This builds shared libraries only
|
||||
default: sharedmods
|
||||
|
||||
# Build everything
|
||||
all: static sharedmods
|
||||
|
||||
# Build shared libraries from our extension modules
|
||||
sharedmods: $(SHAREDMODS)
|
||||
|
||||
# Build a static Python binary containing our extension modules
|
||||
static: $(TARGET)
|
||||
$(TARGET): $(ADDOBJS) lib.a $(PYTHONLIBS) Makefile $(BASELIB)
|
||||
$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) \
|
||||
$(ADDOBJS) lib.a $(PYTHONLIBS) \
|
||||
$(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS) $(SYSLIBS) \
|
||||
-o $(TARGET) $(LDLAST)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------
|
||||
# This is a default version of the install target for wxPython. It just
|
||||
# redirects to wxInstall below...
|
||||
|
||||
install: wxInstall
|
||||
|
||||
#install: sharedmods
|
||||
# if test ! -d $(DESTSHARED) ; then \
|
||||
# mkdir $(DESTSHARED) ; else true ; fi
|
||||
# -for i in X $(SHAREDMODS); do \
|
||||
# if test $$i != X; \
|
||||
# then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
|
||||
# fi; \
|
||||
# done
|
||||
|
||||
|
||||
# Build the library containing our extension modules
|
||||
lib.a: $(MODOBJS)
|
||||
-rm -f lib.a
|
||||
ar cr lib.a $(MODOBJS)
|
||||
-$(RANLIB) lib.a
|
||||
|
||||
# This runs makesetup *twice* to use the BASESETUP definition from Setup
|
||||
config.c Makefile: Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
|
||||
$(MAKESETUP) \
|
||||
-m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
|
||||
$(MAKE) -f Makefile do-it-again
|
||||
|
||||
# Internal target to run makesetup for the second time
|
||||
do-it-again:
|
||||
$(MAKESETUP) \
|
||||
-m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
|
||||
|
||||
# Make config.o from the config.c created by makesetup
|
||||
config.o: config.c
|
||||
$(CC) $(CFLAGS) -c config.c
|
||||
|
||||
# Setup is copied from Setup.in *only* if it doesn't yet exist
|
||||
Setup:
|
||||
cp Setup.in Setup
|
||||
|
||||
# Make the intermediate Makefile.pre from Makefile.pre.in
|
||||
Makefile.pre: Makefile.pre.in sedscript
|
||||
sed -f sedscript Makefile.pre.in >Makefile.pre
|
||||
|
||||
# Shortcuts to make the sed arguments on one line
|
||||
P=prefix
|
||||
E=exec_prefix
|
||||
H=Generated automatically from Makefile.pre.in by sedscript.
|
||||
L=LINKFORSHARED
|
||||
|
||||
# Make the sed script used to create Makefile.pre from Makefile.pre.in
|
||||
sedscript: $(MAKEFILE)
|
||||
sed -n \
|
||||
-e '1s/.*/1i\\/p' \
|
||||
-e '2s%.*%# $H%p' \
|
||||
-e '/^VERSION=/s/^VERSION=[ ]*\(.*\)/s%@VERSION[@]%\1%/p' \
|
||||
-e '/^CC=/s/^CC=[ ]*\(.*\)/s%@CC[@]%\1%/p' \
|
||||
-e '/^CCC=/s/^CCC=[ ]*\(.*\)/s%#@SET_CCC[@]%CCC=\1%/p' \
|
||||
-e '/^LINKCC=/s/^LINKCC=[ ]*\(.*\)/s%@LINKCC[@]%\1%/p' \
|
||||
-e '/^OPT=/s/^OPT=[ ]*\(.*\)/s%@OPT[@]%\1%/p' \
|
||||
-e '/^LDFLAGS=/s/^LDFLAGS=[ ]*\(.*\)/s%@LDFLAGS[@]%\1%/p' \
|
||||
-e '/^DEFS=/s/^DEFS=[ ]*\(.*\)/s%@DEFS[@]%\1%/p' \
|
||||
-e '/^LIBS=/s/^LIBS=[ ]*\(.*\)/s%@LIBS[@]%\1%/p' \
|
||||
-e '/^LIBM=/s/^LIBM=[ ]*\(.*\)/s%@LIBM[@]%\1%/p' \
|
||||
-e '/^LIBC=/s/^LIBC=[ ]*\(.*\)/s%@LIBC[@]%\1%/p' \
|
||||
-e '/^RANLIB=/s/^RANLIB=[ ]*\(.*\)/s%@RANLIB[@]%\1%/p' \
|
||||
-e '/^MACHDEP=/s/^MACHDEP=[ ]*\(.*\)/s%@MACHDEP[@]%\1%/p' \
|
||||
-e '/^SO=/s/^SO=[ ]*\(.*\)/s%@SO[@]%\1%/p' \
|
||||
-e '/^LDSHARED=/s/^LDSHARED=[ ]*\(.*\)/s%@LDSHARED[@]%\1%/p' \
|
||||
-e '/^CCSHARED=/s/^CCSHARED=[ ]*\(.*\)/s%@CCSHARED[@]%\1%/p' \
|
||||
-e '/^$L=/s/^$L=[ ]*\(.*\)/s%@$L[@]%\1%/p' \
|
||||
-e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \
|
||||
-e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \
|
||||
$(MAKEFILE) >sedscript
|
||||
echo "/^#@SET_CCC@/d" >>sedscript
|
||||
echo "/^installdir=/s%=.*%= $(installdir)%" >>sedscript
|
||||
echo "/^exec_installdir=/s%=.*%=$(exec_installdir)%" >>sedscript
|
||||
echo "/^srcdir=/s%=.*%= $(srcdir)%" >>sedscript
|
||||
echo "/^VPATH=/s%=.*%= $(VPATH)%" >>sedscript
|
||||
echo "/^LINKPATH=/s%=.*%= $(LINKPATH)%" >>sedscript
|
||||
echo "/^BASELIB=/s%=.*%= $(BASELIB)%" >>sedscript
|
||||
echo "/^BASESETUP=/s%=.*%= $(BASESETUP)%" >>sedscript
|
||||
|
||||
# Bootstrap target
|
||||
boot: clobber
|
||||
VERSION=`$(PYTHON) -c "import sys; print sys.version[:3]"`; \
|
||||
installdir=`$(PYTHON) -c "import sys; print sys.prefix"`; \
|
||||
exec_installdir=`$(PYTHON) -c "import sys; print sys.exec_prefix"`; \
|
||||
$(MAKE) -f Makefile.pre.in VPATH=$(VPATH) srcdir=$(srcdir) \
|
||||
VERSION=$$VERSION \
|
||||
installdir=$$installdir \
|
||||
exec_installdir=$$exec_installdir \
|
||||
Makefile
|
||||
|
||||
# Handy target to remove intermediate files and backups
|
||||
clean:
|
||||
-rm -f *.o *~
|
||||
|
||||
# Handy target to remove everything that is easily regenerated
|
||||
clobber: clean
|
||||
-rm -f *.a tags TAGS config.c Makefile.pre $(TARGET) sedscript
|
||||
-rm -f *.so *.sl so_locations
|
||||
|
||||
|
||||
# Handy target to remove everything you don't want to distribute
|
||||
distclean: clobber
|
||||
-rm -f Makefile Setup
|
||||
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------
|
||||
# Custom rules and dependencies added for wxPython
|
||||
#
|
||||
|
||||
WXP_VERSION=2.1b1
|
||||
|
||||
SWIGFLAGS=-c++ -shadow -python -dnone -D__WXGTK__ $(SEPARATE)
|
||||
|
||||
|
||||
PYMODULES = $(GENCODEDIR)/wx.py $(GENCODEDIR)/events.py \
|
||||
$(GENCODEDIR)/windows.py $(GENCODEDIR)/misc.py \
|
||||
$(GENCODEDIR)/gdi.py $(GENCODEDIR)/mdi.py \
|
||||
$(GENCODEDIR)/controls.py $(GENCODEDIR)/controls2.py \
|
||||
$(GENCODEDIR)/windows2.py $(GENCODEDIR)/cmndlgs.py \
|
||||
$(GENCODEDIR)/stattool.py $(GENCODEDIR)/frames.py \
|
||||
$(GENCODEDIR)/windows3.py __init__.py \
|
||||
$(GENCODEDIR)/utils.py $(GENCODEDIR)/image.py \
|
||||
$(GENCODEDIR)/printfw.py $(GENCODEDIR)/misc2.py \
|
||||
$(GENCODEDIR)/glcanvas.py
|
||||
|
||||
|
||||
# Implicit rules to run SWIG
|
||||
$(GENCODEDIR)/%.cpp : %.i
|
||||
swig $(SWIGFLAGS) -c -o $@ $<
|
||||
|
||||
$(GENCODEDIR)/%.py : %.i
|
||||
swig $(SWIGFLAGS) -c -o $@ $<
|
||||
|
||||
|
||||
# This one must leave out the -c flag so we define the whole rule
|
||||
$(GENCODEDIR)/wx.cpp $(GENCODEDIR)/wx.py : wx.i my_typemaps.i _defs.i _extras.py
|
||||
swig $(SWIGFLAGS) -o $(GENCODEDIR)/wx.cpp wx.i
|
||||
|
||||
|
||||
# define some dependencies
|
||||
$(GENCODEDIR)/windows.cpp $(GENCODEDIR)/windows.py : windows.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/windows2.cpp $(GENCODEDIR)/windows2.py : windows2.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/windows3.cpp $(GENCODEDIR)/windows3.py : windows3.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/events.cpp $(GENCODEDIR)/events.py : events.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/misc.cpp $(GENCODEDIR)/misc.py : misc.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/misc2.cpp $(GENCODEDIR)/misc2.py : misc2.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/gdi.cpp $(GENCODEDIR)/gdi.py : gdi.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/mdi.cpp $(GENCODEDIR)/mdi.py : mdi.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/controls.cpp $(GENCODEDIR)/controls.py : controls.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/controls2.cpp $(GENCODEDIR)/controls2.py : controls2.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/cmndlgs.cpp $(GENCODEDIR)/cmndlgs.py : cmndlgs.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/frames.cpp $(GENCODEDIR)/frames.py : frames.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/stattool.cpp $(GENCODEDIR)/stattool.py : stattool.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/image.cpp $(GENCODEDIR)/image.py : image.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/utils.cpp $(GENCODEDIR)/utils.py : utils.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/printfw.cpp $(GENCODEDIR)/printfw.py : printfw.i my_typemaps.i _defs.i
|
||||
$(GENCODEDIR)/glcanvas.cpp $(GENCODEDIR)/glcanvas.py : glcanvas.i my_typemaps.i _defs.i
|
||||
|
||||
$(GENCODEDIR)/helpers.cpp:
|
||||
ln -s `pwd`/helpers.cpp $@
|
||||
|
||||
$(GENCODEDIR)/_glcanvas.cpp:
|
||||
-cp $(WXWIN)/utils/glcanvas/$(GENCODEDIR)/glcanvas.cpp $@
|
||||
-cp $(WXWIN)/utils/glcanvas/$(GENCODEDIR)/glcanvas.h ./glcanvas.h
|
||||
|
||||
|
||||
wxInstall : sharedmods $(PYMODULES)
|
||||
if test ! -d $(TARGETDIR) ; then \
|
||||
mkdir $(TARGETDIR) ; else true ; fi
|
||||
if [ "$(SHAREDMODS)" != "" ]; then \
|
||||
chmod 755 $(SHAREDMODS); \
|
||||
cp $(SHAREDMODS) $(TARGETDIR); fi
|
||||
-for i in $(PYMODULES); do \
|
||||
cp $$i $(TARGETDIR); \
|
||||
done
|
||||
if [ "$(TARGETDIR)" != ".." ]; then \
|
||||
mkdir $(TARGETDIR)/lib; \
|
||||
mkdir $(TARGETDIR)/lib/sizers; \
|
||||
mkdir $(TARGETDIR)/demo; \
|
||||
mkdir $(TARGETDIR)/demo/bitmaps; \
|
||||
cp ../lib/*.py $(TARGETDIR)/lib; \
|
||||
cp ../lib/sizers/*.py $(TARGETDIR)/lib/sizers; \
|
||||
cp ../demo/*.py $(TARGETDIR)/demo; \
|
||||
cp ../lib/*.txt $(TARGETDIR)/lib; \
|
||||
cp ../lib/sizers/*.txt $(TARGETDIR)/lib/sizers; \
|
||||
cp ../demo/*.txt $(TARGETDIR)/demo; \
|
||||
cp ../demo/bitmaps/[a-z]* $(TARGETDIR)/demo/bitmaps; \
|
||||
fi
|
||||
if [ "$(TARGETDIR)" != ".." ]; then \
|
||||
python $(LIBDEST)/compileall.py $(TARGETDIR); \
|
||||
python -O $(LIBDEST)/compileall.py $(TARGETDIR); \
|
||||
else \
|
||||
python $(LIBDEST)/compileall.py -l $(TARGETDIR); \
|
||||
python -O $(LIBDEST)/compileall.py -l $(TARGETDIR);\
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
lib : libwxPython.a
|
||||
|
||||
libwxPython.a : lib.a
|
||||
cp $< $@
|
||||
|
||||
dist: tgz rpm
|
||||
|
||||
tgz:
|
||||
cd ../..; wxPython/distrib/maketgz $(WXP_VERSION)
|
||||
|
||||
rpm:
|
||||
cd ../distrib; ./makerpm $(WXP_VERSION)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user