From: Lyle J. <ly...@us...> - 2002-04-03 21:41:05
|
Update of /cvsroot/fxruby/FXRuby/swig-interfaces In directory usw-pr-cvs1:/tmp/cvs-serv13377/swig-interfaces Modified Files: FXDC.i typemaps.i Log Message: Added typemaps and supporting code to get FXDC#setDashes working properly. Fixed other bugs in the FXDC test case. Index: FXDC.i =================================================================== RCS file: /cvsroot/fxruby/FXRuby/swig-interfaces/FXDC.i,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** FXDC.i 3 Apr 2002 17:36:27 -0000 1.20 --- FXDC.i 3 Apr 2002 21:40:57 -0000 1.21 *************** *** 145,148 **** --- 145,150 ---- %rename(setClipRectangle4) FXDC::setClipRectangle(FXint x,FXint y,FXint w,FXint h); + %ignore FXDC::getDashLength() const; + %exception FXDC::FXDC "$action FXRbRegisterRubyObj(self, result);"; *************** *** 310,315 **** virtual void setDashes(FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength); ! /// Get dash pattern ! const FXchar* getDashPattern() const; /// Get dash offset --- 312,321 ---- virtual void setDashes(FXuint dashoffset,const FXchar *dashpattern,FXuint dashlength); ! %addmethods { ! /// Get dash pattern ! VALUE getDashPattern() const { ! return FXRbMakeArray(self->getDashPattern(), self->getDashLength()); ! } ! } /// Get dash offset Index: typemaps.i =================================================================== RCS file: /cvsroot/fxruby/FXRuby/swig-interfaces/typemaps.i,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** typemaps.i 3 Apr 2002 17:36:27 -0000 1.34 --- typemaps.i 3 Apr 2002 21:40:57 -0000 1.35 *************** *** 473,479 **** $2 = static_cast<FXuint>( RARRAY($input)->len ); for (FXuint i = 0; i < $2; i++) { ! FXPoint *p; ! Data_Get_Struct(rb_ary_entry($input, i), FXPoint, p); ! $1[i] = p; } } --- 473,479 ---- $2 = static_cast<FXuint>( RARRAY($input)->len ); for (FXuint i = 0; i < $2; i++) { ! FXPoint *pPoint; ! Data_Get_Struct(rb_ary_entry($input, i), FXPoint, pPoint); ! $1[i] = *pPoint; } } *************** *** 489,495 **** $2 = static_cast<FXuint>( RARRAY($input)->len ); for (FXuint i = 0; i < $2; i++) { ! FXSegment *s; ! Data_Get_Struct(rb_ary_entry($input, i), FXSegment, s); ! $1[i] = s; } } --- 489,495 ---- $2 = static_cast<FXuint>( RARRAY($input)->len ); for (FXuint i = 0; i < $2; i++) { ! FXSegment *pSeg; ! Data_Get_Struct(rb_ary_entry($input, i), FXSegment, pSeg); ! $1[i] = *pSeg; } } *************** *** 505,511 **** $2 = static_cast<FXuint>( RARRAY($input)->len ); for (FXuint i = 0; i < $2; i++) { ! FXRectangle *r; ! Data_Get_Struct(rb_ary_entry($input, i), FXRectangle, r); ! $1[i] = r; } } --- 505,511 ---- $2 = static_cast<FXuint>( RARRAY($input)->len ); for (FXuint i = 0; i < $2; i++) { ! FXRectangle *pRect; ! Data_Get_Struct(rb_ary_entry($input, i), FXRectangle, pRect); ! $1[i] = *pRect; } } *************** *** 521,527 **** $2 = static_cast<FXuint>( RARRAY($input)->len ); for (FXuint i = 0; i < $2; i++) { ! FXArc *arc; ! Data_Get_Struct(rb_ary_entry($input, i), FXArc, arc); ! $1[i] = arc; } } --- 521,527 ---- $2 = static_cast<FXuint>( RARRAY($input)->len ); for (FXuint i = 0; i < $2; i++) { ! FXArc *pArc; ! Data_Get_Struct(rb_ary_entry($input, i), FXArc, pArc); ! $1[i] = *pArc; } } *************** *** 537,538 **** --- 537,552 ---- $2 = RSTRING($input)->len; } + + // Extract a C array (dashpattern) and its length (dashlength) from a Ruby array of Fixnums + %typemap(in) (const FXchar* dashpattern, FXuint dashlength) { + Check_Type($input, T_ARRAY); + $1 = new FXchar[RARRAY($input)->len]; + $2 = static_cast<FXuint>( RARRAY($input)->len ); + for (FXuint i = 0; i < $2; i++) { + $1[i] = NUM2INT(rb_ary_entry($input, i)); + } + } + + %typemap(freearg) (const FXchar* dashpattern, FXuint dashlength) { + delete [] $1; + } |