Пример #1
0
void KrConsole::Print( const char* format, ... )
{
    va_list     va;
    char		buffer[1024];

    //
    //  format and output the message..
    //
    va_start( va, format );
    vsprintf( buffer, format, va );
    va_end( va );

	char* start;
	char* end;
	char* next;

	start = buffer;

	while ( start && *start )
	{
		end = strchr( start, '\n' );
		if ( end )
		{
			next  = end + 1;
			*end = 0;
			PushText( start );
			start = next;
		}
		else
		{
			PushText( start );
			start = 0;
		}			
	}
}
Пример #2
0
void KrConsole::ProcessEnterKey()
{
	gedString buf;
	commandLine->GetText( &buf ); //maks

	// Push the command to the command buffer. Don't add duplicates.
	if ( buf == commandBuf.Front() )
	{
		if ( commandBufSize >= COMMAND_BUF_SIZE )
		{
			commandBuf.PopBack();
		}
		else
		{
			++commandBufSize;
		}
		commandBuf.PushFront( buf );
	}

	// Scroll up!
	textBox->SetText16( 0, textBox->NumLines() - 1 );
	PushText( buf.c_str() );
	commandBufNode = 0;
	commandLine->SetText( "" ); //maks

	// Scan the command list. If that fails, call the default handler.
	GlSListNode<Command>* node = 0;

	gedString compareBuf = buf;
	gedString arg;

	int spaceAt = compareBuf.find( ' ' );
	if ( spaceAt > 0 )
	{
		arg = buf.substr( spaceAt + 1, buf.length() );
		compareBuf.resize( spaceAt );
	}

	for( node = commandList.FrontNode(); node; node = node->next )
	{
		//int len = node->data.command.length();

		if ( compareBuf == node->data.command )
		{
			PublishTaggedEvent( ACTIVATED, 0, compareBuf.c_str(), arg.c_str(), node->data.handler );
			break;
		}
	}
}
Пример #3
0
void KrConsole::TabCompletion()
{
	// Go through the command list and figure out all the commands
	// this could complete to. If only one, make the completion,
	// else push the options to the console.
	gedString buf;
	GlSListNode<Command>* node;
	GlSList<gedString*> matches;

	commandLine->GetText( &buf ); //maks

	for ( node = commandList.FrontNode(); node; node = node->next )
	{
		if ( buf == node->data.command.substr( 0, buf.length() ) ) //maks
		{
			matches.PushFront( &(node->data.command) );
		}
	}

	if ( matches.Size() > 1 )
	{
		GlSListNode<gedString*>* mNode;
		for( mNode = matches.FrontNode(); mNode; mNode = mNode->next )
		{
			PushText( mNode->data->c_str() );
		}
	}
	else if ( matches.Size() == 1 )
	{
		//strcpy( buf, matches.FrontNode()->data->c_str() );
		//strcat( buf, " " );
		buf = *matches.FrontNode()->data;
		buf += " ";
		commandLine->SetText( buf ); //maks
	}
}
Пример #4
0
	bool XMLPrinter::Visit( const XMLText& text )
	{
		PushText( text.Value(), text.CData() );
		return true;
	}
Пример #5
0
	void XMLPrinter::PushText( double value )
	{
		char buf[BUF_SIZE];
		XMLUtil::ToStr( value, buf, BUF_SIZE );
		PushText( buf, false );
	}