1. wxCaret

Matt,

I added the routines for wxCaret to wxEuphoria.cpp. I hope I did it right this
time, everything compiled fine.

object WXEUAPI  new_wxCaret( object params )
{
	int parent = get_int( params, 1 );
	int x = get_int( params, 2 );
	int y = get_int( params, 3 );
	
	wxCaret * caret = new wxCaret( ((wxWindow*) parent), x, y );
	
	return BOX_INT( caret );
}

object WXEUAPI get_caret_blink_time( int caret )
{
	return ((wxCaret*) caret)->GetBlinkTime();
}

object WXEUAPI get_caret_position( int caret )
{
	wxPoint pos = ((wxCaret*) caret)->GetPosition();

	s1_ptr ret = NewS1(2);
	ret->base[1] = pos.x;
	ret->base[2] = pos.y;
	
	return MAKE_SEQ(ret);
}

object WXEUAPI get_caret_size( int caret )
{
	wxSize size = ((wxCaret*) caret)->GetSize();

	s1_ptr ret = NewS1(2);
	ret->base[1] = size.GetWidth();
	ret->base[2] = size.GetHeight();
	
	return MAKE_SEQ(ret);
}

object WXEUAPI get_caret_window( int caret )
{
	return BOX_INT( ((wxCaret*) caret)->GetWindow() );
}

void WXEUAPI hide_caret( int caret )
{
	((wxCaret*) caret)->Hide();
}

object WXEUAPI caret_isok( int caret )
{
	return ((wxCaret*) caret)->IsOk();
}

object WXEUAPI caret_isvisible( int caret )
{
	return ((wxCaret*) caret)->IsVisible();
}

void WXEUAPI move_caret( int caret, int x, int y )
{
	((wxCaret*) caret)->Move( x, y );
}

void WXEUAPI set_caret_blink_time( int caret, int milliseconds )
{
	((wxCaret*) caret)->SetBlinkTime( milliseconds );
}

void WXEUAPI set_caret_size( int caret, int width, int height )
{
	((wxCaret*) caret)->SetSize( width, height );
}

void WXEUAPI show_caret( int caret )
{
	((wxCaret*) caret)->Show( true );
}



Here are the exports:

EXPORT new_wxCaret=_new_wxCaret
EXPORT caret_isok=_caret_isok
EXPORT caret_isvisible=_caret_isvisible
EXPORT get_caret_blink_time=_get_caret_blink_time
EXPORT get_caret_position=_get_caret_position
EXPORT get_caret_size=_get_caret_size
EXPORT get_caret_window=_get_caret_window
EXPORT hide_caret=_hide_caret
EXPORT move_caret=_move_caret
EXPORT set_caret_blink_time=_set_caret_blink_time
EXPORT set_caret_size=_set_caret_size
EXPORT show_caret=_show_caret


Have you ever looked at a word so many times, you're not sure if it's a word
anymore? All I see is "caret, caret, caret caret..." I'm getting hungry! :-p

-Greg

new topic     » topic index » view message » categorize

2. Re: wxCaret

Greg Haberek wrote:
> 
> Matt,
> 
> I added the routines for wxCaret to wxEuphoria.cpp. I hope I did it right
> this time, everything compiled fine.

It compiled?  Ship it!

object WXEUAPI  new_wxCaret( object params )
 {
 	int parent = get_int( params, 1 );
 	int x = get_int( params, 2 );
 	int y = get_int( params, 3 );
 	
 	wxCaret * caret = new wxCaret( ((wxWindow*) parent), x, y );
 	
 	return BOX_INT( caret );
 }

Looks good, except that you also need to deref and sequence that's passed.

You can use wxDerefDS if you know it's a double or a sequence, and wxDeRef
if it's an atom that might be an integer:
  wxDeRefDS( params );
  wxDeRef( params );

You can actually make these calls at the top of the function.  wxEuphoria
won't dereference these (they always have a refcount of at least 2 or 
3 by the time wxEuphoria sees it).  Euphoria will free it after control
returns from the call.  If you don't do this, you'll end up leaking 
memory.

I added you as a developer to the project, so go ahead and make those changes
and commit...

Matt

new topic     » goto parent     » topic index » view message » categorize

3. Re: wxCaret

Matt Lewis wrote:
> 
> Greg Haberek wrote:
> > 
> > Matt,
> > 
> > I added the routines for wxCaret to wxEuphoria.cpp. I hope I did it right
> > this time, everything compiled fine.
> 
> It compiled?  Ship it!
> 
> Matt

Bah! I compile it with Watcom and everything looks fine, but when I drop the new
DLL in %EUDIR%\BIN, I get "Could not open wxEuphoria library.  Press enter to
abort."

Why is this not working? I even recompiled wxWidgets again to be sure. It still
doesn't work. Everything looks fine when I open libwxeu.dll in Dependency Walker.

-Greg

new topic     » goto parent     » topic index » view message » categorize

4. Re: wxCaret

Greg Haberek wrote:
> 
> 
> Bah! I compile it with Watcom and everything looks fine, but when I drop the
> new DLL in %EUDIR%\BIN, I get "Could not open wxEuphoria library.  Press enter
> to abort."
> 
> Why is this not working? I even recompiled wxWidgets again to be sure. It
> still
> doesn't work. Everything looks fine when I open libwxeu.dll in Dependency
> Walker.

I checked out the SVN source and got the wxCaret routines into that
wxEuphora.cpp, and the functions into exports.lbc. The SVN source compiles and
works correctly (unlike my downloaded source).

However, I'm missing "stringhash.e" which is used by wrap.exw. Where do I get
this? I can't find it in the Archive.

-Greg

new topic     » goto parent     » topic index » view message » categorize

5. Re: wxCaret

Greg Haberek wrote:
> 
> Greg Haberek wrote:
> > 
> > 
> > Bah! I compile it with Watcom and everything looks fine, but when I drop the
> > new DLL in %EUDIR%\BIN, I get "Could not open wxEuphoria library.  Press
> > enter
> > to abort."
> > 
> > Why is this not working? I even recompiled wxWidgets again to be sure. It
> > still
> > doesn't work. Everything looks fine when I open libwxeu.dll in Dependency
> > Walker.
> 
> I checked out the SVN source and got the wxCaret routines into that
> wxEuphora.cpp,
> and the functions into exports.lbc. The SVN source compiles and works
> correctly
> (unlike my downloaded source).
> 
> However, I'm missing "stringhash.e" which is used by wrap.exw. Where do I get
> this? I can't find it in the Archive.
> 
> -Greg

I found stringhash.e by googling for it.  Once you copy the file, wrap.exw will
work.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu