Clipper On Line • Ver Tópico - WVG e editor Scintilla
Mudar para estilo Clássico
GTWVG com API Windows somente no Harbour.
No Harbouir 3.4 está sendo usado pointer, aonde no 3.2 é numérico.
Postar uma resposta

WVG e editor Scintilla

16 Out 2017 15:27

Foi só um teste de curiosidade.
Sabem aquele recurso de editor de textos de auto-completar, mostrar lista de funções, code folding, colorir sintaxe, etc. etc. etc.
É tudo o Scintilla.
Então.... fiz um teste ultra-básico com ele.
Um controle básico em GTWVG, só pra testar....

scintilla.png


Lógico... daí pra poder usar como editor de texto... nem sei se compensa... vai ser muita programação.
Foi só pra curiosidade mesmo.

WVG e editor Scintilla

16 Out 2017 15:59

E se olhar os fontes do programmers notepad, tem muitos diálogos em resource.
Dá até pra utilizar esses diálogos prontos direto num aplicativo.
É por isso que tem tanto editor de texto por aí....
O diferencial acaba sendo o quanto eles usam do Scintilla, o modo de configurar, cores escolhidas.
No final, é o Scintilla que faz o trabalho que interessa.

Isso faz pensar uma outra coisa....
Se toda tela do editor de textos é o Scintilla que faz... não seria só ter controles nesse estilo ao invés de LIBs gráficas?

WVG e editor Scintilla

19 Out 2017 06:11

Parabéns Zé. Essa dll é de fato muito boa.

WVG e editor Scintilla

06 Nov 2017 17:53

Pesquisei mais um pouco sobre a DLL.
Realmente, é a DLL que faz tudo, mas haja opções pra colocar na possível IDE....
É só uma pequena parte das "funções"

Código:
#include "hbclass.ch"

CREATE CLASS SCIClass

   VAR    hWnd    INIT NIL
   METHOD SendEditor( nMsg, nParam, xValue ) INLINE ;
                                   iif( ValType( xValue ) == "C", ;
                                   wapi_SendMessageString( hWnd, nMsg, hb_Default( nParam, 0 ), xValue ), ;
                                   wapi_SendMessage( hWnd, nMsg, hb_Default( nParam, 0 ), hb_Default( nParam, 0 ), xValue ) )

METHOD SendEditor( nMsg, nParam, xValue )

   IF ValType( xValue) == "C"
      xReturn := wapi_SendMessageString( ::hWnd, nMsg, nParam, xValue )
   ELSE
      xReturn := wapi_SendMesage( ::hWnd, nMsg, nParam, xValue )
   ENDIF
   RETURN xReturn
   METHOD AddText( nLen, cText )             INLINE ::SendEditor 2001, nLen, cText )
   METHOD GetCurPos()                        INLINE ::SendEditor SCI_GETCURRENTPOS )
   METHOD CharAtPos( nPos )                  INLINE ::SendEditor SCI_GET_CHARAT, nPos )
   //METHOD SetSelText( cText )                INLINE ReplaceSel( ::cText )
   METHOD AddStyledText( nLen )              INLINE ::SendEditor 2002, nLen )
   METHOD InsertText( nPos, cText )          INLINE ::SendEditor 2003, nPos, cText )
   METHOD ClearAll()                         INLINE ::SendEditor 2004 )
   METHOD ClearDocumentStyle()               INLINE ::SendEditor 2005 )
   METHOD GetLength()                        INLINE ::SendEditor 2006 )
   METHOD GetCharAt( nPos )                  INLINE ::SendEditor 2007, nPos )
   METHOD GetStyleAt( nPos )                 INLINE ::SendEditor 2010, nPos )
   METHOD Redo()                             INLINE ::SendEditor 2011 )
   METHOD SetUndoCollection( lCollectUndo )  INLINE ::SendEditor 2012, lCollectUndo )
   METHOD SelectAll()                        INLINE ::SendEditor 2013 )
   METHOD SetSaveProint()                    INLINE ::SendEditor 2014 )
   METHOD GetStyledText()                    INLINE ::SendEditor 2015 )
   METHOD CanRedo()                          INLINE ::SendEditor 2016 )
   METHOD MarkerLineFromHandle( nHandle )    INLINE ::SendEditor 2017, nHandle )
   METHOD MarkerDeleteHandle( nHandle )      INLINE ::SendEditor 2018 )
   METHOD GetUndoCollection()                INLINE ::SendEditor 2019 )
   METHOD GetViewWs()                        INLINE ::SendEditor 2020 )
   //METHOD SetViewWs( nViewWs )               INLINE SetViewWs( 2021 )
   METHOD GotoLine( nValue )                 INLINE ::SendEditor 2024, nValue )
   METHOD GotoPos( nValue )                  INLINE ::SendEditor 2025, nValue )
   METHOD SetAnchor( nPos )                  INLINE ::SendEditor 2026, nValue )
   METHOD GetCurLine( nLen, cText )          INLINE ::SendEditor 2027, nLen, cText )
   METHOD ConvertEOLs( lEOLMode )            INLINE ::SendEditor 2029, lEOLMode )
   METHOD StartStyling( nPos, nMask )        INLINE ::SendEditor 2032, nPos, nMask )
   METHOD SetStyling( nLen, nStyle )         INLINE ::SendEditor 2033, nLen, nStyle )
   METHOD GetBufferedDraw()                  INLINE ::SendEditor 2034 )
   METHOD SetBufferedDraw( lBuffered )       INLINE ::SendEditor 2035, lBuffered )
   METHOD SetTabWidth( nTabWidth )           INLINE ::SendEditor 2036, nTabWidth )
   METHOD GetTabWidth()                      INLINE ::SendEditor 2121 )
   METHOD SetCodepage( nCodepage )           INLINE ::SendEditor 2037, nCodePage )
   METHOD SetUsePalette( lUsePalette )       INLINE ::SendEditor 2039, lUsePalette )

   END CLASS

WVG e editor Scintilla

08 Nov 2017 17:24

Corrigido, porque faltava parêntesis e adicionados mais.

Código:
#include "hbclass.ch"

CREATE CLASS SCIClass

   VAR    hWnd    INIT NIL
   METHOD SendEditor( nMsg, nParam, xValue ) INLINE ;
                                   iif( ValType( xValue ) == "C", ;
                                   wapi_SendMessageString( hWnd, nMsg, hb_Default( nParam, 0 ), xValue ), ;
                                   wapi_SendMessage( hWnd, nMsg, hb_Default( nParam, 0 ), hb_Default( nParam, 0 ), xValue ) )

METHOD SendEditor( nMsg, nParam, xValue )

   IF ValType( xValue) == "C"
      xReturn := wapi_SendMessageString( ::hWnd, nMsg, nParam, xValue )
   ELSE
      xReturn := wapi_SendMesage( ::hWnd, nMsg, nParam, xValue )
   ENDIF
   RETURN xReturn
   METHOD AddText( nLen, cText )                 INLINE ::SendEditor( 2001, nLen, cText )
   METHOD GetCurPos()                            INLINE ::SendEditor( SCI_GETCURRENTPOS )
   METHOD CharAtPos( nPos )                      INLINE ::SendEditor( SCI_GET_CHARAT, nPos )
   //METHOD SetSelText( cText )                  INLINE ReplaceSel( ::cText )
   METHOD AddStyledText( nLen )                  INLINE ::SendEditor( 2002, nLen )
   METHOD InsertText( nPos, cText )              INLINE ::SendEditor( 2003, nPos, cText )
   METHOD ClearAll()                             INLINE ::SendEditor( 2004 )
   METHOD ClearDocumentStyle()                   INLINE ::SendEditor( 2005 )
   METHOD GetLength()                            INLINE ::SendEditor( 2006 )
   METHOD GetCharAt( nPos )                      INLINE ::SendEditor( 2007, nPos )
   METHOD GetStyleAt( nPos )                     INLINE ::SendEditor( 2010, nPos )
   METHOD Redo()                                 INLINE ::SendEditor( 2011 )
   METHOD SetUndoCollection( lCollectUndo )      INLINE ::SendEditor( 2012, lCollectUndo )
   METHOD SelectAll()                            INLINE ::SendEditor( 2013 )
   METHOD SetSaveProint()                        INLINE ::SendEditor( 2014 )
   METHOD GetStyledText()                        INLINE ::SendEditor( 2015 )
   METHOD CanRedo()                              INLINE ::SendEditor( 2016 )
   METHOD MarkerLineFromHandle( nHandle )        INLINE ::SendEditor( 2017, nHandle )
   METHOD MarkerDeleteHandle( nHandle )          INLINE ::SendEditor( 2018 )
   METHOD GetUndoCollection()                    INLINE ::SendEditor( 2019 )
   METHOD GetViewWs()                            INLINE ::SendEditor( 2020 )
   //METHOD SetViewWs( nViewWs )                 INLINE SetViewWs( 2021 )
   METHOD GotoLine( nValue )                     INLINE ::SendEditor( 2024, nValue )
   METHOD GotoPos( nValue )                      INLINE ::SendEditor( 2025, nValue )
   METHOD SetAnchor( nPos )                      INLINE ::SendEditor( 2026, nValue )
   METHOD GetCurLine( nLen, cText )              INLINE ::SendEditor( 2027, nLen, cText )
   METHOD ConvertEOLs( lEOLMode )                INLINE ::SendEditor( 2029, lEOLMode )
   METHOD StartStyling( nPos, nMask )            INLINE ::SendEditor( 2032, nPos, nMask )
   METHOD SetStyling( nLen, nStyle )             INLINE ::SendEditor( 2033, nLen, nStyle )
   METHOD GetBufferedDraw()                      INLINE ::SendEditor( 2034 )
   METHOD SetBufferedDraw( lBuffered )           INLINE ::SendEditor( 2035, lBuffered )
   METHOD SetTabWidth( nTabWidth )               INLINE ::SendEditor( 2036, nTabWidth )
   METHOD GetTabWidth()                          INLINE ::SendEditor( 2121 )
   METHOD SetCodepage( nCodepage )               INLINE ::SendEditor( 2037, nCodePage )
   METHOD SetUsePalette( lUsePalette )           INLINE ::SendEditor( 2039, lUsePalette )
   METHOD MarkerDefine( nMarkerNumber, nSymbol ) INLINE ::SendEditor( 2040, nMarkerNumber, nSymbol )
   METHOD MarkerSetFore( nMarkerNumber, nFore )  INLINE ::SendEditor( 2041, nMarkerNumber, nFore )
   METHOD MarkerSetBack( nMarkerNumber, nBack )  INLINE ::SendEditor( 2042, nMarkerNumber, nBack )
   METHOD MarkerAdd( nLine, nMarkerNumber )      INLINE ::SendEditor( 2043, nLine, nMarkerNumber )
   METHOD MarkerDelete( nLine, nMarkerNumber )   INLINE ::SendEditor( 2044, nMarkerNumber )
   METHOD MarkerDeleteAll( nMarkerNumber )       INLINE ::SendEditor( 2045, nMarkerNumber )
   METHOD MarkerGet( nLine )                     INLINE ::SendEditor( 2046, nLine )
   METHOD MarkerNext( nLineStart, nMarkerMask )  INLINE ::SendEditor( 2047, nLineStart, nMarkerMask )
   METHOD MarkerPrevious( nLineStart, nMarkerMask ) INLINE ::SendEditor( 2048, nLineStart, nMarkerMask )
   METHOD MarkerDefinePixMap( nMarkerNumber, cPixMap ) INLINE ::SendEditor( 2049, nMarkerNumber, cPixMap )
   METHOD MarkerAddSet( nLine, nSets )           INLINE ::SendEditor( 2466, nLine, nSets )
   METHOD SetMarginTypeN( nMargin, nMarginType ) INLINE ::SendEditor( 2240, nMargin, nMarginType )
   METHOD GetMarginTypeN( nMargin )              INLINE ::SendEditor( 2241, nMargin )
   METHOD SetMarginWidthN( nMargin, nPixelWidth) INLINE ::SendEditor( 2242, nMargin, nPixelWidth )

   END CLASS


Tem uma parte muito interessante nisso:
Usa as mensagens do Windows, mas não os códigos do Windows.
Talvez esse tipo de coisa tivesse alguma utilidade para as LIBs: um controle não preso a códigos do Windows.

WVG e editor Scintilla

08 Nov 2017 17:26

E pra quem quiser o editor completo, tá neste fonte de VB.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=66207&lngWId=1

Só não deu pra fazer funcionar aqui, porque depende de mais coisas, e não procurei.
Postar uma resposta