20000509-22:27 GMT+2 Maurilio Longo <maurilio.longo@libero.it>

This commit is contained in:
Maurilio Longo
2000-05-09 20:32:51 +00:00
parent cca893bb9d
commit e820d6adeb
3 changed files with 99 additions and 29 deletions

View File

@@ -1,3 +1,10 @@
20000509-22:27 GMT+2 Maurilio Longo <maurilio.longo@libero.it>
* source/rtl/teditor.prg
+ added a few methods and a new class to support (someday) soft CR
* source/rtl/memoedit.prg
* changed to simulate a K_CTRL_W as LastKey() after a MemoEdit() call
20000509-00:15 GMT-8 Ron Pinkas <Ron@Profit-Master.com>
* source/compiler/hbpcode.c
@@ -20,9 +27,9 @@
* include/hbcomp.h
+ Added :
#define VT_OFFSET_BYREF 60
#define VT_OFFSET_VARIANT 90
#define VT_OFFSET_OPTIONAL 90
#define VT_OFFSET_BYREF 60
#define VT_OFFSET_VARIANT 90
#define VT_OFFSET_OPTIONAL 90
* source/compiler/harbour.c
* Minor cleanup in hb_compVariableAdd()
@@ -198,23 +205,23 @@ The follow is mission from previus session
*source/common/expropt1.c
*source/macro/macro.y
*source/vm/macro.c
* added int exprType for HB_MACRO structure
* TYPE( "{|| NotLinked()}" ) returns now 'B' instead of 'UI'
* added int exprType for HB_MACRO structure
* TYPE( "{|| NotLinked()}" ) returns now 'B' instead of 'UI'
20000505-17:53 GMT+1 Ryszard Glab <rglab@imid.med.pl>
*include/hbcomp.h
*source/compiler/harbour.c
*moved declaration of hb_compVariableGetPos into the header file
*moved declaration of hb_compVariableGetPos into the header file
*source/compiler/harbour.c
* fixed generation of line number pcode at the beginning of
a function
* fixed generation of line number pcode at the beginning of
a function
*source/compiler/hbpcode.c
* fixed non-standard escape sequence "\]" (gcc warnings)
* fixed incorrect number of parameters passed to sprintf
* fixed non-standard escape sequence "\]" (gcc warnings)
* fixed incorrect number of parameters passed to sprintf
20000505-10:47 GMT+2 Maurilio Longo <maurilio.longo@libero.it>

View File

@@ -37,6 +37,7 @@
Needs a lot more work to become */
#include "common.ch"
#include "inkey.ch"
FUNCTION MemoEdit(cString,;
nTop, nLeft,;
@@ -71,6 +72,9 @@ FUNCTION MemoEdit(cString,;
oEd:Edit()
if oEd:lSaved
cString := oEd:GetText()
// dbu tests for LastKey() == K_CTRL_END, so I try to make it happy
KEYBOARD K_CTRL_END
Inkey()
endif
endif

View File

@@ -41,6 +41,18 @@
#include "inkey.ch"
#include "setcurs.ch"
CLASS TTextLine
DATA cText // A line of text
DATA lSoftCR // true if line doesn't end with a HB_OSNewLine() char (word wrapping)
METHOD New(cLine, lSoftCR)
ENDCLASS
CLASS TEditor
DATA cFile INIT "" // name of file being edited
@@ -68,6 +80,13 @@ CLASS TEditor
DATA nWordWrapCol INIT 0 // At which column word wrapping occurs
METHOD New(cString, nTop, nLeft, nBottom, nRight, lEditMode, cUdF, nLineLength, nTabSize)
METHOD AddLine(cLine, lSoftCR)
METHOD InsertLine(cLine, lSoftCR, nRow)
METHOD RemoveLine(nRow)
METHOD GetLine(nRow)
//METHOD SetLine(cLine, lSoftCR, nRow)
METHOD GetText() // Returns aText as a string (for MemoEdit())
METHOD RefreshWindow()
METHOD RefreshLine()
@@ -78,49 +97,49 @@ CLASS TEditor
ENDCLASS
/*
METHOD New(cFile, nTop, nLeft, nBottom, nRight) CLASS TEditor
LOCAL oFile := TFileRead():New(cFile)
oFile:Open()
if oFile:Error()
Alert(oFile:ErrorMsg("FileRead: "))
else
while oFile:MoreToRead()
AAdd(::aText, oFile:ReadLine())
end while
oFile:Close()
METHOD New(cLine, lSoftCR) CLASS TTextLine
::cText := iif(Empty(cLine), "", cLine)
::lSoftCR := iif(Empty(lSoftCR), .F., lSoftCR)
return Self
*/
// Converts a string to an array of strings splitting input string at EOL boundaries
STATIC function Text2Array(cString)
LOCAL cLine, i, nLastEOL, aArray
LOCAL cLine, i, nLastEOL, aArray, cEOL, nEOLLen
nLastEOL := 1
aArray := {}
cEOL := HB_OSNewLine()
nEOLLen := Len(cEOL)
while nLastEOL > 0
cLine := Left(cString, (nLastEOL := at(HB_OSNewLine(), cString)) - 1)
cLine := StrTran(cLine, HB_OSNewLine(), "")
cLine := Left(cString, (nLastEOL := At(cEOL, cString)) - 1)
if nLastEOL > 0
AAdd(aArray, cLine)
nLastEOL += Len(HB_OSNewLine())
cString := SubStr(cString, nLastEOL)
AAdd(aArray, StrTran(cLine, Chr(9), " "))
cString := SubStr(cString, nLastEOL + nEOLLen)
else
if !Empty(cString)
AAdd(aArray, cString)
endif
endif
enddo
return aArray
// Converts an array of text lines to a String
METHOD GetText() CLASS TEditor
LOCAL cString := ""
LOCAL cEOL := HB_OSNewLine()
AEval(::aText, {|cItem| cString += cItem + HB_OSNewLine() })
AEval(::aText, {|cItem| cString += cItem + cEOL })
return cString
@@ -169,6 +188,46 @@ METHOD New(cString, nTop, nLeft, nBottom, nRight, lEditMode, cUdF, nLineLength,
return Self
// Add a new Line of text at end of current text
METHOD AddLine(cLine, lSoftCR) CLASS TEditor
AAdd(::aText, TTextLine():New(cLine, lSoftCR))
::naTextLen++
return Self
// Insert a line of text at a defined row
METHOD InsertLine(cLine, lSoftCR, nRow) CLASS TEditor
::AddLine("", .F.)
::AIns(::aText, nRow)
::aText[nRow] := TTextLine():New(cLine, lSoftCR)
return Self
// Remove a line of text
METHOD RemoveLine(nRow) CLASS TEditor
ADel(::aText, nRow)
ASize(::aText, --::naTextLen)
return Self
// Return line n of text
METHOD GetLine(nRow) CLASS TEditor
if nRow <= ::naTextLen .AND. nRow > 0
return ::aText[nRow]:cText
else
return ""
endif
return Self
// Redraws a screenfull of text (or part of it if nFromRow is not nil)
METHOD RefreshWindow() CLASS TEditor