Page 6 of 38

Re: Introducing FiveTech's fivedit

PostPosted: Thu Jan 22, 2015 11:33 am
by Antonio Linares
Samir,

Thanks for your sugegstions, but for now we are focusing on the basic functionality.

Once it is complete, then we will enhance Fivedit.

Our goal now is to complete it and that it works properly :-)

Re: Introducing FiveTech's fivedit

PostPosted: Thu Jan 22, 2015 11:48 am
by cnavarro
Antonio

Code: Select all  Expand view


Local cChar      := GetCharHdr( nPtrNMHDR )

.../...

//----------------------------------------------------------------------------//
static int GetCharHdr( LPARAM lParam )
{
   struct SCNotification * pMsg = ( struct SCNotification * )lParam;

   return ( pMsg->ch );
}
//----------------------------------------------------------------------------//
HB_FUNC( GETCHARHDR )
{
   hb_retni( GetCharHdr( hb_parnl( 1 ) ));
}
//----------------------------------------------------------------------------//

 


-- ------------------------------- EDITADO
Se me habia olvidado la otra funcion :oops: :P :D :shock:

Re: Introducing FiveTech's fivedit

PostPosted: Thu Jan 22, 2015 12:17 pm
by cnavarro
Antonio Linares wrote:Cristobal,


Te está funcionando bien la indentación ? Esperaré a que esté bien y la incluyo. Gracias :-)


Antonio, en mi anterior post te preguntaba como funcionaba el cierre de indentacion, mira a ver si me puedes decir algo para seguir
Hacia la derecha ya funciona bastante bien

--------------------------------------------- EDITADO
De momento, esto funciona muy bien

Currently, this works very well
Code: Select all  Expand view

METHOD AutoIndent( cLine ) CLASS TEdtScint
Local nCurLine     := ::GetCurrentLine()
Local nIndentation := ::SendEditor( SCI_GETLINEINDENTATION, nCurLine-1 , 0 )
Local x
Local nPos         := 0
Local nInd         := ::SendEditor( SCI_GETINDENT, 0, 0 )
Local aCad1        := {"for ", "while ", "if ", "with ", "case " }
Local aCad2        := {"next ", "enddo ", "endif ", "end ", "endcase ", ;
                       "endwhile ", "endwith ", "else ", "otherwise " }//loop switch "
Local nPosInd      := ::SendEditor( SCI_GETLINEINDENTPOSITION, nCurLine, )
DEFAULT cLine      := ""

   For x = 1 to Len( aCad1 )
       nPos := At( aCad1[ x ], Lower( cLine ) )
       if !Empty( nPos )
          x := Len( aCad1 ) + 1
       endif
   Next x
   if Empty( nPos )
      /*
      For x = 1 to Len( aCad2 )
          nPos := At( aCad2[ x ], Lower( cLine ) )
          if !Empty( nPos )
             x := Len( aCad2 ) + 1
          endif
      Next x
      */

      /*
      if !Empty( nPos )
         nIndentation  := nIndentation - nInd
      endif
      */

      nPosInd := 0
   else
      nIndentation  := nIndentation + nInd
   endif

   if ::GetLineCount() > nCurLine
      ::GoLine( nCurLine + 1 )
   endif

   ::SendEditor( SCI_SETLINEINDENTATION, nCurLine, nPosInd + nIndentation )
   ::GotoPos( ::GetCurrentPos() + nIndentation )

return nil
 

Re: Introducing FiveTech's fivedit

PostPosted: Thu Jan 22, 2015 1:28 pm
by sambomb
Antonio Linares wrote:Samir,

Thanks for your sugegstions, but for now we are focusing on the basic functionality.

Once it is complete, then we will enhance Fivedit.

Our goal now is to complete it and that it works properly :-)


The bookmark looks simple, I could do it myself but I don't have the last edition of fivewin.

Re: Introducing FiveTech's fivedit

PostPosted: Thu Jan 22, 2015 2:05 pm
by cnavarro
Antonio Linares wrote:Cristobal,

la implementación Alt-C y las otras combinaciones:

Code: Select all  Expand view
METHOD SysCommand( nType, nLoWord, nHiWord ) CLASS TScintilla
 .../...
             case nLoWord == Asc( "i" ) .or. nLoWord == Asc( "I" )
 
 




Habria que añadir las mayúsculas, no?

Antonio, por qué crear un nuevo Metodo y no utilizar el que ya existe? -> HandleEvent
Hay algun motivo?
Gracias

Re: Introducing FiveTech's fivedit

PostPosted: Thu Jan 22, 2015 3:44 pm
by James Bott
Antonio,

I think it is quite useful to have methods listed twice, one for the Class header and another for the implementation.


Perhaps this could be an option? Then we could turn it off and on as needed or desired.

Re: Introducing FiveTech's fivedit

PostPosted: Thu Jan 22, 2015 4:41 pm
by Antonio Linares
James,

yes, good idea :-)

Re: Introducing FiveTech's fivedit

PostPosted: Sat Jan 24, 2015 7:50 am
by Antonio Linares
Samir,

sambomb wrote:
Antonio Linares wrote:Samir,

Thanks for your sugegstions, but for now we are focusing on the basic functionality.

Once it is complete, then we will enhance Fivedit.

Our goal now is to complete it and that it works properly :-)


The bookmark looks simple, I could do it myself but I don't have the last edition of fivewin.


You have the Class TScintilla in your current FWH version, so you can modify it.

Help us implementing the bookmarks and whatever else you may want to add, and I will gift you a FWH 15.01 :-)

Re: Introducing FiveTech's fivedit

PostPosted: Sat Jan 24, 2015 7:51 am
by Antonio Linares
Cristobal,

cnavarro wrote:
Antonio Linares wrote:Cristobal,

la implementación Alt-C y las otras combinaciones:

Code: Select all  Expand view
METHOD SysCommand( nType, nLoWord, nHiWord ) CLASS TScintilla
 .../...
             case nLoWord == Asc( "i" ) .or. nLoWord == Asc( "I" )
 
 




Habria que añadir las mayúsculas, no?

Antonio, por qué crear un nuevo Metodo y no utilizar el que ya existe? -> HandleEvent
Hay algun motivo?
Gracias


Las pulsaciones Alt+... son rutadas automaticamente al método SysCommand, pues Windows genera un mensaje WM_SYSCOMMAND.

Buena sugerencia lo de las mayúsculas, gracias :-)

Re: Introducing FiveTech's fivedit

PostPosted: Sat Jan 24, 2015 7:55 am
by Antonio Linares
Cristobal,

cnavarro wrote:
Antonio Linares wrote:Cristobal,


Te está funcionando bien la indentación ? Esperaré a que esté bien y la incluyo. Gracias :-)


Antonio, en mi anterior post te preguntaba como funcionaba el cierre de indentacion, mira a ver si me puedes decir algo para seguir
Hacia la derecha ya funciona bastante bien

--------------------------------------------- EDITADO
De momento, esto funciona muy bien

Currently, this works very well
Code: Select all  Expand view

METHOD AutoIndent( cLine ) CLASS TEdtScint
Local nCurLine     := ::GetCurrentLine()
Local nIndentation := ::SendEditor( SCI_GETLINEINDENTATION, nCurLine-1 , 0 )
Local x
Local nPos         := 0
Local nInd         := ::SendEditor( SCI_GETINDENT, 0, 0 )
Local aCad1        := {"for ", "while ", "if ", "with ", "case " }
Local aCad2        := {"next ", "enddo ", "endif ", "end ", "endcase ", ;
                       "endwhile ", "endwith ", "else ", "otherwise " }//loop switch "
Local nPosInd      := ::SendEditor( SCI_GETLINEINDENTPOSITION, nCurLine, )
DEFAULT cLine      := ""

   For x = 1 to Len( aCad1 )
       nPos := At( aCad1[ x ], Lower( cLine ) )
       if !Empty( nPos )
          x := Len( aCad1 ) + 1
       endif
   Next x
   if Empty( nPos )
      /*
      For x = 1 to Len( aCad2 )
          nPos := At( aCad2[ x ], Lower( cLine ) )
          if !Empty( nPos )
             x := Len( aCad2 ) + 1
          endif
      Next x
      */

      /*
      if !Empty( nPos )
         nIndentation  := nIndentation - nInd
      endif
      */

      nPosInd := 0
   else
      nIndentation  := nIndentation + nInd
   endif

   if ::GetLineCount() > nCurLine
      ::GoLine( nCurLine + 1 )
   endif

   ::SendEditor( SCI_SETLINEINDENTATION, nCurLine, nPosInd + nIndentation )
   ::GotoPos( ::GetCurrentPos() + nIndentation )

return nil
 


La clave me la distes con usar el método Notify :-) Ya lo tengo funcionando asi:

Code: Select all  Expand view
METHOD AutoIndent() CLASS TScintilla

   local nPrevLine     := ::GetCurrentLineNumber() - 1
   local nIndentation := ::GetLineIndentation( nPrevLine )
   local nPos         := ::GetCurrentPos()

   ::Send( SCI_SETLINEINDENTATION, nPrevLine + 1, nIndentation )
   ::InsertText( nPos, Space( nIndentation ) )
   ::Send( SCI_GOTOPOS, nPos + nIndentation )

return nil
 

Re: Introducing FiveTech's fivedit

PostPosted: Sat Jan 24, 2015 8:10 am
by cnavarro
Antonio Linares wrote:Cristobal,

cnavarro wrote:
Antonio Linares wrote:Cristobal,

Antonio, por qué crear un nuevo Metodo y no utilizar el que ya existe? -> HandleEvent
Hay algun motivo?
Gracias


Las pulsaciones Alt+... son rutadas automaticamente al método SysCommand, pues Windows genera un mensaje WM_SYSCOMMAND.



Antonio, es que el tema de las teclas lo tenia implementado asi:

Code: Select all  Expand view

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TEdtScint

.../...

      Case nMsg == WM_SYSCOMMAND
           Do Case
              Case nWParam == SC_KEYMENU

.../...

 


por eso te preguntaba donde era mejor implementarlo, en el SysCommand o en este metodo?

Re: Introducing FiveTech's fivedit

PostPosted: Sat Jan 24, 2015 8:22 am
by cnavarro
Antonio Linares wrote:Cristobal,

cnavarro wrote:
Antonio Linares wrote:Cristobal,


Te está funcionando bien la indentación ? Esperaré a que esté bien y la incluyo. Gracias :-)


Antonio, en mi anterior post te preguntaba como funcionaba el cierre de indentacion, mira a ver si me puedes decir algo para seguir
Hacia la derecha ya funciona bastante bien

--------------------------------------------- EDITADO
De momento, esto funciona muy bien

Currently, this works very well
Code: Select all  Expand view

METHOD AutoIndent( cLine ) CLASS TEdtScint
Local nCurLine     := ::GetCurrentLine()
Local nIndentation := ::SendEditor( SCI_GETLINEINDENTATION, nCurLine-1 , 0 )
Local x
Local nPos         := 0
Local nInd         := ::SendEditor( SCI_GETINDENT, 0, 0 )
Local aCad1        := {"for ", "while ", "if ", "with ", "case " }
Local aCad2        := {"next ", "enddo ", "endif ", "end ", "endcase ", ;
                       "endwhile ", "endwith ", "else ", "otherwise " }//loop switch "
Local nPosInd      := ::SendEditor( SCI_GETLINEINDENTPOSITION, nCurLine, )
DEFAULT cLine      := ""

   For x = 1 to Len( aCad1 )
       nPos := At( aCad1[ x ], Lower( cLine ) )
       if !Empty( nPos )
          x := Len( aCad1 ) + 1
       endif
   Next x
   if Empty( nPos )
      /*
      For x = 1 to Len( aCad2 )
          nPos := At( aCad2[ x ], Lower( cLine ) )
          if !Empty( nPos )
             x := Len( aCad2 ) + 1
          endif
      Next x
      */

      /*
      if !Empty( nPos )
         nIndentation  := nIndentation - nInd
      endif
      */

      nPosInd := 0
   else
      nIndentation  := nIndentation + nInd
   endif

   if ::GetLineCount() > nCurLine
      ::GoLine( nCurLine + 1 )
   endif

   ::SendEditor( SCI_SETLINEINDENTATION, nCurLine, nPosInd + nIndentation )
   ::GotoPos( ::GetCurrentPos() + nIndentation )

return nil
 


La clave me la distes con usar el método Notify :-) Ya lo tengo funcionando asi:

Code: Select all  Expand view
METHOD AutoIndent() CLASS TScintilla

   local nPrevLine     := ::GetCurrentLineNumber() - 1
   local nIndentation := ::GetLineIndentation( nPrevLine )
   local nPos         := ::GetCurrentPos()

   ::Send( SCI_SETLINEINDENTATION, nPrevLine + 1, nIndentation )
   ::InsertText( nPos, Space( nIndentation ) )
   ::Send( SCI_GOTOPOS, nPos + nIndentation )

return nil
 


Antonio, a mi tambien me funciona sin necesidad de:

Code: Select all  Expand view

  ::InsertText( nPos, Space( nIndentation ) )
 

Re: Introducing FiveTech's fivedit

PostPosted: Sat Jan 24, 2015 9:49 am
by Antonio Linares
Cristobal,

A mi sin el InsertText() el cursor se va varias líneas más abajo.

Re: Introducing FiveTech's fivedit

PostPosted: Sat Jan 24, 2015 9:52 am
by Antonio Linares
Colin,

Smart indenting already implemented :-)

James,

On preferences dialogbox new "Duplicates on functions panel" checkbox to remove duplicates :-)

https://bitbucket.org/fivetech/fivewin-contributions/downloads/fivedit.zip

Re: Introducing FiveTech's fivedit

PostPosted: Sat Jan 24, 2015 7:29 pm
by cnavarro
Antonio Linares wrote:Cristobal,

A mi sin el InsertText() el cursor se va varias líneas más abajo.


-------------------------- EDITADO --------------------------------------------

Antonio, prueba con lo siguiente en el Setup, y quita la linea de insercion de espacios

Code: Select all  Expand view

.../...

   ::SendEditor( SCI_SETUSETABS, 0 )
   ::SendEditor( SCI_SETTABWIDTH, 3, 0 )

   //Set autoindentation con 3 spaces
   ::SendEditor( SCI_SETINDENT, ::SendEditor( SCI_GETTABWIDTH, 0, 0 ), 0  )
   ::SendEditor( SCI_SETTABINDENTS, 0, 0  )
   ::SendEditor( SCI_SETBACKSPACEUNINDENTS, 1, 0 )

.../...