2011-08-23 17:28 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbcuied/cu_object.prg
  * contrib/hbcuied/cu_utlty.prg
  * contrib/hbcuied/hbcuied.ch
    + Implemented: K_HOME places the cursor to zero column of the screen.
                   K_END  places the cursor to next column of last 
                          object on that row.
                   Alt_N  Inserts blank row at current cursor position.
                          All objects on/after that row are moved one row down.
                   Alt_O  Delets current row. All objects on that row 
                          are also delted. Subsequent objects are moved 
                          one row up.
    + Added: help screens <General> containing info about the designer.
    * Updated: help screen <Keys> with latest changes.
This commit is contained in:
Pritpal Bedi
2011-08-24 00:37:20 +00:00
parent 736653320c
commit c776918cd5
4 changed files with 263 additions and 204 deletions

View File

@@ -16,6 +16,21 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-08-23 17:28 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbcuied/cu_object.prg
* contrib/hbcuied/cu_utlty.prg
* contrib/hbcuied/hbcuied.ch
+ Implemented: K_HOME places the cursor to zero column of the screen.
K_END places the cursor to next column of last
object on that row.
Alt_N Inserts blank row at current cursor position.
All objects on/after that row are moved one row down.
Alt_O Delets current row. All objects on that row
are also delted. Subsequent objects are moved
one row up.
+ Added: help screens <General> containing info about the designer.
* Updated: help screen <Keys> with latest changes.
2011-08-23 08:08 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbcuied/cu_object.prg
* contrib/hbcuied/cu_utlty.prg

View File

@@ -119,7 +119,7 @@ CLASS hbCUIEditor
DATA nObjHilite INIT 0
DATA nObjSelected INIT 0
DATA cRuler INIT ""
DATA cDrawFill INIT "±±±±±±±±±"
DATA cDrawFill INIT "°°°°°°°°°" //"±±±±±±±±±"
DATA aObjId INIT { 'Bitmap','Line','Text','Field','Expression','BitMap' }
DATA xRefresh INIT OBJ_REFRESH_ALL
DATA nObjCopied INIT 0
@@ -405,7 +405,7 @@ METHOD hbCUIEditor:scrBuildFromBuffer( cBuffer, cScreen )
o_[ OBJ_TEXT ] := s
ENDIF
o_[ OBJ_TO_ROW ] := o_[ OBJ_ROW ]
o_[ OBJ_TO_COL ] := o_[ OBJ_COL ] + len( s )
o_[ OBJ_TO_COL ] := o_[ OBJ_COL ] + len( s ) - 1
o_[ OBJ_F_LEN ] := len( s )
EXIT
@@ -438,7 +438,7 @@ METHOD hbCUIEditor:scrBuildFromBuffer( cBuffer, cScreen )
o_[ OBJ_ROW ] := val( alltrim( a_[ 1 ] ) ) + 1
o_[ OBJ_COL ] := val( alltrim( a_[ 2 ] ) ) + 1
o_[ OBJ_TO_ROW ] := o_[ OBJ_ROW ]
o_[ OBJ_TO_COL ] := o_[ OBJ_COL ] + aAttr[ 4 ]
o_[ OBJ_TO_COL ] := o_[ OBJ_COL ] + aAttr[ 4 ] - 1
o_[ OBJ_F_TYPE ] := aAttr[ 3 ]
o_[ OBJ_F_LEN ] := aAttr[ 4 ]
o_[ OBJ_F_DEC ] := aAttr[ 5 ]
@@ -737,7 +737,7 @@ METHOD hbCUIEditor:scrConfig()
NEXT
::cRuler := s
::cDrawFill := '±±±±±±±±±'
::cDrawFill := "°°°°°°°°°" // 176 "±±±±±±±±±" 177
::aObjId := { 'Bitmap','Line','Text','Field','Expression','BitMap' }
::xRefresh := OBJ_REFRESH_ALL
::nObjCopied := 0
@@ -798,7 +798,7 @@ METHOD hbCUIEditor:scrAddPrp( sct_ )
//----------------------------------------------------------------------//
METHOD hbCUIEditor:operate()
LOCAL nObj
LOCAL nObj, nToCol, i, nOff
LOCAL grf_:= { 43,45,46,48,49,50,51,52,53,54,55,56,57 }
readinsert( .t. )
@@ -872,9 +872,20 @@ METHOD hbCUIEditor:operate()
::nColDis := ::nLeft - 1
::xRefresh := OBJ_REFRESH_ALL
CASE ::nLastKey == K_END
::nColRep := ::nColsMax
::nColCur := ::nRight
::nColDis := ( ::nLeft - 1 ) - ( ::nColRep - ( ::nRight - ::nLeft + 1 ) )
nToCol := 0
ascan( ::obj_, {|e_| iif( e_[ OBJ_ROW ] == ::nRowRep, nToCol := max( nToCol, e_[ OBJ_TO_COL ] ), NIL ) } )
IF nToCol > 0
IF nToCol < ::nColRep
nOff := ::nColRep - nToCol - 1
FOR i := 1 TO nOff
::scrMovLft()
NEXT
ELSEIF nToCol > ::nColRep
FOR i := ::nColRep TO nToCol
::scrMovRgt()
NEXT
ENDIF
ENDIF
::xRefresh := OBJ_REFRESH_ALL
CASE ::nLastKey == K_PGUP
// scrMovPgUp(scn_)
@@ -915,6 +926,7 @@ METHOD hbCUIEditor:operate()
::scrAddBox()
CASE ::nLastKey == K_F10 // Fields
::scrAddFld()
CASE ::nLastKey == K_DEL
IF ! empty( ::aTextBlock )
::scrTextDel()
@@ -936,7 +948,6 @@ METHOD hbCUIEditor:operate()
::nObjHilite := 0
::xRefresh := OBJ_REFRESH_ALL
ENDIF
CASE ::nLastKey == K_BS
IF ::nMode <> OBJ_MODE_SELECT
IF ::scrMovLft()
@@ -948,23 +959,26 @@ METHOD hbCUIEditor:operate()
CASE ::nLastKey == K_ALT_N
::scrAddLine()
::lEdited := .t.
CASE ::nLastKey == K_ALT_O
::scrDelLine()
::lEdited := .t.
CASE ::nLastKey == K_ALT_W
::scrRepCol()
//::scrRepCol()
CASE ::nLastKey == K_CTRL_F6 // Selection of Block
::scrTextBlock()
CASE ::nLastKey == K_CTRL_F7 // Move, Copy
::scrTextMove( 1 )
CASE ::nLastKey == K_CTRL_F8 // Move, Cut AND Paste
::scrTextMove( 0 )
CASE ::nLastKey == HB_K_RESIZE
::scrReConfig()
::scrDisplay()
::scrMove()
::scrStatus()
ENDCASE
IF ::nMode == OBJ_MODE_SELECT
@@ -1555,18 +1569,18 @@ METHOD hbCUIEditor:scrUpdObjRC()
LOCAL nObj := ::nObjSelected
IF nObj > 0
nH := ::obj_[ nObj,OBJ_TO_ROW ] - ::obj_[ nObj,OBJ_ROW ]
nW := ::obj_[ nObj,OBJ_TO_COL ] - ::obj_[ nObj,OBJ_COL ]
nH := ::obj_[ nObj, OBJ_TO_ROW ] - ::obj_[ nObj, OBJ_ROW ]
nW := ::obj_[ nObj, OBJ_TO_COL ] - ::obj_[ nObj, OBJ_COL ]
::obj_[ nObj,OBJ_ROW ] := ::nRowRep
::obj_[ nObj,OBJ_COL ] := ::nColRep
::obj_[ nObj, OBJ_ROW ] := ::nRowRep
::obj_[ nObj, OBJ_COL ] := ::nColRep
IF ::objIsBox( nObj )
::obj_[ nObj,OBJ_TO_ROW ] := ::obj_[ nObj,OBJ_ROW ] + nH
::obj_[ nObj,OBJ_TO_COL ] := ::obj_[ nObj,OBJ_COL ] + nW
::obj_[ nObj, OBJ_TO_ROW ] := ::obj_[ nObj, OBJ_ROW ] + nH
::obj_[ nObj, OBJ_TO_COL ] := ::obj_[ nObj, OBJ_COL ] + nW
ELSE
::obj_[ nObj,OBJ_TO_ROW ] := ::nRowRep
::obj_[ nObj,OBJ_TO_COL ] := ::nColRep + len( ::obj_[ nObj, iif( ::objIsTxt( nObj ), OBJ_EQN, OBJ_TEXT ) ] ) - 1
::obj_[ nObj, OBJ_TO_ROW ] := ::nRowRep
::obj_[ nObj, OBJ_TO_COL ] := ::nColRep + len( ::obj_[ nObj, iif( ::objIsTxt( nObj ), OBJ_EQN, OBJ_TEXT ) ] ) - 1
ENDIF
ENDIF
RETURN NIL
@@ -1579,32 +1593,20 @@ METHOD hbCUIEditor:scrRepCol()
nCol := VouchGetSome( 'Number of Columns?', oCol )
IF !empty( nCol )
nCol := max( 10,nCol )
nCol := max( 10, nCol )
::nColsMax := nCol
::nRight := min( maxCol(), ::nLeft + nCol - 1 )
::nRight := min( maxcol(), ::nLeft + nCol - 1 )
::xRefresh := OBJ_REFRESH_ALL
// ::aProperty[ REP_COLS ]:= nCol
ENDIF
RETURN NIL
//----------------------------------------------------------------------//
/*
This is the routine FROM where row based equations can be implemented
*/
METHOD hbCUIEditor:scrAddLine()
LOCAL nRow := ::nRowRep, nSct
::xRefresh := OBJ_REFRESH_ALL
::nBottom := min( ::nBottom + 1, maxrow() - 3 )
nSct := 1
::sectors_[ nSct, SCT_ROWS ]++
::nRowsMax++
aeval( ::obj_, {|e_,i| iif( e_[ OBJ_ROW ] >= nRow, ::obj_[ i, OBJ_TO_ROW ] += 1, '' ) } )
aeval( ::obj_, {|e_,i| iif( e_[ OBJ_ROW ] >= nRow, ::obj_[ i, OBJ_ROW ] += 1, '' ) } )
aeval( ::obj_, {|e_,i| iif( e_[ OBJ_ROW ] >= ::nRowRep, ::obj_[ i, OBJ_TO_ROW ]++, NIL ) } )
aeval( ::obj_, {|e_,i| iif( e_[ OBJ_ROW ] >= ::nRowRep, ::obj_[ i, OBJ_ROW ]++, NIL ) } )
::xRefresh := OBJ_REFRESH_ALL
@@ -1614,20 +1616,12 @@ METHOD hbCUIEditor:scrAddLine()
METHOD hbCUIEditor:scrDelLine()
LOCAL nRow := ::nRowRep
LOCAL nSct, n, isLast
LOCAL n, isLast
isLast := nRow == ::nRowsMax
nSct := 1
IF ::sectors_[ nSct, SCT_ROWS ] == 1 // A Single Row Must remain IN one group
RETURN NIL
ENDIF
::sectors_[ nSct, SCT_ROWS ]--
::nRowsMax--
isLast := ( nRow == ::nRowsMax )
IF ::nRowsMax < ( ::nBottom - ::nTop + 1 )
::nBottom := max( ::nTop, min( ::nBottom - 1, maxrow() - 3 ) )
::nBottom := max( ::nTop, min( ::nBottom - 1, maxrow() - 2 ) )
ENDIF
DO WHILE .t.
@@ -1636,12 +1630,9 @@ METHOD hbCUIEditor:scrDelLine()
ENDIF
VouchAShrink( ::obj_, n )
ENDDO
IF empty( ::obj_ )
aadd( ::obj_, ::scrObjBlank() )
ENDIF
aeval( ::obj_, {|e_,i| iif( e_[ OBJ_ROW ] > nRow, ::obj_[ i, OBJ_TO_ROW ] -= 1, '' ) } )
aeval( ::obj_, {|e_,i| iif( e_[ OBJ_ROW ] > nRow, ::obj_[ i, OBJ_ROW ] -= 1, '' ) } )
aeval( ::obj_, {|e_,i| iif( e_[ OBJ_ROW ] > nRow, ::obj_[ i, OBJ_TO_ROW ]--, NIL ) } )
aeval( ::obj_, {|e_,i| iif( e_[ OBJ_ROW ] > nRow, ::obj_[ i, OBJ_ROW ]--, NIL ) } )
IF isLast
::nRowRep--
@@ -1891,29 +1882,29 @@ METHOD hbCUIEditor:scrGetChar( nRow, nCol )
ELSEIF ::objIsBox( n )
IF nRow == ::obj_[ n, OBJ_ROW ]
IF nCol == ::obj_[n,OBJ_COL]
s := substr(::obj_[n,OBJ_BOX_SHAPE],1,1)
ELSEIF nCol == ::obj_[n,OBJ_TO_COL]
s := substr(::obj_[n,OBJ_BOX_SHAPE],3,1)
IF nCol == ::obj_[ n, OBJ_COL ]
s := substr(::obj_[ n, OBJ_BOX_SHAPE ], 1, 1 )
ELSEIF nCol == ::obj_[ n, OBJ_TO_COL ]
s := substr(::obj_[ n, OBJ_BOX_SHAPE ], 3, 1 )
ELSE
s := substr(::obj_[n,OBJ_BOX_SHAPE],2,1)
s := substr(::obj_[ n, OBJ_BOX_SHAPE ], 2, 1 )
ENDIF
ELSEIF nRow == ::obj_[n,OBJ_TO_ROW]
IF nCol == ::obj_[n,OBJ_COL]
s := substr(::obj_[n,OBJ_BOX_SHAPE],7,1)
ELSEIF nCol == ::obj_[n,OBJ_TO_COL]
s := substr(::obj_[n,OBJ_BOX_SHAPE],5,1)
ELSEIF nRow == ::obj_[ n, OBJ_TO_ROW ]
IF nCol == ::obj_[ n, OBJ_COL ]
s := substr(::obj_[ n, OBJ_BOX_SHAPE ], 7, 1 )
ELSEIF nCol == ::obj_[ n, OBJ_TO_COL ]
s := substr(::obj_[ n, OBJ_BOX_SHAPE ], 5, 1 )
ELSE
s := substr(::obj_[n,OBJ_BOX_SHAPE],6,1)
s := substr(::obj_[ n, OBJ_BOX_SHAPE ], 6, 1 )
ENDIF
ELSE
IF nCol == ::obj_[n,OBJ_COL]
s := substr(::obj_[n,OBJ_BOX_SHAPE],8,1) // 4.8 are Same
ELSEIF nCol == ::obj_[n,OBJ_TO_COL]
s := substr(::obj_[n,OBJ_BOX_SHAPE],4,1)
IF nCol == ::obj_[ n, OBJ_COL ]
s := substr(::obj_[ n, OBJ_BOX_SHAPE ], 8, 1 ) // 4.8 are Same
ELSEIF nCol == ::obj_[ n, OBJ_TO_COL ]
s := substr(::obj_[ n, OBJ_BOX_SHAPE ], 4, 1 )
ELSE
s := substr(::obj_[n,OBJ_BOX_SHAPE],9,1)
s := IF(empty(s),THE_FILL,s)
s := substr(::obj_[ n, OBJ_BOX_SHAPE ], 9, 1 )
s := iif( empty( s ), THE_FILL, s )
ENDIF
ENDIF
ENDIF
@@ -2146,8 +2137,8 @@ METHOD hbCUIEditor:scrTextPost( gst_, nMode )
ins_[ n1, OBJ_ROW ] := ::obj_[ n, OBJ_ROW ]
ins_[ n1, OBJ_COL ] := ::obj_[ n, OBJ_COL ]
ins_[ n1, OBJ_EQN ] := s1
ins_[ n1, OBJ_TO_ROW ] := ::obj_[ n, OBJ_ROW ]
ins_[ n1, OBJ_TO_COL ] := ins_[ n1,OBJ_COL ] + len( s1 ) - 1
ins_[ n1, OBJ_TO_ROW ] := ::obj_[ n, OBJ_ROW ]
ins_[ n1, OBJ_TO_COL ] := ins_[ n1,OBJ_COL ] + len( s1 ) - 1
ENDIF
IF len(s3) > 0
aadd( ins_, ::scrObjBlank() ) ; n1 := len( ins_ )
@@ -2156,8 +2147,8 @@ METHOD hbCUIEditor:scrTextPost( gst_, nMode )
ins_[ n1, OBJ_ROW ] := ::obj_[ n, OBJ_ROW ]
ins_[ n1, OBJ_COL ] := old_[ 4 ] + 1
ins_[ n1, OBJ_EQN ] := s3
ins_[ n1, OBJ_TO_ROW ] := ::obj_[ n, OBJ_ROW ]
ins_[ n1, OBJ_TO_COL ] := ins_[ n1,OBJ_COL ] + len( s3 ) - 1
ins_[ n1, OBJ_TO_ROW ] := ::obj_[ n, OBJ_ROW ]
ins_[ n1, OBJ_TO_COL ] := ins_[ n1,OBJ_COL ] + len( s3 ) - 1
ENDIF
ENDIF
@@ -2239,19 +2230,19 @@ METHOD hbCUIEditor:scrTextDel()
// TO be retained as it is
s1 := '' ; s3 := ''
s := ::obj_[n,OBJ_EQN]
nCol := ::obj_[n,OBJ_COL]
s := ::obj_[ n, OBJ_EQN ]
nCol := ::obj_[ n, OBJ_COL ]
IF old_[2] <= ::obj_[n,OBJ_COL] .AND. old_[4] >= ::obj_[n,OBJ_TO_COL]
IF old_[ 2 ] <= ::obj_[ n, OBJ_COL ] .AND. old_[ 4 ] >= ::obj_[ n, OBJ_TO_COL ]
// s2 := s // Insert WITH moved coordinates
ELSEIF old_[2] >= ::obj_[n,OBJ_COL]
s1 := substr(s,1,old_[2]-nCol)
ELSEIF old_[ 2 ] >= ::obj_[ n, OBJ_COL ]
s1 := substr( s, 1, old_[ 2 ] - nCol )
// s2 := substr(s,old_[2]-nCol+1,old_[4]-old_[2]+1)
s3 := substr(s,old_[4]-nCol+2)
ELSEIF old_[2] < nCol
s1 := substr(s,1,old_[2]-nCol)
s3 := substr( s, old_[ 4 ] - nCol + 2 )
ELSEIF old_[ 2 ] < nCol
s1 := substr( s, 1, old_[ 2 ] - nCol )
// s2 := substr(s,old_[2]-nCol+1,old_[4]-old_[2]+1)
s3 := substr(s,old_[4]-nCol+2)
s3 := substr( s, old_[ 4 ] - nCol + 2 )
ENDIF
IF len( s1 ) > 0
@@ -2344,7 +2335,7 @@ METHOD hbCUIEditor:scrAddTxt( nMode )
txt_[nTxt,OBJ_EQN] := substr( txt_[ nTxt, OBJ_EQN ], 1,;
::nColRep - txt_[ nTxt, OBJ_COL ] ) + ;
substr( txt_[ nTxt, OBJ_EQN ], ::nColRep - txt_[ nTxt, OBJ_COL ] + 2 )
txt_[ nTxt, OBJ_TO_COL ] := txt_[ nTxt, OBJ_COL ] + len( txt_[ nTxt, OBJ_EQN ] )-1
txt_[ nTxt, OBJ_TO_COL ] := txt_[ nTxt, OBJ_COL ] + len( txt_[ nTxt, OBJ_EQN ] ) - 1
ELSE // Divide it IN two objects
s1 := substr( txt_[ nTxt, OBJ_EQN ], 1, ::nColRep - txt_[ nTxt, OBJ_COL ] )
s2 := substr( txt_[ nTxt, OBJ_EQN ], ::nColRep - txt_[ nTxt, OBJ_COL ] + 2 )
@@ -2401,7 +2392,7 @@ METHOD hbCUIEditor:scrAddTxt( nMode )
FOR i := 2 TO len( txt_ )
IF txt_[ i , OBJ_COL ] == txt_[ i - 1, OBJ_TO_COL ] + 1
txt_[ i - 1, OBJ_EQN ] += txt_[ i, OBJ_EQN ] // Club both
txt_[ i - 1, OBJ_TO_COL ] := txt_[ i - 1, OBJ_COL] + len( txt_[ i - 1, OBJ_EQN ] ) - 1
txt_[ i - 1, OBJ_TO_COL ] := txt_[ i - 1, OBJ_COL ] + len( txt_[ i - 1, OBJ_EQN ] ) - 1
txt_[ i - 1, OBJ_F_LEN ] := len( txt_[ i - 1, OBJ_EQN ] )
VouchAShrink( txt_,i )
lClub := .t.
@@ -2427,7 +2418,7 @@ METHOD hbCUIEditor:scrAddTxt( nMode )
aeval( txt_, {|e_| iif( e_[ OBJ_ROW ] > 0, aadd( ::obj_, e_ ), '' ) } ) // Now attach txt_
DO WHILE .t.
IF( n := ascan( ::obj_,{|e_| e_[OBJ_TO_COL] < e_[OBJ_COL] } ) ) > 0
IF( n := ascan( ::obj_,{|e_| e_[ OBJ_TO_COL ] < e_[ OBJ_COL ] } ) ) > 0
VouchAShrink( ::obj_, n )
IF empty( ::obj_ )
aadd( ::obj_, ::scrObjBlank() )
@@ -2517,7 +2508,7 @@ METHOD hbCUIEditor:scrObjBlank()
METHOD hbCUIEditor:scrVrbBlank( nType )
LOCAL v_:= {}
LOCAL nW := 60
LOCAL nW := 200
SWITCH nType
CASE OBJ_O_FIELD
@@ -2546,7 +2537,7 @@ METHOD hbCUIEditor:scrVrbBlank( nType )
//----------------------------------------------------------------------//
METHOD hbCUIEditor:scrObj2Vv( o_ )
LOCAL v_:={}, nW := 60
LOCAL v_:={}, nW := 200
SWITCH o_[ OBJ_TYPE ]
@@ -2580,19 +2571,19 @@ METHOD hbCUIEditor:scrVrbHeaders( nType )
SWITCH nType
CASE OBJ_O_FIELD
aadd( h_, ' Name ' )
aadd( h_, ' Type ' )
aadd( h_, ' Width ' )
aadd( h_, ' Decimals ' )
aadd( h_, ' Picture ' )
aadd( h_, ' Color ' )
aadd( h_, ' When ' )
aadd( h_, ' Valid ' )
aadd( h_, ' Expression' )
aadd( h_, ' Type ' )
aadd( h_, ' Width ' )
aadd( h_, ' Decimals ' )
aadd( h_, ' Picture ' )
aadd( h_, ' Color ' )
aadd( h_, ' When ' )
aadd( h_, ' Valid ' )
EXIT
CASE OBJ_O_BOX
aadd( h_, ' Color ' )
aadd( h_, ' Border ' )
aadd( h_, ' Pattern ' )
aadd( h_, ' Color ' )
aadd( h_, ' Border ' )
aadd( h_, ' Pattern ' )
EXIT
CASE OBJ_O_TEXT
aadd( h_, ' Expression' )

View File

@@ -198,45 +198,39 @@ FUNCTION VouchGetArray( h_,vv_, sel_, nTop, nLft, nBtm, nRgt, title, bWhen_, bVa
IF h_== NIL .OR. valtype(h_)<>'A' .OR. vv_== NIL .OR. valtype(vv_)<>'A'
RETURN {vv_, 0}
ENDIF
nLenVrb := 0
aeval( vv_, {|e| cTyp := valtype( e ), nLenVrb := max( ;
iif( cTyp == 'C', len( e ), ;
iif( cTyp == 'N', 15, iif( cTyp == 'D', 8, 3 ) ) ), nLenVrb ) } )
IF bWhen_ == NIL
bWhen_:= afill(array(len(vv_)), {|| .t. })
FOR i := 1 TO len(vv_)
s := h_[i]
IF valtype(vv_[i]) == 'L'
bWhen_[i] := {|| VouchYN(s,oGet()),.f. }
bWhen_:= afill( array( len( vv_) ), {|| .t. } )
FOR i := 1 TO len( vv_ )
s := h_[ i ]
IF valtype( vv_[ i ] ) == 'L'
bWhen_[ i ] := {|| VouchYN( s, oGet() ), .f. }
ENDIF
NEXT
ENDIF
IF bValid_ == NIL
bValid_:= afill(array(len(vv_)),{|| .t. })
bValid_:= afill( array( len( vv_ ) ), {|| .t. } )
ENDIF
IF pic_ == NIL
pic_:= array(len(vv_))
FOR i := 1 TO len(vv_)
cTyp := valtype(vv_[i])
pic_[i] := iif(cTyp=="C","@ ",iif(cTyp=="N","@Z 99999999.999",iif(cTyp=="L","Y","@ ")))
NEXT
ENDIF
nLenVrb := 0
aeval(vv_, {|e| cTyp := valtype(e), nLenVrb := max( ;
iif(cTyp == 'C', len( e ), ;
iif(cTyp=='N', 15, iif( cTyp=='D',8,3))), nLenVrb ) })
pmt_:={}
aeval(h_,{|e,i| aadd( pmt_, e + " {"+xtos(vv_[i])+ "}" ) })
// decide maximum length of the largest prompt
mLen := 0
aeval( pmt_, {|x| mLen := max(mLen, len(x)) } )
mLen := max( len(h_[1])+2+nLenVrb, mLen)+2
aeval( pmt_, {|x| mLen := max( mLen, len( x ) ) } )
mLen := max( len( h_[ 1 ] ) + 2 + nLenVrb, mLen ) + 2
IF nTop == NIL
nTop := int( ( maxrow() - min( iif( wvt(),2,3 ) + len( h_ ), maxrow()-3 ) ) / 2 )
nTop := int( ( maxrow() - min( 3 + len( h_ ), maxrow() - 3 ) ) / 2 )
ENDIF
IF nBtm == NIL
nBtm := min( nTop + len( h_ ) + iif( wvt(),2,3 ), maxrow()-3 )
nBtm := min( nTop + len( h_ ) + 3, maxrow() - 3 )
ENDIF
IF nLft == NIL
@@ -262,9 +256,9 @@ FUNCTION VouchGetArray( h_,vv_, sel_, nTop, nLft, nBtm, nRgt, title, bWhen_, bVa
title := alltrim( title )
ENDIF
title := padc( title, nRgt - nLft )
title := { title, replicate(chr(196), len(title)+2) }
title := { title, replicate( chr( 196 ), len( title ) + 2 ) }
maxL := len( h_[ 1 ] )
sel_ := iif( sel_ == NIL,.t., sel_ )
sel_ := iif( sel_ == NIL, .t., sel_ )
vstk_push()
setcursor(0)
@@ -284,24 +278,32 @@ FUNCTION VouchGetArray( h_,vv_, sel_, nTop, nLft, nBtm, nRgt, title, bWhen_, bVa
cgo_:= { 1, 0, .f., .f., pmt_, sel_,/*exe_*/, aScrol_, nLenMnu }
SetGetAch( vv_ ) // Put on stack FOR aChPut(), aChGet()
SetGetAch( vv_ )
IF pic_ == NIL
pic_:= array( len( vv_ ) )
FOR i := 1 TO len( vv_ )
cTyp := valtype( vv_[ i ] )
pic_[ i ] := iif( cTyp == "C", "@S" + hb_ntos( nLenVrb ) + "K ", iif( cTyp == "N", "@Z 99999999.999", iif( cTyp == "L", "Y", "@ " ) ) )
NEXT
ENDIF
DO WHILE .t.
setColor( clr1 )
pmt_:= {}
aeval(h_, {|e,i| aadd(pmt_, e+" {"+xtos(vv_[i])+"}") })
aeval( h_, {|e,i| aadd( pmt_, e + " {" + xtos( vv_[ i ] ) + "}" ) } )
cgo_[ CGO_CH_ ] := pmt_
clear typeahead
nSel := VouchAChoice(nTop+iif(wvt(),2,3),nLft+1+iif(wvt(),1,0),nBtm-1,nRgt-1-iif(wvt(),1,0), ;
cgo_[CGO_CH_], cgo_[CGO_SEL_], "VouchFunc1", ;
cgo_[CGO_POS], cgo_[CGO_ROW],/* oWin */, @nLastKey, cgo_ )
nSel := VouchAChoice( nTop + 3, nLft + 1, nBtm - 1, nRgt - 1, ;
cgo_[ CGO_CH_ ], cgo_[ CGO_SEL_ ], "VouchFunc1", ;
cgo_[ CGO_POS ], cgo_[ CGO_ROW ],/* oWin */, @nLastKey, cgo_ )
IF nLastKey == K_ENTER
vv_[ nSel ] := VouchGetChoice(vv_[ nSel ], nTop + cgo_[ CGO_ROW ]+iif(wvt(),2,3), ;
nLft + maxL + 1, nRgt-iif(wvt(),2,1), bWhen_[ nSel ], ;
bValid_[ nSel ], pic_[ nSel ])
vv_[ nSel ] := VouchGetChoice( vv_[ nSel ], nTop + cgo_[ CGO_ROW ] + 3, ;
nLft + maxL + 1, nRgt - 1, bWhen_[ nSel ], ;
bValid_[ nSel ], pic_[ nSel ] )
ELSEIF nLastKey == K_F10
EXIT
@@ -396,8 +398,8 @@ STATIC FUNCTION VouchGetChoice( vrb, row, col, e_col, whn, vld, pic )
ELSEIF type == "C"
maxL := len( vrb )
pic := "@K"
IF( maxL + col ) > e_col
pic := pic + "S" + ltrim( str( maxL ) )
IF ( maxL + col ) > e_col
pic += "S" + ltrim( str( e_col - col ) )
ENDIF
ENDIF
@@ -681,16 +683,16 @@ FUNCTION VouchMsgBox(r1, c1, r2, c2, width, depth, msg_, msgClr, ;
ENDIF
ENDIF
aeval( msg_, {|s| msgLen := max( msgLen, len( s )) })
aeval( ch_, {|s| chLen := max( chLen, len( s )) })
aeval( msg_, {|s| msgLen := max( msgLen, len( s ) ) } )
aeval( ch_, {|s| chLen := max( chLen, len( s ) ) } )
maxlen := max( msgLen, chLen )
aeval( ch_, {|s,i| s:=s, ch_[i] := pad( ch_[i], maxLen ) } )
aeval( ch_, {|s,i| s := s, ch_[ i ] := pad( ch_[ i ], maxLen ) } )
IF empty( lSelect_ )
lSelect_:= {}
aeval( ch_, {|s| aadd(lSelect_, iif(empty(s), .f., .t.)) })
aeval( ch_, {|s| aadd( lSelect_, iif( empty( s ), .f., .t. ) ) } )
ELSE
aeval( ch_, {|s,i| lSelect_[i] := iif(empty(s),.f.,lSelect_[i]) })
aeval( ch_, {|s,i| lSelect_[ i ] := iif( empty( s ), .f., lSelect_[ i ] ) } )
ENDIF
IF ascan( lSelect_, {|e| e } ) == 0
IF len(ch_) > 0
@@ -1044,7 +1046,7 @@ FUNCTION VouchGetSome( msg, vrb, pass, pic, set_, wh, vl, nLastKey )
DEFAULT wh TO {|| .t. }
DEFAULT vl TO {|| .t. }
DEFAULT pass TO .f.
DEFAULT pic TO iif( dType == 'Y', 'Y', '@! ' )
DEFAULT pic TO iif( dType == 'Y', 'Y', '@K ' )
clr := SetColor()
@@ -1060,19 +1062,19 @@ FUNCTION VouchGetSome( msg, vrb, pass, pic, set_, wh, vl, nLastKey )
IF nLenMsg + nLenVrb > nMaxLen // Only when vrb type c will be asked
nLenVrb := nMaxLen - nLenMsg - 7
pic := substr(pic,1,1)+'S'+hb_ntos(nLenVrb)+substr(pic,2)
pic := substr( pic, 1, 1 ) + 'S' + hb_ntos( nLenVrb ) + substr( pic, 2 )
ENDIF
pic := iif( dType=='N','@Z 99999999999999.99', pic )
pic := iif( dType == 'N', '@Z 99999999999999.99', pic )
l := ( ( maxcol() + 1 - ( nLenMsg + nLenVrb + 7 ) ) / 2 )
r := l + nLenMsg+nLenVrb + 6
r := l + nLenMsg + nLenVrb + 6
SetColor( 'W+/RB,GR+/BG,,,W+/BG' )
vstk_push()
screen := VouchWndSave( t-1, l-4, b+2, r+3 )
dispbox( t, l, b, r, "ÛßÛÛÛÜÛÛ " )
VouchShadow( t,l,b,r )
VouchShadow( t, l, b, r )
@ t+2, l+3 SAY msg GET vrb PICTURE pic WHEN eval(wh) VALID eval(vl)
setCursor(1)
@@ -1105,72 +1107,138 @@ FUNCTION help( cToken )
SWITCH Upper( cToken )
CASE "KEYS"
/* HB_SCREEN_BEGINS <Keys> */
/// 1 3 C 28 0
@ 20, 2 SAY "Alt+S Save designed screen"
/// 2 3 C 27 0
@ 21, 2 SAY "Alt+L Load another screen"
/// 3 3 C 76 0
@ 26, 2 SAY " ESC-Designer 1-General 2-Selective Input 3-Block Selections " COLOR "N/W*"
/// 4 3 C 19 0
@ 3, 2 SAY "F1 This screen"
/// 5 3 C 38 0
@ 4, 2 SAY "F4 Properties of hilighted object"
/// 6 3 C 29 0
@ 5, 2 SAY "F5 Edit hilighted object"
/// 7 3 C 31 0
@ 6, 2 SAY "F6 Select hilighted object"
/// 8 3 C 29 0
@ 7, 2 SAY "F7 Copy hilighted object"
/// 9 3 C 27 0
@ 8, 2 SAY "F8 Paste copied object"
/// 10 3 C 38 0
@ 9, 2 SAY "F9 Start to define new box object"
/// 11 3 C 31 0
@ 10, 2 SAY "F10 Define a new GET object"
/// 12 3 C 31 0
@ 12, 2 SAY "Del Delete hilighted object"
/// 13 3 C 30 0
@ 14, 2 SAY "Ctrl_F6 Begins block selection"
/// 14 3 C 43 0
@ 15, 2 SAY "Ctrl_F7 Copy selected block at new location"
/// 15 3 C 52 0
@ 16, 2 SAY "Ctrl_F8 Cut and paste selected block at new location"
/// 16 3 C 76 0
/// 2 3 C 76 0
@ 1, 2 SAY " Keys " COLOR "N/W*"
/// 18 3 C 76 0
@ 26, 2 SAY " ESC-Designer 1-General 2-SelectiveInput 3-Block Selections 4-About " COLOR "N/W*"
/// 3 3 C 61 0
@ 16, 2 SAY "Alt_N Insert blank row. All objects are moved down one row."
/// 4 3 C 61 0
@ 17, 2 SAY "Alt_O Delete current row. All objects are moved up one row."
/// 5 3 C 71 0
@ 14, 2 SAY "End Cursor is positioned at the next to last column of last object."
/// 6 3 C 44 0
@ 13, 2 SAY "Home Cursor is positioned at column zero."
/// 7 3 C 32 0
@ 12, 2 SAY "Del Delete hilighted object."
/// 8 3 C 32 0
@ 10, 2 SAY "F10 Define a new GET object."
/// 9 3 C 39 0
@ 9, 2 SAY "F9 Start to define new box object."
/// 10 3 C 28 0
@ 8, 2 SAY "F8 Paste copied object."
/// 11 3 C 29 0
@ 7, 2 SAY "F7 Copy hilighted objec.t"
/// 12 3 C 32 0
@ 6, 2 SAY "F6 Select hilighted object."
/// 13 3 C 30 0
@ 5, 2 SAY "F5 Edit hilighted object."
/// 14 3 C 39 0
@ 4, 2 SAY "F4 Properties of hilighted object."
/// 15 3 C 20 0
@ 3, 2 SAY "F1 This screen."
/// 16 3 C 31 0
@ 19, 2 SAY "Ctrl_F6 Begins block selection."
/// 17 3 C 44 0
@ 20, 2 SAY "Ctrl_F7 Copy selected block at new location."
/// 18 3 C 53 0
@ 21, 2 SAY "Ctrl_F8 Cut and paste selected block at new location."
/// 19 3 C 29 0
@ 23, 2 SAY "Alt+S Save designed screen."
/// 20 3 C 28 0
@ 24, 2 SAY "Alt+L Load another screen."
/* HB_SCREEN_ENDS <Keys> */
EXIT
CASE "GENERAL-1"
/* HB_SCREEN_BEGINS <General-1> */
/// 1 3 C 76 0
@ 26, 2 SAY " ESC-Designer 1-General 2-Selective Input 3-Block Selections " COLOR "N/W*"
/// 2 3 C 76 0
/// 1 3 C 76 0
@ 1, 2 SAY " General " COLOR "N/W*"
/// 18 3 C 76 0
@ 26, 2 SAY " ESC-Designer 1-General 2-SelectiveInput 3-Block Selections 4-About " COLOR "N/W*"
/// 2 3 C 76 0
@ 3, 2 SAY "hbCuiEd is a fixed-coordinated, character based screen designer which allows"
/// 3 3 C 76 0
@ 4, 2 SAY "to arrange Harbour's GT oriented objects in visual interaction and saves the"
/// 4 3 C 76 0
@ 5, 2 SAY "results as Harbour source code (with some meta info) directly into the .PRG "
/// 5 3 C 73 0
@ 6, 2 SAY "file ready to be compiled and linked. Thus generated forms can be edited "
/// 6 3 C 76 0
@ 7, 2 SAY "either directly in the source file or through this tool which allows two-way"
/// 7 3 C 56 0
@ 8, 2 SAY "communication leading to highest degree of productivity."
/// 8 3 C 76 0
@ 10, 2 SAY "One source file can contain n number of screens, anywhere in the source, at "
/// 9 3 C 74 0
@ 11, 2 SAY "any indentation. The only requirement is to place following lines where a "
/// 10 3 C 17 0
@ 12, 2 SAY "screen is needed:"
/// 11 3 C 35 0
@ 13, 22 SAY "/* HB_SCREEN_BEGINS <ScreenName> */" COLOR "GR+/B"
/// 12 3 C 35 0
@ 14, 22 SAY "/* HB_SCREEN_ENDS <ScreenName> */" COLOR "GR+/B"
/// 13 3 C 74 0
@ 16, 2 SAY "This is to be done manually. Once you place above lines into source file, "
/// 14 3 C 74 0
@ 17, 2 SAY "just supply that source when loading a screen. All screens defined in that"
/// 15 3 C 44 0
@ 18, 2 SAY "source will be presented to select and edit."
/// 16 3 C 76 0
@ 20, 2 SAY "The designer implements SAYs with/without expression, GETs with all clauses,"
/// 17 3 C 55 0
@ 21, 2 SAY "BOXs with all flavours, special characters (TOBE Done)."
/* HB_SCREEN_ENDS <General-1> */
EXIT
CASE "GENERAL-2"
/* HB_SCREEN_BEGINS <General-2> */
/// 1 3 C 76 0
@ 26, 2 SAY " ESC-Designer 1-General 2-Selective Input 3-Block Selections " COLOR "N/W*"
/// 2 3 C 76 0
@ 1, 2 SAY " Selective Input " COLOR "N/W*"
/// 18 3 C 76 0
@ 26, 2 SAY " ESC-Designer 1-General 2-SelectiveInput 3-Block Selections 4-About " COLOR "N/W*"
/* HB_SCREEN_ENDS <General-2> */
EXIT
CASE "GENERAL-3"
/* HB_SCREEN_BEGINS <General-3> */
/// 1 3 C 76 0
@ 26, 2 SAY " ESC-Designer 1-General 2-Selective Input 3-Block Selections " COLOR "N/W*"
/// 2 3 C 76 0
@ 1, 2 SAY " Block Selection " COLOR "N/W*"
/// 18 3 C 76 0
@ 26, 2 SAY " ESC-Designer 1-General 2-SelectiveInput 3-Block Selections 4-About " COLOR "N/W*"
/* HB_SCREEN_ENDS <General-3> */
EXIT
CASE "ABOUT"
/* HB_SCREEN_BEGINS <About> */
/// 1 3 C 76 0
@ 1, 2 SAY " About " COLOR "N/W*"
/// 2 3 C 76 0
@ 26, 2 SAY " ESC-Designer 1-General 2-SelectiveInput 3-Block Selections 4-About " COLOR "N/W*"
/// 3 3 C 35 0
@ 7, 22 SAY "Harbour Screen Designer ( hbCuiEd )" COLOR "GR+/B"
/// 4 3 C 40 0
@ 10, 20 SAY "Pritpal Bedi ( bedipritpal@hotmail.com )"
/// 5 3 C 13 0
@ 9, 33 SAY "Developed by:"
/// 6 3 C 12 0
@ 15, 34 SAY "Pritpal Bedi"
/// 7 3 C 14 0
@ 14, 33 SAY "Copyright 2011"
/// 8 3 C 23 0
@ 16, 29 SAY "www.harbour-project.org"
/// 9 3 C 29 0
@ 20, 26 SAY "Visit the project website at:"
/// 10 3 C 31 0
@ 21, 25 SAY "http://www.harbour-project.org/" COLOR "GR+/B"
/* HB_SCREEN_ENDS <About> */
EXIT
ENDSWITCH
DispEnd()
@@ -1192,6 +1260,10 @@ FUNCTION help( cToken )
SetHelpStr( "General-3" )
__keyboard( chr( K_F1 ) )
EXIT
ELSEIF nKey == 52
SetHelpStr( "About" )
__keyboard( chr( K_F1 ) )
EXIT
ENDIF
ENDDO

View File

@@ -68,8 +68,7 @@
#ifndef __HBEDCUI_CH
#define __HBEDCUI_CH
#define THE_FILL 'ø'
#define THE_FILL chr( 177 )
#define OBJ_TYPE 1 // N 1
@@ -116,28 +115,10 @@
#define OBJ_O_EXP 5
#define OBJ_O_BMP 6
// Properties will be based on these attributes
#define DGN_MODULE 1
#define DGN_REPORT 2
#define DGN_DOCUMENT 3
#define DGN_LABEL 4
#define DGN_SCREEN 5
#define OBJ_MODE_SELECT 1
#define OBJ_MODE_MOVE 2
#define OBJ_MODE_IDLE 0
#define SCT_ORDER 1
#define SCT_ID 2
#define SCT_SAY 3
#define SCT_ROWS 4
#define SCT_COLOR 5
#define SCT_EQN 6
#define SCT_EJECT 7
#define SCT_RESET 8
#define SCT_INIT_VRBLS 8
#translate B_MSG ;
[ <msg,...> ] ;
[ AT <r1> [, <c1> ] ] ;