[Fxruby-commits] CVS: FXRuby/ext/fox FXRuby.cpp,1.39,1.40 core_wrap.cpp,1.61,1.62
Status: Inactive
Brought to you by:
lyle
From: Lyle J. <ly...@us...> - 2002-04-03 21:41:05
|
Update of /cvsroot/fxruby/FXRuby/ext/fox In directory usw-pr-cvs1:/tmp/cvs-serv13377/ext/fox Modified Files: FXRuby.cpp core_wrap.cpp Log Message: Added typemaps and supporting code to get FXDC#setDashes working properly. Fixed other bugs in the FXDC test case. Index: FXRuby.cpp =================================================================== RCS file: /cvsroot/fxruby/FXRuby/ext/fox/FXRuby.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** FXRuby.cpp 3 Apr 2002 00:18:12 -0000 1.39 --- FXRuby.cpp 3 Apr 2002 21:40:27 -0000 1.40 *************** *** 214,217 **** --- 214,257 ---- } + // Returns a Ruby array of integers + VALUE FXRbMakeArray(const FXchar* dashpattern,FXuint dashlength){ + VALUE result=rb_ary_new(); + for(FXuint i=0; i<dashlength; i++) + rb_ary_push(result,INT2NUM(dashpattern[i])); + return result; + } + + // Returns a Ruby array of FXArcs + VALUE FXRbMakeArray(const FXArc* arcs,FXuint narcs){ + VALUE result=rb_ary_new(); + for(FXuint i=0; i<narcs; i++) + rb_ary_push(result,FXRbGetRubyObj(&arcs[i],"FXArc *")); + return result; + } + + // Returns a Ruby array of FXPoints + VALUE FXRbMakeArray(const FXPoint* points,FXuint npoints){ + VALUE result=rb_ary_new(); + for(FXuint i=0; i<npoints; i++) + rb_ary_push(result,FXRbGetRubyObj(&points[i],"FXPoint *")); + return result; + } + + // Returns a Ruby array of FXRectangles + VALUE FXRbMakeArray(const FXRectangle* rectangles,FXuint nrectangles){ + VALUE result=rb_ary_new(); + for(FXuint i=0; i<nrectangles; i++) + rb_ary_push(result,FXRbGetRubyObj(&rectangles[i],"FXRectangle *")); + return result; + } + + // Returns a Ruby array of FXSegments + VALUE FXRbMakeArray(const FXSegment* segments,FXuint nsegments){ + VALUE result=rb_ary_new(); + for(FXuint i=0; i<nsegments; i++) + rb_ary_push(result,FXRbGetRubyObj(&segments[i],"FXSegment *")); + return result; + } + //---------------------------------------------------------------------- Index: core_wrap.cpp =================================================================== RCS file: /cvsroot/fxruby/FXRuby/ext/fox/core_wrap.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** core_wrap.cpp 3 Apr 2002 17:36:27 -0000 1.61 --- core_wrap.cpp 3 Apr 2002 21:40:27 -0000 1.62 *************** *** 756,759 **** --- 756,762 ---- swig_class cFXArc; static void free_FXArc(FXArc *); + VALUE FXDC_getDashPattern(FXDC const *self){ + return FXRbMakeArray(self->getDashPattern(), self->getDashLength()); + } swig_class cFX_DC; *************** *** 9806,9812 **** [...1203 lines suppressed...] ! arg4 = static_cast<FXuint>( RARRAY(argv[1])->len ); ! for (FXuint i = 0; i < arg4; i++) { ! arg3[i] = NUM2INT(rb_ary_entry(argv[1], i)); ! } ! } (arg1)->_setDashes(arg2,(FXchar const *)arg3,arg4); + { + delete [] arg3; + } return Qnil; } *************** *** 18942,18946 **** rb_define_method(cFX_DC.klass, "getDashPattern", VALUEFUNC(_wrap_FX_DC_getDashPattern), -1); rb_define_method(cFX_DC.klass, "getDashOffset", VALUEFUNC(_wrap_FX_DC_getDashOffset), -1); - rb_define_method(cFX_DC.klass, "getDashLength", VALUEFUNC(_wrap_FX_DC_getDashLength), -1); rb_define_method(cFX_DC.klass, "setLineWidth", VALUEFUNC(_wrap_FX_DC_setLineWidth), -1); rb_define_method(cFX_DC.klass, "getLineWidth", VALUEFUNC(_wrap_FX_DC_getLineWidth), -1); --- 18965,18968 ---- |