Temporary fork of candidate base of potententially very useful development tool for ros.

svn path=/trunk/; revision=3955
This commit is contained in:
Robert Dickenson 2003-01-07 17:59:20 +00:00
parent b8573aace5
commit d73cc06799
25 changed files with 11747 additions and 0 deletions

View file

@ -0,0 +1,6 @@
*.o
*.sym
*.coff
*.exe
*.ini
*.bat

View file

@ -0,0 +1,328 @@
/********************************************************************
* Class: CList.cpp. This is part of WinUI.
*
* Purpose: A simple way to create doubly linked lists.
*
* Authors: Originally coded by Claude Catonio.
*
* License: Original code was public domain.
* Present revised CList classes are covered by GNU General Public License.
*
* Revisions:
* Manu B. 10/05/01 Terms was translated to English.
* Manu B. 10/16/01 Add CList::Destroy(CNode *node) method.
* Manu B. 11/12/01 Add InsertBefore/InsertAfter methods.
* Manu B. 11/17/01 First() & Last() now returns an integer value.
* Manu B. 11/19/01 CNode::Destroy() returns next node by default.
* Manu B. 12/28/01 Simplify CList, add InsertSorted().
* Manu B. 03/13/02 Suppress CNode methods, next and prev are public.
* Manu B. 03/28/02 Add Compare().
*
********************************************************************/
#include "CList.h"
/********************************************************************
* Class: CList.
*
* Purpose: List management.
*
* Revisions:
*
********************************************************************/
CList::~CList(){
//MessageBox (0, "CList", "destructor", MB_OK);
while (first != NULL){
current = first;
first = first->next;
delete current;
}
current = last = first;
count = 0;
}
/********************************************************************
* Browse the list.
********************************************************************/
CNode * CList::First(){
current = first;
return current;
}
CNode * CList::Last(){
current = last;
return current;
}
CNode * CList::Prev(){
// Empty list ?
if (first != NULL){
if(current->prev == NULL){
// No previous node.
return NULL;
}else{
// A previous one.
current = current->prev;
return current;
}
}
return NULL;
}
CNode * CList::Next(){
// Empty list ?
if (first != NULL){
if(current->next == NULL){
// No next node.
return NULL;
}else{
// A next one.
current = current->next;
return current;
}
}
return NULL;
}
/********************************************************************
* Insert nodes.
********************************************************************/
void CList::InsertFirst(CNode *node){
if(first == NULL){
// Empty list.
first = last = node;
}else{
// Set node pointers.
node->prev = NULL;
node->next = first;
// Insert in the list.
first->prev = node;
first = node;
}
// Set current node, increment the node counter.
current = node;
count++;
}
void CList::InsertLast(CNode *node){
if(first == NULL){
// Empty list.
first = last = node;
}else{
// Set node pointers.
node->prev = last;
node->next = NULL;
// Insert in the list.
last->next = node;
last = node;
}
// Set current node, increment the node counter.
current = node;
count++;
}
void CList::InsertBefore(CNode *node){
if(first == NULL){
// Empty list.
first = last = node;
}else{
if (current == first)
first = node;
// Set node pointers.
node->prev = current->prev;
node->next = current;
// Insert in the list.
if (node->prev)
node->prev->next = node;
current->prev = node;
}
// Set current node, increment the node counter.
current = node;
count++;
}
void CList::InsertAfter(CNode *node){
if(first == NULL){
// Empty list.
first = last = node;
}else{
if (current == last)
last = node;
// Set node pointers.
node->prev = current;
node->next = current->next;
// Insert in the list.
if (node->next)
node->next->prev = node;
current->next = node;
}
// Set current node, increment the node counter.
current = node;
count++;
}
bool CList::InsertSorted(CNode * newNode){
// Get the current node.
CNode * currentNode = GetCurrent();
int cmpResult;
if(!currentNode){
// The list is empty, InsertFirst() and return.
InsertFirst(newNode);
return true;
}
// Compare new node and current node data to know if we must parse Up
// or Down from current node.
cmpResult = Compare(newNode, currentNode);
// Search Up -----------------------------------------------------------------
if (cmpResult == -1){
// Parse the list while there's a previous node.
while (Prev()){
currentNode = GetCurrent();
cmpResult = Compare(newNode, currentNode);
if (cmpResult == 1){
// Correct position found.
InsertAfter(newNode);
return true;
}else if (cmpResult == 0){
// Don't add a file twice.
return false;
}
}
// There's no previous node, so insert first.
InsertFirst(newNode);
return true;
}
// Search Down --------------------------------------------------------------
else if (cmpResult == 1){
// Parse the list while there's a next node.
while (Next()){
currentNode = GetCurrent();
cmpResult = Compare(newNode, currentNode);
if (cmpResult == -1){
// Correct position found.
InsertBefore(newNode);
return true;
}else if (cmpResult == 0){
// Don't add a file twice.
return false;
}
}
// There's no next node, so insert last.
InsertLast(newNode);
return true;
}
// Don't add a file twice (cmpResult == 0) -------------------------------------
return false;
}
int CList::InsertSorted_New(CNode * newNode){
int cmpResult;
/* Get the current node */
CNode * currentNode = GetCurrent();
if(!currentNode)
return EMPTY_LIST;
/* Parse up or down ? */
cmpResult = Compare(newNode, currentNode);
/* -Up- */
if (cmpResult == -1){
// Parse the list while there's a previous node.
while (Prev()){
currentNode = GetCurrent();
cmpResult = Compare(newNode, currentNode);
if (cmpResult == 1){
// Correct position found.
return INSERT_AFTER;
}else if (cmpResult == 0){
// Don't add a file twice.
return FILE_FOUND;
}
}
// There's no previous node, so insert first.
return INSERT_FIRST;
/* -Down- */
}else if (cmpResult == 1){
// Parse the list while there's a next node.
while (Next()){
currentNode = GetCurrent();
cmpResult = Compare(newNode, currentNode);
if (cmpResult == -1){
// Correct position found.
return INSERT_BEFORE;
}else if (cmpResult == 0){
// Don't add a file twice.
return FILE_FOUND;
}
}
// There's no next node, so insert last.
return INSERT_LAST;
}
// Don't add a file twice (cmpResult == 0) -------------------------------------
return FILE_FOUND;
}
/********************************************************************
* Destroy nodes.
********************************************************************/
void CList::DestroyCurrent(){
// CNode * node = current;
Destroy(current);
}
void CList::Destroy(CNode * node){
// Empty list ?
if (current != NULL){
// Detach node from the list.
if (node->next != NULL)
node->next->prev = node->prev;
if (node->prev != NULL)
node->prev->next = node->next;
// Set current node.
if(node->next != NULL)
current = node->next;
else
current = node->prev;
if (current == NULL){
// Now, the list is empty.
first = last = NULL;
}else if (first == node){
// Detached node was first.
first = current;
}else if (last == node){
// Detached node was last.
last = current;
}
delete node;
count--;
}
}
void CList::DestroyList(){
while (first != NULL){
current = first;
first = first->next;
delete current;
}
current = last = first;
count = 0;
}
int CList::Length(){
return count;
}

View file

@ -0,0 +1,79 @@
/********************************************************************
* Module: CList.h. This is part of WinUI.
*
* License: WinUI is covered by GNU General Public License,
* Copyright (C) 2001 Manu B.
* See license.htm for more details.
*
********************************************************************/
#ifndef CLIST_H
#define CLIST_H
#include <stdlib.h>
/********************************************************************
* Generic CNode.
********************************************************************/
class CNode
{
public:
CNode() {next = prev = NULL; /*type = 0;*/};
virtual ~CNode() {};
CNode * prev;
CNode * next;
long type;
protected:
private:
};
/********************************************************************
* Generic List.
********************************************************************/
#define FILE_FOUND 0
#define EMPTY_LIST 1
#define INSERT_FIRST 2
#define INSERT_LAST 3
#define INSERT_BEFORE 4
#define INSERT_AFTER 5
class CList
{
public:
CList() {first = last = current = NULL; count = 0;};
virtual ~CList();
CNode * GetCurrent() {return current;};
CNode * First();
CNode * Last();
CNode * Prev();
CNode * Next();
void InsertFirst(CNode *node);
void InsertLast(CNode *node);
void InsertBefore(CNode *node);
void InsertAfter(CNode *node);
bool InsertSorted(CNode * newNode);
int InsertSorted_New(CNode * newNode);
void DestroyCurrent();
void Destroy(CNode * node);
void DestroyList();
int Length();
protected:
virtual int Compare(CNode *, CNode *) {return 0;};
CNode *first;
CNode *last;
CNode *current;
int count;
private:
};
#endif

View file

@ -0,0 +1,340 @@
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
Appendix: 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.

View file

@ -0,0 +1,29 @@
# $Id: Makefile.ros,v 1.1 2003/01/07 17:59:20 robd Exp $
#
PATH_TO_TOP = ../../../reactos
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = vmingw
TARGET_CFLAGS = -D_WIN32_IE=0x0400
TARGET_SDKLIBS = user32.a comctl32.a ole32.a
TARGET_OBJECTS = \
CList.o\
editor.o\
main.o\
process.o\
project.o\
rsrc.o\
winui.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

Binary file not shown.

View file

@ -0,0 +1,300 @@
// Scintilla source code edit control
/** @file SciLexer.h
** Interface to the added lexer functions in the SciLexer version of the edit control.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Most of this file is automatically generated from the Scintilla.iface interface definition
// file which contains any comments about the definitions. HFacer.py does the generation.
#ifndef SCILEXER_H
#define SCILEXER_H
// SciLexer features - not in standard Scintilla
//++Autogenerated -- start of section automatically generated from Scintilla.iface
#define SCLEX_CONTAINER 0
#define SCLEX_NULL 1
#define SCLEX_PYTHON 2
#define SCLEX_CPP 3
#define SCLEX_HTML 4
#define SCLEX_XML 5
#define SCLEX_PERL 6
#define SCLEX_SQL 7
#define SCLEX_VB 8
#define SCLEX_PROPERTIES 9
#define SCLEX_ERRORLIST 10
#define SCLEX_MAKEFILE 11
#define SCLEX_BATCH 12
#define SCLEX_XCODE 13
#define SCLEX_LATEX 14
#define SCLEX_LUA 15
#define SCLEX_DIFF 16
#define SCLEX_CONF 17
#define SCLEX_PASCAL 18
#define SCLEX_AVE 19
#define SCLEX_ADA 20
#define SCLEX_LISP 21
#define SCLEX_RUBY 22
#define SCLEX_EIFFEL 23
#define SCLEX_EIFFELKW 24
#define SCLEX_TCL 25
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_P_NUMBER 2
#define SCE_P_STRING 3
#define SCE_P_CHARACTER 4
#define SCE_P_WORD 5
#define SCE_P_TRIPLE 6
#define SCE_P_TRIPLEDOUBLE 7
#define SCE_P_CLASSNAME 8
#define SCE_P_DEFNAME 9
#define SCE_P_OPERATOR 10
#define SCE_P_IDENTIFIER 11
#define SCE_P_COMMENTBLOCK 12
#define SCE_P_STRINGEOL 13
#define SCE_C_DEFAULT 0
#define SCE_C_COMMENT 1
#define SCE_C_COMMENTLINE 2
#define SCE_C_COMMENTDOC 3
#define SCE_C_NUMBER 4
#define SCE_C_WORD 5
#define SCE_C_STRING 6
#define SCE_C_CHARACTER 7
#define SCE_C_UUID 8
#define SCE_C_PREPROCESSOR 9
#define SCE_C_OPERATOR 10
#define SCE_C_IDENTIFIER 11
#define SCE_C_STRINGEOL 12
#define SCE_C_VERBATIM 13
#define SCE_C_REGEX 14
#define SCE_C_COMMENTLINEDOC 15
#define SCE_C_WORD2 16
#define SCE_H_DEFAULT 0
#define SCE_H_TAG 1
#define SCE_H_TAGUNKNOWN 2
#define SCE_H_ATTRIBUTE 3
#define SCE_H_ATTRIBUTEUNKNOWN 4
#define SCE_H_NUMBER 5
#define SCE_H_DOUBLESTRING 6
#define SCE_H_SINGLESTRING 7
#define SCE_H_OTHER 8
#define SCE_H_COMMENT 9
#define SCE_H_ENTITY 10
#define SCE_H_TAGEND 11
#define SCE_H_XMLSTART 12
#define SCE_H_XMLEND 13
#define SCE_H_SCRIPT 14
#define SCE_H_ASP 15
#define SCE_H_ASPAT 16
#define SCE_H_CDATA 17
#define SCE_H_QUESTION 18
#define SCE_H_VALUE 19
#define SCE_H_XCCOMMENT 20
#define SCE_H_SGML 21
#define SCE_HJ_START 40
#define SCE_HJ_DEFAULT 41
#define SCE_HJ_COMMENT 42
#define SCE_HJ_COMMENTLINE 43
#define SCE_HJ_COMMENTDOC 44
#define SCE_HJ_NUMBER 45
#define SCE_HJ_WORD 46
#define SCE_HJ_KEYWORD 47
#define SCE_HJ_DOUBLESTRING 48
#define SCE_HJ_SINGLESTRING 49
#define SCE_HJ_SYMBOLS 50
#define SCE_HJ_STRINGEOL 51
#define SCE_HJ_REGEX 52
#define SCE_HJA_START 55
#define SCE_HJA_DEFAULT 56
#define SCE_HJA_COMMENT 57
#define SCE_HJA_COMMENTLINE 58
#define SCE_HJA_COMMENTDOC 59
#define SCE_HJA_NUMBER 60
#define SCE_HJA_WORD 61
#define SCE_HJA_KEYWORD 62
#define SCE_HJA_DOUBLESTRING 63
#define SCE_HJA_SINGLESTRING 64
#define SCE_HJA_SYMBOLS 65
#define SCE_HJA_STRINGEOL 66
#define SCE_HJA_REGEX 67
#define SCE_HB_START 70
#define SCE_HB_DEFAULT 71
#define SCE_HB_COMMENTLINE 72
#define SCE_HB_NUMBER 73
#define SCE_HB_WORD 74
#define SCE_HB_STRING 75
#define SCE_HB_IDENTIFIER 76
#define SCE_HB_STRINGEOL 77
#define SCE_HBA_START 80
#define SCE_HBA_DEFAULT 81
#define SCE_HBA_COMMENTLINE 82
#define SCE_HBA_NUMBER 83
#define SCE_HBA_WORD 84
#define SCE_HBA_STRING 85
#define SCE_HBA_IDENTIFIER 86
#define SCE_HBA_STRINGEOL 87
#define SCE_HP_START 90
#define SCE_HP_DEFAULT 91
#define SCE_HP_COMMENTLINE 92
#define SCE_HP_NUMBER 93
#define SCE_HP_STRING 94
#define SCE_HP_CHARACTER 95
#define SCE_HP_WORD 96
#define SCE_HP_TRIPLE 97
#define SCE_HP_TRIPLEDOUBLE 98
#define SCE_HP_CLASSNAME 99
#define SCE_HP_DEFNAME 100
#define SCE_HP_OPERATOR 101
#define SCE_HP_IDENTIFIER 102
#define SCE_HPA_START 105
#define SCE_HPA_DEFAULT 106
#define SCE_HPA_COMMENTLINE 107
#define SCE_HPA_NUMBER 108
#define SCE_HPA_STRING 109
#define SCE_HPA_CHARACTER 110
#define SCE_HPA_WORD 111
#define SCE_HPA_TRIPLE 112
#define SCE_HPA_TRIPLEDOUBLE 113
#define SCE_HPA_CLASSNAME 114
#define SCE_HPA_DEFNAME 115
#define SCE_HPA_OPERATOR 116
#define SCE_HPA_IDENTIFIER 117
#define SCE_HPHP_DEFAULT 118
#define SCE_HPHP_HSTRING 119
#define SCE_HPHP_SIMPLESTRING 120
#define SCE_HPHP_WORD 121
#define SCE_HPHP_NUMBER 122
#define SCE_HPHP_VARIABLE 123
#define SCE_HPHP_COMMENT 124
#define SCE_HPHP_COMMENTLINE 125
#define SCE_HPHP_HSTRING_VARIABLE 126
#define SCE_HPHP_OPERATOR 127
#define SCE_PL_DEFAULT 0
#define SCE_PL_ERROR 1
#define SCE_PL_COMMENTLINE 2
#define SCE_PL_POD 3
#define SCE_PL_NUMBER 4
#define SCE_PL_WORD 5
#define SCE_PL_STRING 6
#define SCE_PL_CHARACTER 7
#define SCE_PL_PUNCTUATION 8
#define SCE_PL_PREPROCESSOR 9
#define SCE_PL_OPERATOR 10
#define SCE_PL_IDENTIFIER 11
#define SCE_PL_SCALAR 12
#define SCE_PL_ARRAY 13
#define SCE_PL_HASH 14
#define SCE_PL_SYMBOLTABLE 15
#define SCE_PL_REGEX 17
#define SCE_PL_REGSUBST 18
#define SCE_PL_LONGQUOTE 19
#define SCE_PL_BACKTICKS 20
#define SCE_PL_DATASECTION 21
#define SCE_PL_HERE_DELIM 22
#define SCE_PL_HERE_Q 23
#define SCE_PL_HERE_QQ 24
#define SCE_PL_HERE_QX 25
#define SCE_PL_STRING_Q 26
#define SCE_PL_STRING_QQ 27
#define SCE_PL_STRING_QX 28
#define SCE_PL_STRING_QR 29
#define SCE_PL_STRING_QW 30
#define SCE_L_DEFAULT 0
#define SCE_L_COMMAND 1
#define SCE_L_TAG 2
#define SCE_L_MATH 3
#define SCE_L_COMMENT 4
#define SCE_LUA_DEFAULT 0
#define SCE_LUA_COMMENT 1
#define SCE_LUA_COMMENTLINE 2
#define SCE_LUA_COMMENTDOC 3
#define SCE_LUA_NUMBER 4
#define SCE_LUA_WORD 5
#define SCE_LUA_STRING 6
#define SCE_LUA_CHARACTER 7
#define SCE_LUA_LITERALSTRING 8
#define SCE_LUA_PREPROCESSOR 9
#define SCE_LUA_OPERATOR 10
#define SCE_LUA_IDENTIFIER 11
#define SCE_LUA_STRINGEOL 12
#define SCE_ERR_DEFAULT 0
#define SCE_ERR_PYTHON 1
#define SCE_ERR_GCC 2
#define SCE_ERR_MS 3
#define SCE_ERR_CMD 4
#define SCE_ERR_BORLAND 5
#define SCE_ERR_PERL 6
#define SCE_ERR_NET 7
#define SCE_ERR_LUA 8
#define SCE_ERR_DIFF_CHANGED 10
#define SCE_ERR_DIFF_ADDITION 11
#define SCE_ERR_DIFF_DELETION 12
#define SCE_ERR_DIFF_MESSAGE 13
#define SCE_BAT_DEFAULT 0
#define SCE_BAT_COMMENT 1
#define SCE_BAT_WORD 2
#define SCE_BAT_LABEL 3
#define SCE_BAT_HIDE 4
#define SCE_BAT_COMMAND 5
#define SCE_BAT_IDENTIFIER 6
#define SCE_BAT_OPERATOR 7
#define SCE_MAKE_DEFAULT 0
#define SCE_MAKE_COMMENT 1
#define SCE_MAKE_PREPROCESSOR 2
#define SCE_MAKE_IDENTIFIER 3
#define SCE_MAKE_OPERATOR 4
#define SCE_MAKE_TARGET 5
#define SCE_MAKE_IDEOL 9
#define SCE_CONF_DEFAULT 0
#define SCE_CONF_COMMENT 1
#define SCE_CONF_NUMBER 2
#define SCE_CONF_IDENTIFIER 3
#define SCE_CONF_EXTENSION 4
#define SCE_CONF_PARAMETER 5
#define SCE_CONF_STRING 6
#define SCE_CONF_OPERATOR 7
#define SCE_CONF_IP 8
#define SCE_CONF_DIRECTIVE 9
#define SCE_AVE_DEFAULT 0
#define SCE_AVE_COMMENT 1
#define SCE_AVE_NUMBER 2
#define SCE_AVE_WORD 3
#define SCE_AVE_KEYWORD 4
#define SCE_AVE_STATEMENT 5
#define SCE_AVE_STRING 6
#define SCE_AVE_ENUM 7
#define SCE_AVE_STRINGEOL 8
#define SCE_AVE_IDENTIFIER 9
#define SCE_AVE_OPERATOR 10
#define SCE_ADA_DEFAULT 0
#define SCE_ADA_COMMENT 1
#define SCE_ADA_NUMBER 2
#define SCE_ADA_WORD 3
#define SCE_ADA_STRING 4
#define SCE_ADA_CHARACTER 5
#define SCE_ADA_OPERATOR 6
#define SCE_ADA_IDENTIFIER 7
#define SCE_ADA_STRINGEOL 8
#define SCE_LISP_DEFAULT 0
#define SCE_LISP_COMMENT 1
#define SCE_LISP_NUMBER 2
#define SCE_LISP_KEYWORD 3
#define SCE_LISP_STRING 6
#define SCE_LISP_STRINGEOL 8
#define SCE_LISP_IDENTIFIER 9
#define SCE_LISP_OPERATOR 10
#define SCE_EIFFEL_DEFAULT 0
#define SCE_EIFFEL_COMMENTLINE 1
#define SCE_EIFFEL_NUMBER 2
#define SCE_EIFFEL_WORD 3
#define SCE_EIFFEL_STRING 4
#define SCE_EIFFEL_CHARACTER 5
#define SCE_EIFFEL_OPERATOR 6
#define SCE_EIFFEL_IDENTIFIER 7
#define SCE_EIFFEL_STRINGEOL 8
//--Autogenerated -- end of section automatically generated from Scintilla.iface
#endif

View file

@ -0,0 +1,599 @@
// Scintilla source code edit control
/** @file Scintilla.h
** Interface to the edit control.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Most of this file is automatically generated from the Scintilla.iface interface definition
// file which contains any comments about the definitions. HFacer.py does the generation.
#ifndef SCINTILLA_H
#define SCINTILLA_H
// Compile-time configuration options
#define MACRO_SUPPORT 1 // Comment out to remove macro hooks
#if PLAT_WIN
#ifdef STATIC_BUILD
void Scintilla_RegisterClasses(HINSTANCE hInstance);
#endif
#endif
// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
// hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
// May need to be changed for 64 bit platforms.
typedef unsigned long uptr_t;
typedef long sptr_t;
typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
//++Autogenerated -- start of section automatically generated from Scintilla.iface
#define INVALID_POSITION -1
#define SCI_START 2000
#define SCI_OPTIONAL_START 3000
#define SCI_LEXER_START 4000
#define SCI_ADDTEXT 2001
#define SCI_ADDSTYLEDTEXT 2002
#define SCI_INSERTTEXT 2003
#define SCI_CLEARALL 2004
#define SCI_CLEARDOCUMENTSTYLE 2005
#define SCI_GETLENGTH 2006
#define SCI_GETCHARAT 2007
#define SCI_GETCURRENTPOS 2008
#define SCI_GETANCHOR 2009
#define SCI_GETSTYLEAT 2010
#define SCI_REDO 2011
#define SCI_SETUNDOCOLLECTION 2012
#define SCI_SELECTALL 2013
#define SCI_SETSAVEPOINT 2014
#define SCI_GETSTYLEDTEXT 2015
#define SCI_CANREDO 2016
#define SCI_MARKERLINEFROMHANDLE 2017
#define SCI_MARKERDELETEHANDLE 2018
#define SCI_GETUNDOCOLLECTION 2019
#define SCWS_INVISIBLE 0
#define SCWS_VISIBLEALWAYS 1
#define SCWS_VISIBLEAFTERINDENT 2
#define SCI_GETVIEWWS 2020
#define SCI_SETVIEWWS 2021
#define SCI_POSITIONFROMPOINT 2022
#define SCI_POSITIONFROMPOINTCLOSE 2023
#define SCI_GOTOLINE 2024
#define SCI_GOTOPOS 2025
#define SCI_SETANCHOR 2026
#define SCI_GETCURLINE 2027
#define SCI_GETENDSTYLED 2028
#define SC_EOL_CRLF 0
#define SC_EOL_CR 1
#define SC_EOL_LF 2
#define SCI_CONVERTEOLS 2029
#define SCI_GETEOLMODE 2030
#define SCI_SETEOLMODE 2031
#define SCI_STARTSTYLING 2032
#define SCI_SETSTYLING 2033
#define SCI_GETBUFFEREDDRAW 2034
#define SCI_SETBUFFEREDDRAW 2035
#define SCI_SETTABWIDTH 2036
#define SCI_GETTABWIDTH 2121
#define SC_CP_UTF8 65001
#define SCI_SETCODEPAGE 2037
#define SCI_SETUSEPALETTE 2039
#define MARKER_MAX 31
#define SC_MARK_CIRCLE 0
#define SC_MARK_ROUNDRECT 1
#define SC_MARK_ARROW 2
#define SC_MARK_SMALLRECT 3
#define SC_MARK_SHORTARROW 4
#define SC_MARK_EMPTY 5
#define SC_MARK_ARROWDOWN 6
#define SC_MARK_MINUS 7
#define SC_MARK_PLUS 8
#define SC_MARK_VLINE 9
#define SC_MARK_LCORNER 10
#define SC_MARK_TCORNER 11
#define SC_MARK_BOXPLUS 12
#define SC_MARK_BOXPLUSCONNECTED 13
#define SC_MARK_BOXMINUS 14
#define SC_MARK_BOXMINUSCONNECTED 15
#define SC_MARK_LCORNERCURVE 16
#define SC_MARK_TCORNERCURVE 17
#define SC_MARK_CIRCLEPLUS 18
#define SC_MARK_CIRCLEPLUSCONNECTED 19
#define SC_MARK_CIRCLEMINUS 20
#define SC_MARK_CIRCLEMINUSCONNECTED 21
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
#define SC_MARKNUM_FOLDERMIDTAIL 27
#define SC_MARKNUM_FOLDERTAIL 28
#define SC_MARKNUM_FOLDERSUB 29
#define SC_MARKNUM_FOLDER 30
#define SC_MARKNUM_FOLDEROPEN 31
#define SCI_MARKERDEFINE 2040
#define SCI_MARKERSETFORE 2041
#define SCI_MARKERSETBACK 2042
#define SCI_MARKERADD 2043
#define SCI_MARKERDELETE 2044
#define SCI_MARKERDELETEALL 2045
#define SCI_MARKERGET 2046
#define SCI_MARKERNEXT 2047
#define SCI_MARKERPREVIOUS 2048
#define SC_MARGIN_SYMBOL 0
#define SC_MARGIN_NUMBER 1
#define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242
#define SCI_GETMARGINWIDTHN 2243
#define SCI_SETMARGINMASKN 2244
#define SCI_GETMARGINMASKN 2245
#define SCI_SETMARGINSENSITIVEN 2246
#define SCI_GETMARGINSENSITIVEN 2247
#define STYLE_DEFAULT 32
#define STYLE_LINENUMBER 33
#define STYLE_BRACELIGHT 34
#define STYLE_BRACEBAD 35
#define STYLE_CONTROLCHAR 36
#define STYLE_INDENTGUIDE 37
#define STYLE_MAX 127
#define SC_CHARSET_ANSI 0
#define SC_CHARSET_DEFAULT 1
#define SC_CHARSET_BALTIC 186
#define SC_CHARSET_CHINESEBIG5 136
#define SC_CHARSET_EASTEUROPE 238
#define SC_CHARSET_GB2312 134
#define SC_CHARSET_GREEK 161
#define SC_CHARSET_HANGUL 129
#define SC_CHARSET_MAC 77
#define SC_CHARSET_OEM 255
#define SC_CHARSET_RUSSIAN 204
#define SC_CHARSET_SHIFTJIS 128
#define SC_CHARSET_SYMBOL 2
#define SC_CHARSET_TURKISH 162
#define SC_CHARSET_JOHAB 130
#define SC_CHARSET_HEBREW 177
#define SC_CHARSET_ARABIC 178
#define SC_CHARSET_VIETNAMESE 163
#define SC_CHARSET_THAI 222
#define SCI_STYLECLEARALL 2050
#define SCI_STYLESETFORE 2051
#define SCI_STYLESETBACK 2052
#define SCI_STYLESETBOLD 2053
#define SCI_STYLESETITALIC 2054
#define SCI_STYLESETSIZE 2055
#define SCI_STYLESETFONT 2056
#define SCI_STYLESETEOLFILLED 2057
#define SCI_STYLERESETDEFAULT 2058
#define SCI_STYLESETUNDERLINE 2059
#define SC_CASE_MIXED 0
#define SC_CASE_UPPER 1
#define SC_CASE_LOWER 2
#define SCI_STYLESETCASE 2060
#define SCI_STYLESETCHARACTERSET 2066
#define SCI_SETSELFORE 2067
#define SCI_SETSELBACK 2068
#define SCI_SETCARETFORE 2069
#define SCI_ASSIGNCMDKEY 2070
#define SCI_CLEARCMDKEY 2071
#define SCI_CLEARALLCMDKEYS 2072
#define SCI_SETSTYLINGEX 2073
#define SCI_STYLESETVISIBLE 2074
#define SCI_GETCARETPERIOD 2075
#define SCI_SETCARETPERIOD 2076
#define SCI_SETWORDCHARS 2077
#define SCI_BEGINUNDOACTION 2078
#define SCI_ENDUNDOACTION 2079
#define INDIC_MAX 7
#define INDIC_PLAIN 0
#define INDIC_SQUIGGLE 1
#define INDIC_TT 2
#define INDIC_DIAGONAL 3
#define INDIC_STRIKE 4
#define INDIC0_MASK 32
#define INDIC1_MASK 64
#define INDIC2_MASK 128
#define INDICS_MASK INDIC0_MASK | INDIC1_MASK | INDIC2_MASK
#define SCI_INDICSETSTYLE 2080
#define SCI_INDICGETSTYLE 2081
#define SCI_INDICSETFORE 2082
#define SCI_INDICGETFORE 2083
#define SCI_SETSTYLEBITS 2090
#define SCI_GETSTYLEBITS 2091
#define SCI_SETLINESTATE 2092
#define SCI_GETLINESTATE 2093
#define SCI_GETMAXLINESTATE 2094
#define SCI_GETCARETLINEVISIBLE 2095
#define SCI_SETCARETLINEVISIBLE 2096
#define SCI_GETCARETLINEBACK 2097
#define SCI_SETCARETLINEBACK 2098
#define SCI_AUTOCSHOW 2100
#define SCI_AUTOCCANCEL 2101
#define SCI_AUTOCACTIVE 2102
#define SCI_AUTOCPOSSTART 2103
#define SCI_AUTOCCOMPLETE 2104
#define SCI_AUTOCSTOPS 2105
#define SCI_AUTOCSETSEPARATOR 2106
#define SCI_AUTOCGETSEPARATOR 2107
#define SCI_AUTOCSELECT 2108
#define SCI_AUTOCSETCANCELATSTART 2110
#define SCI_AUTOCGETCANCELATSTART 2111
#define SCI_AUTOCSETFILLUPS 2112
#define SCI_AUTOCSETCHOOSESINGLE 2113
#define SCI_AUTOCGETCHOOSESINGLE 2114
#define SCI_AUTOCSETIGNORECASE 2115
#define SCI_AUTOCGETIGNORECASE 2116
#define SCI_USERLISTSHOW 2117
#define SCI_AUTOCSETAUTOHIDE 2118
#define SCI_AUTOCGETAUTOHIDE 2119
#define SCI_SETINDENT 2122
#define SCI_GETINDENT 2123
#define SCI_SETUSETABS 2124
#define SCI_GETUSETABS 2125
#define SCI_SETLINEINDENTATION 2126
#define SCI_GETLINEINDENTATION 2127
#define SCI_GETLINEINDENTPOSITION 2128
#define SCI_GETCOLUMN 2129
#define SCI_SETHSCROLLBAR 2130
#define SCI_GETHSCROLLBAR 2131
#define SCI_SETINDENTATIONGUIDES 2132
#define SCI_GETINDENTATIONGUIDES 2133
#define SCI_SETHIGHLIGHTGUIDE 2134
#define SCI_GETHIGHLIGHTGUIDE 2135
#define SCI_GETLINEENDPOSITION 2136
#define SCI_GETCODEPAGE 2137
#define SCI_GETCARETFORE 2138
#define SCI_GETUSEPALETTE 2139
#define SCI_GETREADONLY 2140
#define SCI_SETCURRENTPOS 2141
#define SCI_SETSELECTIONSTART 2142
#define SCI_GETSELECTIONSTART 2143
#define SCI_SETSELECTIONEND 2144
#define SCI_GETSELECTIONEND 2145
#define SCI_SETPRINTMAGNIFICATION 2146
#define SCI_GETPRINTMAGNIFICATION 2147
#define SC_PRINT_NORMAL 0
#define SC_PRINT_INVERTLIGHT 1
#define SC_PRINT_BLACKONWHITE 2
#define SC_PRINT_COLOURONWHITE 3
#define SC_PRINT_COLOURONWHITEDEFAULTBG 4
#define SCI_SETPRINTCOLOURMODE 2148
#define SCI_GETPRINTCOLOURMODE 2149
#define SCFIND_WHOLEWORD 2
#define SCFIND_MATCHCASE 4
#define SCFIND_WORDSTART 0x00100000
#define SCFIND_REGEXP 0x00200000
#define SCI_FINDTEXT 2150
#define SCI_FORMATRANGE 2151
#define SCI_GETFIRSTVISIBLELINE 2152
#define SCI_GETLINE 2153
#define SCI_GETLINECOUNT 2154
#define SCI_SETMARGINLEFT 2155
#define SCI_GETMARGINLEFT 2156
#define SCI_SETMARGINRIGHT 2157
#define SCI_GETMARGINRIGHT 2158
#define SCI_GETMODIFY 2159
#define SCI_SETSEL 2160
#define SCI_GETSELTEXT 2161
#define SCI_GETTEXTRANGE 2162
#define SCI_HIDESELECTION 2163
#define SCI_POINTXFROMPOSITION 2164
#define SCI_POINTYFROMPOSITION 2165
#define SCI_LINEFROMPOSITION 2166
#define SCI_POSITIONFROMLINE 2167
#define SCI_LINESCROLL 2168
#define SCI_SCROLLCARET 2169
#define SCI_REPLACESEL 2170
#define SCI_SETREADONLY 2171
#define SCI_NULL 2172
#define SCI_CANPASTE 2173
#define SCI_CANUNDO 2174
#define SCI_EMPTYUNDOBUFFER 2175
#define SCI_UNDO 2176
#define SCI_CUT 2177
#define SCI_COPY 2178
#define SCI_PASTE 2179
#define SCI_CLEAR 2180
#define SCI_SETTEXT 2181
#define SCI_GETTEXT 2182
#define SCI_GETTEXTLENGTH 2183
#define SCI_GETDIRECTFUNCTION 2184
#define SCI_GETDIRECTPOINTER 2185
#define SCI_SETOVERTYPE 2186
#define SCI_GETOVERTYPE 2187
#define SCI_SETCARETWIDTH 2188
#define SCI_GETCARETWIDTH 2189
#define SCI_SETTARGETSTART 2190
#define SCI_GETTARGETSTART 2191
#define SCI_SETTARGETEND 2192
#define SCI_GETTARGETEND 2193
#define SCI_REPLACETARGET 2194
#define SCI_REPLACETARGETRE 2195
#define SCI_SEARCHINTARGET 2197
#define SCI_SETSEARCHFLAGS 2198
#define SCI_GETSEARCHFLAGS 2199
#define SCI_CALLTIPSHOW 2200
#define SCI_CALLTIPCANCEL 2201
#define SCI_CALLTIPACTIVE 2202
#define SCI_CALLTIPPOSSTART 2203
#define SCI_CALLTIPSETHLT 2204
#define SCI_CALLTIPSETBACK 2205
#define SCI_VISIBLEFROMDOCLINE 2220
#define SCI_DOCLINEFROMVISIBLE 2221
#define SC_FOLDLEVELBASE 0x400
#define SC_FOLDLEVELWHITEFLAG 0x1000
#define SC_FOLDLEVELHEADERFLAG 0x2000
#define SC_FOLDLEVELNUMBERMASK 0x0FFF
#define SCI_SETFOLDLEVEL 2222
#define SCI_GETFOLDLEVEL 2223
#define SCI_GETLASTCHILD 2224
#define SCI_GETFOLDPARENT 2225
#define SCI_SHOWLINES 2226
#define SCI_HIDELINES 2227
#define SCI_GETLINEVISIBLE 2228
#define SCI_SETFOLDEXPANDED 2229
#define SCI_GETFOLDEXPANDED 2230
#define SCI_TOGGLEFOLD 2231
#define SCI_ENSUREVISIBLE 2232
#define SCI_SETFOLDFLAGS 2233
#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
#define SCI_SETTABINDENTS 2260
#define SCI_GETTABINDENTS 2261
#define SCI_SETBACKSPACEUNINDENTS 2262
#define SCI_GETBACKSPACEUNINDENTS 2263
#define SC_TIME_FOREVER 10000000
#define SCI_SETMOUSEDWELLTIME 2264
#define SCI_GETMOUSEDWELLTIME 2265
#define SCI_LINEDOWN 2300
#define SCI_LINEDOWNEXTEND 2301
#define SCI_LINEUP 2302
#define SCI_LINEUPEXTEND 2303
#define SCI_CHARLEFT 2304
#define SCI_CHARLEFTEXTEND 2305
#define SCI_CHARRIGHT 2306
#define SCI_CHARRIGHTEXTEND 2307
#define SCI_WORDLEFT 2308
#define SCI_WORDLEFTEXTEND 2309
#define SCI_WORDRIGHT 2310
#define SCI_WORDRIGHTEXTEND 2311
#define SCI_HOME 2312
#define SCI_HOMEEXTEND 2313
#define SCI_LINEEND 2314
#define SCI_LINEENDEXTEND 2315
#define SCI_DOCUMENTSTART 2316
#define SCI_DOCUMENTSTARTEXTEND 2317
#define SCI_DOCUMENTEND 2318
#define SCI_DOCUMENTENDEXTEND 2319
#define SCI_PAGEUP 2320
#define SCI_PAGEUPEXTEND 2321
#define SCI_PAGEDOWN 2322
#define SCI_PAGEDOWNEXTEND 2323
#define SCI_EDITTOGGLEOVERTYPE 2324
#define SCI_CANCEL 2325
#define SCI_DELETEBACK 2326
#define SCI_TAB 2327
#define SCI_BACKTAB 2328
#define SCI_NEWLINE 2329
#define SCI_FORMFEED 2330
#define SCI_VCHOME 2331
#define SCI_VCHOMEEXTEND 2332
#define SCI_ZOOMIN 2333
#define SCI_ZOOMOUT 2334
#define SCI_DELWORDLEFT 2335
#define SCI_DELWORDRIGHT 2336
#define SCI_LINECUT 2337
#define SCI_LINEDELETE 2338
#define SCI_LINETRANSPOSE 2339
#define SCI_LOWERCASE 2340
#define SCI_UPPERCASE 2341
#define SCI_LINESCROLLDOWN 2342
#define SCI_LINESCROLLUP 2343
#define SCI_MOVECARETINSIDEVIEW 2401
#define SCI_LINELENGTH 2350
#define SCI_BRACEHIGHLIGHT 2351
#define SCI_BRACEBADLIGHT 2352
#define SCI_BRACEMATCH 2353
#define SCI_GETVIEWEOL 2355
#define SCI_SETVIEWEOL 2356
#define SCI_GETDOCPOINTER 2357
#define SCI_SETDOCPOINTER 2358
#define SCI_SETMODEVENTMASK 2359
#define EDGE_NONE 0
#define EDGE_LINE 1
#define EDGE_BACKGROUND 2
#define SCI_GETEDGECOLUMN 2360
#define SCI_SETEDGECOLUMN 2361
#define SCI_GETEDGEMODE 2362
#define SCI_SETEDGEMODE 2363
#define SCI_GETEDGECOLOUR 2364
#define SCI_SETEDGECOLOUR 2365
#define SCI_SEARCHANCHOR 2366
#define SCI_SEARCHNEXT 2367
#define SCI_SEARCHPREV 2368
#define CARET_SLOP 0x01
#define CARET_CENTER 0x02
#define CARET_STRICT 0x04
#define CARET_XEVEN 0x08
#define CARET_XJUMPS 0x10
#define SCI_SETCARETPOLICY 2369
#define SCI_LINESONSCREEN 2370
#define SCI_USEPOPUP 2371
#define SCI_SELECTIONISRECTANGLE 2372
#define SCI_SETZOOM 2373
#define SCI_GETZOOM 2374
#define SCI_CREATEDOCUMENT 2375
#define SCI_ADDREFDOCUMENT 2376
#define SCI_RELEASEDOCUMENT 2377
#define SCI_GETMODEVENTMASK 2378
#define SCI_SETFOCUS 2380
#define SCI_GETFOCUS 2381
#define SCI_SETSTATUS 2382
#define SCI_GETSTATUS 2383
#define SCI_SETMOUSEDOWNCAPTURES 2384
#define SCI_GETMOUSEDOWNCAPTURES 2385
#define SC_CURSORNORMAL -1
#define SC_CURSORWAIT 3
#define SCI_SETCURSOR 2386
#define SCI_GETCURSOR 2387
#define SCI_WORDPARTLEFT 2390
#define SCI_WORDPARTLEFTEXTEND 2391
#define SCI_WORDPARTRIGHT 2392
#define SCI_WORDPARTRIGHTEXTEND 2393
#define VISIBLE_SLOP 0x01
#define VISIBLE_STRICT 0x04
#define SCI_SETVISIBLEPOLICY 2394
#define SCI_DELLINELEFT 2395
#define SCI_DELLINERIGHT 2396
#define SCI_GRABFOCUS 2400
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
#define SCI_GETLEXER 4002
#define SCI_COLOURISE 4003
#define SCI_SETPROPERTY 4004
#define SCI_SETKEYWORDS 4005
#define SCI_SETLEXERLANGUAGE 4006
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4
#define SC_MOD_CHANGEFOLD 0x8
#define SC_PERFORMED_USER 0x10
#define SC_PERFORMED_UNDO 0x20
#define SC_PERFORMED_REDO 0x40
#define SC_LASTSTEPINUNDOREDO 0x100
#define SC_MOD_CHANGEMARKER 0x200
#define SC_MOD_BEFOREINSERT 0x400
#define SC_MOD_BEFOREDELETE 0x800
#define SC_MODEVENTMASKALL 0xF77
#define SCEN_CHANGE 768
#define SCEN_SETFOCUS 512
#define SCEN_KILLFOCUS 256
#define SCK_DOWN 300
#define SCK_UP 301
#define SCK_LEFT 302
#define SCK_RIGHT 303
#define SCK_HOME 304
#define SCK_END 305
#define SCK_PRIOR 306
#define SCK_NEXT 307
#define SCK_DELETE 308
#define SCK_INSERT 309
#define SCK_ESCAPE 7
#define SCK_BACK 8
#define SCK_TAB 9
#define SCK_RETURN 13
#define SCK_ADD 310
#define SCK_SUBTRACT 311
#define SCK_DIVIDE 312
#define SCMOD_SHIFT 1
#define SCMOD_CTRL 2
#define SCMOD_ALT 4
#define SCN_STYLENEEDED 2000
#define SCN_CHARADDED 2001
#define SCN_SAVEPOINTREACHED 2002
#define SCN_SAVEPOINTLEFT 2003
#define SCN_MODIFYATTEMPTRO 2004
#define SCN_KEY 2005
#define SCN_DOUBLECLICK 2006
#define SCN_UPDATEUI 2007
#define SCN_CHECKBRACE 2007
#define SCN_MODIFIED 2008
#define SCN_MACRORECORD 2009
#define SCN_MARGINCLICK 2010
#define SCN_NEEDSHOWN 2011
#define SCN_POSCHANGED 2012
#define SCN_PAINTED 2013
#define SCN_USERLISTSELECTION 2014
#define SCN_URIDROPPED 2015
#define SCN_DWELLSTART 2016
#define SCN_DWELLEND 2017
//--Autogenerated -- end of section automatically generated from Scintilla.iface
// Optional module for macro recording
#ifdef MACRO_SUPPORT
typedef void (tMacroRecorder)(unsigned int iMessage, unsigned long wParam,
long lParam, void *userData);
#endif
// These structures are defined to be exactly the same shape as the Win32
// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
// So older code that treats Scintilla as a RichEdit will work.
struct CharacterRange {
long cpMin;
long cpMax;
};
struct TextRange {
struct CharacterRange chrg;
char *lpstrText;
};
struct TextToFind {
struct CharacterRange chrg;
char *lpstrText;
struct CharacterRange chrgText;
};
#ifdef PLATFORM_H
// This structure is used in printing and requires some of the graphics types
// from Platform.h. Not needed by most client code.
struct RangeToFormat {
SurfaceID hdc;
SurfaceID hdcTarget;
PRectangle rc;
PRectangle rcPage;
CharacterRange chrg;
};
#endif
struct NotifyHeader {
// hwndFrom is really an environment specifc window handle or pointer
// but most clients of Scintilla.h do not have this type visible.
//WindowID hwndFrom;
void *hwndFrom;
unsigned int idFrom;
unsigned int code;
};
struct SCNotification {
struct NotifyHeader nmhdr;
int position; // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND
int ch; // SCN_CHARADDED, SCN_KEY
int modifiers; // SCN_KEY
int modificationType; // SCN_MODIFIED
const char *text; // SCN_MODIFIED
int length; // SCN_MODIFIED
int linesAdded; // SCN_MODIFIED
#ifdef MACRO_SUPPORT
int message; // SCN_MACRORECORD
uptr_t wParam; // SCN_MACRORECORD
sptr_t lParam; // SCN_MACRORECORD
#endif
int line; // SCN_MODIFIED
int foldLevelNow; // SCN_MODIFIED
int foldLevelPrev; // SCN_MODIFIED
int margin; // SCN_MARGINCLICK
int listType; // SCN_USERLISTSELECTION
int x; // SCN_DWELLSTART, SCN_DWELLEND
int y; // SCN_DWELLSTART, SCN_DWELLEND
};
#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | \
(1<<SC_MARKNUM_FOLDEROPEN) | \
(1<<SC_MARKNUM_FOLDERSUB) | \
(1<<SC_MARKNUM_FOLDERTAIL) | \
(1<<SC_MARKNUM_FOLDERMIDTAIL) | \
(1<<SC_MARKNUM_FOLDEROPENMID) | \
(1<<SC_MARKNUM_FOLDEREND))
// Deprecation section listing all API features that are deprecated and will
// will be removed completely in a future version.
// To enable these features define INCLUDE_DEPRECATED_FEATURES
#ifdef INCLUDE_DEPRECATED_FEATURES
#endif
#endif

View file

@ -0,0 +1,834 @@
/********************************************************************
* Module: editor.cpp. This is part of Visual-MinGW.
*
* Purpose: Procedures to manage Scintilla editor.
*
* Authors: These classes are based on SciTE release 1.39.
* http://www.scintilla.org/
* SciTE original code by Neil Hodgson.
* Present revised code by Manu B.
*
* License: Both SciTE and Scintilla are covered by
* "License for Scintilla and SciTE" agreement terms detailed in license.htm.
* Present revised code is covered by GNU General Public License.
*
* Revisions:
*
********************************************************************/
#include <windows.h>
#include <stdio.h>
#include "commctrl.h"
#include "commdlg.h"
#include "editor.h"
#include "rsrc.h"
extern CMessageBox MsgBox;
int Minimum(int a, int b);
int Maximum(int a, int b);
int Minimum(int a, int b){
if (a < b)
return a;
else
return b;
}
int Maximum(int a, int b){
if (a > b)
return a;
else
return b;
}
void EnsureRangeVisible(HWND hwndCtrl, int posStart, int posEnd, bool enforcePolicy){
int lineStart = SendMessage(hwndCtrl, SCI_LINEFROMPOSITION, Minimum(posStart, posEnd), 0);
int lineEnd = SendMessage(hwndCtrl, SCI_LINEFROMPOSITION, Maximum(posStart, posEnd), 0);
for (int line = lineStart; line <= lineEnd; line++){
SendMessage(hwndCtrl,
enforcePolicy ? SCI_ENSUREVISIBLEENFORCEPOLICY : SCI_ENSUREVISIBLE, line, 0);
}
}
int LengthDocument(HWND hwndCtrl){
return SendMessage(hwndCtrl, SCI_GETLENGTH, 0, 0);
}
CharacterRange GetSelection(HWND hwndCtrl){
CharacterRange crange;
crange.cpMin = SendMessage(hwndCtrl, SCI_GETSELECTIONSTART, 0, 0);
crange.cpMax = SendMessage(hwndCtrl, SCI_GETSELECTIONEND, 0, 0);
return crange;
}
/********************************************************************
* Class: CChooseFontDlg.
*
* Purpose:
*
* Revisions:
*
********************************************************************/
CChooseFontDlg::CChooseFontDlg(){
ZeroMemory(&lf, sizeof(LOGFONT));
/* lf.lfHeight;
lf.lfWidth;
lf.lfEscapement;
lf.lfOrientation;
lf.lfWeight;
lf.lfItalic;
lf.lfUnderline;
lf.lfStrikeOut;
lf.lfCharSet;
lf.lfOutPrecision;
lf.lfClipPrecision;
lf.lfQuality;
lf.lfPitchAndFamily;
lf.lfFaceName[LF_FACESIZE];*/
cf.lStructSize = sizeof(CHOOSEFONT);
cf.hwndOwner = 0;
cf.hDC = NULL;
cf.lpLogFont = &lf;//&(Profile.LogFont);
cf.iPointSize = 0;
cf.Flags = /*CF_INITTOLOGFONTSTRUCT
|*/ CF_SCREENFONTS | CF_EFFECTS
/*| CF_ENABLEHOOK*/;
cf.rgbColors = 0;//Profile.rgbForeColor;
cf.lCustData = 0;
cf.lpfnHook = NULL;
cf.lpTemplateName = NULL;
cf.hInstance = NULL;
cf.lpszStyle = NULL;
cf.nFontType = SCREEN_FONTTYPE;
cf.nSizeMin = 0;
cf.nSizeMax = 0;
}
CChooseFontDlg::~CChooseFontDlg(){
}
bool CChooseFontDlg::Create(CWindow * pWindow){
cf.hwndOwner = pWindow->_hWnd;
return ChooseFont(&cf);
}
/*bool ChooseNewFont(HWND hWndListBox){
static CHOOSEFONT cf;
static BOOL bFirstTime = TRUE;
HFONT hFont;
if(bFirstTime){
bFirstTime = false;
}
if(ChooseFont(&cf)){
HDC hDC;
hFont = CreateFontIndirect( &(Profile.LogFont) );
hDC = GetDC( hWndListBox );
SelectObject( hDC, hFont );
Profile.rgbForeColor = cf.rgbColors;
InvalidateRect( hWndListBox, NULL, TRUE );
SendMessage( hWndListBox, WM_CTLCOLORLISTBOX, (DWORD) hDC, (LONG) hWndListBox );
SendMessage( hWndListBox, WM_SETFONT, (DWORD) hFont, TRUE );
ReleaseDC( hWndListBox, hDC );
}
return true;
}*/
/********************************************************************
* Class: CFindReplaceDlg.
*
* Purpose:
*
* Revisions:
*
********************************************************************/
CFindReplaceDlg::CFindReplaceDlg(){
pEditor = NULL;
hEditor = 0;
resId = 0;
*findWhat = '\0';
*replaceWhat = '\0';
bWholeWord = false;
bMatchCase = true;
bRegExp = false;
bWrapFind = false;
bUnSlash = false;
bReverseFind = false;
bHavefound = false;
}
CFindReplaceDlg::~CFindReplaceDlg(){
}
HWND CFindReplaceDlg::Find(CScintilla * pEditor){
if (_hWnd || !pEditor)
return 0;
return CreateParam(pEditor, IDD_FIND, (long) IDD_FIND);
}
HWND CFindReplaceDlg::Replace(CScintilla * pEditor){
if (_hWnd || !pEditor)
return 0;
return CreateParam(pEditor, IDD_REPLACE, (long) IDD_REPLACE);
}
LRESULT CALLBACK CFindReplaceDlg::CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam){
switch(Message){
case WM_INITDIALOG:
return OnInitDialog((HWND) wParam, lParam);
case WM_COMMAND:
OnCommand(HIWORD(wParam), LOWORD(wParam), (HWND) lParam);
break;
case WM_CLOSE:
EndDlg(0);
break;
}
return FALSE;
}
BOOL CFindReplaceDlg::OnInitDialog(HWND, LPARAM lInitParam){
// Set pointers.
pEditor = (CEditor *) _pParent;
if (pEditor == NULL)
return TRUE;
hEditor = pEditor->_hWnd;
resId = lInitParam;
hFindWhat = GetItem(IDC_FINDWHAT);
hWholeWord = GetItem(IDC_WHOLEWORD);
hMatchCase = GetItem(IDC_MATCHCASE);
hRegExp = GetItem(IDC_REGEXP);
hWrap = GetItem(IDC_WRAP);
hUnSlash = GetItem(IDC_UNSLASH);
if (resId == IDD_FIND)
return Find_OnInitDialog();
else if (resId == IDD_REPLACE)
return Replace_OnInitDialog();
return FALSE;
}
BOOL CFindReplaceDlg::Find_OnInitDialog(void){
hUp = GetItem(IDC_DIRECTIONUP);
hDown = GetItem(IDC_DIRECTIONDOWN);
SetItemText(hFindWhat, findWhat);
//FillComboFromMemory(wFindWhat, memFinds);
if (bWholeWord)
::SendMessage(hWholeWord, BM_SETCHECK, BST_CHECKED, 0);
if (bMatchCase)
::SendMessage(hMatchCase, BM_SETCHECK, BST_CHECKED, 0);
if (bRegExp)
::SendMessage(hRegExp, BM_SETCHECK, BST_CHECKED, 0);
if (bWrapFind)
::SendMessage(hWrap, BM_SETCHECK, BST_CHECKED, 0);
if (bUnSlash)
::SendMessage(hUnSlash, BM_SETCHECK, BST_CHECKED, 0);
if (bReverseFind) {
::SendMessage(hUp, BM_SETCHECK, BST_CHECKED, 0);
} else {
::SendMessage(hDown, BM_SETCHECK, BST_CHECKED, 0);
}
return TRUE;
}
BOOL CFindReplaceDlg::Replace_OnInitDialog(void){
SetItemText(hFindWhat, findWhat);
//FillComboFromMemory(wFindWhat, sci->memFinds);
hReplaceWith = GetItem(IDC_REPLACEWITH);
SetItemText(hReplaceWith, replaceWhat);
//FillComboFromMemory(wReplaceWith, sci->memReplaces);
if (bWholeWord)
::SendMessage(hWholeWord, BM_SETCHECK, BST_CHECKED, 0);
if (bMatchCase)
::SendMessage(hMatchCase, BM_SETCHECK, BST_CHECKED, 0);
if (bRegExp)
::SendMessage(hRegExp, BM_SETCHECK, BST_CHECKED, 0);
if (bWrapFind)
::SendMessage(hWrap, BM_SETCHECK, BST_CHECKED, 0);
if (bUnSlash)
::SendMessage(hUnSlash, BM_SETCHECK, BST_CHECKED, 0);
if ((findWhat) != '\0'){
::SetFocus(hReplaceWith);
return FALSE;
}
return TRUE;
}
BOOL CFindReplaceDlg::OnCommand(WORD, WORD wID, HWND){
if (resId == IDD_FIND)
return Find_OnCommand(wID);
else if (resId == IDD_REPLACE)
return Replace_OnCommand(wID);
return FALSE;
}
BOOL CFindReplaceDlg::Find_OnCommand(WORD wID){
switch (wID){
case IDOK:
char s[200];
GetItemText(hFindWhat, s, sizeof(s));
strcpy(findWhat, s);
//memFinds.Insert(s);
bWholeWord = BST_CHECKED ==
::SendMessage(hWholeWord, BM_GETCHECK, 0, 0);
bMatchCase = BST_CHECKED ==
::SendMessage(hMatchCase, BM_GETCHECK, 0, 0);
bRegExp = BST_CHECKED ==
::SendMessage(hRegExp, BM_GETCHECK, 0, 0);
bWrapFind = BST_CHECKED ==
::SendMessage(hWrap, BM_GETCHECK, 0, 0);
bUnSlash = BST_CHECKED ==
::SendMessage(hUnSlash, BM_GETCHECK, 0, 0);
bReverseFind = BST_CHECKED ==
::SendMessage(hUp, BM_GETCHECK, 0, 0);
FindNext(bReverseFind, true);
return TRUE;
case IDCANCEL:
EndDlg(IDCANCEL);
return FALSE;
}
return FALSE;
}
BOOL CFindReplaceDlg::Replace_OnCommand(WORD wID){
if (wID == IDCANCEL){
EndDlg(IDCANCEL);
return FALSE;
}else{
return HandleReplaceCommand(wID);
}
return FALSE;
}
void CFindReplaceDlg::FindNext(bool reverseDirection, bool showWarnings){
if (!hEditor){
MsgBox.DisplayWarning("Can't get editor handle");
return;
}
if (!findWhat[0]) { // nothing to found
//Find(hEditor);
return;
}
char findTarget[FR_MAX_LEN + 1];
strcpy(findTarget, findWhat);
// for C conversions -> int lenFind = UnSlashAsNeeded(findTarget, unSlash, regExp);
int lenFind = strlen(findTarget); // normal return of UnSlashAsNeeded
if (lenFind == 0)
return;
CharacterRange cr = GetSelection(hEditor);
int startPosition = cr.cpMax;
int endPosition = LengthDocument(hEditor);
if (reverseDirection){
startPosition = cr.cpMin - 1;
endPosition = 0;
}
int flags = (bWholeWord ? SCFIND_WHOLEWORD : 0) |
(bMatchCase ? SCFIND_MATCHCASE : 0) |
(bRegExp ? SCFIND_REGEXP : 0);
::SendMessage(hEditor, SCI_SETTARGETSTART, startPosition, 0);
::SendMessage(hEditor, SCI_SETTARGETEND, endPosition, 0);
::SendMessage(hEditor, SCI_SETSEARCHFLAGS, flags, 0);
int posFind = ::SendMessage(hEditor, SCI_SEARCHINTARGET, lenFind, (LPARAM) findTarget);
if (posFind == -1 && bWrapFind){ // not found with wrapFind
// Failed to find in indicated direction
// so search from the beginning (forward) or from the end (reverse)
// unless wrapFind is false
if (reverseDirection){
startPosition = LengthDocument(hEditor);
endPosition = 0;
} else {
startPosition = 0;
endPosition = LengthDocument(hEditor);
}
::SendMessage(hEditor, SCI_SETTARGETSTART, startPosition, 0);
::SendMessage(hEditor, SCI_SETTARGETEND, endPosition, 0);
posFind = ::SendMessage(hEditor, SCI_SEARCHINTARGET, lenFind, (LPARAM) findTarget);
}
if (posFind == -1){ // not found
bHavefound = false;
if (showWarnings){
/*warn that not found
WarnUser(warnNotFound);*/
if (strlen(findWhat) > FR_MAX_LEN)
findWhat[FR_MAX_LEN] = '\0';
char msg[FR_MAX_LEN + 50];
strcpy(msg, "Cannot find the string \"");
strcat(msg, findWhat);
strcat(msg, "\".");
if (_hWnd){
MsgBox.DisplayWarning(msg);
}else{
MessageBox(0, msg, "Message", MB_OK);
}
}
}else{ // found
bHavefound = true;
int start = ::SendMessage(hEditor, SCI_GETTARGETSTART, 0, 0);
int end = ::SendMessage(hEditor, SCI_GETTARGETEND, 0, 0);
EnsureRangeVisible(hEditor, start, end, true);
::SendMessage(hEditor, SCI_SETSEL, start, end);
}
}
BOOL CFindReplaceDlg::HandleReplaceCommand(int cmd){
if (!hEditor){
MsgBox.DisplayWarning("Can't get editor handle");
return false;
}
if ((cmd == IDOK) || (cmd == IDC_REPLACE) || (cmd == IDC_REPLACEALL) || (cmd == IDC_REPLACEINSEL)) {
GetItemText(hFindWhat, findWhat, sizeof(findWhat));
//props.Set("find.what", findWhat);
//memFinds.Insert(findWhat);
bWholeWord = BST_CHECKED ==
::SendMessage(hWholeWord, BM_GETCHECK, 0, 0);
bMatchCase = BST_CHECKED ==
::SendMessage(hMatchCase, BM_GETCHECK, 0, 0);
bRegExp = BST_CHECKED ==
::SendMessage(hRegExp, BM_GETCHECK, 0, 0);
bWrapFind = BST_CHECKED ==
::SendMessage(hWrap, BM_GETCHECK, 0, 0);
bUnSlash = BST_CHECKED ==
::SendMessage(hUnSlash, BM_GETCHECK, 0, 0);
}
if ((cmd == IDC_REPLACE) || (cmd == IDC_REPLACEALL) || (cmd == IDC_REPLACEINSEL)) {
GetItemText(hReplaceWith, replaceWhat, sizeof(replaceWhat));
//memReplaces.Insert(replaceWhat);
}
if (cmd == IDOK) {
FindNext(bReverseFind, true); // Find next
} else if (cmd == IDC_REPLACE) {
if (bHavefound){
ReplaceOnce();
} else {
CharacterRange crange = GetSelection(hEditor);
::SendMessage(hEditor, SCI_SETSEL, crange.cpMin, crange.cpMin);
FindNext(bReverseFind, true);
if (bHavefound){
ReplaceOnce();
}
}
} else if ((cmd == IDC_REPLACEALL) || (cmd == IDC_REPLACEINSEL)){
ReplaceAll(cmd == IDC_REPLACEINSEL);
}
return TRUE;
}
void CFindReplaceDlg::ReplaceOnce(void){
if (bHavefound){
char replaceTarget[FR_MAX_LEN + 1];
strcpy(replaceTarget, replaceWhat);
// for C conversions -> int replaceLen = UnSlashAsNeeded(replaceTarget, unSlash, regExp);
int replaceLen = strlen(replaceTarget); // normal return of UnSlashAsNeeded
CharacterRange cr = GetSelection(hEditor);
::SendMessage(hEditor, SCI_SETTARGETSTART, cr.cpMin, 0);
::SendMessage(hEditor, SCI_SETTARGETEND, cr.cpMax, 0);
int lenReplaced = replaceLen;
if (bRegExp)
lenReplaced = ::SendMessage(hEditor, SCI_REPLACETARGETRE, replaceLen, (LPARAM) replaceTarget);
else // Allow \0 in replacement
::SendMessage(hEditor, SCI_REPLACETARGET, replaceLen, (LPARAM) replaceTarget);
::SendMessage(hEditor, SCI_SETSEL, cr.cpMin + lenReplaced, cr.cpMin);
bHavefound = false;
}
FindNext(bReverseFind, true);
}
void CFindReplaceDlg::ReplaceAll(bool inSelection){
char findTarget[FR_MAX_LEN + 1];
strcpy(findTarget, findWhat);
// for C conversions -> int findLen = UnSlashAsNeeded(findTarget, unSlash, regExp);
int findLen = strlen(findTarget); // normal return of UnSlashAsNeeded
if (findLen == 0) {
MessageBox(_hWnd, "Find string for \"Replace All\" must not be empty.", "Message", MB_OK | MB_ICONWARNING);
return;
}
CharacterRange cr = GetSelection(hEditor);
int startPosition = cr.cpMin;
int endPosition = cr.cpMax;
if (inSelection) {
if (startPosition == endPosition) {
MessageBox(_hWnd, "Selection for \"Replace in Selection\" must not be empty.", "Message", MB_OK | MB_ICONWARNING);
return;
}
} else {
endPosition = LengthDocument(hEditor);
if (bWrapFind) {
// Whole document
startPosition = 0;
}
// If not wrapFind, replace all only from caret to end of document
}
char replaceTarget[FR_MAX_LEN + 1];
strcpy(replaceTarget, replaceWhat);
// for C conversions -> int replaceLen = UnSlashAsNeeded(replaceTarget, unSlash, regExp);
int replaceLen = strlen(replaceTarget); // normal return of UnSlashAsNeeded
int flags = (bWholeWord ? SCFIND_WHOLEWORD : 0) |
(bMatchCase ? SCFIND_MATCHCASE : 0) |
(bRegExp ? SCFIND_REGEXP : 0);
::SendMessage(hEditor, SCI_SETTARGETSTART, startPosition, 0);
::SendMessage(hEditor, SCI_SETTARGETEND, endPosition, 0);
::SendMessage(hEditor, SCI_SETSEARCHFLAGS, flags, 0);
int posFind = ::SendMessage(hEditor, SCI_SEARCHINTARGET, findLen, (LPARAM) findTarget);
if ((findLen == 1) && bRegExp && (findTarget[0] == '^')) {
// Special case for replace all start of line so it hits the first line
posFind = startPosition;
::SendMessage(hEditor, SCI_SETTARGETSTART, startPosition, 0);
::SendMessage(hEditor, SCI_SETTARGETEND, startPosition, 0);
}
if ((posFind != -1) && (posFind <= endPosition)) {
int lastMatch = posFind;
::SendMessage(hEditor, SCI_BEGINUNDOACTION, 0, 0);
while (posFind != -1) {
int lenTarget = ::SendMessage(hEditor, SCI_GETTARGETEND, 0, 0) - ::SendMessage(hEditor, SCI_GETTARGETSTART, 0, 0);
int lenReplaced = replaceLen;
if (bRegExp)
lenReplaced = ::SendMessage(hEditor, SCI_REPLACETARGETRE, replaceLen, (LPARAM) replaceTarget);
else
::SendMessage(hEditor, SCI_REPLACETARGET, replaceLen, (LPARAM) replaceTarget);
// Modify for change caused by replacement
endPosition += lenReplaced - lenTarget;
lastMatch = posFind + lenReplaced;
// For the special cases of start of line and end of line
// Something better could be done but there are too many special cases
if (lenTarget <= 0)
lastMatch++;
::SendMessage(hEditor, SCI_SETTARGETSTART, lastMatch, 0);
::SendMessage(hEditor, SCI_SETTARGETEND, endPosition, 0);
posFind = ::SendMessage(hEditor, SCI_SEARCHINTARGET, findLen, (LPARAM) findTarget);
}
if (inSelection)
::SendMessage(hEditor, SCI_SETSEL, startPosition, endPosition);
else
::SendMessage(hEditor, SCI_SETSEL, lastMatch, lastMatch);
::SendMessage(hEditor, SCI_ENDUNDOACTION, 0, 0);
} else {
if (strlen(findWhat) > FR_MAX_LEN)
findWhat[FR_MAX_LEN] = '\0';
char msg[FR_MAX_LEN + 50];
strcpy(msg, "No replacements because string \"");
strcat(msg, findWhat);
strcat(msg, "\" was not present.");
MessageBox(_hWnd, msg, "Message", MB_OK | MB_ICONWARNING);
}
}
/********************************************************************
* Class: CEditor.
*
* Purpose:
*
* Revisions:
*
********************************************************************/
CEditor::CEditor(){
caretPos = 1;
}
CEditor::~CEditor(){
}
void CEditor::LoadFile(CFileItem * file){
if (!file || !_hWnd)
return;
if (file->nFileOffset == 0)
return; // Untitled file.
SetLexer(file->type);
::SendMessage(_hWnd, SCI_CANCEL, 0, 0);
::SendMessage(_hWnd, SCI_SETUNDOCOLLECTION, 0, 0);
FILE *fp = fopen(file->szFileName, "rb");
if (fp){
char data[blockSize];
int lenFile = fread(data, 1, sizeof(data), fp);
while (lenFile > 0){
::SendMessage(_hWnd, SCI_ADDTEXT, lenFile, (LPARAM) data);
lenFile = fread(data, 1, sizeof(data), fp);
}
fclose(fp);
}else{
MsgBox.DisplayWarning("Can't load file %s", file->szFileName);
}
::SendMessage(_hWnd, SCI_SETUNDOCOLLECTION, 1, 0);
::SendMessage(_hWnd, EM_EMPTYUNDOBUFFER, 0, 0);
::SendMessage(_hWnd, SCI_SETSAVEPOINT, 0 , 0);
::SendMessage(_hWnd, SCI_GOTOPOS, 0, 0);
}
void GetFileType(CFileItem * file){
if (!file)
return;
if (file->nFileExtension){
char * ext = file->szFileName + file->nFileExtension;
// H_FILE ?
if (!stricmp(ext, "h")){
file->type = H_FILE;
return;
}else if (!stricmp(ext, "hpp")){
file->type = H_FILE;
return;
}else if (!stricmp(ext, "hxx")){
file->type = H_FILE;
return;
// C_FILE ?
}else if (!stricmp(ext, "c")){
file->type = C_FILE;
return;
}else if (!stricmp(ext, "cpp")){
file->type = C_FILE;
return;
}else if (!stricmp(ext, "cxx")){
file->type = C_FILE;
return;
// RC_FILE ?
}else if (!stricmp(ext, "rc")){
file->type = RC_FILE;
return;
}
}
file->type = U_FILE;
return;
}
void CEditor::SaveFile(char * fullPath){
if (!_hWnd)
return;
FILE *fp = fopen(fullPath, "wb");
if (fp){
char data[blockSize + 1];
int lengthDoc = ::SendMessage(_hWnd, SCI_GETLENGTH, 0, 0);
for (int i = 0; i < lengthDoc; i += blockSize) {
int grabSize = lengthDoc - i;
if (grabSize > blockSize)
grabSize = blockSize;
GetRange(i, i + grabSize, data);
fwrite(data, grabSize, 1, fp);
}
fclose(fp);
::SendMessage(_hWnd, SCI_SETSAVEPOINT, 0, 0);
}else{
MsgBox.DisplayWarning("Can't save file %s", fullPath);
}
}
int CEditor::GetCurrentPos(void){
int currentPos = ::SendMessage(_hWnd, SCI_GETCURRENTPOS, 0,0);
caretPos = ::SendMessage(_hWnd, SCI_LINEFROMPOSITION, currentPos, 0) + 1;
return caretPos;
}
void CEditor::GetRange(int start, int end, char *text){
TextRange tr;
tr.chrg.cpMin = start;
tr.chrg.cpMax = end;
tr.lpstrText = text;
::SendMessage(_hWnd, SCI_GETTEXTRANGE, 0, (LPARAM) &tr);
}
void CEditor::SetAStyle(int style, COLORREF fore, COLORREF back, int size, const char *face){
::SendMessage(_hWnd, SCI_STYLESETFORE, style, fore);
::SendMessage(_hWnd, SCI_STYLESETBACK, style, back);
if (size >= 1)
::SendMessage(_hWnd, SCI_STYLESETSIZE, style, size);
if (face)
::SendMessage(_hWnd, SCI_STYLESETFONT, style, (LPARAM) face);
}
void CEditor::DefineMarker(int marker, int markerType, COLORREF fore, COLORREF back) {
::SendMessage(_hWnd, SCI_MARKERDEFINE, marker, markerType);
::SendMessage(_hWnd, SCI_MARKERSETFORE, marker, fore);
::SendMessage(_hWnd, SCI_MARKERSETBACK, marker, back);
}
void CEditor::SetLexer(int fileType){
switch (fileType){
case H_FILE:
case C_FILE:
case RC_FILE:
SetCppLexer();
return;
default:
// Global default style.
SetAStyle(STYLE_DEFAULT, black, white, 10, "Verdana");
::SendMessage(_hWnd, SCI_STYLECLEARALL, 0, 0); // Copies to all other styles.
}
}
void CEditor::SetCppLexer(void){
::SendMessage(_hWnd, SCI_SETLEXER, SCLEX_CPP, 0);
::SendMessage(_hWnd, SCI_SETSTYLEBITS, 5, 0);
::SendMessage(_hWnd, SCI_SETKEYWORDS, 0, (LPARAM) cppKeyWords);
// Global default style.
SetAStyle(STYLE_DEFAULT, black, white, 10, "Verdana");
::SendMessage(_hWnd, SCI_STYLECLEARALL, 0, 0); // Copies to all other styles.
// C Styles.
SetAStyle(SCE_C_DEFAULT, black, white, 10, "Verdana"); //0
SetAStyle(SCE_C_COMMENT, Green, white, 0, 0); //1
SetAStyle(SCE_C_COMMENTLINE, Green, white, 0, 0); //2
SetAStyle(SCE_C_COMMENTDOC, darkGreen, white, 0, 0); //3
SetAStyle(SCE_C_NUMBER, Ice, white, 0, 0); //4
SetAStyle(SCE_C_WORD, darkBlue, white, 0, 0); //5
::SendMessage(_hWnd, SCI_STYLESETBOLD, SCE_C_WORD, 1);
SetAStyle(SCE_C_STRING, Purple, white, 0, 0); //6
SetAStyle(SCE_C_CHARACTER, Purple, white, 0, 0); //7
SetAStyle(SCE_C_PREPROCESSOR, Olive, white, 0, 0); //9
SetAStyle(SCE_C_OPERATOR, black, white, 0, 0); //10
::SendMessage(_hWnd, SCI_STYLESETBOLD, SCE_C_OPERATOR, 1);
// SetAStyle(SCE_C_STRINGEOL, darkBlue, white, 0, 0); //12
// SetAStyle(SCE_C_COMMENTLINEDOC, darkBlue, white, 0, 0); //15
// SetAStyle(SCE_C_WORD2, darkBlue, white, 0, 0); //16
::SendMessage(_hWnd, SCI_SETPROPERTY, (long)"fold", (long)"1");
::SendMessage(_hWnd, SCI_SETPROPERTY, (long)"fold.compact", (long)"1");
::SendMessage(_hWnd, SCI_SETPROPERTY, (long)"fold.symbols", (long)"1");
::SendMessage(_hWnd, SCI_SETFOLDFLAGS, 16, 0);
// To put the folder markers in the line number region
//SendEditor(SCI_SETMARGINMASKN, 0, SC_MASK_FOLDERS);
::SendMessage(_hWnd, SCI_SETMODEVENTMASK, SC_MOD_CHANGEFOLD, 0);
// Create a margin column for the folding symbols
::SendMessage(_hWnd, SCI_SETMARGINTYPEN, 2, SC_MARGIN_SYMBOL);
::SendMessage(_hWnd, SCI_SETMARGINWIDTHN, 2, /*foldMargin ? foldMarginWidth :*/ 16);
::SendMessage(_hWnd, SCI_SETMARGINMASKN, 2, SC_MASK_FOLDERS);
::SendMessage(_hWnd, SCI_SETMARGINSENSITIVEN, 2, 1);
DefineMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS, white, black);
DefineMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS, white, black);
DefineMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY, white, black);
DefineMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY, white, black);
DefineMarker(SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY, white, black);
DefineMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY, white, black);
DefineMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY, white, black);
return;
}
void CEditor::GotoLine(int line, char * /*fileName*/){
::SendMessage(_hWnd, SCI_ENSUREVISIBLEENFORCEPOLICY, line, 0);
::SendMessage(_hWnd, SCI_GOTOLINE, line, 0);
}
bool CEditor::MarginClick(int position, int modifiers){
int lineClick = ::SendMessage(_hWnd, SCI_LINEFROMPOSITION, position, 0);
//Platform::DebugPrintf("Margin click %d %d %x\n", position, lineClick,
// ::SendMessage(_hWnd, SCI_GETFOLDLEVEL, lineClick) & SC_FOLDLEVELHEADERFLAG);
/* if ((modifiers & SCMOD_SHIFT) && (modifiers & SCMOD_CTRL)) {
FoldAll();
} else {*/
int levelClick = ::SendMessage(_hWnd, SCI_GETFOLDLEVEL, lineClick, 0);
if (levelClick & SC_FOLDLEVELHEADERFLAG) {
if (modifiers & SCMOD_SHIFT) {
// Ensure all children visible
::SendMessage(_hWnd, SCI_SETFOLDEXPANDED, lineClick, 1);
Expand(lineClick, true, true, 100, levelClick);
} else if (modifiers & SCMOD_CTRL) {
if (::SendMessage(_hWnd, SCI_GETFOLDEXPANDED, lineClick, 0)) {
// Contract this line and all children
::SendMessage(_hWnd, SCI_SETFOLDEXPANDED, lineClick, 0);
Expand(lineClick, false, true, 0, levelClick);
} else {
// Expand this line and all children
::SendMessage(_hWnd, SCI_SETFOLDEXPANDED, lineClick, 1);
Expand(lineClick, true, true, 100, levelClick);
}
} else {
// Toggle this line
::SendMessage(_hWnd, SCI_TOGGLEFOLD, lineClick, 0);
}
}
/* }*/
return true;
}
void CEditor::Expand(int &line, bool doExpand, bool force, int visLevels, int level){
int lineMaxSubord = ::SendMessage(_hWnd, SCI_GETLASTCHILD, line, level & SC_FOLDLEVELNUMBERMASK);
line++;
while (line <= lineMaxSubord) {
if (force) {
if (visLevels > 0)
::SendMessage(_hWnd, SCI_SHOWLINES, line, line);
else
::SendMessage(_hWnd, SCI_HIDELINES, line, line);
} else {
if (doExpand)
::SendMessage(_hWnd, SCI_SHOWLINES, line, line);
}
int levelLine = level;
if (levelLine == -1)
levelLine = ::SendMessage(_hWnd, SCI_GETFOLDLEVEL, line, 0);
if (levelLine & SC_FOLDLEVELHEADERFLAG) {
if (force) {
if (visLevels > 1)
::SendMessage(_hWnd, SCI_SETFOLDEXPANDED, line, 1);
else
::SendMessage(_hWnd, SCI_SETFOLDEXPANDED, line, 0);
Expand(line, doExpand, force, visLevels - 1);
} else {
if (doExpand) {
if (!::SendMessage(_hWnd, SCI_GETFOLDEXPANDED, line, 0))
::SendMessage(_hWnd, SCI_SETFOLDEXPANDED, line, 1);
Expand(line, true, force, visLevels - 1);
} else {
Expand(line, false, force, visLevels - 1);
}
}
} else {
line++;
}
}
}

View file

@ -0,0 +1,165 @@
/********************************************************************
* Module: editor.h. This is part of Visual-MinGW.
*
* License: Visual-MinGW is covered by GNU General Public License,
* Copyright (C) 2001 Manu B.
* See license.htm for more details.
*
*******************************************************************/
#ifndef EDITOR_H
#define EDITOR_H
#include "Scintilla.h"
#include "SciLexer.h"
#include "winui.h"
#define U_FILE 3
#define H_FILE (U_FILE+1)
#define C_FILE (U_FILE+2)
#define RC_FILE (U_FILE+3)
// Default block size.
const int blockSize = 131072;
// Default colors.
const COLORREF black = RGB(0,0,0);
const COLORREF white = RGB(0xff,0xff,0xff);
const COLORREF darkBlue = RGB(0, 0, 0x7f);
const COLORREF Green = RGB(0, 0x7f, 0);
const COLORREF darkGreen = RGB(0x3f, 0x70, 0x3f);
const COLORREF Purple = RGB(0x7f, 0x00, 0x7f);
const COLORREF Ice = RGB(0x00, 0x7f, 0x7f);
const COLORREF Olive = RGB(0x7f, 0x7f, 0x00);
// Default Cpp keywords.
const char cppKeyWords[] =
"asm auto bool break case catch char class const const_cast continue "
"default delete do double dynamic_cast else enum explicit export extern false float for "
"friend goto if inline int long mutable namespace new operator private protected public "
"register reinterpret_cast return short signed sizeof static static_cast struct switch "
"template this throw true try typedef typeid typename union unsigned using "
"virtual void volatile wchar_t while";
void EnsureRangeVisible(HWND hwndCtrl, int posStart, int posEnd, bool enforcePolicy);
int LengthDocument(HWND hwndCtrl);
CharacterRange GetSelection(HWND hwndCtrl);
class CFileItem : public CNode
{
public:
CFileItem();
~CFileItem();
// File name.
char szFileName[MAX_PATH];
WORD nFileOffset;
WORD nFileExtension;
// Owner tree view.
CTreeView * pTreeView;
HTREEITEM _hItem;
HTREEITEM _hDirItem;
// Owner child window.
CMDIChild * pMdiChild;
int show;
bool isInProject;
protected:
private:
};
void GetFileType(CFileItem * file);
class CEditor : public CScintilla
{
public:
CEditor();
~CEditor();
void LoadFile(CFileItem * file);
void SaveFile(char * fullPath);
int GetCurrentPos(void);
void GotoLine(int line, char * fileName = NULL);
int caretPos;
void SetLexer(int fileType);
void SetCppLexer(void);
bool MarginClick(int position, int modifiers);
protected:
private:
void DefineMarker(int marker, int markerType, COLORREF fore, COLORREF back);
void GetRange(int start, int end, char *text);
void SetAStyle(int style, COLORREF fore, COLORREF back, int size, const char *face);
void Expand(int &line, bool doExpand, bool force = false,
int visLevels = 0, int level = -1);
};
#define FR_MAX_LEN 200
class CFindReplaceDlg : public CDlgBase
{
public:
CFindReplaceDlg();
virtual ~CFindReplaceDlg();
HWND Find(CScintilla * pEditor);
HWND Replace(CScintilla * pEditor);
protected:
void FindNext(bool reverseDirection, bool showWarnings);
virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
BOOL Find_OnInitDialog(void);
BOOL Replace_OnInitDialog(void);
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
BOOL Find_OnCommand(WORD wIDl);
BOOL Replace_OnCommand(WORD wID);
BOOL HandleReplaceCommand(int cmd);
void ReplaceOnce(void);
void ReplaceAll(bool inSelection);
private:
HWND hFindWhat;
HWND hReplaceWith;
HWND hWholeWord;
HWND hMatchCase;
HWND hRegExp;
HWND hWrap;
HWND hUnSlash;
HWND hUp;
HWND hDown;
char findWhat[FR_MAX_LEN + 1];
char replaceWhat[FR_MAX_LEN + 1];
bool bWholeWord;
bool bMatchCase;
bool bRegExp;
bool bWrapFind;
bool bUnSlash;
bool bReverseFind;
bool bHavefound;
CEditor * pEditor;
HWND hEditor;
int resId;
};
class CChooseFontDlg : public CWindow
{
public:
CChooseFontDlg();
~CChooseFontDlg();
bool Create(CWindow * pWindow);
protected:
CHOOSEFONT cf;
LOGFONT lf;
private:
};
#endif

View file

@ -0,0 +1,121 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>Visual-MinGW license agreement.</title>
<meta name="generator" content="Namo WebEditor v3.0">
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red" style="font-family:Arial; font-size:12;">
<div align="center"><table border="0" cellspacing="0" bgcolor="teal">
<tr>
<td width="597"><p align="center"><font size="5" color="white"><b>Visual-MinGW's
license</b></font></td>
</tr>
<tr>
<td width="597"><table border="0" cellpadding="5" bgcolor="white">
<tr>
<td width="591" valign="top"><p align="center">&nbsp;
<table border="0">
<tr>
<td width="55"><p>&nbsp;</td>
<td width="518"><p><font size="2">Visual-MinGW
is a C/C++ Integrated Development Environment.<br>
Copyright (C) 2001 &nbsp;Manu B.</font></p>
<p><font size="2">The following license
terms applies to Visual-MinGW:</font></p>
<p><font size="2">This program is free software;
you can redistribute it and/or modify it
under the<br> terms of the GNU General Public
License version 2 as published by the Free
<br>
Software Foundation.</font></p>
<p><font size="2">This program is distributed
in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or <br>
FITNESS FOR A PARTICULAR PURPOSE.<br> See
the </font><a href="GNU-GPL.txt"><font size="2">GNU
General Public License</font></a><font size="2">
for more details.</font></p>
<p><font size="2">You should have received
a copy of the </font><a href="GNU-GPL.txt"><font
size="2">GNU General Public License</font></a><font
size="2"><br> along with this program;
if not, write to the Free Software<br> Foundation,
Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307,USA.</font></p>
<p>&nbsp;</td>
</tr>
<tr>
<td width="577" colspan="2"><p><hr size="1" width="80%"
noshade></td>
</tr>
<tr>
<td width="55"><p>&nbsp;</td>
<td width="518"><p><font size="2">Visual-MinGW
uses Neil Hodgson's</font><font size="2">
</font><a href="http://www.scintilla.org/"><font
size="2">Scintilla</font></a><font size="2">
</font><font size="2">editing component</font><font
size="2"> a</font><font size="2">s source
code <br>
editor. </font></p>
<p><font size="2">Th</font><font size="2">e
following license terms applies to both
</font><a href="http://www.scintilla.org/"><font
size="2">Scintilla</font></a><font size="2">
and </font><a href="http://www.scintilla.org/"><font
size="2">SciTE</font></a><font size="2">.</font></p>
<p>&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td width="597"><p align="center"><font size="5" color="white"><b>License
for Scintilla and SciTE</b></font></td>
</tr>
<tr>
<td width="597"><table border="0" cellpadding="5" bgcolor="white">
<tr>
<td width="591" valign="top"><table border="0">
<tr>
<td width="55"><p>&nbsp;</p>
<p>&nbsp;</td>
<td width="518"><p><font size="2">Copyright
1998-2001 by Neil Hodgson &lt;neilh@scintilla.org&gt;</font></p>
<p><font size="2">All Rights Reserved </font></p>
<p><font size="2">Permission to use, copy,
modify, and distribute this software and
its <br> documentation for any purpose and
without fee is hereby granted, <br> provided
that the above copyright notice appear in
all copies and that <br> both that copyright
notice and this permission notice appear
in <br> supporting documentation. </font></p>
<p><font size="2">NEIL HODGSON DISCLAIMS
ALL WARRANTIES WITH REGARD TO THIS <br>
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY <br> AND FITNESS, IN
NO EVENT SHALL NEIL HODGSON BE LIABLE FOR
ANY <br> SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES <br> WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, <br>
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER <br> TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE <br> OR
PERFORMANCE OF THIS SOFTWARE.</font></p>
<p>&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

View file

@ -0,0 +1,59 @@
Visual-MinGW's license
----------------------
Visual-MinGW is a C/C++ Integrated Development Environment.
Copyright (C) 2001 Manu B.
The following license terms applies to Visual-MinGW:
This program is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License version 2 as published by the Free
Software Foundation.
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.
--------------------------------------------------------------------------------
Visual-MinGW uses Neil Hodgson's Scintilla editing component as source code
editor.
The following license terms applies to both Scintilla and SciTE.
License for Scintilla and SciTE
-------------------------------
Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation.
NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
OR PERFORMANCE OF THIS SOFTWARE.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,385 @@
/********************************************************************
* Module: main.h. This is part of Visual-MinGW.
*
* License: Visual-MinGW is covered by GNU General Public License,
* Copyright (C) 2001 Manu B.
* See license.htm for more details.
*
********************************************************************/
#ifndef MAIN_H
#define MAIN_H
#include "CList.h"
#include "winui.h"
#include "editor.h"
#include "process.h"
#define LVOUT_NORMAL (STDOUT_USER)
#define LVOUT_ERROR (STDOUT_USER+1)
#define IDASK 21
#define WORKSPACE 0
#define PROJECT 1
#define DIR 2
#define PRJ_FILE 0
#define SRC_FILE 1
#define ADD_SRC_FILE 2
#define FILES_TAB 0
#define PROJECT_TAB 1
#define REPORT_MAIN_TAB 0
#define REPORT_LOG_TAB 1
class CChildView : public CMDIChild
{
public:
CChildView();
virtual ~CChildView();
bool modified;
bool OnCreate(LPCREATESTRUCT lParam);
bool OnSize(UINT wParam, int width, int height);
BOOL OnClose(void);
BOOL OnDestroy(void);
BOOL OnCommand(WPARAM wParam, LPARAM lParam);
BOOL OnNotify(int idCtrl, LPNMHDR notify);
BOOL OnSetFocus(HWND hwndLoseFocus);
BOOL OnActivate(HWND hwndChildDeact, HWND hwndChildAct);
void CmdSave(void);
void CmdSaveAs(void);
CEditor Editor;
protected:
private:
};
class CFileList : public CList
{
public:
CFileList();
~CFileList();
protected:
virtual int Compare(CNode *node1, CNode *node2);
private:
};
class CProjectView : public CTreeView, public CFileList
{
public:
CProjectView();
~CProjectView();
CFileItem * NewFile(char * name);
bool OpenFile(CFileItem * file);
void RemoveFile(void);
void RemoveModule(void);
int DestroyFile(CFileItem * file, int decision=IDASK);
int SaveAll(int decision);
bool Close();
void CreateRoot(char * projectName);
void DestroyRoot(void);
CFileItem * FindFile(char * szFileName);
char * GetFileName(CFileItem * currentNode, bool flag);
HWND Create(CWindow * pParent, CImageList * imgList);
HTREEITEM CreateDirItem(HTREEITEM hParent, char * dir);
protected:
private:
bool CreateSubDirItem(CFileItem * file);
HTREEITEM FindDirItem(HTREEITEM hItem, char * dir);
HTREEITEM hRoot;
};
class CFilesView : public CTreeView, public CFileList
{
public:
CFilesView();
~CFilesView();
bool OpenFile(CFileItem * file);
void New (void);
void CloseFile(CFileItem * file);
int SaveAll(int decision);
HWND Create(CWindow * pParent, CImageList * imgList);
protected:
private:
HTREEITEM hRoot;
};
class CManager : public CTabCtrl
{
public:
CManager();
~CManager();
void OpenFileDialog(void);
bool OpenFile(CFileItem * file);
int SaveAll(int silent);
bool NewProjectDialog(void);
bool OpenProjectDialog(void);
bool CloseProject(void);
int SaveProjectFiles(int decision);
void RemoveProjectFile(void);
void RemoveProjectModule(void);
void Create(CWindow * pParent);
bool SetPosition(HWND hInsertAfter, int x, int y, int width, int height, UINT uFlags);
BOOL OnNotify(int idCtrl, LPNMHDR notify);
void Tv_OnDeleteItem(LPNMTREEVIEW notify);
void Tv_OnSelchanged(LPNMTREEVIEW notify);
void OnSelChanging(LPNMHDR notify);
void OnSelChange(LPNMHDR notify);
CImageList ImgList;
CFilesView FilesView;
CProjectView ProjectView;
protected:
private:
void CreateImageList(void);
};
class CLogList : public CListView
{
public:
CLogList();
~CLogList();
void Create(CWindow * pParent);
bool SetPosition(HWND hInsertAfter, int x, int y, int width, int height, UINT uFlags);
bool Append(char * line, WORD outputFlag);
protected:
private:
char szMsg[1024];
};
class CMainList : public CListView
{
public:
CMainList();
~CMainList();
void Create(CWindow * pParent);
void Lv_OnDbClick(LPNMLISTVIEW lpnmlv);
bool Append(char * line, WORD outputFlag);
protected:
private:
char szLine[512];
char szUnit[512];
char szMsg[512];
bool SplitErrorLine(char * line);
};
class CReport : public CTabCtrl
{
public:
CReport();
~CReport();
bool Append(char * line, WORD outputFlag);
void Clear(void);
void Create(CWindow * pParent);
bool SetPosition(HWND hInsertAfter, int x, int y, int width, int height, UINT uFlags);
BOOL OnNotify(int idCtrl, LPNMHDR notify);
void OnSelChanging(LPNMHDR notify);
void OnSelChange(LPNMHDR notify);
CMainList MainList;
CLogList LogList;
protected:
private:
void CreateImageList(void);
};
class CFileDlg : public CFileDlgBase
{
public:
CFileDlg();
~CFileDlg();
bool Open(CWindow * pWindow, char * pszFileName, DWORD nMaxFile, int fileflag);
bool Save(CWindow * pWindow, char * pszFileName, DWORD nMaxFile, int fileflag);
protected:
private:
};
class CGrepDlg : public CDlgBase
{
public:
CGrepDlg();
~CGrepDlg();
int Create(void);
LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
void FindInFiles(char * findWhat, char * fileFilter);
char gDir[MAX_PATH];
char findWhat[200];
protected:
private:
HWND hFindWhat;
HWND hgDir;
};
class CEnvDlg : public CDlgBase
{
public:
CEnvDlg();
virtual ~CEnvDlg();
virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
void SetEnvText(void);
bool bIsVisible;
bool bModified;
protected:
private:
HWND hApply;
HWND hSetCcBin;
HWND hCcBinDir;
HWND hBrowseCc;
HWND hSetCmdBin;
HWND hCmdBinDir;
HWND hBrowseCmd;
HWND hAutoexec;
HWND hEnvView;
};
class CPreferencesDlg : public CTabbedDlg
{
public:
CPreferencesDlg();
virtual ~CPreferencesDlg();
int Create(void);
BOOL EndDlg(int nResult);
virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
protected:
private:
CEnvDlg EnvDlg;
};
class CWinApp : public CMDIBase
{
public:
CWinApp();
~CWinApp();
void FirstRunTest(void);
bool ReadIniFile(char * iniFile);
void SaveIniFile(FILE * file);
bool WriteIniFile(void);
bool CustomInit(void);
bool Release(void);
bool SetEnv(void);
bool CreateUI(void);
void CreateToolbar(void);
void CreateSplitter(void);
void CreateMDI(void);
HWND CreateChild(char * caption, LPVOID lParam);
void CreateStatusBar(void);
void SendCaretPos(int caretPos);
// Main window.
LRESULT CALLBACK CMainWndProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnCreate(LPCREATESTRUCT lParam);
BOOL OnPaint(HDC wParam);
BOOL OnSize(UINT wParam, int width, int height);
BOOL OnDestroy(void);
BOOL OnClose (void);
BOOL OnNotify(int idCtrl, LPNMHDR notify);
BOOL OnLButtonDown(short xPos, short yPos, UINT fwKeys);
BOOL OnMouseMove(short xPos, short yPos, UINT fwKeys);
BOOL OnLButtonUp(short xPos, short yPos, UINT fwKeys);
BOOL OnSetCursor(HWND hwnd, UINT nHittest, UINT wMouseMsg);
BOOL OnCommand(WPARAM wParam, LPARAM lParam);
// Child window.
LRESULT CALLBACK CChildWndProc(CWindow * pWnd, UINT Message, WPARAM wParam, LPARAM lParam);
HMODULE hmod;
char iniFileName[MAX_PATH];
CIniFile IniFile;
CPreferencesDlg PreferencesDlg;
CGrepDlg GrepDlg;
CShellDlg ShellDlg;
CFileDlg FileDlg;
CProcess Process;
CToolBar Toolbar;
CSplitter MainSplitter;
CSplitter ChildSplitter;
CManager Manager;
CReport Report;
CStatusBar Sbar;
/* Preferences */
char openFilesDir[MAX_PATH];
char projectDir[MAX_PATH];
bool bSetCcEnv;
bool bSetCmdEnv;
bool bSetDefEnv;
char szCcBinDir[MAX_PATH];
char szCmdBinDir[MAX_PATH];
char includeDir[MAX_PATH];
protected:
private:
bool firstRun;
// Child windows dimensions.
int deltaY;
int tbarHeight;
int sbarHeight;
int tvWidth;
int lvHeight;
int hSplitter;
int vSplitter;
};
#endif

View file

@ -0,0 +1,682 @@
/********************************************************************
* Module: process.cpp. This is part of Visual-MinGW.
*
* Purpose: Procedures to invoke MinGW compiler.
*
* Authors: Manu B.
*
* License: Visual-MinGW is covered by GNU General Public License,
* Copyright (C) 2001 Manu B.
* See license.htm for more details.
*
* Note: The following article from MSDN explanes how to handle Callback
* procedures :
* Calling All Members: Member Functions as Callbacks.
* by Dale Rogerson.
* Microsoft Developer Network Technology Group.
* April 30, 1992.
* http://msdn.microsoft.com/archive/default.asp
*
* Revisions:
*
********************************************************************/
#include <windows.h>
#include <stdio.h>
#include <process.h>
#include <time.h>
#include <process.h>
#include "process.h"
#include "project.h"
#include "main.h"
#include "rsrc.h"
extern CCriticalSection CriticalSection;
extern CMessageBox MsgBox;
char errmsg[128];
// For winApp.isWinNT and winApp.Report.Append
extern CWinApp winApp;
/********************************************************************
* Class: CCommandDlg.
*
* Purpose:
*
* Revisions:
*
********************************************************************/
CCommandDlg::CCommandDlg(){
*cmdLine = '\0';
}
CCommandDlg::~CCommandDlg(){
}
HWND CCommandDlg::Create(void){
return CreateParam(&winApp, IDD_COMMAND, 0);
}
LRESULT CALLBACK CCommandDlg::CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam){
switch(Message){
case WM_INITDIALOG:
return OnInitDialog((HWND) wParam, lParam);
case WM_COMMAND:
OnCommand(HIWORD(wParam), LOWORD(wParam), (HWND) lParam);
break;
case WM_CLOSE:
EndDlg(0);
break;
}
return FALSE;
}
BOOL CCommandDlg::OnInitDialog(HWND, LPARAM){
hCmdLine = GetItem(IDC_CMDLINE);
SetItemText(hCmdLine, cmdLine);
// Show the dialog.
Show();
return TRUE;
}
BOOL CCommandDlg::OnCommand(WORD, WORD wID, HWND){
switch (wID){
case IDOK:
GetItemText(hCmdLine, cmdLine, sizeof(cmdLine));
//MsgBox.DisplayString(cmdLine);
winApp.Process.CommandLine(cmdLine);
return TRUE;
case IDCANCEL:
EndDlg(IDCANCEL);
return FALSE;
}
return FALSE;
}
/********************************************************************
* Class: CTask.
*
* Purpose:
*
* Revisions:
*
********************************************************************/
CTask::CTask(){
*cmdLine = '\0';
*szFileName = '\0';
creationFlag = 0;
outputFlag = 0;
}
CTask::~CTask(){
}
/********************************************************************
* Class: CStack.
*
* Purpose:
*
* Revisions:
*
********************************************************************/
CStack::CStack(){
retBuf = NULL;
}
CStack::~CStack(){
DestroyList();
if (retBuf)
delete retBuf;
}
void CStack::DetachCurrent(void){
// Empty list ?
if (current != NULL){
CNode * node = current;
// Detach node from the list.
if (node->next != NULL)
node->next->prev = node->prev;
if (node->prev != NULL)
node->prev->next = node->next;
// Set current node.
if(node->next != NULL)
current = node->next;
else
current = node->prev;
if (current == NULL){
// Now, the list is empty.
first = last = NULL;
}else if (first == node){
// Detached node was first.
first = current;
}else if (last == node){
// Detached node was last.
last = current;
}
count--;
}
}
/********************************************************************
* Push/Pop/Flush.
********************************************************************/
int CStack::Push(CTask * newTask){
InsertLast(newTask);
return Length();
}
CTask * CStack::Pop(void){
// Delete return buffer.
if (retBuf){
delete retBuf;
retBuf = NULL;
}
// Get first node. (FIFO stack)
retBuf = (CTask*) First();
// The Stack is empty ?
if (!retBuf)
return NULL;
// Detach current node from the list. Return a pointer to it.
DetachCurrent();
return retBuf;
}
void CStack::Flush(void){
DestroyList();
if (retBuf)
delete retBuf;
retBuf = NULL;
}
/********************************************************************
* Class: CPipes.
*
* Purpose: Creates needed pipes, depending on creationFlag.
* Like GNU Make does, we use an Handle array for our pipes.
* Parent Process Side is stdXXX[0] and Child Process Side is stdXXX[1].
*
* Ex: PARENT ->[0]IN_PIPE[1]-> CHILD_IO ->[1]OUT_PIPE[0]-> PARENT
* ->[1]ERR_PIPE[0]-> PARENT
* Revisions:
*
********************************************************************/
CPipes::CPipes(){
hIn[0] = NULL;
hIn[1] = NULL;
hOut[0] = NULL;
hOut[1] = NULL;
hErr[0] = NULL;
hErr[1] = NULL;
}
CPipes::~CPipes(){
}
bool CPipes::Create(WORD creationFlag, bool winNT){
/* Create needed pipes according to creationFlag */
/* Parent side of pipes is [0], child side is [1] */
HANDLE hDup;
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;
if (winNT){
/* Create a security descriptor for Windows NT */
SECURITY_DESCRIPTOR sd;
if (!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION)){
sprintf(errmsg, "vm error: Process.cpp InitializeSecurityDescriptor(winNT) failed (e=%d)", (int)GetLastError());
winApp.Report.Append(errmsg, LVOUT_ERROR);
return false;
}
if (!SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE)){
sprintf(errmsg, "vm error: Process.cpp SetSecurityDescriptorDacl(winNT) failed (e=%d)", (int)GetLastError());
winApp.Report.Append(errmsg, LVOUT_ERROR);
return false;
}
sa.lpSecurityDescriptor = &sd;
}
/* Input pipe */
if (!CreatePipe(&hIn[1], &hIn[0], &sa, 0)){
sprintf(errmsg, "vm error: Process.cpp CreatePipe(In) failed (e=%d)", (int)GetLastError());
winApp.Report.Append(errmsg, LVOUT_ERROR);
return false;
}
if (!DuplicateHandle(GetCurrentProcess(),
hIn[0],
GetCurrentProcess(),
&hDup,
0,
FALSE,
DUPLICATE_SAME_ACCESS)){
sprintf(errmsg, "vm error: Process.cpp DuplicateHandle(In) failed (e=%d)", (int)GetLastError());
winApp.Report.Append(errmsg, LVOUT_ERROR);
return false;
}
CloseHandle(hIn[0]);
hIn[0] = hDup;
/* Output pipe */
if (!CreatePipe(&hOut[0], &hOut[1], &sa, 0)){
sprintf(errmsg, "vm error: Process.cpp CreatePipe(Out) failed (e=%d)", (int)GetLastError());
winApp.Report.Append(errmsg, LVOUT_ERROR);
return false;
}
if (!DuplicateHandle(GetCurrentProcess(),
hOut[0],
GetCurrentProcess(),
&hDup,
0,
FALSE,
DUPLICATE_SAME_ACCESS)){
sprintf(errmsg, "vm error: Process.cpp DuplicateHandle(Out) failed (e=%d)", (int)GetLastError());
winApp.Report.Append(errmsg, LVOUT_ERROR);
return false;
}
CloseHandle(hOut[0]);
hOut[0] = hDup;
/* Error pipe */
if (!(creationFlag & OUTERR_PIPE) && (creationFlag & ERR_PIPE)){
if (!CreatePipe(&hErr[0], &hErr[1], &sa, 0)){
sprintf(errmsg, "vm error: Process.cpp CreatePipe(Err) failed (e=%d)", (int)GetLastError());
winApp.Report.Append(errmsg, LVOUT_ERROR);
return false;
}
if (!DuplicateHandle(GetCurrentProcess(),
hErr[0],
GetCurrentProcess(),
&hDup,
0,
FALSE,
DUPLICATE_SAME_ACCESS)){
sprintf(errmsg, "vm error: Process.cpp DuplicateHandle(Err) failed (e=%d)", (int)GetLastError());
winApp.Report.Append(errmsg, LVOUT_ERROR);
return false;
}
CloseHandle(hErr[0]);
hErr[0] = hDup;
}
return true;
}
bool CPipes::CloseChildSide(void){
return Close(1);
}
bool CPipes::CloseParentSide(void){
return Close(0);
}
bool CPipes::Close(int side){
if (side < 0 || side > 1)
return false;
if (hIn[side]){
CloseHandle(hIn[side]);
hIn[side] = NULL;
}
if (hOut[side]){
CloseHandle(hOut[side]);
hOut[side] = NULL;
}
if (hErr[side]){
CloseHandle(hErr[side]);
hErr[side] = NULL;
}
return true;
}
/********************************************************************
* Class: CProcess.
*
* Purpose:
*
* Revisions:
*
********************************************************************/
CProcess::CProcess(){
Running = false;
exitCode = 0;
pi.hProcess = 0;
pi.hThread = 0;
pi.dwProcessId = 0;
pi.dwThreadId = 0;
}
CProcess::~CProcess(){
}
/********************************************************************
* Manage Tasks.
********************************************************************/
bool CProcess::isRunning(void){
if (Running){
MsgBox.DisplayWarning("A process is already running !");
return true;
}
return false;
}
CTask * CProcess::AddTask(char * cmdLine, WORD creationFlag, WORD outputFlag){
CTask * newTask = new CTask;
strcpy(newTask->cmdLine, cmdLine);
newTask->creationFlag = creationFlag;
newTask->outputFlag = outputFlag;
Push(newTask);
return newTask;
}
bool CProcess::CmdCat(char * cmdLine){
CTask * task = (CTask*) GetCurrent();
if (!task)
return false;
strcat(task->cmdLine, cmdLine);
return true;
}
/********************************************************************
* RunNext/Run/RunProcess.
********************************************************************/
void __cdecl call_thread(void * ptr){
/* C++ adapter */
((CProcess *) ptr)->Run_Thread_Internal();
}
void CProcess::Run(void){
// Check if something is already running before creating a thread.
if (!Running){
// Call Run_Thread_Internal()
_beginthread(call_thread, 1024 * 1024, (void *) this);
}
}
void CProcess::Run_Thread_Internal(void){
exitCode = 0;
/* Execute each task */
for ( ; ; ){
/* If previous task returns an error code, abort */
if (exitCode != 0)
break;
// Get one task to execute.
currTask = Pop();
// Nothing to run.
if (!currTask)
break;
/* Show command lines ?*/
winApp.Report.Append(currTask->cmdLine, LVOUT_NORMAL);
if (RunProcess(currTask)){
winApp.Report.Append("Abort !", LVOUT_NORMAL);
exitCode = 1;
break;
}
}
// Successful ?
if (exitCode == 0)
winApp.Report.Append("Performed successfully.", LVOUT_NORMAL);
Flush();
Running = false;
return;
}
bool CProcess::RunProcess(CTask * task){
if (!task)
return false;
bool usePipes = task->creationFlag;
STARTUPINFO si = {sizeof(STARTUPINFO), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0};
/* PROCESS_INFORMATION */
pi.hProcess = 0;
pi.hThread = 0;
pi.dwProcessId = 0;
pi.dwThreadId = 0;
/* Process creation with pipes */
if (usePipes){
/* Create needed pipes according to creationFlag */
if(!Pipes.Create(task->creationFlag, winApp.isWinNT)){
Pipes.CloseChildSide();
Pipes.CloseParentSide();
return false;
}
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
si.wShowWindow = SW_HIDE;
//si.wShowWindow = SW_SHOWNORMAL;
/* Set pipe handles */
if (Pipes.hIn[1] != NULL && Pipes.hOut[1] != NULL){
si.hStdInput = Pipes.hIn[1];
si.hStdOutput = Pipes.hOut[1];
if (Pipes.hErr[1] == NULL)
si.hStdError = Pipes.hOut[1];
else
si.hStdError = Pipes.hErr[1];
}else{
sprintf(errmsg, "vm error: Process.cpp Invalid pipe handle");
winApp.Report.Append(errmsg, LVOUT_ERROR);
Pipes.CloseChildSide();
Pipes.CloseParentSide();
return false;
}
}
/* Create the child process */
Running = CreateProcess(NULL,
task->cmdLine,
NULL,
NULL,
usePipes,
0,
NULL,
/*startDir[0] ? startDir :*/ NULL,
&si,
&pi);
if (!Running){
/* CreateProcess failed. Close handles and return */
Pipes.CloseChildSide();
Pipes.CloseParentSide();
sprintf(errmsg, "vm error: Process.cpp CreateProcess failed (e=%d)", (int)GetLastError());
winApp.Report.Append(errmsg, LVOUT_ERROR);
return false;
}else{
/* Close child process handles */
Pipes.CloseChildSide();
if (!(usePipes & IN_PIPE)){
/* Don't use the Input pipe */
::CloseHandle(Pipes.hIn[0]);
Pipes.hIn[0] = NULL;
}
}
//sprintf(errmsg, "vm debug: enter io loop");
//winApp.Report.Append(errmsg, LVOUT_ERROR);
if (usePipes){
/* Initialize buffers */
*outBuf = 0;
chr = outBuf;
bool bResult;
for ( ; ; ){
Sleep(100L);
bResult = ReadStdOut(task, Pipes.hOut[0]);
if (bResult != NO_ERROR)
break;
::GetExitCodeProcess(pi.hProcess, &exitCode);
if (exitCode != STILL_ACTIVE){
break;
}
}
}
//sprintf(errmsg, "vm debug: exit io loop");
//winApp.Report.Append(errmsg, LVOUT_ERROR);
/* The child process is running. Perform I/O until terminated */
::WaitForSingleObject(pi.hProcess, INFINITE);
/* Process terminated. Get exit code. */
::GetExitCodeProcess(pi.hProcess, &exitCode);
if (exitCode == NO_ERROR){
return NO_ERROR;
}
/* Close handles */
Pipes.CloseParentSide();
::CloseHandle(pi.hProcess);
if (pi.hThread){
::CloseHandle(pi.hThread);
pi.hThread = NULL;
}
return exitCode;
}
/********************************************************************
* Pipes input/output.
********************************************************************/
void CProcess::WriteStdIn(HANDLE hPipe, WORD){
if (!hPipe)
return;
return;
}
void CProcess::ReadStdErr(HANDLE hPipe, WORD){
if (!hPipe)
return;
return;
}
long CProcess::ReadStdOut(CTask * task, HANDLE hPipe){
if (!task || !hPipe)
return ERROR_INVALID_FUNCTION;
/* Copy each char and output lines while there is something to read */
for ( ; ; ){
// Copy one char, return if nothing available.
if (!ReadOneChar(hPipe, chr))
break;
// Ignore CR.
if (*chr == '\r')
continue;
if (*chr != '\n'){
chr++;
/* @@TODO Overflow
if ((chr - outBuf) >= max_len)
realloc(buffer);*/
// End of line
}else if (*chr =='\n'){
*chr = '\0';
// Output error lines to List View.
if (task->outputFlag == STDOUT_FILE_APPEND){
WriteFileAppend(task->szFileName, outBuf, (chr - outBuf));
}else{
OutputLine(task->outputFlag, outBuf, (chr - outBuf));
}
*outBuf = '\0';
chr = outBuf;
}
}
return NO_ERROR;
}
int CProcess::ReadOneChar(HANDLE hPipe, char * chrin){
DWORD bytesRead = 0;
DWORD bytesAvail = 0;
if (!PeekNamedPipe(hPipe, chrin, (DWORD)1, &bytesRead, &bytesAvail, NULL))
return 0;
if (bytesAvail == 0)
return 0;
if (!ReadFile(hPipe, chrin, (DWORD)1, &bytesRead, NULL))
return 0;
return bytesRead;
}
bool CProcess::CommandLine(char * cmdLine){
if (!Pipes.hIn[0])
return false;
if (!Running || !currTask || !currTask->creationFlag)
return false;
int len = strlen(cmdLine);
if (len){
strcpy(inBuf, cmdLine);
char * s = inBuf;
s+=len;
*s = '\r';
s++;
*s = '\n';
s++;
*s = '\0';
}
DWORD written;
if (!WriteFile(Pipes.hIn[0], inBuf, strlen(inBuf), &written, 0))
return false;
return true;
}
bool CProcess::WriteFileAppend(char * fileName, char * line, int /*len*/){
if (!*fileName)
return false;
/* Append one line of text to a file */
FILE * file = fopen(fileName, "a");
if (file){
fprintf(file, line);
fprintf(file, "\n");
fclose(file);
return true;
}
return false;
}
bool CProcess::OutputLine(WORD outputFlag, char * line, int /*len*/){
/* Output error lines to List View */
CriticalSection.Enter();
winApp.Report.Append(line, outputFlag);
CriticalSection.Leave();
return true;
}

View file

@ -0,0 +1,146 @@
/********************************************************************
* Module: process.h. This is part of Visual-MinGW.
*
* License: Visual-MinGW is covered by GNU General Public License,
* Copyright (C) 2001 Manu B.
* See license.htm for more details.
*
********************************************************************/
#ifndef PROCESS_H
#define PROCESS_H
#include "winui.h"
#include "CList.h"
class CCommandDlg : public CDlgBase
{
public:
CCommandDlg();
~CCommandDlg();
HWND Create(void);
LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
char cmdLine[1024];
protected:
private:
HWND hCmdLine;
};
/********************************************************
creationFlag truth table
-----------------------------------
8 4 2 1
------------------
NO_PIPE 0 0 0 0
IN_PIPE 0 0 0 1
OUT_PIPE 0 0 1 0
ERR_PIPE 0 1 0 0
OUTERR_PIPE 1 0 1 0
*********************************************************/
#define NO_PIPE 0x0000
#define IN_PIPE 0x0001
#define OUT_PIPE 0x0002
#define ERR_PIPE 0x0004
#define OUTERR_PIPE 0x000A
#define STDOUT_NONE 0
#define STDOUT_FILE_APPEND 1
#define STDOUT_USER 2
class CTask : public CNode
{
public:
CTask();
~CTask();
char cmdLine[MAX_PATH];
char szFileName[MAX_PATH];
WORD creationFlag;
WORD outputFlag;
protected:
private:
};
class CStack : public CList
{
public:
CStack();
~CStack();
int Push(CTask * newTask);
CTask * Pop(void);
void Flush(void);
protected:
private:
CTask * retBuf;
void DetachCurrent(void);
};
class CPipes
{
public:
CPipes();
~CPipes();
HANDLE hIn[2];
HANDLE hOut[2];
HANDLE hErr[2];
bool Create(WORD creationFlag, bool winNT);
bool CloseChildSide(void);
bool CloseParentSide(void);
protected:
private:
bool Close(int side);
};
class CProcess : public CStack
{
public:
CProcess();
~CProcess();
bool CommandLine(char * cmdLine);
bool isRunning(void);
CTask * AddTask(char * cmdLine, WORD creationFlag, WORD outputFlag/* = STDOUT_NONE*/);
bool CmdCat(char * cmdLine);
void Run(void);
void Run_Thread_Internal(void);
CCommandDlg CommandDlg;
protected:
private:
PROCESS_INFORMATION pi;
bool Running;
DWORD exitCode;
CTask * currTask;
CPipes Pipes;
char * chr;
char inBuf[1024];
char outBuf[1024];
char errBuf[1024];
bool RunProcess(CTask * task);
void WriteStdIn(HANDLE hPipe, WORD creationFlag);
void ReadStdErr(HANDLE hPipe, WORD creationFlag);
long ReadStdOut(CTask * task, HANDLE hPipe);
int ReadOneChar(HANDLE hPipe, char * chrin);
bool WriteFileAppend(char * fileName, char * line, int len=-1);
bool OutputLine(WORD outputFlag, char * line, int len=-1);
};
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,295 @@
/********************************************************************
* Module: project.h. This is part of Visual-MinGW.
*
* License: Visual-MinGW is covered by GNU General Public License,
* Copyright (C) 2001 Manu B.
* See license.htm for more details.
*
********************************************************************/
#ifndef PROJECT_H
#define PROJECT_H
#include "winui.h"
#include "main.h"
#include "process.h"
#define BUILD_STATLIB 0
#define BUILD_DLL 1
#define BUILD_EXE 2
#define BUILD_GUIEXE 3
#define LANGC 0
#define LANGCPP 1
class CProject;
class CMakefile;
bool CheckFile(CFileItem * file);
class CGeneralDlg : public CDlgBase
{
public:
CGeneralDlg();
virtual ~CGeneralDlg();
virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
protected:
private:
CProject *pProject;
CMakefile *pMakefile;
HWND hStatLib;
HWND hDll;
HWND hConsole;
HWND hGuiExe;
HWND hDbgSym;
HWND hLangC;
HWND hLangCpp;
HWND hMkfName;
HWND hMkfDir;
HWND hUserMkf;
HWND hTgtName;
HWND hTgtDir;
};
class CCompilerDlg : public CDlgBase
{
public:
CCompilerDlg();
virtual ~CCompilerDlg();
virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
protected:
private:
CProject *pProject;
CMakefile *pMakefile;
HWND hCppFlags;
HWND hWarning;
HWND hOptimiz;
HWND hCFlags;
HWND hIncDirs;
};
class CZipDlg : public CDlgBase
{
public:
CZipDlg();
virtual ~CZipDlg();
virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
protected:
private:
CProject *pProject;
CMakefile *pMakefile;
HWND hZipDir;
HWND hZipFlags;
};
class CLinkerDlg : public CDlgBase
{
public:
CLinkerDlg();
virtual ~CLinkerDlg();
virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
protected:
private:
CProject *pProject;
CMakefile *pMakefile;
HWND hLdStrip;
HWND hLdOpts;
HWND hLdLibs;
HWND hLibsDirs;
};
class COptionsDlg : public CTabbedDlg
{
public:
COptionsDlg();
virtual ~COptionsDlg();
BOOL EndDlg(int nResult);
virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND hwndFocus, LPARAM lInitParam);
BOOL OnCommand(WORD wNotifyCode, WORD wID, HWND hwndCtl);
protected:
private:
CProject *pProject;
CMakefile *pMakefile;
CGeneralDlg GeneralDlg;
CCompilerDlg CompilerDlg;
CLinkerDlg LinkerDlg;
CZipDlg ZipDlg;
};
class CNewModuleDlg : public CDlgBase
{
public:
CNewModuleDlg();
virtual ~CNewModuleDlg();
virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
protected:
private:
CProject *pProject;
};
class CCompiler : public CIniFile
{
public:
CCompiler();
~CCompiler();
bool LoadData(char * fullpath);
char make[64];
char cc[16];
char cFlags[64];
char ldFlags[64];
char wres[16];
char debug[16];
char test[16];
protected:
private:
};
class CMakefile
{
public:
CMakefile();
~CMakefile();
void Init(void);
bool SwitchCurrentDir(void);
void GetFullPath(char * prjFileName, WORD offset, char * name);
void Build(CProjectView * Tree, CProcess* Process);
void SrcList2Buffers(CProjectView * Tree);
void Write(void);
// File.
char szFileName[MAX_PATH];
WORD nFileOffset;
char mkfDir[MAX_PATH];
// Compiler dependent.
char cc[4];
char make[64];
char wres[16];
char test[16];
char target[64];
char tgtDir[MAX_PATH];
UINT buildWhat;
bool debug;
UINT lang;
// Compiler data.
char cppFlags[256];
char warning[64];
char optimize[64];
char cFlags[64];
char incDirs[256];
// Linker data.
char ldStrip[32];
char ldOpts[64];
char ldLibs[64];
char libDirs[256];
// Archiver.
char arFlags[64];
protected:
private:
// Buffers.
char objFile[64];
char srcBuf [1024];
char objBuf [1024];
char resBuf [1024];
char depBuf [256];
};
class CProject //: public CIniFile
{
public:
CProject();
~CProject();
bool NoProject(void);
int CloseDecision(void);
bool New(char * fileName, WORD fileOffset);
bool Open(char * fileName, WORD fileOffset);
bool RelativeToAbsolute(char * relativePath);
bool AddFiles(void);
bool OptionsDlg(void);
bool NewModuleDlg(void);
bool NewModule(char * srcFile, bool createHeader);
void ZipSrcs(void);
void Explore(HWND hwnd);
void Build(void);
void RebuildAll(void);
void RunTarget(void);
void MakeClean(void);
void BuildMakefile(void);
bool SwitchCurrentDir(void);
CMakefile Makefile;
/* May be private members */
int numFiles;
bool loaded;
bool modified;
bool buildMakefile;
int SavePrjFile(int decision);
char szFileName[MAX_PATH];
WORD nFileOffset;
WORD nFileExtension;
char szDirBuffer[MAX_PATH];
char zipDir[MAX_PATH];
char zipFlags[256];
char compilerName[64];
protected:
private:
void Reset();
CIniFile PrjFile;
COptionsDlg _OptionsDlg;
CNewModuleDlg _NewModuleDlg;
int prjVer;
};
#endif

View file

@ -0,0 +1,168 @@
/********************************************************************
* Module: resource.h. This is part of Visual-MinGW.
*
* License: Visual-MinGW is covered by GNU General Public License,
* Copyright (C) 2001 Manu B.
* See license.htm for more details.
*
********************************************************************/
#define APP_VERSION "0.43a"
#define FULL_APP_VERSION "0.43 alpha"
// Static control ----------------------------
#define IDC_STATIC -1
// Bitmaps ----------------------------------
#define IDB_TOOLBAR 10
#define IDB_TREEVIEW 11
#define IDAPPLY 20
// Preferences Dialog -----------------------
#define IDD_PREFERENCES 100
#define IDC_PREF_TABS 101
#define IDD_ENVIRON 110
#define IDC_SET_CCBIN 111
#define IDC_CCBIN 112
#define IDC_BROWSE_CC 113
#define IDC_SET_CMDBIN 114
#define IDC_CMDBIN 115
#define IDC_BROWSE_CMD 116
#define IDC_AUTOEXEC 117
#define IDC_ENV_VIEW 118
/*#define IDC_CC_INCDIR 101
#define IDC_BROWSE 102*/
// Find Dialog -------------------------------
#define IDD_FIND 120
#define IDC_FINDWHAT 121
#define IDC_WHOLEWORD 122
#define IDC_MATCHCASE 123
#define IDC_REGEXP 124
#define IDC_WRAP 125
#define IDC_UNSLASH 126
#define IDC_DIRECTIONUP 127
#define IDC_DIRECTIONDOWN 128
// Replace ----------------------------------
#define IDD_REPLACE 130
#define IDC_REPLACEWITH 131
#define IDC_REPLACE 132
#define IDC_REPLACEALL 133
#define IDC_REPLACEINSEL 134
// Find in files -------------------------------
#define IDD_GREP 135
#define IDC_GFILTER 136
#define IDC_GDIR 137
#define IDC_GBROWSE 139
// New module ------------------------------
#define IDD_NEW_MODULE 140
#define IDC_HEADER 141
// Options ----------------------------------
#define IDD_OPTION 150
#define IDC_OPTION_TABS 151
#define IDC_HELP_BTN 152
// General tab ---------------------------------
#define IDD_GENERAL_PANE 160
#define IDC_STATLIB 161
#define IDC_DLL 162
#define IDC_CONSOLE 163
#define IDC_GUIEXE 164
#define IDC_DBGSYM 165
#define IDC_LANGC 166
#define IDC_LANGCPP 167
#define IDC_MKF_NAME 168
#define IDC_MKF_DIR 169
#define IDC_USER_MKF 170
#define IDC_TGT_NAME 171
#define IDC_TGT_DIR 172
// Compiler tab -----------------------------
#define IDD_COMPILER 180
#define IDC_CPPFLAGS 181
#define IDC_WARNING 182
#define IDC_OPTIMIZ 183
#define IDC_CFLAGS 184
#define IDC_INCDIRS 185
// Linker tab --------------------------------
#define IDD_LINKER 190
#define IDC_LDSTRIP 191
#define IDC_LDOPTS 192
#define IDC_LDLIBS 193
#define IDC_LIBDIRS 194
#define IDD_ZIP 200
#define IDC_INFOZIP 201
#define IDC_TAR_GZIP 202
#define IDC_TAR_BZ2 203
#define IDC_ZIP_TEST 204
#define IDC_ZIP_DIR 205
#define IDC_ZIPFLAGS 206
// About ------------------------------------
#define IDD_ABOUT 210
#define IDD_COMMAND 220
#define IDC_CMDLINE 221
// Menu -------------------------------------
#define ID_MENU 1000
#define IDM_NEW 1001
#define IDM_OPEN 1002
//#define IDM_CLOSE 1003
#define IDM_NEW_PROJECT 1004
#define IDM_OPEN_PROJECT 1005
#define IDM_SAVE_PROJECT 1006
#define IDM_CLOSE_PROJECT 1007
#define IDM_SAVE 1008
#define IDM_SAVEAS 1009
#define IDM_SAVEALL 1010
#define IDM_PREFERENCES 1011
#define IDM_PAGESETUP 1012
#define IDM_PRINT 1013
#define IDM_QUIT 1014
#define IDM_UNDO 1020
#define IDM_REDO 1021
#define IDM_CUT 1022
#define IDM_COPY 1023
#define IDM_PASTE 1024
#define IDM_SELECTALL 1025
#define IDM_FIND 1030
#define IDM_REPLACE 1031
#define IDM_GREP 1032
#define IDM_CASCADE 1040
#define IDM_TILEHORZ 1041
#define IDM_TILEVERT 1042
#define IDM_ARRANGE 1043
#define IDM_NEW_MODULE 1050
#define IDM_ADD 1051
#define IDM_REMOVE_FILE 1052
#define IDM_REMOVE_MODULE 1053
#define IDM_OPTION 1054
#define IDM_ZIP_SRCS 1055
#define IDM_EXPLORE 1056
#define IDM_BUILD 1060
#define IDM_REBUILDALL 1061
#define IDM_RUN_TARGET 1062
#define IDM_MKCLEAN 1063
#define IDM_MKF_BUILD 1064
#define IDM_RUN_CMD 1065
#define IDM_TEST 1070
#define IDM_HELP 1080
#define IDM_ABOUT 1081
#define ID_POPMENU 1100
#define ID_FIRSTCHILD 2000

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -0,0 +1,91 @@
[Project]
Signature = 40
NumFiles = 15
Compiler = mingw
BuildMakefile = 0
[Archives]
Directory = .\zip
Flags = *.prj .\bin\*.dll .\src\*.* .\include\*.h -x *.o
[Makefile]
MAKE = make
CC = g++
WRES = windres
TEST = gcc -v
Makefile = makefile
MakefileDir = .\src
Target = visual-mingw.exe
TargetDir = ..\bin
Build = 3
Debug = 0
Lang = 1
CppFlags = -D_WIN32_IE=0x0400
CcWarning = -W -Wall -pedantic
CcOptimize = -O2
CcFlags = -fvtable-thunks -fno-rtti
IncDirs = -I ../include
LdStrip = -s
LdOptions =
LdLibraries = -lcomctl32 -lole32
LdLibDirs =
[File1]
Name = .\src\ChangeLog
Show = 0
[File2]
Name = .\src\CList.cpp
Show = 0
[File3]
Name = .\src\CList.h
Show = 0
[File4]
Name = .\src\editor.cpp
Show = 0
[File5]
Name = .\src\editor.h
Show = 0
[File6]
Name = .\src\main.cpp
Show = 0
[File7]
Name = .\src\main.h
Show = 0
[File8]
Name = .\src\process.cpp
Show = 0
[File9]
Name = .\src\process.h
Show = 0
[File10]
Name = .\src\project.cpp
Show = 0
[File11]
Name = .\src\project.h
Show = 0
[File12]
Name = .\src\rsrc.h
Show = 0
[File13]
Name = .\src\rsrc.rc
Show = 0
[File14]
Name = .\src\winui.cpp
Show = 0
[File15]
Name = .\src\winui.h
Show = 0

View file

@ -0,0 +1,399 @@
/********************************************************************
* Module: rsrc.rc. This is part of Visual-MinGW.
*
* Purpose: Resource file.
*
* Authors: Manu B.
*
* License: Visual-MinGW is covered by GNU General Public License,
* Copyright (C) 2001 Manu B.
* See license.htm for more details.
*
* Revisions: 11/06/01.
*
********************************************************************/
// For Borland Resource Workshop. (It doesn't like windows.h)
#ifndef WORKSHOP_INVOKED
#include "windows.h"
#endif
#include "rsrc.h"
ID_MENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New" , IDM_NEW
MENUITEM "&Open" , IDM_OPEN
MENUITEM "&Close" , IDM_OPEN, GRAYED
MENUITEM SEPARATOR
MENUITEM "&New Project" , IDM_NEW_PROJECT
MENUITEM "&Open Project" , IDM_OPEN_PROJECT
MENUITEM "&Save Project" , IDM_SAVE_PROJECT
MENUITEM "&Close Project" , IDM_CLOSE_PROJECT
MENUITEM SEPARATOR
MENUITEM "&Save\tCtrl+S" , IDM_SAVE, GRAYED
MENUITEM "Save as" , IDM_SAVEAS, GRAYED
MENUITEM "&Save all" , IDM_SAVEALL
MENUITEM SEPARATOR
MENUITEM "Preferences" , IDM_PREFERENCES
MENUITEM "Page setup" , IDM_PAGESETUP, GRAYED
MENUITEM "&Print" , IDM_PRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Quit" , IDM_QUIT
END
POPUP "&Edit", GRAYED
BEGIN
MENUITEM "&Undo" , IDM_UNDO
MENUITEM "&Redo" , IDM_REDO
MENUITEM SEPARATOR
MENUITEM "&Cut" , IDM_CUT
MENUITEM "&Copy" , IDM_COPY
MENUITEM "&Paste" , IDM_PASTE
MENUITEM SEPARATOR
MENUITEM "&Select all" , IDM_SELECTALL
END
POPUP "&Find"
BEGIN
MENUITEM "&Search..." , IDM_FIND, GRAYED
MENUITEM "&Replace" , IDM_REPLACE, GRAYED
MENUITEM "Find in files" , IDM_GREP
END
POPUP "&Window", GRAYED
BEGIN
MENUITEM "&Cascade" , IDM_CASCADE
MENUITEM "Tile &Horizontal" , IDM_TILEHORZ
MENUITEM "Tile &Vertical" , IDM_TILEVERT
MENUITEM "Arrange &Icons" , IDM_ARRANGE
END
POPUP "&Project"
BEGIN
MENUITEM "&New Module" , IDM_NEW_MODULE
MENUITEM "&Add files" , IDM_ADD
MENUITEM "&Remove File" , IDM_REMOVE_FILE
MENUITEM "&Remove Module" , IDM_REMOVE_MODULE
MENUITEM "&Options" , IDM_OPTION
MENUITEM "&Create archive" , IDM_ZIP_SRCS
MENUITEM "&Explore" , IDM_EXPLORE
END
POPUP "&Build"
BEGIN
MENUITEM "&Build" , IDM_BUILD
MENUITEM "&Rebuild All" , IDM_REBUILDALL
MENUITEM "&Run" , IDM_RUN_TARGET
MENUITEM "&Make Clean" , IDM_MKCLEAN
MENUITEM "&Build Makefile" , IDM_MKF_BUILD
#ifdef DEBUG
MENUITEM "&Run command" , IDM_RUN_CMD
#endif
END
#ifdef DEBUG
POPUP "&Testing"
BEGIN
MENUITEM "a_new_procedure" , IDM_TEST
END
#endif
POPUP "&?"
BEGIN
MENUITEM "&Help" , IDM_HELP, GRAYED
MENUITEM "&About" , IDM_ABOUT
END
END
PopupMenu MENU
BEGIN
POPUP "&Editer"
BEGIN
MENUITEM "&Remove" , IDM_REMOVE_MODULE
END
END
STRINGTABLE DISCARDABLE
BEGIN
IDM_NEW "New"
IDM_OPEN "Open"
IDM_SAVE "Save"
IDM_CUT "Cut"
IDM_COPY "Copy"
IDM_PASTE "Paste"
IDM_UNDO "Undo"
IDM_REDO "Redo"
IDM_FIND "Search"
IDM_PRINT "Print"
END
IDB_TOOLBAR BITMAP DISCARDABLE "toolbar.bmp"
IDB_TREEVIEW BITMAP DISCARDABLE "treeview.bmp"
IDD_PREFERENCES DIALOG 0, 0, 283, 197
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Program Preferences"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Ok", IDOK, 115, 179, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 172, 179, 50, 14
CONTROL "", IDC_PREF_TABS, "SysTabControl32", 0x0 | WS_CLIPSIBLINGS, 4, 4, 275, 169
PUSHBUTTON "Apply", IDAPPLY, 229, 179, 50, 14, WS_DISABLED
END
// "NOT WS_POPUP" is a workaround for windres prior version 2.11.92.
// LCC's weditres doesn't recognize this flag.
IDD_ENVIRON DIALOG 0, 0, 259, 148
#ifdef __LCC__
STYLE DS_CONTROL | WS_CHILD
#else
STYLE DS_CONTROL | WS_CHILD | NOT WS_POPUP
#endif
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Path variable", IDC_STATIC, 3, 3, 252, 140
EDITTEXT IDC_CCBIN, 20, 26, 165, 12, ES_AUTOHSCROLL
AUTOCHECKBOX "Compiler bin directory", IDC_SET_CCBIN, 8, 16, 86, 10
PUSHBUTTON "Browse", IDC_BROWSE_CC, 197, 25, 45, 14
EDITTEXT IDC_CMDBIN, 20, 55, 165, 12, ES_AUTOHSCROLL
AUTOCHECKBOX "Default bin directory", IDC_SET_CMDBIN, 8, 45, 86, 10
PUSHBUTTON "Browse", IDC_BROWSE_CMD, 197, 54, 45, 14
AUTOCHECKBOX "Use default environment variables", IDC_AUTOEXEC, 8, 75, 125, 10
EDITTEXT IDC_ENV_VIEW, 8, 88, 242, 49, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY, WS_EX_TRANSPARENT
END
IDD_FIND DIALOG 0, 0, 236, 92
STYLE DS_MODALFRAME | WS_VISIBLE | DS_CENTER | DS_3DLOOK | WS_POPUP | WS_CAPTION
CAPTION "Find"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Fi&nd what:",-1,4,8,42,8
COMBOBOX IDC_FINDWHAT,47,7,128,50, WS_TABSTOP | CBS_DROPDOWN | CBS_AUTOHSCROLL
AUTOCHECKBOX "Match &whole word only", IDC_WHOLEWORD,4,26,100,10, WS_GROUP | WS_TABSTOP
AUTOCHECKBOX "Match &case", IDC_MATCHCASE,4,38,100,10, WS_GROUP | WS_TABSTOP
AUTOCHECKBOX "Regular &expression", IDC_REGEXP,4,50,100,10, WS_GROUP | WS_TABSTOP
AUTOCHECKBOX "Wrap aroun&d", IDC_WRAP,4,62,100,10, WS_GROUP | WS_TABSTOP
AUTOCHECKBOX "Transform &backslash expressions", IDC_UNSLASH,4,74,150,10, WS_GROUP | WS_TABSTOP
GROUPBOX "Direction",1072,107,26,68,28,WS_GROUP
AUTORADIOBUTTON "&Up",IDC_DIRECTIONUP,111,38,25,12, WS_GROUP
AUTORADIOBUTTON "&Down",IDC_DIRECTIONDOWN,138,38,35,12
DEFPUSHBUTTON "&Find Next",IDOK,182,5,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,182,23,50,14
END
IDD_REPLACE DIALOG 0, 0, 260, 108
STYLE DS_MODALFRAME | WS_VISIBLE | DS_CENTER | DS_3DLOOK | WS_POPUP | WS_CAPTION
CAPTION "Replace"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Fi&nd what:",-1,4,9,48,8
COMBOBOX IDC_FINDWHAT,54,7,114,50,WS_TABSTOP | CBS_DROPDOWN | CBS_AUTOHSCROLL
LTEXT "Re&place with:",-1,4,26,48,8
COMBOBOX IDC_REPLACEWITH,54,24,114,50,WS_TABSTOP | CBS_DROPDOWN | CBS_AUTOHSCROLL
AUTOCHECKBOX "Match &whole word only", IDC_WHOLEWORD,4,44,100,10, WS_GROUP | WS_TABSTOP
AUTOCHECKBOX "Match &case", IDC_MATCHCASE,4,56,100,10, WS_GROUP | WS_TABSTOP
AUTOCHECKBOX "Regular &expression", IDC_REGEXP,4,68,100,10, WS_GROUP | WS_TABSTOP
AUTOCHECKBOX "Wrap aroun&d", IDC_WRAP,4,80,100,10, WS_GROUP | WS_TABSTOP
AUTOCHECKBOX "Transform &backslash expressions", IDC_UNSLASH,4,92,150,10, WS_GROUP | WS_TABSTOP
DEFPUSHBUTTON "&Find Next",IDOK,174,4,80,14,WS_GROUP
PUSHBUTTON "&Replace",IDC_REPLACE,174,21,80,14
PUSHBUTTON "Replace &All",IDC_REPLACEALL,174,38,80,14
PUSHBUTTON "Replace in &Selection",IDC_REPLACEINSEL,174,55,80,14
PUSHBUTTON "Close",IDCANCEL,174,72,80,14
END
IDD_GREP DIALOG 26, 41, 226, 66
STYLE DS_MODALFRAME | DS_CENTER | DS_3DLOOK | WS_POPUP | WS_CAPTION
CAPTION "Find in Files"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Fi&nd what:", IDC_STATIC, 5, 8, 35, 8, NOT WS_GROUP
COMBOBOX IDC_FINDWHAT, 40, 7, 120, 50, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
LTEXT "F&iles:", IDC_STATIC, 5, 28, 30, 8, NOT WS_GROUP
COMBOBOX IDC_GFILTER, 40, 27, 120, 50, CBS_DROPDOWN | WS_BORDER | WS_TABSTOP
LTEXT "&Directory:", IDC_STATIC, 5, 48, 30, 8, NOT WS_GROUP
DEFPUSHBUTTON "&Find", IDOK, 168, 6, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 168, 26, 50, 14
COMBOBOX 138, 40, 47, 120, 50, CBS_DROPDOWN | WS_BORDER | WS_TABSTOP
PUSHBUTTON "Browse", IDC_GBROWSE, 168, 46, 50, 14
END
IDD_OPTION DIALOGEX 0, 0, 252, 202
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
CAPTION "Project options"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "", IDC_OPTION_TABS, "SysTabControl32", 0x8000, 4, 5, 244, 173
PUSHBUTTON "Ok", IDOK, 79, 184, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 141, 184, 50, 14
PUSHBUTTON "Help", IDC_HELP_BTN, 198, 184, 50, 14
END
IDD_GENERAL_PANE DIALOG 0, 0, 230, 139
#ifdef __LCC__
STYLE DS_CONTROL | WS_CHILD
#else
STYLE DS_CONTROL | WS_CHILD | NOT WS_POPUP
#endif
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Build what ?", IDC_STATIC, 5, 3, 107, 79
AUTORADIOBUTTON "Static library", IDC_STATLIB, 12, 15, 59, 10, WS_GROUP | WS_TABSTOP
AUTORADIOBUTTON "Dll", IDC_DLL, 12, 28, 59, 10
AUTORADIOBUTTON "Console executable", IDC_CONSOLE, 12, 41, 78, 10
AUTORADIOBUTTON "GUI executable", IDC_GUIEXE, 12, 54, 65, 10
AUTOCHECKBOX "Generate debug symbols", IDC_DBGSYM, 12, 67, 97, 10
GROUPBOX "Language", IDC_STATIC, 5, 86, 107, 46
AUTORADIOBUTTON "C", IDC_LANGC, 12, 101, 25, 10, WS_GROUP | WS_TABSTOP
AUTORADIOBUTTON "C++", IDC_LANGCPP, 12, 114, 29, 10
GROUPBOX "Makefile", IDC_STATIC, 120, 3, 104, 67
LTEXT "Name", IDC_STATIC, 124, 18, 23, 9
EDITTEXT IDC_MKF_NAME, 156, 16, 61, 12, ES_AUTOHSCROLL
LTEXT "Directory", IDC_STATIC, 124, 35, 30, 9
EDITTEXT IDC_MKF_DIR, 156, 33, 61, 12, ES_AUTOHSCROLL
AUTOCHECKBOX "User makefile", IDC_USER_MKF, 125, 52, 62, 10, WS_DISABLED
GROUPBOX "Output file", IDC_STATIC, 120, 76, 104, 56
LTEXT "Name", IDC_STATIC, 124, 95, 23, 9
EDITTEXT IDC_TGT_NAME, 156, 93, 61, 12, ES_AUTOHSCROLL
LTEXT "Directory", 133, 123, 112, 30, 9
EDITTEXT IDC_TGT_DIR, 156, 110, 61, 12, ES_AUTOHSCROLL
END
IDD_COMPILER DIALOG 0, 0, 230, 139
#ifdef __LCC__
STYLE DS_CONTROL | WS_CHILD
#else
STYLE DS_CONTROL | WS_CHILD | NOT WS_POPUP
#endif
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Compiler options", IDC_STATIC, 17, 11, 194, 111
LTEXT "Preprocessor", IDC_STATIC, 22, 25, 46, 9
EDITTEXT IDC_CPPFLAGS, 67, 24, 138, 12, ES_AUTOHSCROLL
LTEXT "Warning", IDC_STATIC, 22, 42, 31, 9
EDITTEXT IDC_WARNING, 67, 40, 138, 12, ES_AUTOHSCROLL
LTEXT "Optimization", IDC_STATIC, 22, 58, 42, 9
EDITTEXT IDC_OPTIMIZ, 67, 56, 138, 12, ES_AUTOHSCROLL
LTEXT "C/C++", IDC_STATIC, 23, 73, 24, 9
EDITTEXT IDC_CFLAGS, 67, 72, 138, 12, ES_AUTOHSCROLL
LTEXT "Include directories", IDC_STATIC, 22, 92, 61, 9
EDITTEXT IDC_INCDIRS, 22, 101, 183, 12, ES_AUTOHSCROLL
END
IDD_LINKER DIALOG 0, 0, 230, 139
#ifdef __LCC__
STYLE DS_CONTROL | WS_CHILD
#else
STYLE DS_CONTROL | WS_CHILD | NOT WS_POPUP
#endif
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Linker", IDC_STATIC, 17, 16, 194, 103
LTEXT "Strip", IDC_STATIC, 23, 37, 18, 9
EDITTEXT IDC_LDSTRIP, 53, 36, 53, 12, ES_AUTOHSCROLL
LTEXT "Options", IDC_STATIC, 23, 53, 29, 9
EDITTEXT IDC_LDOPTS, 53, 52, 151, 12, ES_AUTOHSCROLL
LTEXT "Libraries", IDC_STATIC, 23, 69, 34, 9
EDITTEXT IDC_LDLIBS, 53, 68, 151, 12, ES_AUTOHSCROLL
LTEXT "Library directories", IDC_STATIC, 23, 88, 61, 9
EDITTEXT IDC_LIBDIRS, 22, 98, 182, 12, ES_AUTOHSCROLL
END
IDD_ZIP DIALOG 0, 0, 230, 139
#ifdef __LCC__
STYLE DS_CONTROL | WS_CHILD
#else
STYLE DS_CONTROL | WS_CHILD | NOT WS_POPUP
#endif
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Archiver", 304, 15, 7, 87, 58
AUTORADIOBUTTON "Info-ZIP", IDC_INFOZIP, 20, 17, 39, 10, WS_GROUP
AUTORADIOBUTTON "Tar/Gzip", IDC_TAR_GZIP, 20, 32, 46, 10, WS_DISABLED
AUTORADIOBUTTON "Tar/Bz2", IDC_TAR_BZ2, 20, 47, 44, 10, WS_DISABLED
GROUPBOX "Output File", IDC_STATIC, 15, 71, 195, 56
LTEXT "Directory", IDC_STATIC, 21, 86, 30, 9
EDITTEXT IDC_ZIP_DIR, 56, 84, 61, 12, ES_AUTOHSCROLL
LTEXT "Options", IDC_STATIC, 21, 109, 29, 9
EDITTEXT IDC_ZIPFLAGS, 51, 108, 151, 12, ES_AUTOHSCROLL
GROUPBOX "Date format", 207, 112, 7, 97, 58
AUTORADIOBUTTON "mmddyyyy", 208, 117, 17, 53, 10
AUTORADIOBUTTON "ddmmyyyy", 209, 117, 32, 49, 10, WS_DISABLED
AUTORADIOBUTTON "yyyymmdd", 211, 117, 47, 50, 10, WS_DISABLED
END
IDD_NEW_MODULE DIALOG 226, 122, 142, 39
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "New module"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT 301, 6, 4, 84, 12, ES_AUTOHSCROLL
AUTOCHECKBOX "Create header", IDC_HEADER, 21, 22, 58, 10
PUSHBUTTON "Ok", IDOK, 97, 3, 40, 14
PUSHBUTTON "Cancel", IDCANCEL, 97, 22, 40, 14
END
IDD_ABOUT DIALOG 14, 26, 200, 78
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About this software..."
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "&OK", IDOK, 140, 18, 50, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
ICON 500, IDC_STATIC, 16, 24, 18, 20, WS_GROUP
GROUPBOX "Informations", IDC_STATIC, 4, 3, 192, 70
LTEXT "Version 0.42a", IDC_STATIC, 57, 15, 67, 52
END
IDD_COMMAND DIALOG 0, 0, 216, 45
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog Title"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Command line", IDC_STATIC, 5, 8, 48, 9
EDITTEXT IDC_CMDLINE, 59, 7, 148, 12, ES_AUTOHSCROLL
PUSHBUTTON "Enter", IDOK, 157, 25, 50, 14
END
ACCELS ACCELERATORS
BEGIN
"S", IDM_SAVE, VIRTKEY, CONTROL
END
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,43,0,0
PRODUCTVERSION 0,43,0,0
FILEFLAGSMASK 0x3fL
#ifdef DEBUG
FILEFLAGS VS_FF_PRERELEASE
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "04090000"
BEGIN
VALUE "CompanyName", "Visual-MinGW project\0"
VALUE "FileDescription", "Visual-MinGW\0"
VALUE "FileVersion", FULL_APP_VERSION
VALUE "InternalName", "visual-mingw\0"
VALUE "LegalCopyright", "Copyright (C) 2001 Manu B\0"
VALUE "OriginalFilename", "visual-mingw.exe\0"
VALUE "ProductName", "Visual-MinGW\0"
VALUE "ProductVersion", FULL_APP_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 0
END
END

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,529 @@
/********************************************************************
* Module: winui.h. This is part of WinUI.
*
* License: WinUI is covered by GNU General Public License,
* Copyright (C) 2001 Manu B.
* See license.htm for more details.
*
********************************************************************/
#ifndef WINUI_H
#define WINUI_H
/* These are patched headers */
#include "commdlg.h"
#include "commctrl.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// OLE.
#include <shlobj.h>
#include "CList.h"
#define SPLSTYLE_HORZ 0
#define SPLSTYLE_VERT 1
#define SPLMODE_1 0
#define SPLMODE_2 1
char *StpCpy(char *dest, const char *src);
size_t strcpylen(char *dest, const char *src);
void SplitFileName(char * dirName, char * fileName);
bool ChangeFileExt(char * fileName, char * ext);
class CMessageBox
{
public:
CMessageBox();
~CMessageBox();
void SetParent(HWND hwnd);
void SetCaption(char * string);
void DisplayString(char * string, char * substring = NULL, UINT uType = MB_OK);
void DisplayWarning(char * string, char * substring = NULL);
void DisplayFatal(char * string, char * substring = NULL);
void DisplayLong(long number);
void DisplayRect(RECT * rect);
int Ask(char * question, bool canCancel);
int AskToSave(bool canCancel);
protected:
HWND hParent;
char msgBuf[256];
char caption[64];
private:
};
class CPath
{
public:
CPath();
~CPath();
bool ChangeDirectory(char * dir);
protected:
private:
char pathBuf[MAX_PATH];
};
class CWindow
{
public:
CWindow();
virtual ~CWindow();
virtual HWND CreateEx(CWindow * pWindow, DWORD dwExStyle,
LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y,
int nWidth, int nHeight, HMENU hMenu, LPVOID lpParam);
HWND GetId(void);
LONG SetLong(int nIndex, LONG dwNewLong);
LONG GetLong(int nIndex);
LRESULT SendMessage(UINT msg, WPARAM wParam = 0, LPARAM lParam = 0);
virtual bool SetPosition(HWND hInsertAfter, int x, int y, int width, int height, UINT uFlags);
virtual bool Show(int nCmdShow = SW_SHOWNORMAL);
virtual bool Hide(void);
HWND SetFocus(void);
CWindow * _pParent;
HWND _hWnd;
HINSTANCE _hInst;
LPVOID _lParam;
protected:
private:
};
class CWinBase : public CWindow
{
public:
CWinBase();
~CWinBase();
HINSTANCE hPrevInst;
LPSTR lpCmdLine;
int nCmdShow;
char appName[64];
char msgBuf[256];
bool isWinNT;
bool Init(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow);
bool SetName(char * name, char * version = NULL);
void ParseCmdLine(char * outBuff);
bool IsWinNT(void);
bool ChangeDirectory(char * dir);
protected:
private:
};
class CSDIBase : public CWinBase
{
public:
CSDIBase();
virtual ~CSDIBase();
virtual int Run(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
virtual bool CustomInit(void);
virtual bool Release(void);
virtual bool CreateUI(void);
bool MainRegisterEx(const char * className);
virtual LRESULT CALLBACK CMainWndProc(UINT Message, WPARAM wParam, LPARAM lParam);
protected:
WNDCLASSEX wc;
HACCEL hAccel;
char mainClass[16];
private:
};
class CMDIChild;
class CMDIClient : public CWindow
{
public:
CMDIClient();
~CMDIClient();
void Init(int menuIndex, UINT idFirstChild);
HWND CreateEx(CWindow * pWindow, DWORD dwExStyle, DWORD dwStyle = WS_CHILD, UINT resId = 0);
LPARAM GetParam(LPARAM lParam);
bool initialized;
char childClass[16];
CList childList;
protected:
CLIENTCREATESTRUCT ccs;
int nPos;
private:
};
class UseOle
{
public:
UseOle(){oleError = OleInitialize(NULL);}
~UseOle(){OleUninitialize();}
HRESULT GetError(void){return oleError;}
protected:
HRESULT oleError;
private:
};
class CMDIBase : public CSDIBase
{
public:
CMDIBase();
virtual ~CMDIBase();
virtual int Run(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
virtual bool CustomInit(void);
virtual bool Release(void);
virtual bool CreateUI(void);
bool ChildRegisterEx(const char * className);
virtual LRESULT CALLBACK CMainWndProc(UINT Message, WPARAM wParam, LPARAM lParam);
virtual LRESULT CALLBACK CChildWndProc(CWindow * pWnd, UINT Message, WPARAM wParam, LPARAM lParam);
CMDIClient MdiClient;
protected:
UseOle useOle;
private:
};
class CMDIChild : public CNode, public CWindow
{
public:
CMDIChild();
virtual ~CMDIChild();
HWND CreateEx(CMDIClient * pMdiClient, DWORD dwExStyle, DWORD dwStyle, char * caption, UINT resId = 0, LPVOID lParam = NULL);
CMDIBase * _pFrame;
protected:
private:
};
class CFileDlgBase : public CWindow
{
public:
CFileDlgBase();
~CFileDlgBase();
void Reset(void);
void SetData(char * filter, char * defExt, DWORD flags);
void SetTitle(char * title);
void SetFilterIndex(DWORD filterIndex);
void SetFilter(char * filter);
void SetDefExt(char * defExt);
void SetFlags(DWORD flags);
void SetInitialDir(char * lpstrInitialDir);
WORD GetFileOffset(void);
WORD GetFileExtension(void);
WORD GetNextFileOffset(void);
bool OpenFileName(CWindow * pWindow, char * pszFileName, DWORD nMaxFile);
bool SaveFileName(CWindow * pWindow, char * pszFileName, DWORD nMaxFile);
OPENFILENAME ofn;
protected:
WORD nNextFileOffset;
private:
};
class CDlgBase : public CWindow
{
public:
CDlgBase();
virtual ~CDlgBase();
HWND Create(CWindow * pWindow, WORD wResId, RECT * Pos, LPARAM lParam);
int CreateModal(CWindow * pWindow, WORD wResId, LPARAM lParam);
HWND CreateParam(CWindow * pWindow, WORD wResId, LPARAM lParam);
BOOL EndDlg(int nResult);
virtual LRESULT CALLBACK CDlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
HWND GetItem(int nIDDlgItem);
BOOL SetItemText(HWND hItem, LPCTSTR lpString);
UINT GetItemText(HWND hItem, LPTSTR lpString, int nMaxCount);
/* BOOL SetItemInt(HWND hItem, UINT uValue, BOOL bSigned);
UINT GetItemInt(HWND hItem, BOOL *lpTranslated, BOOL bSigned);
*/
protected:
private:
};
class CTabbedDlg : public CDlgBase
{
public:
CTabbedDlg();
virtual ~CTabbedDlg();
virtual void OnNotify(int idCtrl, LPNMHDR notify);
virtual void OnSelChanging(LPNMHDR notify);
virtual void OnSelChange(LPNMHDR notify);
virtual bool SetChildPosition(HWND hChild);
protected:
LPARAM GetParam(void);
HWND _hWndTab;
RECT Pos;
TCITEM tcitem;
private:
};
class CToolBar : public CWindow
{
public:
CToolBar();
~CToolBar();
HWND CreateEx(CWindow * pWindow, DWORD dwExStyle, DWORD dwStyle = WS_CHILD, UINT resId = 0);
LRESULT AddBitmap(UINT resId, int nBmp, HINSTANCE hInstance = 0);
BOOL AddButtons(TBBUTTON * tbButtons, UINT numButtons);
protected:
private:
};
class CBitmap
{
public:
CBitmap();
~CBitmap();
HBITMAP Load(CWindow * pWindow, LPCTSTR lpBitmapName);
HBITMAP Load(CWindow * pWindow, WORD wResId);
BOOL Destroy(void);
HBITMAP hBitmap;
protected:
private:
};
class CImageList
{
public:
CImageList();
~CImageList();
HIMAGELIST Create(int cx, int cy, UINT flags, int cInitial, int cGrow);
int AddMasked(CBitmap * pBitmap, COLORREF crMask);
HIMAGELIST GetId(void){return hImgList;};
protected:
HIMAGELIST hImgList;
private:
};
class CTabCtrl : public CWindow
{
public:
CTabCtrl();
~CTabCtrl();
HWND CreateEx(CWindow * pWindow, DWORD dwExStyle, DWORD dwStyle = WS_CHILD, UINT resId = 0, LPVOID lParam = NULL);
BOOL SetItem_Param(int iItem, LPARAM lParam);
LPARAM GetItem_Param(int iItem);
int GetCurSel(void);
int InsertItem(int iItem, UINT mask, DWORD dwState, DWORD dwStateMask,
LPTSTR pszText, int cchTextMax, int iImage, LPARAM lParam);
protected:
TCITEM tcitem;
private:
};
class CTreeView : public CWindow
{
public:
CTreeView();
~CTreeView();
TVINSERTSTRUCT tvi;
TVITEM _TvItem;
HWND CreateEx(CWindow * pWindow, DWORD dwExStyle, DWORD dwStyle = WS_CHILD, UINT resId = 0, LPVOID lParam = NULL);
HTREEITEM CreateItem(HTREEITEM hParent, HTREEITEM hInsertAfter, int iImage, LPTSTR pszText, LPARAM lParam);
LPARAM GetSelectedItemParam(void);
protected:
private:
};
class CScintilla : public CWindow
{
public:
CScintilla();
~CScintilla();
HWND CreateEx(CWindow * pWindow, DWORD dwExStyle, DWORD dwStyle = WS_CHILD, UINT resId = 0, LPVOID lParam = NULL);
protected:
private:
};
class CListView : public CWindow
{
public:
CListView();
~CListView();
HWND CreateEx(CWindow * pWindow, DWORD dwExStyle, DWORD dwStyle = WS_CHILD, UINT resId = 0);
void Clear(void);
protected:
DWORD lastRow;
private:
};
class CStatusBar : public CWindow
{
public:
CStatusBar();
~CStatusBar();
HWND CreateEx(CWindow * pWindow, DWORD dwExStyle, DWORD dwStyle = WS_CHILD, UINT resId = 0);
void SetParts(int nParts, int * aWidths);
void WriteString(char * string, int part);
void WriteLong(long number, int part);
protected:
private:
int numParts;
};
class CSplitter : public CWindow
{
public:
CSplitter();
~CSplitter();
void Init(CWindow * pane1, CWindow * pane2, bool vertical,
int barPos, int barMode);
bool SetPosition(HWND hInsertAfter, int x, int y, int width, int height, UINT uFlags);
bool Show(int nCmdShow = SW_SHOWNORMAL);
bool Hide(void);
bool HaveMouse(HWND hwnd, short xPos, short yPos);
void Move(int mouseX, int mouseY);
bool OnLButtonDown(HWND hwnd, short xPos, short yPos);
void OnMouseMove(HWND hwnd, short xPos, short yPos);
void OnLButtonUp(HWND hwnd, short xPos, short yPos);
bool OnSetCursor(HWND hwnd, LPARAM lParam);
protected:
void SetVertPosition(void);
void SetHorzPosition(void);
void DrawXorBar(HDC hdc, int x1, int y1, int width, int height);
void ClientToWindow(HWND hwnd, POINT * pt, RECT * rect);
CWindow * Pane1;
CWindow * Pane2;
int p;
int size;
int psize;
bool isVertical;
int mode;
bool isActive;
RECT pos;
RECT barPos;
int deltaPos;
POINT initialXorPos;
POINT initialPos;
POINT newPos;
private:
bool initialized;
};
#define MAX_BLOC_SIZE 16384
class CIniFile
{
public:
CIniFile();
~CIniFile();
bool Load(char * fullPath);
void Close(void);
bool GetString(char * data, char * key, char * section = NULL);
int GetInt(char * key, char * section = NULL);
protected:
private:
char * buffer;
char * pcurrent;
char * psection;
bool FindSection(char * pcurrent, char * section);
bool FindData(char * s, char * key, char * data);
long CopyData(char * data, char * s);
char *SkipUnwanted(char *s);
};
class CChrono
{
public:
CChrono();
~CChrono();
void Start(void);
DWORD Stop(void);
protected:
DWORD _time;
private:
};
class CShellDlg
{
public:
CShellDlg();
~CShellDlg();
bool BrowseForFolder(CWindow * pWindow, LPSTR pszDisplayName, LPCSTR lpszTitle,
UINT ulFlags, BFFCALLBACK lpfn=0, LPARAM lParam=0, int iImage=0);
protected:
IMalloc* pMalloc;
BROWSEINFO bi;
private:
};
class CCriticalSection
{
public:
CCriticalSection();
~CCriticalSection();
void Enter();
void Leave();
private:
CRITICAL_SECTION cs;
};
#endif