320d5cdf26
- aggiornamenti per cambio nome include di base - aggiustamento su Save.
76 lines
2.4 KiB
C++
76 lines
2.4 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : TestEGrCmd.cpp Data : 15.03.14 Versione : 1.5c5
|
|
// Contenuto : Metodi dell'edit per comandi utente.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 27.02.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "TestEGrCmd.h"
|
|
#include "TestEGrUtils.h"
|
|
#include "/EgtDev/Include/EGnStringUtils.h"
|
|
#include "/EgtDev/Include/EgtStringConverter.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
//----------------------------------------------------------------------------
|
|
BEGIN_MESSAGE_MAP( TestEGrCmd, CEdit)
|
|
ON_WM_KEYDOWN()
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
TestEGrCmd::TestEGrCmd( void)
|
|
{
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
TestEGrCmd::~TestEGrCmd( void)
|
|
{
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
void
|
|
TestEGrCmd::OutputText( const string& sText)
|
|
{
|
|
ReplaceSel( stringtoW( sText)) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
void
|
|
TestEGrCmd::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags)
|
|
{
|
|
CEdit::OnKeyDown( nChar, nRepCnt, nFlags) ;
|
|
|
|
// se e' stato premuto RETURN
|
|
if ( nChar == VK_RETURN) {
|
|
// si recupera la linea corrente
|
|
SetSel( -1, 0) ; // per eliminare la selezione corrente
|
|
int nBuf = LineLength( LineIndex()) + 1 ; // usa indice di carattere
|
|
wcharBuffer wBuffer( nBuf) ;
|
|
int nLen = GetLine( LineFromChar(), wBuffer.data(), nBuf) ; // usa indice di linea
|
|
wBuffer.terminate( nLen) ;
|
|
string sCmd = wcharBtoA( wBuffer) ;
|
|
TrimLeft( sCmd) ;
|
|
// se linea valida si esegue
|
|
if ( ! sCmd.empty() && sCmd.compare( 0, 2, "//") != 0) {
|
|
if ( ! ::LineExec( sCmd))
|
|
::OutInfo( "Error executing command") ;
|
|
}
|
|
}
|
|
}
|