// Machine generated IDispatch wrapper class(es) created with ClassWizard

#include "stdafx.h"
#include "outputcomeditorstream.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif



/////////////////////////////////////////////////////////////////////////////
// IOutputCOMEditor properties

/////////////////////////////////////////////////////////////////////////////
// IOutputCOMEditor operations

void IOutputCOMEditor::ShowWindow()
{
	InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

void IOutputCOMEditor::AddText(LPCTSTR text)
{
	static BYTE parms[] =
		VTS_BSTR;
	InvokeHelper(0x2, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
		 text);
}

long IOutputCOMEditor::GetCursorPosition()
{
	long result;
	InvokeHelper(0x3, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
	return result;
}

void IOutputCOMEditor::SetCursorAtPosition(long position)
{
	static BYTE parms[] =
		VTS_I4;
	InvokeHelper(0x4, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
		 position);
}

long IOutputCOMEditor::GetMaximalCursorPosition()
{
	long result;
	InvokeHelper(0x5, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
	return result;
}

void IOutputCOMEditor::SetCursorAtStart()
{
	InvokeHelper(0x6, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

void IOutputCOMEditor::SetCursorAtEnd()
{
	InvokeHelper(0x7, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

void IOutputCOMEditor::MoveCursorBy(long offset)
{
	static BYTE parms[] =
		VTS_I4;
	InvokeHelper(0x8, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
		 offset);
}

void IOutputCOMEditor::EndLine()
{
	InvokeHelper(0x9, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}


namespace kaBasicClasses {

OutputCOMEditorStream* DumpStreamPtr;

OutputCOMEditorStreamBuffer::OutputCOMEditorStreamBuffer() : theBufferSize(1000)
{
	theBuffer.reserve(theBufferSize+3);
	setp( theBuffer.begin(), theBuffer.begin()+(theBufferSize-1));
	if( !theEditor.CreateDispatch("OutputCOMEditor.Document") )
			AfxMessageBox("Unable to CreateDispatch(OutputCOMEditor.Document)");
	theEditor.ShowWindow();
}


OutputCOMEditorStreamBuffer::~OutputCOMEditorStreamBuffer()
{
	flush();
	theEditor.ReleaseDispatch();
}

int OutputCOMEditorStreamBuffer::flush()
{
	int num=pptr()-pbase();
	charType ch=*pptr();
	*pptr()=charType(0);
	theEditor.AddText(&*theBuffer.begin());
	*pptr()=ch;
	pbump(-num);
	return num;
}

OutputCOMEditorStreamBuffer::int_type OutputCOMEditorStreamBuffer::overflow( int_type c )
{
		if( c!=EOF )
		{
			*pptr()=c;
			pbump(1);
		}
		flush();
		return c;
}

int OutputCOMEditorStreamBuffer::getCursorPosition()
{
	return theEditor.GetCursorPosition();
}

int OutputCOMEditorStreamBuffer::getMaximalCursorPosition()
{
	return theEditor.GetMaximalCursorPosition();
}

void OutputCOMEditorStreamBuffer::setCursorAtBeginning()
{
	theEditor.SetCursorAtStart();
}

void OutputCOMEditorStreamBuffer::setCursorAtEnd()
{
	theEditor.SetCursorAtEnd();
}

void OutputCOMEditorStreamBuffer::setCursorAtPosition( int pos )
{
	theEditor.SetCursorAtPosition(pos);
}

void OutputCOMEditorStreamBuffer::moveCursorBy(int pos)
{
	theEditor.MoveCursorBy(pos);
}

}; //kaBasicClasses

Hosted by www.Geocities.ws

1