Back to index

plt-scheme  4.2.1
wxs_dc.cxx
Go to the documentation of this file.
00001 /* DO NOT EDIT THIS FILE. */
00002 /* This file was generated by xctocc from "wxs_dc.xc". */
00003 
00004 
00005 #if defined(_MSC_VER)
00006 # include "wx.h"
00007 #endif
00008 #if defined(OS_X)
00009 # include "common.h"
00010 #endif
00011 
00012 #include "wx_dccan.h"
00013 #include "wx_dcmem.h"
00014 #include "wx_dcps.h"
00015 #include "wx_gdi.h"
00016 #ifdef wx_msw
00017 #include "wx_mf.h"
00018 #endif
00019 #include "wx_types.h"
00020 #ifdef wx_mac
00021 #include "wx_dcpr.h"
00022 #endif
00023 #include "wx_rgn.h"
00024 #include "../../wxcommon/wxGLConfig.h"
00025 #include <math.h>
00026 
00027 #ifdef wx_msw
00028 # define USE_GL
00029 #endif
00030 #ifdef wx_mac
00031 # define USE_GL
00032 #endif
00033 
00034 #ifndef USE_GL
00035 class wxGL : public wxObject {
00036 public:
00037   wxGL();
00038 
00039   int Ok();
00040 
00041   void Reset(long d);
00042   void SwapBuffers(void);
00043   void ThisContextCurrent(void);
00044 };
00045 
00046 wxGL::wxGL()
00047 : wxObject(WXGC_NO_CLEANUP)
00048 {
00049 }
00050 int wxGL::Ok() { return 0; }
00051 void wxGL::SwapBuffers(void) { }
00052 void wxGL::ThisContextCurrent(void) { }
00053 #endif
00054 
00055 
00056 
00057 
00058 #ifdef wx_x
00059 # define BM_SELECTED(map) ((map)->selectedTo)
00060 #endif
00061 #if defined(wx_mac) || defined(wx_msw)
00062 # define BM_SELECTED(map) ((map)->selectedInto)
00063 #endif
00064 # define BM_IN_USE(map) ((map)->selectedIntoDC)
00065 
00066 
00067 
00068 
00069 #define ESCAPE_NO_RET_VAL /*empty*/
00070 
00071 
00072 #include "wxscheme.h"
00073 #include "wxs_dc.h"
00074 
00075 #ifdef MZ_PRECISE_GC
00076 START_XFORM_SKIP;
00077 #endif
00078 
00079 static Scheme_Object *textMode_wxTRANSPARENT_sym = NULL;
00080 static Scheme_Object *textMode_wxSOLID_sym = NULL;
00081 
00082 static void init_symset_textMode(void) {
00083   REMEMBER_VAR_STACK();
00084   wxREGGLOB(textMode_wxTRANSPARENT_sym);
00085   textMode_wxTRANSPARENT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("transparent"));
00086   wxREGGLOB(textMode_wxSOLID_sym);
00087   textMode_wxSOLID_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("solid"));
00088 }
00089 
00090 static int unbundle_symset_textMode(Scheme_Object *v, const char *where) {
00091   SETUP_VAR_STACK(1);
00092   VAR_STACK_PUSH(0, v);
00093   if (!textMode_wxSOLID_sym) WITH_VAR_STACK(init_symset_textMode());
00094   if (0) { }
00095   else if (v == textMode_wxTRANSPARENT_sym) { READY_TO_RETURN; return wxTRANSPARENT; }
00096   else if (v == textMode_wxSOLID_sym) { READY_TO_RETURN; return wxSOLID; }
00097   if (where) WITH_VAR_STACK(scheme_wrong_type(where, "textMode symbol", -1, 0, &v));
00098   READY_TO_RETURN;
00099   return 0;
00100 }
00101 
00102 static Scheme_Object *bundle_symset_textMode(int v) {
00103   if (!textMode_wxSOLID_sym) init_symset_textMode();
00104   switch (v) {
00105   case wxTRANSPARENT: return textMode_wxTRANSPARENT_sym;
00106   case wxSOLID: return textMode_wxSOLID_sym;
00107   default: return NULL;
00108   }
00109 }
00110 
00111 
00112 static Scheme_Object *bitmapDrawStyle_wxSOLID_sym = NULL;
00113 static Scheme_Object *bitmapDrawStyle_wxSTIPPLE_sym = NULL;
00114 static Scheme_Object *bitmapDrawStyle_wxXOR_sym = NULL;
00115 
00116 static void init_symset_bitmapDrawStyle(void) {
00117   REMEMBER_VAR_STACK();
00118   wxREGGLOB(bitmapDrawStyle_wxSOLID_sym);
00119   bitmapDrawStyle_wxSOLID_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("solid"));
00120   wxREGGLOB(bitmapDrawStyle_wxSTIPPLE_sym);
00121   bitmapDrawStyle_wxSTIPPLE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("opaque"));
00122   wxREGGLOB(bitmapDrawStyle_wxXOR_sym);
00123   bitmapDrawStyle_wxXOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor"));
00124 }
00125 
00126 static int unbundle_symset_bitmapDrawStyle(Scheme_Object *v, const char *where) {
00127   SETUP_VAR_STACK(1);
00128   VAR_STACK_PUSH(0, v);
00129   if (!bitmapDrawStyle_wxXOR_sym) WITH_VAR_STACK(init_symset_bitmapDrawStyle());
00130   if (0) { }
00131   else if (v == bitmapDrawStyle_wxSOLID_sym) { READY_TO_RETURN; return wxSOLID; }
00132   else if (v == bitmapDrawStyle_wxSTIPPLE_sym) { READY_TO_RETURN; return wxSTIPPLE; }
00133   else if (v == bitmapDrawStyle_wxXOR_sym) { READY_TO_RETURN; return wxXOR; }
00134   if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bitmapDrawStyle symbol", -1, 0, &v));
00135   READY_TO_RETURN;
00136   return 0;
00137 }
00138 
00139 
00140 
00141 static Scheme_Object *fillKind_wxODDEVEN_RULE_sym = NULL;
00142 static Scheme_Object *fillKind_wxWINDING_RULE_sym = NULL;
00143 
00144 static void init_symset_fillKind(void) {
00145   REMEMBER_VAR_STACK();
00146   wxREGGLOB(fillKind_wxODDEVEN_RULE_sym);
00147   fillKind_wxODDEVEN_RULE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("odd-even"));
00148   wxREGGLOB(fillKind_wxWINDING_RULE_sym);
00149   fillKind_wxWINDING_RULE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("winding"));
00150 }
00151 
00152 static int unbundle_symset_fillKind(Scheme_Object *v, const char *where) {
00153   SETUP_VAR_STACK(1);
00154   VAR_STACK_PUSH(0, v);
00155   if (!fillKind_wxWINDING_RULE_sym) WITH_VAR_STACK(init_symset_fillKind());
00156   if (0) { }
00157   else if (v == fillKind_wxODDEVEN_RULE_sym) { READY_TO_RETURN; return wxODDEVEN_RULE; }
00158   else if (v == fillKind_wxWINDING_RULE_sym) { READY_TO_RETURN; return wxWINDING_RULE; }
00159   if (where) WITH_VAR_STACK(scheme_wrong_type(where, "fillKind symbol", -1, 0, &v));
00160   READY_TO_RETURN;
00161   return 0;
00162 }
00163 
00164 
00165 static Scheme_Object *smoothingMode_0_sym = NULL;
00166 static Scheme_Object *smoothingMode_1_sym = NULL;
00167 static Scheme_Object *smoothingMode_2_sym = NULL;
00168 
00169 static void init_symset_smoothingMode(void) {
00170   REMEMBER_VAR_STACK();
00171   wxREGGLOB(smoothingMode_0_sym);
00172   smoothingMode_0_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unsmoothed"));
00173   wxREGGLOB(smoothingMode_1_sym);
00174   smoothingMode_1_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("smoothed"));
00175   wxREGGLOB(smoothingMode_2_sym);
00176   smoothingMode_2_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("aligned"));
00177 }
00178 
00179 static int unbundle_symset_smoothingMode(Scheme_Object *v, const char *where) {
00180   SETUP_VAR_STACK(1);
00181   VAR_STACK_PUSH(0, v);
00182   if (!smoothingMode_2_sym) WITH_VAR_STACK(init_symset_smoothingMode());
00183   if (0) { }
00184   else if (v == smoothingMode_0_sym) { READY_TO_RETURN; return 0; }
00185   else if (v == smoothingMode_1_sym) { READY_TO_RETURN; return 1; }
00186   else if (v == smoothingMode_2_sym) { READY_TO_RETURN; return 2; }
00187   if (where) WITH_VAR_STACK(scheme_wrong_type(where, "smoothingMode symbol", -1, 0, &v));
00188   READY_TO_RETURN;
00189   return 0;
00190 }
00191 
00192 static Scheme_Object *bundle_symset_smoothingMode(int v) {
00193   if (!smoothingMode_2_sym) init_symset_smoothingMode();
00194   switch (v) {
00195   case 0: return smoothingMode_0_sym;
00196   case 1: return smoothingMode_1_sym;
00197   case 2: return smoothingMode_2_sym;
00198   default: return NULL;
00199   }
00200 }
00201 
00202 
00203 
00204 static wxColour* dcGetTextBackground(wxDC *dc)
00205 {
00206   wxColour *c = NULL, *bg = NULL;
00207   SETUP_VAR_STACK(2);
00208   VAR_STACK_PUSH(0, dc);
00209   VAR_STACK_PUSH(1, c);
00210 
00211   c = WITH_VAR_STACK(new wxColour());
00212 #ifdef MZ_PRECISE_GC
00213   WITH_VAR_STACK(c->gcInit_wxColour());
00214 #endif
00215   bg = WITH_VAR_STACK(dc->GetTextBackground());
00216   WITH_VAR_STACK(c->CopyFrom(bg));
00217   READY_TO_RETURN;
00218   return c;
00219 }
00220 
00221 static wxColour* dcGetTextForeground(wxDC *dc)
00222 {
00223   wxColour *c = NULL, *fg = NULL;
00224   SETUP_VAR_STACK(2);
00225   VAR_STACK_PUSH(0, dc);
00226   VAR_STACK_PUSH(1, c);
00227 
00228   c = WITH_VAR_STACK(new wxColour());
00229 #ifdef MZ_PRECISE_GC
00230   WITH_VAR_STACK(c->gcInit_wxColour());
00231 #endif
00232   fg = WITH_VAR_STACK(dc->GetTextForeground());
00233   WITH_VAR_STACK(c->CopyFrom(fg));
00234   READY_TO_RETURN;
00235   return c;
00236 }
00237 
00238 static Bool DrawBitmap(wxDC *dc, wxBitmap *bm, double x, double y, int mode, wxColour *c, wxBitmap* mask)
00239 {
00240   REMEMBER_VAR_STACK();
00241   if (bm->Ok()) {
00242     return WITH_REMEMBERED_STACK(dc->Blit(x, y, bm->GetWidth(), bm->GetHeight(), bm, 0, 0, mode, c, mask));
00243   } else
00244     return FALSE;
00245 }
00246 
00247 static Bool DrawBitmapRegion(wxDC *dc, wxBitmap *bm, double x, double y, double dx, double dy, double dw, double dh, int mode, wxColour *c, wxBitmap* mask)
00248 {
00249   REMEMBER_VAR_STACK();
00250   if (bm->Ok()) {
00251     return WITH_REMEMBERED_STACK(dc->Blit(x, y, dw, dh, bm, dx, dy, mode, c, mask));
00252   } else
00253     return FALSE;
00254 }
00255 
00256 static void* MyTextExtent(wxDC *dc, mzchar *s, wxFont *f, Bool combine, int offset)
00257 {
00258   double w, h, d, asc;
00259   Scheme_Object *a[4];
00260   void *r;
00261   SETUP_VAR_STACK(3);
00262   VAR_STACK_PUSH_ARRAY(0, a, 4);
00263 
00264   a[0] = a[1] = a[2] = a[3] = NULL;
00265 
00266   WITH_VAR_STACK(dc->GetTextExtent((char *)s, &w, &h, &d, &asc, f, combine, TRUE, offset));
00267     
00268   a[0] = WITH_VAR_STACK(scheme_make_double(w));
00269   a[1] = WITH_VAR_STACK(scheme_make_double(h));
00270   a[2] = WITH_VAR_STACK(scheme_make_double(d));
00271   a[3] = WITH_VAR_STACK(scheme_make_double(asc));
00272 
00273   r = WITH_VAR_STACK(scheme_values(4, a));
00274 
00275   READY_TO_RETURN;
00276 
00277   return r;
00278 }
00279 
00280 static void* MyGetSize(wxDC *dc)
00281 {
00282   double w, h;
00283   Scheme_Object *a[2];
00284   void *r;
00285   SETUP_VAR_STACK(3);
00286   VAR_STACK_PUSH_ARRAY(0, a, 2);
00287 
00288   a[0] = a[1] = NULL;
00289 
00290   dc->GetSize(&w, &h); /* no GC possible */
00291 
00292   a[0] = WITH_VAR_STACK(scheme_make_double(w));
00293   a[1] = WITH_VAR_STACK(scheme_make_double(h));
00294 
00295   r = WITH_VAR_STACK(scheme_values(2, a));
00296 
00297   READY_TO_RETURN;
00298 
00299   return r;
00300 }
00301 
00302 static void* MyGetScale(wxDC *dc)
00303 {
00304   double w, h;
00305   Scheme_Object *a[2];
00306   void *r;
00307   SETUP_VAR_STACK(3);
00308   VAR_STACK_PUSH_ARRAY(0, a, 2);
00309 
00310   a[0] = a[1] = NULL;
00311 
00312   dc->GetUserScale(&w, &h); /* no GC possible */
00313 
00314   a[0] = WITH_VAR_STACK(scheme_make_double(w));
00315   a[1] = WITH_VAR_STACK(scheme_make_double(h));
00316 
00317   r = WITH_VAR_STACK(scheme_values(2, a));
00318 
00319   READY_TO_RETURN;
00320 
00321   return r;
00322 }
00323 
00324 static void* MyGetOrigin(wxDC *dc)
00325 {
00326   double w, h;
00327   Scheme_Object *a[2];
00328   void *r;
00329   SETUP_VAR_STACK(3);
00330   VAR_STACK_PUSH_ARRAY(0, a, 2);
00331 
00332   a[0] = a[1] = NULL;
00333 
00334   dc->GetDeviceOrigin(&w, &h); /* no GC possible */
00335 
00336   a[0] = WITH_VAR_STACK(scheme_make_double(w));
00337   a[1] = WITH_VAR_STACK(scheme_make_double(h));
00338 
00339   r = WITH_VAR_STACK(scheme_values(2, a));
00340 
00341   READY_TO_RETURN;
00342 
00343   return r;
00344 }
00345 
00346 inline static wxGL *_GetGL(wxDC *dc)
00347 {
00348 #ifdef USE_GL
00349   return dc->GetGL();
00350 #else
00351   return NULL;
00352 #endif
00353 }
00354 
00355 #ifdef MZ_PRECISE_GC
00356 END_XFORM_SKIP;
00357 #endif
00358 static wxMemoryDC *make_memdc(void)
00359 {
00360   return new wxMemoryDC(1);
00361 }
00362 #ifdef MZ_PRECISE_GC
00363 START_XFORM_SKIP;
00364 #endif
00365 
00366 static wxMemoryDC *temp_mdc;
00367 
00368 static wxMemoryDC *MakeDC(wxBitmap *src)
00369 {
00370   wxMemoryDC *srcdc = NULL;
00371   SETUP_VAR_STACK(2);
00372   VAR_STACK_PUSH(0, src);
00373   VAR_STACK_PUSH(1, srcdc);
00374 
00375 #ifdef wx_msw
00376   srcdc = (wxMemoryDC *)src->selectedInto;
00377   if (!srcdc) {
00378 #endif
00379     if (!temp_mdc) {
00380       wxREGGLOB(temp_mdc);
00381       temp_mdc = WITH_VAR_STACK(make_memdc());
00382     }
00383     WITH_VAR_STACK(temp_mdc->SelectObject(src));
00384     srcdc = temp_mdc;
00385 #ifdef wx_msw
00386   }
00387 #endif
00388 
00389   READY_TO_RETURN;
00390 
00391   return srcdc;
00392 }
00393 
00394 static void UnmakeDC(wxMemoryDC *srcdc)
00395 {
00396 #ifdef wx_msw
00397   if (srcdc == temp_mdc)
00398 #endif
00399     WITH_VAR_STACK(temp_mdc->SelectObject(NULL));
00400 }
00401 
00402 static void dcGetARGBPixels(wxMemoryDC *dc, double x, double y, int w, int h, char *s, Bool get_alpha)
00403 {
00404   int i, j, p;
00405   unsigned char *ss = (unsigned char *)s;
00406   wxColour *c = NULL;
00407   double xs, ys, xo, yo;
00408   SETUP_VAR_STACK(3);
00409   VAR_STACK_PUSH(0, ss);
00410   VAR_STACK_PUSH(1, c);
00411   VAR_STACK_PUSH(2, dc);
00412 
00413   dc->GetUserScale(&xs, &ys);
00414   dc->GetDeviceOrigin(&xo, &yo);
00415   p = 0;
00416 
00417   if (xs == 1 && ys == 1 && xo == 0 && yo == 0
00418       && WITH_VAR_STACK(dc->BeginGetPixelFast((int)x, (int)y, w, h))) {
00419     int xi = (int)x;
00420     int yi = (int)y;
00421     int r, g, b;
00422     if (!get_alpha) {
00423       for (j = 0; j < h; j++) {
00424        for (i = 0; i < w; i++) {
00425          WITH_VAR_STACK(dc->GetPixelFast(xi + i, yi + j, &r, &g, &b));
00426          ss[p++] = 255; /* alpha */
00427          ss[p++] = r;
00428          ss[p++] = g;
00429          ss[p++] = b;
00430        }
00431       }
00432     } else {
00433       for (j = 0; j < h; j++) {
00434        for (i = 0; i < w; i++) {
00435          WITH_VAR_STACK(dc->GetPixelFast(xi + i, yi + j, &r, &g, &b));
00436          ss[p] = 255 - ((r + g + b) / 3);
00437          p += 4;
00438        }
00439       }
00440     }
00441     WITH_VAR_STACK(dc->EndGetPixelFast());
00442   } else {
00443     c = new wxColour();
00444 
00445     if (!get_alpha) {
00446       for (j = 0; j < h; j++) {
00447        for (i = 0; i < w; i++) {
00448          WITH_VAR_STACK(dc->GetPixel(x + i, y + j, c));
00449          ss[p++] = 255; /* alpha */
00450          ss[p++] = c->Red();
00451          ss[p++] = c->Green();
00452          ss[p++] = c->Blue();
00453        }
00454       }
00455     } else {
00456       for (j = 0; j < h; j++) {
00457        for (i = 0; i < w; i++) {
00458          WITH_VAR_STACK(dc->GetPixel(x + i, y + j, c));
00459          ss[p] = 255 - ((c->Red() + c->Green() + c->Blue()) / 3);
00460          p += 4;
00461        }
00462       }
00463     }
00464   }
00465 
00466   READY_TO_RETURN;
00467 }
00468 
00469 void wxGetARGBPixels(wxBitmap *src, double x, double y, int w, int h, char *s, Bool get_alpha)
00470 {
00471   wxMemoryDC *srcdc;
00472   SETUP_VAR_STACK(1);
00473   VAR_STACK_PUSH(0, srcdc);
00474 
00475   srcdc = WITH_VAR_STACK(MakeDC(src));
00476   WITH_VAR_STACK(dcGetARGBPixels(srcdc, x, y, w, h, (char *)s, get_alpha));
00477   WITH_VAR_STACK(UnmakeDC(srcdc));
00478 
00479   READY_TO_RETURN;
00480 }
00481 
00482 static void dcSetARGBPixels(wxMemoryDC *dc, double x, double y, int w, int h, char *s, Bool set_alpha)
00483 {
00484   int i, j, p;
00485   unsigned char *ss = (unsigned char *)s;
00486   wxColour *c = NULL;
00487   double xs, ys, xo, yo;
00488   SETUP_VAR_STACK(3);
00489   VAR_STACK_PUSH(0, ss);
00490   VAR_STACK_PUSH(1, c);
00491   VAR_STACK_PUSH(2, dc);
00492 
00493   dc->GetUserScale(&xs, &ys);
00494   dc->GetDeviceOrigin(&xo, &yo);
00495   p = 0;    
00496 
00497   if (xs == 1 && ys == 1 && xo == 0 && yo == 0
00498       && WITH_VAR_STACK(dc->BeginSetPixelFast((int)x, (int)y, w, h))) {
00499     int xi = (int)x;
00500     int yi = (int)y;
00501     if (!set_alpha) {
00502       for (j = 0; j < h; j++) {
00503        for (i = 0; i < w; i++) {
00504          WITH_VAR_STACK(dc->SetPixelFast(xi + i, yi + j, ss[p+1], ss[p+2], ss[p+3]));
00505          p += 4;
00506        }
00507       }
00508     } else {
00509       for (j = 0; j < h; j++) {
00510        for (i = 0; i < w; i++) {
00511          WITH_VAR_STACK(dc->SetPixelFast(xi + i, yi + j, 255-ss[p], 255-ss[p], 255-ss[p]));
00512          p += 4;
00513        }
00514       }
00515     }
00516     WITH_VAR_STACK(dc->EndSetPixelFast());
00517   } else {
00518     c = new wxColour();
00519   
00520     if (!set_alpha) {
00521       for (j = 0; j < h; j++) {
00522        for (i = 0; i < w; i++) {
00523          WITH_VAR_STACK(c->Set(ss[p+1], ss[p+2], ss[p+3]));
00524          WITH_VAR_STACK(dc->SetPixel(x + i, y + j, c));
00525          p += 4;
00526        }
00527       }
00528     } else {
00529       for (j = 0; j < h; j++) {
00530        for (i = 0; i < w; i++) {
00531          WITH_VAR_STACK(c->Set(255-ss[p], 255-ss[p], 255-ss[p]));
00532          WITH_VAR_STACK(dc->SetPixel(x + i, y + j, c));
00533          p += 4;
00534        }
00535       }
00536     }
00537   }
00538 
00539   READY_TO_RETURN;
00540 }
00541 
00542 static wxBitmap *dc_target(Scheme_Object *obj)
00543 {
00544   wxDC *dc;
00545   dc = (wxDC *)((Scheme_Class_Object *)obj)->primdata;
00546   if (dc->__type == wxTYPE_DC_MEMORY) {
00547     wxBitmap *bm;
00548     bm = ((wxMemoryDC *)dc)->GetObject();
00549     if (bm)
00550       return bm;
00551   }
00552   return (wxBitmap *)0x1; /* dont't return NULL because that matches unspecified mask */
00553 }
00554 
00555 static inline double approx_dist(double x, double y) 
00556 {
00557   x = fabs(x);
00558   y = fabs(y);
00559   return ((x < y) ? y : x);
00560 }
00561 
00562 static double my_round(double f)
00563 /* doesn't have to deal with negtive numbers */
00564 {
00565   double d, frac;
00566   
00567   frac = modf(f, &d);
00568 
00569   if (frac >= 0.5)  
00570     d += 1.0;
00571 
00572   return d;
00573 }
00574 
00575 static void ScaleSection(wxMemoryDC *dest, wxBitmap *src, 
00576                       double tx, double ty, double ww2, double hh2,
00577                       double fx, double fy, double ww, double hh,
00578                       wxBitmap *mask)
00579 {
00580   double xs, ys, r, g, b, t, dx, dy, wt, si, sj, a, span;
00581   int i, j, starti, endi, startj, endj, p, xi, xj, sji, sii;
00582   int sbmw, sbmh, w, h, w2, h2, ispan, jspan;
00583   unsigned char *s = NULL, *s2 = NULL;
00584   wxMemoryDC *srcdc = NULL;
00585   SETUP_VAR_STACK(6);
00586   VAR_STACK_PUSH(0, s);
00587   VAR_STACK_PUSH(1, s2);
00588   VAR_STACK_PUSH(2, dest);
00589   VAR_STACK_PUSH(3, src);
00590   VAR_STACK_PUSH(4, srcdc);
00591   VAR_STACK_PUSH(5, mask);
00592 
00593   if (!dest->Ok())
00594     WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","draw-bitmap-section-smooth"), 
00595                                    "dc is not ok: ",
00596                                    WITH_VAR_STACK(objscheme_bundle_wxMemoryDC(dest))));
00597   if (!src->Ok())
00598     WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","draw-bitmap-section-smooth"), 
00599                                    "source bitmap is not ok: ", 
00600                                    WITH_VAR_STACK(objscheme_bundle_wxBitmap(src))));
00601   sbmw = WITH_VAR_STACK(src->GetWidth());
00602   sbmh = WITH_VAR_STACK(src->GetHeight());
00603   if (fx > sbmw)
00604     WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","draw-bitmap-section-smooth"), 
00605                                    "x offset too large for source bitmap: ", 
00606                                    WITH_VAR_STACK(scheme_make_double(fx))));
00607   if (fy > sbmh)
00608     WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","draw-bitmap-section-smooth"), 
00609                                    "y offset too large for source bitmap: ", 
00610                                    WITH_VAR_STACK(scheme_make_double(fy))));
00611   if ((fx + ww) > sbmw)
00612     WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","draw-bitmap-section-smooth"), 
00613                                    "x offset plus width too large for source bitmap: ", 
00614                                    WITH_VAR_STACK(scheme_make_double(fx))));
00615   if ((fy + hh) > sbmh)
00616     WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","draw-bitmap-section-smooth"), 
00617                                    "y offset plus height too large for source bitmap: ", 
00618                                    WITH_VAR_STACK(scheme_make_double(fy))));
00619   
00620   if (mask) {
00621     if (!mask->Ok()) {
00622       WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","draw-bitmap-section-smooth"), 
00623                                     "mask bitmap is not ok: ", 
00624                                     WITH_VAR_STACK(objscheme_bundle_wxBitmap(mask))));
00625     }
00626     if ((WITH_VAR_STACK(mask->GetWidth()) != sbmw)
00627        || (WITH_VAR_STACK(mask->GetHeight()) != sbmh))
00628       WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","draw-bitmap-section-smooth"), 
00629                                     "mask bitmap does not match source bitmap dimensions: ", 
00630                                     WITH_VAR_STACK(objscheme_bundle_wxBitmap(mask))));
00631   }
00632 
00633   w = (int)(floor(ww + fx) - floor(fx));
00634   h = (int)(floor(hh + fy) - floor(fy));
00635 
00636   w2 = (int)(floor(ww2 + tx) - floor(tx));
00637   h2 = (int)(floor(hh2 + ty) - floor(ty));
00638 
00639   xs = (double)w2 / (double)w;
00640   ys = (double)h2 / (double)h;
00641 
00642   s = (unsigned char *)WITH_VAR_STACK(scheme_malloc_atomic(w * h * 4));
00643   s2 = (unsigned char *)WITH_VAR_STACK(scheme_malloc_atomic(w2 * h2 * 4));
00644 
00645   srcdc = WITH_VAR_STACK(MakeDC(src));
00646   WITH_VAR_STACK(dcGetARGBPixels(srcdc, fx, fy, w, h, (char *)s, 0));
00647   WITH_VAR_STACK(UnmakeDC(srcdc));
00648 
00649   if (mask) {
00650     srcdc = WITH_VAR_STACK(MakeDC(mask));
00651     WITH_VAR_STACK(dcGetARGBPixels(srcdc, fx, fy, w, h, (char *)s, 1));
00652     WITH_VAR_STACK(UnmakeDC(srcdc));
00653 
00654     WITH_VAR_STACK(dcGetARGBPixels(dest, tx, ty, w2, h2, (char *)s2, 0));
00655   }
00656 
00657   if (w <= w2)
00658     ispan = 0;
00659   else
00660     ispan = (w / w2) - 1;
00661   if (h <= h2)
00662     jspan = 0;
00663   else
00664     jspan = (h / h2) - 1;
00665   span = (((double)ispan + (double)jspan) / 2.0) + 0.001;
00666 
00667   for (j = 0; j < h2; j++) {
00668     sj = (double)j / ys;
00669     sji = (int)sj;
00670     startj = sji - (jspan >> 1);
00671     if (startj < 0)
00672       startj = 0;
00673     endj = sji + (jspan - (jspan >> 1)) + (((double)sji == sj) ? 0 : 1);
00674     if (endj >= h)
00675       endj = h - 1;
00676     
00677     for (i = 0; i < w2; i++) {
00678       si = (double)i / xs;
00679       sii = (int)si;
00680       starti = sii - (ispan >> 1);
00681       if (starti < 0)
00682        starti = 0;
00683       endi = sii + (ispan - (ispan >> 1)) + (((double)sii == si) ? 0 : 1);
00684       if (endi >= w)
00685        endi = w - 1;
00686 
00687       r = g = b = t = a = 0.0;
00688 
00689       for (xj = startj; xj <= endj; xj++) {
00690        dy = ((xj * ys) - j);
00691        for (xi = starti; xi <= endi; xi++) {
00692          dx = ((xi * xs) - i);
00693          wt = 1 / (span + approx_dist(dx, dy));
00694          p = ((xj * w) + xi) * 4;
00695          a += (wt * s[p]);
00696          r += (wt * s[p+1]);
00697          g += (wt * s[p+2]);
00698          b += (wt * s[p+3]);
00699          t += wt;
00700        }
00701       }
00702 
00703       r /= t;
00704       g /= t;
00705       b /= t;
00706 
00707       p = ((j * w2) + i) * 4;
00708 
00709       if (mask) {
00710        a /= (3.0 * 255.0 * t);
00711        r = (r * (1 - a)) + ((double)s2[p+1] * a);
00712        g = (g * (1 - a)) + ((double)s2[p+2] * a);
00713        b = (b * (1 - a)) + ((double)s2[p+3] * a);
00714       }
00715 
00716       s2[p+1] = (int)my_round(r);
00717       s2[p+2] = (int)my_round(g);
00718       s2[p+3] = (int)my_round(b);
00719     }
00720   }
00721 
00722   WITH_VAR_STACK(dcSetARGBPixels(dest, tx, ty, w2, h2, (char *)s2, 0));
00723 
00724 #ifndef SENORA_GC_NO_FREE
00725   GC_free(s);
00726   GC_free(s2);
00727 #endif
00728 
00729   READY_TO_RETURN;
00730 }
00731 
00732 #ifdef MZ_PRECISE_GC
00733 END_XFORM_SKIP;
00734 #endif
00735 
00736 static void SetPen(wxDC *dc, wxColour *c, double pw, int style)
00737 {
00738   wxPenList *pl;
00739   wxPen *p;
00740   pl = wxThePenList;
00741   p = pl->FindOrCreatePen(c, pw, style);
00742   dc->SetPen(p);
00743 }
00744 
00745 static void SetPen(wxDC *dc, char *cname, double pw, int style)
00746 {
00747   wxPenList *pl;
00748   wxPen *p;
00749   pl = wxThePenList;
00750   p = pl->FindOrCreatePen(cname, pw, style);
00751   if (p)
00752     dc->SetPen(p);
00753   else {
00754     scheme_arg_mismatch(METHODNAME("dc<%>", "set-pen"), "unknown color: ", scheme_make_utf8_string(cname));
00755   }
00756 }
00757 
00758 static void SetBrush(wxDC *dc, wxColour *c, int style)
00759 {
00760   wxBrushList *bl;
00761   wxBrush *b;
00762   bl = wxTheBrushList;
00763   b = bl->FindOrCreateBrush(c, style);
00764   dc->SetBrush(b);
00765 }
00766 
00767 static void SetBrush(wxDC *dc, char *cname, int style)
00768 {
00769   wxBrushList *bl;
00770   wxBrush *b;
00771   bl = wxTheBrushList;
00772   b = bl->FindOrCreateBrush(cname, style);
00773   if (b)
00774     dc->SetBrush(b);
00775   else {
00776     scheme_arg_mismatch(METHODNAME("dc<%>", "set-brush"), "unknown color: ", scheme_make_utf8_string(cname));
00777   }
00778 }
00779 
00780 void wxDrawTabBase(wxDC *dc, double x, double y, double w, double h, int state)
00781 {
00782 #ifdef wx_mac
00783   dc->DrawTabBase(x, y, w, h, state);
00784 #endif
00785 }
00786 
00787 void wxDrawTab(wxDC *dc, char *s, double x, double y, double w, double h, int state)
00788 {
00789 #ifdef wx_mac
00790   dc->DrawTab(s, x, y, w, h, state);
00791 #endif
00792 }
00793 
00794 #ifdef MZ_PRECISE_GC
00795 START_XFORM_SKIP;
00796 #endif
00797 
00798 
00799 static Scheme_Object *brushStyle_wxTRANSPARENT_sym = NULL;
00800 static Scheme_Object *brushStyle_wxSOLID_sym = NULL;
00801 static Scheme_Object *brushStyle_wxSTIPPLE_sym = NULL;
00802 static Scheme_Object *brushStyle_wxXOR_sym = NULL;
00803 static Scheme_Object *brushStyle_wxCOLOR_sym = NULL;
00804 static Scheme_Object *brushStyle_wxBDIAGONAL_HATCH_sym = NULL;
00805 static Scheme_Object *brushStyle_wxCROSSDIAG_HATCH_sym = NULL;
00806 static Scheme_Object *brushStyle_wxFDIAGONAL_HATCH_sym = NULL;
00807 static Scheme_Object *brushStyle_wxCROSS_HATCH_sym = NULL;
00808 static Scheme_Object *brushStyle_wxHORIZONTAL_HATCH_sym = NULL;
00809 static Scheme_Object *brushStyle_wxVERTICAL_HATCH_sym = NULL;
00810 static Scheme_Object *brushStyle_wxPANEL_PATTERN_sym = NULL;
00811 
00812 static void init_symset_brushStyle(void) {
00813   REMEMBER_VAR_STACK();
00814   wxREGGLOB(brushStyle_wxTRANSPARENT_sym);
00815   brushStyle_wxTRANSPARENT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("transparent"));
00816   wxREGGLOB(brushStyle_wxSOLID_sym);
00817   brushStyle_wxSOLID_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("solid"));
00818   wxREGGLOB(brushStyle_wxSTIPPLE_sym);
00819   brushStyle_wxSTIPPLE_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("opaque"));
00820   wxREGGLOB(brushStyle_wxXOR_sym);
00821   brushStyle_wxXOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor"));
00822   wxREGGLOB(brushStyle_wxCOLOR_sym);
00823   brushStyle_wxCOLOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("hilite"));
00824   wxREGGLOB(brushStyle_wxBDIAGONAL_HATCH_sym);
00825   brushStyle_wxBDIAGONAL_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bdiagonal-hatch"));
00826   wxREGGLOB(brushStyle_wxCROSSDIAG_HATCH_sym);
00827   brushStyle_wxCROSSDIAG_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("crossdiag-hatch"));
00828   wxREGGLOB(brushStyle_wxFDIAGONAL_HATCH_sym);
00829   brushStyle_wxFDIAGONAL_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("fdiagonal-hatch"));
00830   wxREGGLOB(brushStyle_wxCROSS_HATCH_sym);
00831   brushStyle_wxCROSS_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("cross-hatch"));
00832   wxREGGLOB(brushStyle_wxHORIZONTAL_HATCH_sym);
00833   brushStyle_wxHORIZONTAL_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("horizontal-hatch"));
00834   wxREGGLOB(brushStyle_wxVERTICAL_HATCH_sym);
00835   brushStyle_wxVERTICAL_HATCH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("vertical-hatch"));
00836   wxREGGLOB(brushStyle_wxPANEL_PATTERN_sym);
00837   brushStyle_wxPANEL_PATTERN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("panel"));
00838 }
00839 
00840 static int unbundle_symset_brushStyle(Scheme_Object *v, const char *where) {
00841   SETUP_VAR_STACK(1);
00842   VAR_STACK_PUSH(0, v);
00843   if (!brushStyle_wxPANEL_PATTERN_sym) WITH_VAR_STACK(init_symset_brushStyle());
00844   if (0) { }
00845   else if (v == brushStyle_wxTRANSPARENT_sym) { READY_TO_RETURN; return wxTRANSPARENT; }
00846   else if (v == brushStyle_wxSOLID_sym) { READY_TO_RETURN; return wxSOLID; }
00847   else if (v == brushStyle_wxSTIPPLE_sym) { READY_TO_RETURN; return wxSTIPPLE; }
00848   else if (v == brushStyle_wxXOR_sym) { READY_TO_RETURN; return wxXOR; }
00849   else if (v == brushStyle_wxCOLOR_sym) { READY_TO_RETURN; return wxCOLOR; }
00850   else if (v == brushStyle_wxBDIAGONAL_HATCH_sym) { READY_TO_RETURN; return wxBDIAGONAL_HATCH; }
00851   else if (v == brushStyle_wxCROSSDIAG_HATCH_sym) { READY_TO_RETURN; return wxCROSSDIAG_HATCH; }
00852   else if (v == brushStyle_wxFDIAGONAL_HATCH_sym) { READY_TO_RETURN; return wxFDIAGONAL_HATCH; }
00853   else if (v == brushStyle_wxCROSS_HATCH_sym) { READY_TO_RETURN; return wxCROSS_HATCH; }
00854   else if (v == brushStyle_wxHORIZONTAL_HATCH_sym) { READY_TO_RETURN; return wxHORIZONTAL_HATCH; }
00855   else if (v == brushStyle_wxVERTICAL_HATCH_sym) { READY_TO_RETURN; return wxVERTICAL_HATCH; }
00856   else if (v == brushStyle_wxPANEL_PATTERN_sym) { READY_TO_RETURN; return wxPANEL_PATTERN; }
00857   if (where) WITH_VAR_STACK(scheme_wrong_type(where, "brushStyle symbol", -1, 0, &v));
00858   READY_TO_RETURN;
00859   return 0;
00860 }
00861 
00862 static Scheme_Object *bundle_symset_brushStyle(int v) {
00863   if (!brushStyle_wxPANEL_PATTERN_sym) init_symset_brushStyle();
00864   switch (v) {
00865   case wxTRANSPARENT: return brushStyle_wxTRANSPARENT_sym;
00866   case wxSOLID: return brushStyle_wxSOLID_sym;
00867   case wxSTIPPLE: return brushStyle_wxSTIPPLE_sym;
00868   case wxXOR: return brushStyle_wxXOR_sym;
00869   case wxCOLOR: return brushStyle_wxCOLOR_sym;
00870   case wxBDIAGONAL_HATCH: return brushStyle_wxBDIAGONAL_HATCH_sym;
00871   case wxCROSSDIAG_HATCH: return brushStyle_wxCROSSDIAG_HATCH_sym;
00872   case wxFDIAGONAL_HATCH: return brushStyle_wxFDIAGONAL_HATCH_sym;
00873   case wxCROSS_HATCH: return brushStyle_wxCROSS_HATCH_sym;
00874   case wxHORIZONTAL_HATCH: return brushStyle_wxHORIZONTAL_HATCH_sym;
00875   case wxVERTICAL_HATCH: return brushStyle_wxVERTICAL_HATCH_sym;
00876   case wxPANEL_PATTERN: return brushStyle_wxPANEL_PATTERN_sym;
00877   default: return NULL;
00878   }
00879 }
00880 
00881 
00882 static Scheme_Object *penStyle_wxTRANSPARENT_sym = NULL;
00883 static Scheme_Object *penStyle_wxSOLID_sym = NULL;
00884 static Scheme_Object *penStyle_wxXOR_sym = NULL;
00885 static Scheme_Object *penStyle_wxCOLOR_sym = NULL;
00886 static Scheme_Object *penStyle_wxDOT_sym = NULL;
00887 static Scheme_Object *penStyle_wxLONG_DASH_sym = NULL;
00888 static Scheme_Object *penStyle_wxSHORT_DASH_sym = NULL;
00889 static Scheme_Object *penStyle_wxDOT_DASH_sym = NULL;
00890 static Scheme_Object *penStyle_wxXOR_DOT_sym = NULL;
00891 static Scheme_Object *penStyle_wxXOR_LONG_DASH_sym = NULL;
00892 static Scheme_Object *penStyle_wxXOR_SHORT_DASH_sym = NULL;
00893 static Scheme_Object *penStyle_wxXOR_DOT_DASH_sym = NULL;
00894 
00895 static void init_symset_penStyle(void) {
00896   REMEMBER_VAR_STACK();
00897   wxREGGLOB(penStyle_wxTRANSPARENT_sym);
00898   penStyle_wxTRANSPARENT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("transparent"));
00899   wxREGGLOB(penStyle_wxSOLID_sym);
00900   penStyle_wxSOLID_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("solid"));
00901   wxREGGLOB(penStyle_wxXOR_sym);
00902   penStyle_wxXOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor"));
00903   wxREGGLOB(penStyle_wxCOLOR_sym);
00904   penStyle_wxCOLOR_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("hilite"));
00905   wxREGGLOB(penStyle_wxDOT_sym);
00906   penStyle_wxDOT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("dot"));
00907   wxREGGLOB(penStyle_wxLONG_DASH_sym);
00908   penStyle_wxLONG_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("long-dash"));
00909   wxREGGLOB(penStyle_wxSHORT_DASH_sym);
00910   penStyle_wxSHORT_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("short-dash"));
00911   wxREGGLOB(penStyle_wxDOT_DASH_sym);
00912   penStyle_wxDOT_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("dot-dash"));
00913   wxREGGLOB(penStyle_wxXOR_DOT_sym);
00914   penStyle_wxXOR_DOT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor-dot"));
00915   wxREGGLOB(penStyle_wxXOR_LONG_DASH_sym);
00916   penStyle_wxXOR_LONG_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor-long-dash"));
00917   wxREGGLOB(penStyle_wxXOR_SHORT_DASH_sym);
00918   penStyle_wxXOR_SHORT_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor-short-dash"));
00919   wxREGGLOB(penStyle_wxXOR_DOT_DASH_sym);
00920   penStyle_wxXOR_DOT_DASH_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xor-dot-dash"));
00921 }
00922 
00923 static int unbundle_symset_penStyle(Scheme_Object *v, const char *where) {
00924   SETUP_VAR_STACK(1);
00925   VAR_STACK_PUSH(0, v);
00926   if (!penStyle_wxXOR_DOT_DASH_sym) WITH_VAR_STACK(init_symset_penStyle());
00927   if (0) { }
00928   else if (v == penStyle_wxTRANSPARENT_sym) { READY_TO_RETURN; return wxTRANSPARENT; }
00929   else if (v == penStyle_wxSOLID_sym) { READY_TO_RETURN; return wxSOLID; }
00930   else if (v == penStyle_wxXOR_sym) { READY_TO_RETURN; return wxXOR; }
00931   else if (v == penStyle_wxCOLOR_sym) { READY_TO_RETURN; return wxCOLOR; }
00932   else if (v == penStyle_wxDOT_sym) { READY_TO_RETURN; return wxDOT; }
00933   else if (v == penStyle_wxLONG_DASH_sym) { READY_TO_RETURN; return wxLONG_DASH; }
00934   else if (v == penStyle_wxSHORT_DASH_sym) { READY_TO_RETURN; return wxSHORT_DASH; }
00935   else if (v == penStyle_wxDOT_DASH_sym) { READY_TO_RETURN; return wxDOT_DASH; }
00936   else if (v == penStyle_wxXOR_DOT_sym) { READY_TO_RETURN; return wxXOR_DOT; }
00937   else if (v == penStyle_wxXOR_LONG_DASH_sym) { READY_TO_RETURN; return wxXOR_LONG_DASH; }
00938   else if (v == penStyle_wxXOR_SHORT_DASH_sym) { READY_TO_RETURN; return wxXOR_SHORT_DASH; }
00939   else if (v == penStyle_wxXOR_DOT_DASH_sym) { READY_TO_RETURN; return wxXOR_DOT_DASH; }
00940   if (where) WITH_VAR_STACK(scheme_wrong_type(where, "penStyle symbol", -1, 0, &v));
00941   READY_TO_RETURN;
00942   return 0;
00943 }
00944 
00945 static Scheme_Object *bundle_symset_penStyle(int v) {
00946   if (!penStyle_wxXOR_DOT_DASH_sym) init_symset_penStyle();
00947   switch (v) {
00948   case wxTRANSPARENT: return penStyle_wxTRANSPARENT_sym;
00949   case wxSOLID: return penStyle_wxSOLID_sym;
00950   case wxXOR: return penStyle_wxXOR_sym;
00951   case wxCOLOR: return penStyle_wxCOLOR_sym;
00952   case wxDOT: return penStyle_wxDOT_sym;
00953   case wxLONG_DASH: return penStyle_wxLONG_DASH_sym;
00954   case wxSHORT_DASH: return penStyle_wxSHORT_DASH_sym;
00955   case wxDOT_DASH: return penStyle_wxDOT_DASH_sym;
00956   case wxXOR_DOT: return penStyle_wxXOR_DOT_sym;
00957   case wxXOR_LONG_DASH: return penStyle_wxXOR_LONG_DASH_sym;
00958   case wxXOR_SHORT_DASH: return penStyle_wxXOR_SHORT_DASH_sym;
00959   case wxXOR_DOT_DASH: return penStyle_wxXOR_DOT_DASH_sym;
00960   default: return NULL;
00961   }
00962 }
00963 
00964 
00965 
00966 
00967 
00968 
00969 
00970 #define DO_OK_CHECK(name) if (!((wxDC *)((Scheme_Class_Object *)THEOBJ)->primdata)->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(name, "device context is not ok: ", THEOBJ));
00971 
00972 
00973 
00974 extern Scheme_Object *objscheme_bundle_wxPoint(wxPoint *);
00975 extern wxPoint *objscheme_unbundle_wxPoint(Scheme_Object *, const char *, int);
00976 
00977 #undef l_ADDRESS
00978 #undef l_DEREF
00979 #undef l_TEST
00980 #undef l_POINT
00981 #undef l_TYPE
00982 #undef l_LIST_ITEM_BUNDLE
00983 #undef l_LIST_ITEM_UNBUNDLE
00984 #undef l_MAKE_LIST
00985 #undef l_MAKE_ARRAY
00986 #undef l_EXTRA
00987 #undef l_TERMINATE
00988 #undef l_COPY
00989 #undef l_OKTEST
00990 #undef l_INTTYPE
00991 
00992 #define l_ADDRESS &
00993 #define l_DEREF *
00994 #define l_NEWATOMIC (AtomicGC)
00995 #define l_NULLOK 0
00996 #define l_TEST , l_NULLOK
00997 #define l_POINT 
00998 #define l_EXTRA 0
00999 #define l_TERMINATE 
01000 #define l_COPY l_COPYDEST.x=l_COPYSRC.x; l_COPYDEST.y=l_COPYSRC.y;
01001 #define l_OKTEST 
01002 #define l_INTTYPE int
01003 #define l_DIRECTMALLOC 1
01004 
01005 #define l_TYPE wxPoint
01006 #define l_LIST_ITEM_BUNDLE objscheme_bundle_wxPoint
01007 #define l_LIST_ITEM_UNBUNDLE objscheme_unbundle_wxPoint
01008 #define l_MAKE_LIST __MakewxPointList
01009 #define l_MAKE_ARRAY __MakewxPointArray
01010 
01011 
01012 
01013 
01014 
01015 static Scheme_Object *l_MAKE_LIST(l_TYPE l_POINT *f, l_INTTYPE c)
01016 {
01017   Scheme_Object *cdr = scheme_null, *obj = NULL;
01018   SETUP_VAR_STACK(1);
01019   VAR_STACK_PUSH(0, cdr);
01020 
01021   while (c--) {
01022     obj = WITH_VAR_STACK(l_LIST_ITEM_BUNDLE(l_ADDRESS f[c]));
01023     cdr = WITH_VAR_STACK(scheme_make_pair(obj, cdr));
01024   }
01025   
01026   READY_TO_RETURN;
01027 
01028   return cdr;
01029 }
01030 
01031 static l_TYPE l_POINT *l_MAKE_ARRAY(Scheme_Object *l, l_INTTYPE *c, char *who)
01032 {
01033   Scheme_Object *orig_l = l;
01034   int i = 0;
01035   long len;
01036   l_TYPE l_POINT *f = NULL;
01037 
01038   SETUP_VAR_STACK(3);
01039   VAR_STACK_PUSH(0, l);
01040   VAR_STACK_PUSH(1, orig_l);
01041   VAR_STACK_PUSH(2, f);
01042 
01043   len = WITH_VAR_STACK(scheme_proper_list_length(l));
01044   if (len < 0) WITH_VAR_STACK(scheme_wrong_type(who, "proper-list", -1, 0, &l));
01045   if (c) *c = len;
01046 
01047   if (!(len + l_EXTRA)) {
01048     READY_TO_RETURN;
01049     return NULL;
01050   }
01051 
01052 #if l_DIRECTMALLOC
01053   f = (l_TYPE l_POINT *)WITH_VAR_STACK(GC_malloc_atomic(sizeof(l_TYPE l_POINT) * (len + l_EXTRA)));
01054 #else
01055   f = WITH_VAR_STACK(new l_NEWATOMIC l_TYPE l_POINT[len + l_EXTRA]);
01056 #endif
01057 
01058   while (!SCHEME_NULLP(l)) {
01059     if (!SCHEME_LISTP(l)) {
01060       WITH_VAR_STACK(scheme_arg_mismatch(who, "expected a proper list: ", orig_l));
01061       READY_TO_RETURN;
01062       return NULL;
01063     }
01064 
01065 #define l_COPYDEST f[i]
01066 #define l_COPYSRC (l_DEREF WITH_VAR_STACK(l_LIST_ITEM_UNBUNDLE(SCHEME_CAR(l), who l_TEST)))
01067 
01068     l_COPY
01069 
01070     l_OKTEST
01071 
01072     i++;
01073 
01074     l = SCHEME_CDR(l);
01075   }
01076   l_TERMINATE
01077 
01078   READY_TO_RETURN;
01079 
01080   return f;
01081 }
01082 
01083 
01084 /* The methods are here: */
01085 
01086 
01087 
01088 
01089 
01090 
01091 
01092 
01093 
01094 
01095 
01096 
01097 
01098 // Also in wxWindow:
01099 
01100 
01101 #ifndef wx_mac
01102 #define HIDETHISSTATEMENT(x) x
01103 #else
01104 #define HIDETHISSTATEMENT(x) 
01105 #endif
01106 
01107 
01108 #ifndef wx_mac
01109 #define CHECKTHISONE(x) x
01110 #else
01111 #define CHECKTHISONE(x) 1
01112 #endif
01113 
01114 
01115 
01116 
01117 
01118 
01119 
01120 
01121 
01122 
01123 
01124 
01125 
01126 
01127 class os_wxDC : public wxDC {
01128  public:
01129 
01130   ~os_wxDC();
01131 #ifdef MZ_PRECISE_GC
01132   void gcMark();
01133   void gcFixup();
01134 #endif
01135 };
01136 
01137 #ifdef MZ_PRECISE_GC
01138 void os_wxDC::gcMark() {
01139   wxDC::gcMark();
01140 }
01141 void os_wxDC::gcFixup() {
01142   wxDC::gcFixup();
01143 }
01144 #endif
01145 
01146 static Scheme_Object *os_wxDC_class;
01147 static Scheme_Object *os_wxDC_interface;
01148 
01149 os_wxDC::~os_wxDC()
01150 {
01151     objscheme_destroy(this, (Scheme_Object *) __gc_external);
01152 }
01153 
01154 static Scheme_Object *os_wxDCCacheFontMetricsKey(int n,  Scheme_Object *p[])
01155 {
01156   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01157   REMEMBER_VAR_STACK();
01158   int r;
01159   objscheme_check_valid(os_wxDC_class, "cache-font-metrics-key in dc<%>", n, p);
01160 
01161   SETUP_VAR_STACK_REMEMBERED(1);
01162   VAR_STACK_PUSH(0, p);
01163 
01164   
01165 
01166   
01167   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->CacheFontMetricsKey());
01168 
01169   
01170   
01171   READY_TO_RETURN;
01172   return scheme_make_integer(r);
01173 }
01174 
01175 static Scheme_Object *os_wxDCGetAlpha(int n,  Scheme_Object *p[])
01176 {
01177   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01178   REMEMBER_VAR_STACK();
01179   double r;
01180   objscheme_check_valid(os_wxDC_class, "get-alpha in dc<%>", n, p);
01181 
01182   SETUP_VAR_STACK_REMEMBERED(1);
01183   VAR_STACK_PUSH(0, p);
01184 
01185   
01186 
01187   
01188   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GetAlpha());
01189 
01190   
01191   
01192   READY_TO_RETURN;
01193   return WITH_REMEMBERED_STACK(scheme_make_double(r));
01194 }
01195 
01196 static Scheme_Object *os_wxDCSetAlpha(int n,  Scheme_Object *p[])
01197 {
01198   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01199   REMEMBER_VAR_STACK();
01200   objscheme_check_valid(os_wxDC_class, "set-alpha in dc<%>", n, p);
01201   double x0;
01202 
01203   SETUP_VAR_STACK_REMEMBERED(1);
01204   VAR_STACK_PUSH(0, p);
01205 
01206   
01207   x0 = WITH_VAR_STACK(objscheme_unbundle_double_in(p[POFFSET+0], 0, 1, "set-alpha in dc<%>"));
01208 
01209   
01210   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetAlpha(x0));
01211 
01212   
01213   
01214   READY_TO_RETURN;
01215   return scheme_void;
01216 }
01217 
01218 static Scheme_Object *os_wxDCGlyphAvailable(int n,  Scheme_Object *p[])
01219 {
01220   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01221   REMEMBER_VAR_STACK();
01222   Bool r;
01223   objscheme_check_valid(os_wxDC_class, "glyph-exists? in dc<%>", n, p);
01224   mzchar x0;
01225   class wxFont* x1 INIT_NULLED_OUT;
01226 
01227   SETUP_VAR_STACK_REMEMBERED(2);
01228   VAR_STACK_PUSH(0, p);
01229   VAR_STACK_PUSH(1, x1);
01230 
01231   
01232   x0 = WITH_VAR_STACK(objscheme_unbundle_char(p[POFFSET+0], "glyph-exists? in dc<%>"));
01233   if (n > (POFFSET+1)) {
01234     x1 = WITH_VAR_STACK(objscheme_unbundle_wxFont(p[POFFSET+1], "glyph-exists? in dc<%>", 1));
01235   } else
01236     x1 = NULL;
01237 
01238   DO_OK_CHECK(METHODNAME("dc<%>","glyph-exists?"))
01239   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GlyphAvailable(x0, x1));
01240 
01241   
01242   
01243   READY_TO_RETURN;
01244   return (r ? scheme_true : scheme_false);
01245 }
01246 
01247 static Scheme_Object *os_wxDCEndPage(int n,  Scheme_Object *p[])
01248 {
01249   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01250   REMEMBER_VAR_STACK();
01251   objscheme_check_valid(os_wxDC_class, "end-page in dc<%>", n, p);
01252 
01253   SETUP_VAR_STACK_REMEMBERED(1);
01254   VAR_STACK_PUSH(0, p);
01255 
01256   
01257 
01258   DO_OK_CHECK(METHODNAME("dc<%>","end-page"))
01259   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->EndPage());
01260 
01261   
01262   
01263   READY_TO_RETURN;
01264   return scheme_void;
01265 }
01266 
01267 static Scheme_Object *os_wxDCEndDoc(int n,  Scheme_Object *p[])
01268 {
01269   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01270   REMEMBER_VAR_STACK();
01271   objscheme_check_valid(os_wxDC_class, "end-doc in dc<%>", n, p);
01272 
01273   SETUP_VAR_STACK_REMEMBERED(1);
01274   VAR_STACK_PUSH(0, p);
01275 
01276   
01277 
01278   DO_OK_CHECK(METHODNAME("dc<%>","end-doc-line"))
01279   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->EndDoc());
01280 
01281   
01282   
01283   READY_TO_RETURN;
01284   return scheme_void;
01285 }
01286 
01287 static Scheme_Object *os_wxDCStartPage(int n,  Scheme_Object *p[])
01288 {
01289   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01290   REMEMBER_VAR_STACK();
01291   objscheme_check_valid(os_wxDC_class, "start-page in dc<%>", n, p);
01292 
01293   SETUP_VAR_STACK_REMEMBERED(1);
01294   VAR_STACK_PUSH(0, p);
01295 
01296   
01297 
01298   DO_OK_CHECK(METHODNAME("dc<%>","start-page"))
01299   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->StartPage());
01300 
01301   
01302   
01303   READY_TO_RETURN;
01304   return scheme_void;
01305 }
01306 
01307 static Scheme_Object *os_wxDCStartDoc(int n,  Scheme_Object *p[])
01308 {
01309   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01310   REMEMBER_VAR_STACK();
01311   Bool r;
01312   objscheme_check_valid(os_wxDC_class, "start-doc in dc<%>", n, p);
01313   string x0 INIT_NULLED_OUT;
01314 
01315   SETUP_VAR_STACK_REMEMBERED(2);
01316   VAR_STACK_PUSH(0, p);
01317   VAR_STACK_PUSH(1, x0);
01318 
01319   
01320   x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "start-doc in dc<%>"));
01321 
01322   DO_OK_CHECK(METHODNAME("dc<%>","start-doc"))
01323   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->StartDoc(x0));
01324 
01325   
01326   
01327   READY_TO_RETURN;
01328   return (r ? scheme_true : scheme_false);
01329 }
01330 
01331 static Scheme_Object *os_wxDCOk(int n,  Scheme_Object *p[])
01332 {
01333   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01334   REMEMBER_VAR_STACK();
01335   Bool r;
01336   objscheme_check_valid(os_wxDC_class, "ok? in dc<%>", n, p);
01337 
01338   SETUP_VAR_STACK_REMEMBERED(1);
01339   VAR_STACK_PUSH(0, p);
01340 
01341   
01342 
01343   
01344   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->Ok());
01345 
01346   
01347   
01348   READY_TO_RETURN;
01349   return (r ? scheme_true : scheme_false);
01350 }
01351 
01352 static Scheme_Object *os_wxDC_GetGL(int n,  Scheme_Object *p[])
01353 {
01354   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01355   REMEMBER_VAR_STACK();
01356   class wxGL* r;
01357   objscheme_check_valid(os_wxDC_class, "get-gl-context in dc<%>", n, p);
01358 
01359   SETUP_VAR_STACK_REMEMBERED(1);
01360   VAR_STACK_PUSH(0, p);
01361 
01362   
01363 
01364   
01365   r = WITH_VAR_STACK(_GetGL(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)));
01366 
01367   
01368   
01369   READY_TO_RETURN;
01370   return WITH_REMEMBERED_STACK(objscheme_bundle_wxGL(r));
01371 }
01372 
01373 static Scheme_Object *os_wxDCMyGetSize(int n,  Scheme_Object *p[])
01374 {
01375   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01376   REMEMBER_VAR_STACK();
01377   void* r;
01378   objscheme_check_valid(os_wxDC_class, "get-size in dc<%>", n, p);
01379 
01380   SETUP_VAR_STACK_REMEMBERED(1);
01381   VAR_STACK_PUSH(0, p);
01382 
01383   
01384 
01385   DO_OK_CHECK(METHODNAME("dc<%>","get-size"))
01386   r = WITH_VAR_STACK(MyGetSize(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)));
01387 
01388   
01389   
01390   READY_TO_RETURN;
01391   return (Scheme_Object*)r;
01392 }
01393 
01394 static Scheme_Object *os_wxDCdcGetTextForeground(int n,  Scheme_Object *p[])
01395 {
01396   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01397   REMEMBER_VAR_STACK();
01398   class wxColour* r;
01399   objscheme_check_valid(os_wxDC_class, "get-text-foreground in dc<%>", n, p);
01400 
01401   SETUP_VAR_STACK_REMEMBERED(1);
01402   VAR_STACK_PUSH(0, p);
01403 
01404   
01405 
01406   DO_OK_CHECK(METHODNAME("dc<%>","get-text-foreground"))
01407   r = WITH_VAR_STACK(dcGetTextForeground(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)));
01408 
01409   
01410   
01411   READY_TO_RETURN;
01412   return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
01413 }
01414 
01415 static Scheme_Object *os_wxDCdcGetTextBackground(int n,  Scheme_Object *p[])
01416 {
01417   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01418   REMEMBER_VAR_STACK();
01419   class wxColour* r;
01420   objscheme_check_valid(os_wxDC_class, "get-text-background in dc<%>", n, p);
01421 
01422   SETUP_VAR_STACK_REMEMBERED(1);
01423   VAR_STACK_PUSH(0, p);
01424 
01425   
01426 
01427   DO_OK_CHECK(METHODNAME("dc<%>","get-text-background"))
01428   r = WITH_VAR_STACK(dcGetTextBackground(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)));
01429 
01430   
01431   
01432   READY_TO_RETURN;
01433   return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
01434 }
01435 
01436 static Scheme_Object *os_wxDCGetPen(int n,  Scheme_Object *p[])
01437 {
01438   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01439   REMEMBER_VAR_STACK();
01440   class wxPen* r;
01441   objscheme_check_valid(os_wxDC_class, "get-pen in dc<%>", n, p);
01442 
01443   SETUP_VAR_STACK_REMEMBERED(1);
01444   VAR_STACK_PUSH(0, p);
01445 
01446   
01447 
01448   DO_OK_CHECK(METHODNAME("dc<%>","get-pen"))
01449   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GetPen());
01450 
01451   
01452   
01453   READY_TO_RETURN;
01454   return WITH_REMEMBERED_STACK(objscheme_bundle_wxPen(r));
01455 }
01456 
01457 static Scheme_Object *os_wxDCGetFont(int n,  Scheme_Object *p[])
01458 {
01459   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01460   REMEMBER_VAR_STACK();
01461   class wxFont* r;
01462   objscheme_check_valid(os_wxDC_class, "get-font in dc<%>", n, p);
01463 
01464   SETUP_VAR_STACK_REMEMBERED(1);
01465   VAR_STACK_PUSH(0, p);
01466 
01467   
01468 
01469   DO_OK_CHECK(METHODNAME("dc<%>","get-font"))
01470   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GetFont());
01471 
01472   
01473   
01474   READY_TO_RETURN;
01475   return WITH_REMEMBERED_STACK(objscheme_bundle_wxFont(r));
01476 }
01477 
01478 static Scheme_Object *os_wxDCGetBrush(int n,  Scheme_Object *p[])
01479 {
01480   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01481   REMEMBER_VAR_STACK();
01482   class wxBrush* r;
01483   objscheme_check_valid(os_wxDC_class, "get-brush in dc<%>", n, p);
01484 
01485   SETUP_VAR_STACK_REMEMBERED(1);
01486   VAR_STACK_PUSH(0, p);
01487 
01488   
01489 
01490   DO_OK_CHECK(METHODNAME("dc<%>","get-brush"))
01491   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GetBrush());
01492 
01493   
01494   
01495   READY_TO_RETURN;
01496   return WITH_REMEMBERED_STACK(objscheme_bundle_wxBrush(r));
01497 }
01498 
01499 static Scheme_Object *os_wxDCGetBackgroundMode(int n,  Scheme_Object *p[])
01500 {
01501   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01502   REMEMBER_VAR_STACK();
01503   int r;
01504   objscheme_check_valid(os_wxDC_class, "get-text-mode in dc<%>", n, p);
01505 
01506   SETUP_VAR_STACK_REMEMBERED(1);
01507   VAR_STACK_PUSH(0, p);
01508 
01509   
01510 
01511   DO_OK_CHECK(METHODNAME("dc<%>","get-text-mode"))
01512   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GetBackgroundMode());
01513 
01514   
01515   
01516   READY_TO_RETURN;
01517   return WITH_REMEMBERED_STACK(bundle_symset_textMode(r));
01518 }
01519 
01520 static Scheme_Object *os_wxDCGetBackground(int n,  Scheme_Object *p[])
01521 {
01522   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01523   REMEMBER_VAR_STACK();
01524   class wxColour* r;
01525   objscheme_check_valid(os_wxDC_class, "get-background in dc<%>", n, p);
01526 
01527   SETUP_VAR_STACK_REMEMBERED(1);
01528   VAR_STACK_PUSH(0, p);
01529 
01530   
01531 
01532   DO_OK_CHECK(METHODNAME("dc<%>","get-background"))
01533   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GetBackground());
01534 
01535   
01536   
01537   READY_TO_RETURN;
01538   return WITH_REMEMBERED_STACK(objscheme_bundle_wxColour(r));
01539 }
01540 
01541 static Scheme_Object *os_wxDCMyGetOrigin(int n,  Scheme_Object *p[])
01542 {
01543   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01544   REMEMBER_VAR_STACK();
01545   void* r;
01546   objscheme_check_valid(os_wxDC_class, "get-origin in dc<%>", n, p);
01547 
01548   SETUP_VAR_STACK_REMEMBERED(1);
01549   VAR_STACK_PUSH(0, p);
01550 
01551   
01552 
01553   DO_OK_CHECK(METHODNAME("dc<%>","get-origin"))
01554   r = WITH_VAR_STACK(MyGetOrigin(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)));
01555 
01556   
01557   
01558   READY_TO_RETURN;
01559   return (Scheme_Object*)r;
01560 }
01561 
01562 static Scheme_Object *os_wxDCMyGetScale(int n,  Scheme_Object *p[])
01563 {
01564   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01565   REMEMBER_VAR_STACK();
01566   void* r;
01567   objscheme_check_valid(os_wxDC_class, "get-scale in dc<%>", n, p);
01568 
01569   SETUP_VAR_STACK_REMEMBERED(1);
01570   VAR_STACK_PUSH(0, p);
01571 
01572   
01573 
01574   DO_OK_CHECK(METHODNAME("dc<%>","get-scale"))
01575   r = WITH_VAR_STACK(MyGetScale(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)));
01576 
01577   
01578   
01579   READY_TO_RETURN;
01580   return (Scheme_Object*)r;
01581 }
01582 
01583 static Scheme_Object *os_wxDCSetDeviceOrigin(int n,  Scheme_Object *p[])
01584 {
01585   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01586   REMEMBER_VAR_STACK();
01587   objscheme_check_valid(os_wxDC_class, "set-origin in dc<%>", n, p);
01588   double x0;
01589   double x1;
01590 
01591   SETUP_VAR_STACK_REMEMBERED(1);
01592   VAR_STACK_PUSH(0, p);
01593 
01594   
01595   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "set-origin in dc<%>"));
01596   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "set-origin in dc<%>"));
01597 
01598   DO_OK_CHECK(METHODNAME("dc<%>","set-origin"))
01599   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetDeviceOrigin(x0, x1));
01600 
01601   
01602   
01603   READY_TO_RETURN;
01604   return scheme_void;
01605 }
01606 
01607 static Scheme_Object *os_wxDCSetUserScale(int n,  Scheme_Object *p[])
01608 {
01609   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01610   REMEMBER_VAR_STACK();
01611   objscheme_check_valid(os_wxDC_class, "set-scale in dc<%>", n, p);
01612   nndouble x0;
01613   nndouble x1;
01614 
01615   SETUP_VAR_STACK_REMEMBERED(1);
01616   VAR_STACK_PUSH(0, p);
01617 
01618   
01619   x0 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+0], "set-scale in dc<%>"));
01620   x1 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+1], "set-scale in dc<%>"));
01621 
01622   DO_OK_CHECK(METHODNAME("dc<%>","set-scale"))
01623   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetUserScale(x0, x1));
01624 
01625   
01626   
01627   READY_TO_RETURN;
01628   return scheme_void;
01629 }
01630 
01631 static Scheme_Object *os_wxDCSetBackgroundMode(int n,  Scheme_Object *p[])
01632 {
01633   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01634   REMEMBER_VAR_STACK();
01635   objscheme_check_valid(os_wxDC_class, "set-text-mode in dc<%>", n, p);
01636   int x0;
01637 
01638   SETUP_VAR_STACK_REMEMBERED(1);
01639   VAR_STACK_PUSH(0, p);
01640 
01641   
01642   x0 = WITH_VAR_STACK(unbundle_symset_textMode(p[POFFSET+0], "set-text-mode in dc<%>"));
01643 
01644   DO_OK_CHECK(METHODNAME("dc<%>","set-text-mode"))
01645   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetBackgroundMode(x0));
01646 
01647   
01648   
01649   READY_TO_RETURN;
01650   return scheme_void;
01651 }
01652 
01653 static Scheme_Object *os_wxDCTryColour(int n,  Scheme_Object *p[])
01654 {
01655   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01656   REMEMBER_VAR_STACK();
01657   objscheme_check_valid(os_wxDC_class, "try-color in dc<%>", n, p);
01658   class wxColour* x0 INIT_NULLED_OUT;
01659   class wxColour* x1 INIT_NULLED_OUT;
01660 
01661   SETUP_VAR_STACK_REMEMBERED(3);
01662   VAR_STACK_PUSH(0, p);
01663   VAR_STACK_PUSH(1, x0);
01664   VAR_STACK_PUSH(2, x1);
01665 
01666   
01667   x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "try-color in dc<%>", 0));
01668   x1 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+1], "try-color in dc<%>", 0));
01669 
01670   DO_OK_CHECK(METHODNAME("dc<%>","try-color"))
01671   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->TryColour(x0, x1));
01672 
01673   
01674   
01675   READY_TO_RETURN;
01676   return scheme_void;
01677 }
01678 
01679 static Scheme_Object *os_wxDCDrawBitmap(int n,  Scheme_Object *p[])
01680 {
01681   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01682   REMEMBER_VAR_STACK();
01683   Bool r;
01684   objscheme_check_valid(os_wxDC_class, "draw-bitmap in dc<%>", n, p);
01685   class wxBitmap* x0 INIT_NULLED_OUT;
01686   double x1;
01687   double x2;
01688   int x3;
01689   class wxColour* x4 INIT_NULLED_OUT;
01690   class wxBitmap* x5 INIT_NULLED_OUT;
01691 
01692   SETUP_VAR_STACK_REMEMBERED(4);
01693   VAR_STACK_PUSH(0, p);
01694   VAR_STACK_PUSH(1, x0);
01695   VAR_STACK_PUSH(2, x4);
01696   VAR_STACK_PUSH(3, x5);
01697 
01698   
01699   x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+0], "draw-bitmap in dc<%>", 0));
01700   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-bitmap in dc<%>"));
01701   x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw-bitmap in dc<%>"));
01702   if (n > (POFFSET+3)) {
01703     x3 = WITH_VAR_STACK(unbundle_symset_bitmapDrawStyle(p[POFFSET+3], "draw-bitmap in dc<%>"));
01704   } else
01705     x3 = wxSOLID;
01706   if (n > (POFFSET+4)) {
01707     x4 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+4], "draw-bitmap in dc<%>", 0));
01708   } else
01709     x4 = NULL;
01710   if (n > (POFFSET+5)) {
01711     x5 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+5], "draw-bitmap in dc<%>", 1));
01712   } else
01713     x5 = NULL;
01714 
01715   if (x5 && !(x5->Ok())) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-bitmap"), "mask bitmap is not ok: ", p[POFFSET+5]));if (x5 && ((x0->GetWidth() != x5->GetWidth()) || (x0->GetHeight() != x5->GetHeight()))) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-bitmap"), "mask bitmap size does not match bitmap to draw: ", p[POFFSET+0]));DO_OK_CHECK(METHODNAME("dc<%>","draw-bitmap"))if (WITH_VAR_STACK(dc_target(THEOBJ)) == x0) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-bitmap"), "source bitmap is the same as the destination: ", p[POFFSET+0])); if (WITH_VAR_STACK(dc_target(THEOBJ)) == x5) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-bitmap"), "mask bitmap is the same as the destination: ", p[POFFSET+5]));
01716   r = WITH_VAR_STACK(DrawBitmap(((wxDC *)((Scheme_Class_Object *)p[0])->primdata), x0, x1, x2, x3, x4, x5));
01717 
01718   
01719   
01720   READY_TO_RETURN;
01721   return (r ? scheme_true : scheme_false);
01722 }
01723 
01724 static Scheme_Object *os_wxDCDrawBitmapRegion(int n,  Scheme_Object *p[])
01725 {
01726   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01727   REMEMBER_VAR_STACK();
01728   Bool r;
01729   objscheme_check_valid(os_wxDC_class, "draw-bitmap-section in dc<%>", n, p);
01730   class wxBitmap* x0 INIT_NULLED_OUT;
01731   double x1;
01732   double x2;
01733   double x3;
01734   double x4;
01735   nndouble x5;
01736   nndouble x6;
01737   int x7;
01738   class wxColour* x8 INIT_NULLED_OUT;
01739   class wxBitmap* x9 INIT_NULLED_OUT;
01740 
01741   SETUP_VAR_STACK_REMEMBERED(4);
01742   VAR_STACK_PUSH(0, p);
01743   VAR_STACK_PUSH(1, x0);
01744   VAR_STACK_PUSH(2, x8);
01745   VAR_STACK_PUSH(3, x9);
01746 
01747   
01748   x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+0], "draw-bitmap-section in dc<%>", 0));
01749   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-bitmap-section in dc<%>"));
01750   x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw-bitmap-section in dc<%>"));
01751   x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "draw-bitmap-section in dc<%>"));
01752   x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "draw-bitmap-section in dc<%>"));
01753   x5 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+5], "draw-bitmap-section in dc<%>"));
01754   x6 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+6], "draw-bitmap-section in dc<%>"));
01755   if (n > (POFFSET+7)) {
01756     x7 = WITH_VAR_STACK(unbundle_symset_bitmapDrawStyle(p[POFFSET+7], "draw-bitmap-section in dc<%>"));
01757   } else
01758     x7 = wxSOLID;
01759   if (n > (POFFSET+8)) {
01760     x8 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+8], "draw-bitmap-section in dc<%>", 0));
01761   } else
01762     x8 = NULL;
01763   if (n > (POFFSET+9)) {
01764     x9 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+9], "draw-bitmap-section in dc<%>", 1));
01765   } else
01766     x9 = NULL;
01767 
01768   if (x9 && !(x9->Ok())) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-bitmap-section"), "mask bitmap is not ok: ", p[POFFSET+9]));if (x9 && ((x0->GetWidth() != x9->GetWidth()) || (x0->GetHeight() != x9->GetHeight()))) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-bitmap-section"), "mask bitmap size does not match bitmap to draw: ", p[POFFSET+0]));DO_OK_CHECK(METHODNAME("dc<%>","draw-bitmap-section"))if (WITH_VAR_STACK(dc_target(THEOBJ)) == x0) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-bitmap-section"), "source bitmap is the same as the destination: ", p[POFFSET+0])); if (WITH_VAR_STACK(dc_target(THEOBJ)) == x9) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-bitmap-section"), "mask bitmap is the same as the destination: ", p[POFFSET+9]));
01769   r = WITH_VAR_STACK(DrawBitmapRegion(((wxDC *)((Scheme_Class_Object *)p[0])->primdata), x0, x1, x2, x3, x4, x5, x6, x7, x8, x9));
01770 
01771   
01772   
01773   READY_TO_RETURN;
01774   return (r ? scheme_true : scheme_false);
01775 }
01776 
01777 static Scheme_Object *os_wxDCGetCharWidth(int n,  Scheme_Object *p[])
01778 {
01779   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01780   REMEMBER_VAR_STACK();
01781   double r;
01782   objscheme_check_valid(os_wxDC_class, "get-char-width in dc<%>", n, p);
01783 
01784   SETUP_VAR_STACK_REMEMBERED(1);
01785   VAR_STACK_PUSH(0, p);
01786 
01787   
01788 
01789   DO_OK_CHECK(METHODNAME("dc<%>","get-char-width"))
01790   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GetCharWidth());
01791 
01792   
01793   
01794   READY_TO_RETURN;
01795   return WITH_REMEMBERED_STACK(scheme_make_double(r));
01796 }
01797 
01798 static Scheme_Object *os_wxDCGetCharHeight(int n,  Scheme_Object *p[])
01799 {
01800   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01801   REMEMBER_VAR_STACK();
01802   double r;
01803   objscheme_check_valid(os_wxDC_class, "get-char-height in dc<%>", n, p);
01804 
01805   SETUP_VAR_STACK_REMEMBERED(1);
01806   VAR_STACK_PUSH(0, p);
01807 
01808   
01809 
01810   DO_OK_CHECK(METHODNAME("dc<%>","get-char-height"))
01811   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GetCharHeight());
01812 
01813   
01814   
01815   READY_TO_RETURN;
01816   return WITH_REMEMBERED_STACK(scheme_make_double(r));
01817 }
01818 
01819 static Scheme_Object *os_wxDCMyTextExtent(int n,  Scheme_Object *p[])
01820 {
01821   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01822   REMEMBER_VAR_STACK();
01823   void* r;
01824   objscheme_check_valid(os_wxDC_class, "get-text-extent in dc<%>", n, p);
01825   mzstring x0 INIT_NULLED_OUT;
01826   class wxFont* x1 INIT_NULLED_OUT;
01827   Bool x2;
01828   nnint x3;
01829 
01830   SETUP_VAR_STACK_REMEMBERED(3);
01831   VAR_STACK_PUSH(0, p);
01832   VAR_STACK_PUSH(1, x0);
01833   VAR_STACK_PUSH(2, x1);
01834 
01835   
01836   x0 = (mzstring)WITH_VAR_STACK(objscheme_unbundle_mzstring(p[POFFSET+0], "get-text-extent in dc<%>"));
01837   if (n > (POFFSET+1)) {
01838     x1 = WITH_VAR_STACK(objscheme_unbundle_wxFont(p[POFFSET+1], "get-text-extent in dc<%>", 1));
01839   } else
01840     x1 = NULL;
01841   if (n > (POFFSET+2)) {
01842     x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "get-text-extent in dc<%>"));
01843   } else
01844     x2 = FALSE;
01845   if (n > (POFFSET+3)) {
01846     x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+3], "get-text-extent in dc<%>"));
01847   } else
01848     x3 = 0;
01849 
01850   if (x3 > SCHEME_CHAR_STRLEN_VAL(p[POFFSET+0])) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","get-text-extent"), "string index too large: ", p[POFFSET+3]));DO_OK_CHECK(METHODNAME("dc<%>","get-text-extent"))
01851   r = WITH_VAR_STACK(MyTextExtent(((wxDC *)((Scheme_Class_Object *)p[0])->primdata), x0, x1, x2, x3));
01852 
01853   
01854   
01855   READY_TO_RETURN;
01856   return (Scheme_Object*)r;
01857 }
01858 
01859 static Scheme_Object *os_wxDCGetAntiAlias(int n,  Scheme_Object *p[])
01860 {
01861   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01862   REMEMBER_VAR_STACK();
01863   int r;
01864   objscheme_check_valid(os_wxDC_class, "get-smoothing in dc<%>", n, p);
01865 
01866   SETUP_VAR_STACK_REMEMBERED(1);
01867   VAR_STACK_PUSH(0, p);
01868 
01869   
01870 
01871   
01872   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GetAntiAlias());
01873 
01874   
01875   
01876   READY_TO_RETURN;
01877   return WITH_REMEMBERED_STACK(bundle_symset_smoothingMode(r));
01878 }
01879 
01880 static Scheme_Object *os_wxDCSetAntiAlias(int n,  Scheme_Object *p[])
01881 {
01882   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01883   REMEMBER_VAR_STACK();
01884   objscheme_check_valid(os_wxDC_class, "set-smoothing in dc<%>", n, p);
01885   int x0;
01886 
01887   SETUP_VAR_STACK_REMEMBERED(1);
01888   VAR_STACK_PUSH(0, p);
01889 
01890   
01891   x0 = WITH_VAR_STACK(unbundle_symset_smoothingMode(p[POFFSET+0], "set-smoothing in dc<%>"));
01892 
01893   
01894   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetAntiAlias(x0));
01895 
01896   
01897   
01898   READY_TO_RETURN;
01899   return scheme_void;
01900 }
01901 
01902 static Scheme_Object *os_wxDCSetTextForeground(int n,  Scheme_Object *p[])
01903 {
01904   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01905   REMEMBER_VAR_STACK();
01906   objscheme_check_valid(os_wxDC_class, "set-text-foreground in dc<%>", n, p);
01907   class wxColour* x0 INIT_NULLED_OUT;
01908 
01909   SETUP_VAR_STACK_REMEMBERED(2);
01910   VAR_STACK_PUSH(0, p);
01911   VAR_STACK_PUSH(1, x0);
01912 
01913   
01914   x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "set-text-foreground in dc<%>", 0));
01915 
01916   DO_OK_CHECK(METHODNAME("dc<%>","set-text-foreground"))
01917   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetTextForeground(x0));
01918 
01919   
01920   
01921   READY_TO_RETURN;
01922   return scheme_void;
01923 }
01924 
01925 static Scheme_Object *os_wxDCSetTextBackground(int n,  Scheme_Object *p[])
01926 {
01927   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01928   REMEMBER_VAR_STACK();
01929   objscheme_check_valid(os_wxDC_class, "set-text-background in dc<%>", n, p);
01930   class wxColour* x0 INIT_NULLED_OUT;
01931 
01932   SETUP_VAR_STACK_REMEMBERED(2);
01933   VAR_STACK_PUSH(0, p);
01934   VAR_STACK_PUSH(1, x0);
01935 
01936   
01937   x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "set-text-background in dc<%>", 0));
01938 
01939   DO_OK_CHECK(METHODNAME("dc<%>","set-text-background"))
01940   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetTextBackground(x0));
01941 
01942   
01943   
01944   READY_TO_RETURN;
01945   return scheme_void;
01946 }
01947 
01948 static Scheme_Object *os_wxDCSetBrush(int n,  Scheme_Object *p[])
01949 {
01950   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
01951   SETUP_PRE_VAR_STACK(1);
01952   PRE_VAR_STACK_PUSH(0, p);
01953   REMEMBER_VAR_STACK();
01954   objscheme_check_valid(os_wxDC_class, "set-brush in dc<%>", n, p);
01955   if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxBrush(p[POFFSET+0], NULL, 0))) {
01956     class wxBrush* x0 INIT_NULLED_OUT;
01957 
01958     SETUP_VAR_STACK_PRE_REMEMBERED(2);
01959     VAR_STACK_PUSH(0, p);
01960     VAR_STACK_PUSH(1, x0);
01961 
01962     
01963     if (n != (POFFSET+1)) 
01964       WITH_VAR_STACK(scheme_wrong_count_m("set-brush in dc<%> (brush% case)", POFFSET+1, POFFSET+1, n, p, 1));
01965     x0 = WITH_VAR_STACK(objscheme_unbundle_wxBrush(p[POFFSET+0], "set-brush in dc<%> (brush% case)", 0));
01966 
01967     DO_OK_CHECK(METHODNAME("dc<%>","set-brush"))
01968     WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetBrush(x0));
01969 
01970     
01971     
01972     READY_TO_PRE_RETURN;
01973   } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[POFFSET+0], NULL, 0))) {
01974     class wxColour* x0 INIT_NULLED_OUT;
01975     int x1;
01976 
01977     SETUP_VAR_STACK_PRE_REMEMBERED(2);
01978     VAR_STACK_PUSH(0, p);
01979     VAR_STACK_PUSH(1, x0);
01980 
01981     
01982     if (n != (POFFSET+2)) 
01983       WITH_VAR_STACK(scheme_wrong_count_m("set-brush in dc<%> (color% case)", POFFSET+2, POFFSET+2, n, p, 1));
01984     x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "set-brush in dc<%> (color% case)", 0));
01985     x1 = WITH_VAR_STACK(unbundle_symset_brushStyle(p[POFFSET+1], "set-brush in dc<%> (color% case)"));
01986 
01987     DO_OK_CHECK(METHODNAME("dc<%>","set-brush"))
01988     WITH_VAR_STACK(SetBrush(((wxDC *)((Scheme_Class_Object *)p[0])->primdata), x0, x1));
01989 
01990     
01991     
01992     READY_TO_PRE_RETURN;
01993   } else  {
01994     string x0 INIT_NULLED_OUT;
01995     int x1;
01996 
01997     SETUP_VAR_STACK_PRE_REMEMBERED(2);
01998     VAR_STACK_PUSH(0, p);
01999     VAR_STACK_PUSH(1, x0);
02000 
02001     
02002     if (n != (POFFSET+2)) 
02003       WITH_VAR_STACK(scheme_wrong_count_m("set-brush in dc<%> (color name case)", POFFSET+2, POFFSET+2, n, p, 1));
02004     x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "set-brush in dc<%> (color name case)"));
02005     x1 = WITH_VAR_STACK(unbundle_symset_brushStyle(p[POFFSET+1], "set-brush in dc<%> (color name case)"));
02006 
02007     DO_OK_CHECK(METHODNAME("dc<%>","set-brush"))
02008     WITH_VAR_STACK(SetBrush(((wxDC *)((Scheme_Class_Object *)p[0])->primdata), x0, x1));
02009 
02010     
02011     
02012     READY_TO_PRE_RETURN;
02013   }
02014 
02015   return scheme_void;
02016 }
02017 
02018 static Scheme_Object *os_wxDCSetPen(int n,  Scheme_Object *p[])
02019 {
02020   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02021   SETUP_PRE_VAR_STACK(1);
02022   PRE_VAR_STACK_PUSH(0, p);
02023   REMEMBER_VAR_STACK();
02024   objscheme_check_valid(os_wxDC_class, "set-pen in dc<%>", n, p);
02025   if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxPen(p[POFFSET+0], NULL, 0))) {
02026     class wxPen* x0 INIT_NULLED_OUT;
02027 
02028     SETUP_VAR_STACK_PRE_REMEMBERED(2);
02029     VAR_STACK_PUSH(0, p);
02030     VAR_STACK_PUSH(1, x0);
02031 
02032     
02033     if (n != (POFFSET+1)) 
02034       WITH_VAR_STACK(scheme_wrong_count_m("set-pen in dc<%> (pen% case)", POFFSET+1, POFFSET+1, n, p, 1));
02035     x0 = WITH_VAR_STACK(objscheme_unbundle_wxPen(p[POFFSET+0], "set-pen in dc<%> (pen% case)", 0));
02036 
02037     DO_OK_CHECK(METHODNAME("dc<%>","set-pen"))
02038     WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetPen(x0));
02039 
02040     
02041     
02042     READY_TO_PRE_RETURN;
02043   } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_wxColour(p[POFFSET+0], NULL, 0))) {
02044     class wxColour* x0 INIT_NULLED_OUT;
02045     double x1;
02046     int x2;
02047 
02048     SETUP_VAR_STACK_PRE_REMEMBERED(2);
02049     VAR_STACK_PUSH(0, p);
02050     VAR_STACK_PUSH(1, x0);
02051 
02052     
02053     if (n != (POFFSET+3)) 
02054       WITH_VAR_STACK(scheme_wrong_count_m("set-pen in dc<%> (color% case)", POFFSET+3, POFFSET+3, n, p, 1));
02055     x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "set-pen in dc<%> (color% case)", 0));
02056     x1 = WITH_VAR_STACK(objscheme_unbundle_double_in(p[POFFSET+1], 0, 255, "set-pen in dc<%> (color% case)"));
02057     x2 = WITH_VAR_STACK(unbundle_symset_penStyle(p[POFFSET+2], "set-pen in dc<%> (color% case)"));
02058 
02059     DO_OK_CHECK(METHODNAME("dc<%>","set-pen"))
02060     WITH_VAR_STACK(SetPen(((wxDC *)((Scheme_Class_Object *)p[0])->primdata), x0, x1, x2));
02061 
02062     
02063     
02064     READY_TO_PRE_RETURN;
02065   } else  {
02066     string x0 INIT_NULLED_OUT;
02067     double x1;
02068     int x2;
02069 
02070     SETUP_VAR_STACK_PRE_REMEMBERED(2);
02071     VAR_STACK_PUSH(0, p);
02072     VAR_STACK_PUSH(1, x0);
02073 
02074     
02075     if (n != (POFFSET+3)) 
02076       WITH_VAR_STACK(scheme_wrong_count_m("set-pen in dc<%> (color name case)", POFFSET+3, POFFSET+3, n, p, 1));
02077     x0 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[POFFSET+0], "set-pen in dc<%> (color name case)"));
02078     x1 = WITH_VAR_STACK(objscheme_unbundle_double_in(p[POFFSET+1], 0, 255, "set-pen in dc<%> (color name case)"));
02079     x2 = WITH_VAR_STACK(unbundle_symset_penStyle(p[POFFSET+2], "set-pen in dc<%> (color name case)"));
02080 
02081     DO_OK_CHECK(METHODNAME("dc<%>","set-pen"))
02082     WITH_VAR_STACK(SetPen(((wxDC *)((Scheme_Class_Object *)p[0])->primdata), x0, x1, x2));
02083 
02084     
02085     
02086     READY_TO_PRE_RETURN;
02087   }
02088 
02089   return scheme_void;
02090 }
02091 
02092 static Scheme_Object *os_wxDCSetFont(int n,  Scheme_Object *p[])
02093 {
02094   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02095   REMEMBER_VAR_STACK();
02096   objscheme_check_valid(os_wxDC_class, "set-font in dc<%>", n, p);
02097   class wxFont* x0 INIT_NULLED_OUT;
02098 
02099   SETUP_VAR_STACK_REMEMBERED(2);
02100   VAR_STACK_PUSH(0, p);
02101   VAR_STACK_PUSH(1, x0);
02102 
02103   
02104   x0 = WITH_VAR_STACK(objscheme_unbundle_wxFont(p[POFFSET+0], "set-font in dc<%>", 0));
02105 
02106   DO_OK_CHECK(METHODNAME("dc<%>","set-font"))
02107   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetFont(x0));
02108 
02109   
02110   
02111   READY_TO_RETURN;
02112   return scheme_void;
02113 }
02114 
02115 static Scheme_Object *os_wxDCSetBackground(int n,  Scheme_Object *p[])
02116 {
02117   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02118   REMEMBER_VAR_STACK();
02119   objscheme_check_valid(os_wxDC_class, "set-background in dc<%>", n, p);
02120   class wxColour* x0 INIT_NULLED_OUT;
02121 
02122   SETUP_VAR_STACK_REMEMBERED(2);
02123   VAR_STACK_PUSH(0, p);
02124   VAR_STACK_PUSH(1, x0);
02125 
02126   
02127   x0 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+0], "set-background in dc<%>", 0));
02128 
02129   DO_OK_CHECK(METHODNAME("dc<%>","set-background"))
02130   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetBackground(x0));
02131 
02132   
02133   
02134   READY_TO_RETURN;
02135   return scheme_void;
02136 }
02137 
02138 static Scheme_Object *os_wxDCGetClippingRegion(int n,  Scheme_Object *p[])
02139 {
02140   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02141   REMEMBER_VAR_STACK();
02142   class wxRegion* r;
02143   objscheme_check_valid(os_wxDC_class, "get-clipping-region in dc<%>", n, p);
02144 
02145   SETUP_VAR_STACK_REMEMBERED(1);
02146   VAR_STACK_PUSH(0, p);
02147 
02148   
02149 
02150   DO_OK_CHECK(METHODNAME("dc<%>","set-clipping-region"))
02151   r = WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->GetClippingRegion());
02152 
02153   
02154   
02155   READY_TO_RETURN;
02156   return WITH_REMEMBERED_STACK(objscheme_bundle_wxRegion(r));
02157 }
02158 
02159 static Scheme_Object *os_wxDCSetClippingRegion(int n,  Scheme_Object *p[])
02160 {
02161   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02162   REMEMBER_VAR_STACK();
02163   objscheme_check_valid(os_wxDC_class, "set-clipping-region in dc<%>", n, p);
02164   class wxRegion* x0 INIT_NULLED_OUT;
02165 
02166   SETUP_VAR_STACK_REMEMBERED(2);
02167   VAR_STACK_PUSH(0, p);
02168   VAR_STACK_PUSH(1, x0);
02169 
02170   
02171   x0 = WITH_VAR_STACK(objscheme_unbundle_wxRegion(p[POFFSET+0], "set-clipping-region in dc<%>", 1));
02172 
02173   if (x0 && (x0->GetDC() != ((wxDC *)((Scheme_Class_Object *)THEOBJ)->primdata))) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","set-clipping-region"), "provided a different dc's region: ", p[POFFSET+0]));
02174   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetClippingRegion(x0));
02175 
02176   DO_OK_CHECK(METHODNAME("dc<%>","set-clipping-region"))
02177   
02178   READY_TO_RETURN;
02179   return scheme_void;
02180 }
02181 
02182 static Scheme_Object *os_wxDCSetClippingRect(int n,  Scheme_Object *p[])
02183 {
02184   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02185   REMEMBER_VAR_STACK();
02186   objscheme_check_valid(os_wxDC_class, "set-clipping-rect in dc<%>", n, p);
02187   double x0;
02188   double x1;
02189   nndouble x2;
02190   nndouble x3;
02191 
02192   SETUP_VAR_STACK_REMEMBERED(1);
02193   VAR_STACK_PUSH(0, p);
02194 
02195   
02196   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "set-clipping-rect in dc<%>"));
02197   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "set-clipping-rect in dc<%>"));
02198   x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "set-clipping-rect in dc<%>"));
02199   x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "set-clipping-rect in dc<%>"));
02200 
02201   if (x2 < 0) x2 = 0;if (x3 < 0) x3 = 0;DO_OK_CHECK(METHODNAME("dc<%>","set-clipping-rec"))
02202   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->SetClippingRect(x0, x1, x2, x3));
02203 
02204   
02205   
02206   READY_TO_RETURN;
02207   return scheme_void;
02208 }
02209 
02210 static Scheme_Object *os_wxDCDrawPolygon(int n,  Scheme_Object *p[])
02211 {
02212   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02213   REMEMBER_VAR_STACK();
02214   objscheme_check_valid(os_wxDC_class, "draw-polygon in dc<%>", n, p);
02215   int x0;
02216   class wxPoint* x1 INIT_NULLED_OUT;
02217   double x2;
02218   double x3;
02219   int x4;
02220 
02221   SETUP_VAR_STACK_REMEMBERED(2);
02222   VAR_STACK_PUSH(0, p);
02223   VAR_STACK_PUSH(1, x1);
02224 
02225   
02226   x1 = NULL;
02227   if (n > (POFFSET+1)) {
02228     x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-polygon in dc<%>"));
02229   } else
02230     x2 = 0;
02231   if (n > (POFFSET+2)) {
02232     x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw-polygon in dc<%>"));
02233   } else
02234     x3 = 0;
02235   if (n > (POFFSET+3)) {
02236     x4 = WITH_VAR_STACK(unbundle_symset_fillKind(p[POFFSET+3], "draw-polygon in dc<%>"));
02237   } else
02238     x4 = wxODDEVEN_RULE;
02239 
02240   x1 = WITH_VAR_STACK(__MakewxPointArray((0+POFFSET < n) ? p[POFFSET+0] : scheme_null, &x0, METHODNAME("dc<%>","draw-polygon")));DO_OK_CHECK(METHODNAME("dc<%>","draw-polygon"))
02241   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawPolygon(x0, x1, x2, x3, x4));
02242 
02243   
02244   
02245   READY_TO_RETURN;
02246   return scheme_void;
02247 }
02248 
02249 static Scheme_Object *os_wxDCDrawLines(int n,  Scheme_Object *p[])
02250 {
02251   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02252   REMEMBER_VAR_STACK();
02253   objscheme_check_valid(os_wxDC_class, "draw-lines in dc<%>", n, p);
02254   int x0;
02255   class wxPoint* x1 INIT_NULLED_OUT;
02256   double x2;
02257   double x3;
02258 
02259   SETUP_VAR_STACK_REMEMBERED(2);
02260   VAR_STACK_PUSH(0, p);
02261   VAR_STACK_PUSH(1, x1);
02262 
02263   
02264   x1 = NULL;
02265   if (n > (POFFSET+1)) {
02266     x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-lines in dc<%>"));
02267   } else
02268     x2 = 0;
02269   if (n > (POFFSET+2)) {
02270     x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw-lines in dc<%>"));
02271   } else
02272     x3 = 0;
02273 
02274   x1 = WITH_VAR_STACK(__MakewxPointArray((0+POFFSET < n) ? p[POFFSET+0] : scheme_null, &x0, METHODNAME("dc<%>","draw-lines")));DO_OK_CHECK(METHODNAME("dc<%>","draw-lines"))
02275   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawLines(x0, x1, x2, x3));
02276 
02277   
02278   
02279   READY_TO_RETURN;
02280   return scheme_void;
02281 }
02282 
02283 static Scheme_Object *os_wxDCDrawPath(int n,  Scheme_Object *p[])
02284 {
02285   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02286   REMEMBER_VAR_STACK();
02287   objscheme_check_valid(os_wxDC_class, "draw-path in dc<%>", n, p);
02288   class wxPath* x0 INIT_NULLED_OUT;
02289   double x1;
02290   double x2;
02291   int x3;
02292 
02293   SETUP_VAR_STACK_REMEMBERED(2);
02294   VAR_STACK_PUSH(0, p);
02295   VAR_STACK_PUSH(1, x0);
02296 
02297   
02298   x0 = WITH_VAR_STACK(objscheme_unbundle_wxPath(p[POFFSET+0], "draw-path in dc<%>", 0));
02299   if (n > (POFFSET+1)) {
02300     x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-path in dc<%>"));
02301   } else
02302     x1 = 0.0;
02303   if (n > (POFFSET+2)) {
02304     x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw-path in dc<%>"));
02305   } else
02306     x2 = 0.0;
02307   if (n > (POFFSET+3)) {
02308     x3 = WITH_VAR_STACK(unbundle_symset_fillKind(p[POFFSET+3], "draw-path in dc<%>"));
02309   } else
02310     x3 = wxODDEVEN_RULE;
02311 
02312   DO_OK_CHECK(METHODNAME("dc<%>","draw-path"))
02313   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawPath(x0, x1, x2, x3));
02314 
02315   
02316   
02317   READY_TO_RETURN;
02318   return scheme_void;
02319 }
02320 
02321 static Scheme_Object *os_wxDCDrawEllipse(int n,  Scheme_Object *p[])
02322 {
02323   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02324   REMEMBER_VAR_STACK();
02325   objscheme_check_valid(os_wxDC_class, "draw-ellipse in dc<%>", n, p);
02326   double x0;
02327   double x1;
02328   nndouble x2;
02329   nndouble x3;
02330 
02331   SETUP_VAR_STACK_REMEMBERED(1);
02332   VAR_STACK_PUSH(0, p);
02333 
02334   
02335   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "draw-ellipse in dc<%>"));
02336   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-ellipse in dc<%>"));
02337   x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "draw-ellipse in dc<%>"));
02338   x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "draw-ellipse in dc<%>"));
02339 
02340   if (x2 <= 0) { READY_TO_RETURN; return scheme_void; }if (x3 <= 0) { READY_TO_RETURN; return scheme_void; }DO_OK_CHECK(METHODNAME("dc<%>","draw-ellipse"))
02341   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawEllipse(x0, x1, x2, x3));
02342 
02343   
02344   
02345   READY_TO_RETURN;
02346   return scheme_void;
02347 }
02348 
02349 static Scheme_Object *os_wxDCDrawArc(int n,  Scheme_Object *p[])
02350 {
02351   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02352   REMEMBER_VAR_STACK();
02353   objscheme_check_valid(os_wxDC_class, "draw-arc in dc<%>", n, p);
02354   double x0;
02355   double x1;
02356   nndouble x2;
02357   nndouble x3;
02358   double x4;
02359   double x5;
02360 
02361   SETUP_VAR_STACK_REMEMBERED(1);
02362   VAR_STACK_PUSH(0, p);
02363 
02364   
02365   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "draw-arc in dc<%>"));
02366   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-arc in dc<%>"));
02367   x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "draw-arc in dc<%>"));
02368   x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "draw-arc in dc<%>"));
02369   x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "draw-arc in dc<%>"));
02370   x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "draw-arc in dc<%>"));
02371 
02372   DO_OK_CHECK(METHODNAME("dc<%>","draw-arc"))
02373   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawArc(x0, x1, x2, x3, x4, x5));
02374 
02375   
02376   
02377   READY_TO_RETURN;
02378   return scheme_void;
02379 }
02380 
02381 static Scheme_Object *os_wxDCDrawText(int n,  Scheme_Object *p[])
02382 {
02383   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02384   REMEMBER_VAR_STACK();
02385   objscheme_check_valid(os_wxDC_class, "draw-text in dc<%>", n, p);
02386   mzxstring x0 INIT_NULLED_OUT;
02387   double x1;
02388   double x2;
02389   Bool x3;
02390   Bool x4;
02391   nnint x5;
02392   double x6;
02393 
02394   SETUP_VAR_STACK_REMEMBERED(2);
02395   VAR_STACK_PUSH(0, p);
02396   VAR_STACK_PUSH(1, x0);
02397 
02398   
02399   x0 = (mzxstring)WITH_VAR_STACK(objscheme_unbundle_mzxstring(p[POFFSET+0], "draw-text in dc<%>"));
02400   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-text in dc<%>"));
02401   x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw-text in dc<%>"));
02402   if (n > (POFFSET+3)) {
02403     x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "draw-text in dc<%>"));
02404   } else
02405     x3 = FALSE;
02406   if (n > (POFFSET+4)) {
02407     x5 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_integer(p[POFFSET+4], "draw-text in dc<%>"));
02408   } else
02409     x5 = 0;
02410   if (n > (POFFSET+5)) {
02411     x6 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "draw-text in dc<%>"));
02412   } else
02413     x6 = 0.0;
02414 
02415   if (x5 > SCHEME_CHAR_STRLEN_VAL(p[POFFSET+0])) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-text"), "string index too large: ", p[POFFSET+5]));DO_OK_CHECK(METHODNAME("dc<%>","draw-text"))x4 = TRUE;
02416   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawText(x0, x1, x2, x3, x4, x5, x6));
02417 
02418   
02419   
02420   READY_TO_RETURN;
02421   return scheme_void;
02422 }
02423 
02424 static Scheme_Object *os_wxDCDrawSpline(int n,  Scheme_Object *p[])
02425 {
02426   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02427   REMEMBER_VAR_STACK();
02428   objscheme_check_valid(os_wxDC_class, "draw-spline in dc<%>", n, p);
02429   double x0;
02430   double x1;
02431   double x2;
02432   double x3;
02433   double x4;
02434   double x5;
02435 
02436   SETUP_VAR_STACK_REMEMBERED(1);
02437   VAR_STACK_PUSH(0, p);
02438 
02439   
02440   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "draw-spline in dc<%>"));
02441   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-spline in dc<%>"));
02442   x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw-spline in dc<%>"));
02443   x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "draw-spline in dc<%>"));
02444   x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "draw-spline in dc<%>"));
02445   x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "draw-spline in dc<%>"));
02446 
02447   DO_OK_CHECK(METHODNAME("dc<%>","draw-spline"))
02448   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawSpline(x0, x1, x2, x3, x4, x5));
02449 
02450   
02451   
02452   READY_TO_RETURN;
02453   return scheme_void;
02454 }
02455 
02456 static Scheme_Object *os_wxDCDrawRoundedRectangle(int n,  Scheme_Object *p[])
02457 {
02458   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02459   REMEMBER_VAR_STACK();
02460   objscheme_check_valid(os_wxDC_class, "draw-rounded-rectangle in dc<%>", n, p);
02461   double x0;
02462   double x1;
02463   nndouble x2;
02464   nndouble x3;
02465   double x4;
02466 
02467   SETUP_VAR_STACK_REMEMBERED(1);
02468   VAR_STACK_PUSH(0, p);
02469 
02470   
02471   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "draw-rounded-rectangle in dc<%>"));
02472   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-rounded-rectangle in dc<%>"));
02473   x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "draw-rounded-rectangle in dc<%>"));
02474   x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "draw-rounded-rectangle in dc<%>"));
02475   if (n > (POFFSET+4)) {
02476     x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+4], "draw-rounded-rectangle in dc<%>"));
02477   } else
02478     x4 = -0.25;
02479 
02480   if (x2 <= 0) { READY_TO_RETURN; return scheme_void; }if (x3 <= 0) { READY_TO_RETURN; return scheme_void; }{ if (x4 < -0.5)  WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-rounded-rectangle"), "radius must be no less than -0.5: ", p[POFFSET+4])); if (x4 > 0) { if (2 * x4 > x2) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-rounded-rectangle"), "radius is more than half the width: ", p[POFFSET+4])); if (2 * x4 > x3) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("dc<%>","draw-rounded-rectangle"), "radius is more than half the height: ", p[POFFSET+4])); } }DO_OK_CHECK(METHODNAME("dc<%>","draw-rounded-rectangle"))
02481   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawRoundedRectangle(x0, x1, x2, x3, x4));
02482 
02483   
02484   
02485   READY_TO_RETURN;
02486   return scheme_void;
02487 }
02488 
02489 static Scheme_Object *os_wxDCDrawRectangle(int n,  Scheme_Object *p[])
02490 {
02491   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02492   REMEMBER_VAR_STACK();
02493   objscheme_check_valid(os_wxDC_class, "draw-rectangle in dc<%>", n, p);
02494   double x0;
02495   double x1;
02496   nndouble x2;
02497   nndouble x3;
02498 
02499   SETUP_VAR_STACK_REMEMBERED(1);
02500   VAR_STACK_PUSH(0, p);
02501 
02502   
02503   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "draw-rectangle in dc<%>"));
02504   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-rectangle in dc<%>"));
02505   x2 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+2], "draw-rectangle in dc<%>"));
02506   x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "draw-rectangle in dc<%>"));
02507 
02508   if (x2 <= 0) { READY_TO_RETURN; return scheme_void; }if (x3 <= 0) { READY_TO_RETURN; return scheme_void; }DO_OK_CHECK(METHODNAME("dc<%>","draw-rectangle"))
02509   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawRectangle(x0, x1, x2, x3));
02510 
02511   
02512   
02513   READY_TO_RETURN;
02514   return scheme_void;
02515 }
02516 
02517 static Scheme_Object *os_wxDCDrawPoint(int n,  Scheme_Object *p[])
02518 {
02519   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02520   REMEMBER_VAR_STACK();
02521   objscheme_check_valid(os_wxDC_class, "draw-point in dc<%>", n, p);
02522   double x0;
02523   double x1;
02524 
02525   SETUP_VAR_STACK_REMEMBERED(1);
02526   VAR_STACK_PUSH(0, p);
02527 
02528   
02529   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "draw-point in dc<%>"));
02530   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-point in dc<%>"));
02531 
02532   DO_OK_CHECK(METHODNAME("dc<%>","draw-point"))
02533   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawPoint(x0, x1));
02534 
02535   
02536   
02537   READY_TO_RETURN;
02538   return scheme_void;
02539 }
02540 
02541 static Scheme_Object *os_wxDCDrawLine(int n,  Scheme_Object *p[])
02542 {
02543   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02544   REMEMBER_VAR_STACK();
02545   objscheme_check_valid(os_wxDC_class, "draw-line in dc<%>", n, p);
02546   double x0;
02547   double x1;
02548   double x2;
02549   double x3;
02550 
02551   SETUP_VAR_STACK_REMEMBERED(1);
02552   VAR_STACK_PUSH(0, p);
02553 
02554   
02555   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "draw-line in dc<%>"));
02556   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-line in dc<%>"));
02557   x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw-line in dc<%>"));
02558   x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+3], "draw-line in dc<%>"));
02559 
02560   DO_OK_CHECK(METHODNAME("dc<%>","draw-line"))
02561   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->DrawLine(x0, x1, x2, x3));
02562 
02563   
02564   
02565   READY_TO_RETURN;
02566   return scheme_void;
02567 }
02568 
02569 static Scheme_Object *os_wxDCClear(int n,  Scheme_Object *p[])
02570 {
02571   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02572   REMEMBER_VAR_STACK();
02573   objscheme_check_valid(os_wxDC_class, "clear in dc<%>", n, p);
02574 
02575   SETUP_VAR_STACK_REMEMBERED(1);
02576   VAR_STACK_PUSH(0, p);
02577 
02578   
02579 
02580   DO_OK_CHECK(METHODNAME("dc<%>","clear"))
02581   WITH_VAR_STACK(((wxDC *)((Scheme_Class_Object *)p[0])->primdata)->Clear());
02582 
02583   
02584   
02585   READY_TO_RETURN;
02586   return scheme_void;
02587 }
02588 
02589 void objscheme_setup_wxDC(Scheme_Env *env)
02590 {
02591   SETUP_VAR_STACK(1);
02592   VAR_STACK_PUSH(0, env);
02593 
02594   wxREGGLOB(os_wxDC_class);
02595   wxREGGLOB(os_wxDC_interface);
02596 
02597   os_wxDC_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "dc%", "object%", NULL, 52));
02598 
02599   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "cache-font-metrics-key" " method", (Scheme_Method_Prim *)os_wxDCCacheFontMetricsKey, 0, 0));
02600   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-alpha" " method", (Scheme_Method_Prim *)os_wxDCGetAlpha, 0, 0));
02601   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-alpha" " method", (Scheme_Method_Prim *)os_wxDCSetAlpha, 1, 1));
02602   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "glyph-exists?" " method", (Scheme_Method_Prim *)os_wxDCGlyphAvailable, 1, 2));
02603   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "end-page" " method", (Scheme_Method_Prim *)os_wxDCEndPage, 0, 0));
02604   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "end-doc" " method", (Scheme_Method_Prim *)os_wxDCEndDoc, 0, 0));
02605   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "start-page" " method", (Scheme_Method_Prim *)os_wxDCStartPage, 0, 0));
02606   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "start-doc" " method", (Scheme_Method_Prim *)os_wxDCStartDoc, 1, 1));
02607   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "ok?" " method", (Scheme_Method_Prim *)os_wxDCOk, 0, 0));
02608   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-gl-context" " method", (Scheme_Method_Prim *)os_wxDC_GetGL, 0, 0));
02609   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-size" " method", (Scheme_Method_Prim *)os_wxDCMyGetSize, 0, 0));
02610   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-text-foreground" " method", (Scheme_Method_Prim *)os_wxDCdcGetTextForeground, 0, 0));
02611   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-text-background" " method", (Scheme_Method_Prim *)os_wxDCdcGetTextBackground, 0, 0));
02612   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-pen" " method", (Scheme_Method_Prim *)os_wxDCGetPen, 0, 0));
02613   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-font" " method", (Scheme_Method_Prim *)os_wxDCGetFont, 0, 0));
02614   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-brush" " method", (Scheme_Method_Prim *)os_wxDCGetBrush, 0, 0));
02615   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-text-mode" " method", (Scheme_Method_Prim *)os_wxDCGetBackgroundMode, 0, 0));
02616   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-background" " method", (Scheme_Method_Prim *)os_wxDCGetBackground, 0, 0));
02617   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-origin" " method", (Scheme_Method_Prim *)os_wxDCMyGetOrigin, 0, 0));
02618   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-scale" " method", (Scheme_Method_Prim *)os_wxDCMyGetScale, 0, 0));
02619   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-origin" " method", (Scheme_Method_Prim *)os_wxDCSetDeviceOrigin, 2, 2));
02620   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-scale" " method", (Scheme_Method_Prim *)os_wxDCSetUserScale, 2, 2));
02621   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-text-mode" " method", (Scheme_Method_Prim *)os_wxDCSetBackgroundMode, 1, 1));
02622   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "try-color" " method", (Scheme_Method_Prim *)os_wxDCTryColour, 2, 2));
02623   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-bitmap" " method", (Scheme_Method_Prim *)os_wxDCDrawBitmap, 3, 6));
02624   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-bitmap-section" " method", (Scheme_Method_Prim *)os_wxDCDrawBitmapRegion, 7, 10));
02625   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-char-width" " method", (Scheme_Method_Prim *)os_wxDCGetCharWidth, 0, 0));
02626   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-char-height" " method", (Scheme_Method_Prim *)os_wxDCGetCharHeight, 0, 0));
02627   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-text-extent" " method", (Scheme_Method_Prim *)os_wxDCMyTextExtent, 1, 4));
02628   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-smoothing" " method", (Scheme_Method_Prim *)os_wxDCGetAntiAlias, 0, 0));
02629   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-smoothing" " method", (Scheme_Method_Prim *)os_wxDCSetAntiAlias, 1, 1));
02630   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-text-foreground" " method", (Scheme_Method_Prim *)os_wxDCSetTextForeground, 1, 1));
02631   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-text-background" " method", (Scheme_Method_Prim *)os_wxDCSetTextBackground, 1, 1));
02632   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-brush" " method", (Scheme_Method_Prim *)os_wxDCSetBrush, 1, 2));
02633   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-pen" " method", (Scheme_Method_Prim *)os_wxDCSetPen, 1, 3));
02634   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-font" " method", (Scheme_Method_Prim *)os_wxDCSetFont, 1, 1));
02635   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-background" " method", (Scheme_Method_Prim *)os_wxDCSetBackground, 1, 1));
02636   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "get-clipping-region" " method", (Scheme_Method_Prim *)os_wxDCGetClippingRegion, 0, 0));
02637   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-clipping-region" " method", (Scheme_Method_Prim *)os_wxDCSetClippingRegion, 1, 1));
02638   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "set-clipping-rect" " method", (Scheme_Method_Prim *)os_wxDCSetClippingRect, 4, 4));
02639   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-polygon" " method", (Scheme_Method_Prim *)os_wxDCDrawPolygon, 1, 4));
02640   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-lines" " method", (Scheme_Method_Prim *)os_wxDCDrawLines, 1, 3));
02641   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-path" " method", (Scheme_Method_Prim *)os_wxDCDrawPath, 1, 4));
02642   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-ellipse" " method", (Scheme_Method_Prim *)os_wxDCDrawEllipse, 4, 4));
02643   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-arc" " method", (Scheme_Method_Prim *)os_wxDCDrawArc, 6, 6));
02644   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-text" " method", (Scheme_Method_Prim *)os_wxDCDrawText, 3, 6));
02645   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-spline" " method", (Scheme_Method_Prim *)os_wxDCDrawSpline, 6, 6));
02646   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-rounded-rectangle" " method", (Scheme_Method_Prim *)os_wxDCDrawRoundedRectangle, 4, 5));
02647   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-rectangle" " method", (Scheme_Method_Prim *)os_wxDCDrawRectangle, 4, 4));
02648   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-point" " method", (Scheme_Method_Prim *)os_wxDCDrawPoint, 2, 2));
02649   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "draw-line" " method", (Scheme_Method_Prim *)os_wxDCDrawLine, 4, 4));
02650   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxDC_class, "clear" " method", (Scheme_Method_Prim *)os_wxDCClear, 0, 0));
02651 
02652 
02653   WITH_VAR_STACK(scheme_made_class(os_wxDC_class));
02654 
02655   os_wxDC_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxDC_class, "dc" "<%>"));
02656 
02657   WITH_VAR_STACK(objscheme_add_global_interface(os_wxDC_interface, "dc" "<%>", env));
02658   WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxDC, wxTYPE_DC));
02659 
02660   READY_TO_RETURN;
02661 }
02662 
02663 int objscheme_istype_wxDC(Scheme_Object *obj, const char *stop, int nullOK)
02664 {
02665   REMEMBER_VAR_STACK();
02666   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
02667   if (objscheme_is_a(obj,  os_wxDC_class))
02668     return 1;
02669   else {
02670     if (!stop)
02671        return 0;
02672     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "dc% object or " XC_NULL_STR: "dc% object", -1, 0, &obj));
02673     return 0;
02674   }
02675 }
02676 
02677 Scheme_Object *objscheme_bundle_wxDC(class wxDC *realobj)
02678 {
02679   Scheme_Class_Object *obj INIT_NULLED_OUT;
02680   Scheme_Object *sobj INIT_NULLED_OUT;
02681 
02682   if (!realobj) return XC_SCHEME_NULL;
02683 
02684   if (realobj->__gc_external)
02685     return (Scheme_Object *)realobj->__gc_external;
02686 
02687   SETUP_VAR_STACK(2);
02688   VAR_STACK_PUSH(0, obj);
02689   VAR_STACK_PUSH(1, realobj);
02690 
02691   if ((realobj->__type != wxTYPE_DC) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
02692     { READY_TO_RETURN; return sobj; }
02693   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxDC_class));
02694 
02695   obj->primdata = realobj;
02696   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
02697   obj->primflag = 0;
02698 
02699   realobj->__gc_external = (void *)obj;
02700   READY_TO_RETURN;
02701   return (Scheme_Object *)obj;
02702 }
02703 
02704 class wxDC *objscheme_unbundle_wxDC(Scheme_Object *obj, const char *where, int nullOK)
02705 {
02706   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
02707 
02708   REMEMBER_VAR_STACK();
02709 
02710   (void)objscheme_istype_wxDC(obj, where, nullOK);
02711   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
02712   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
02713   if (o->primflag)
02714     return (os_wxDC *)o->primdata;
02715   else
02716     return (wxDC *)o->primdata;
02717 }
02718 
02719 
02720 
02721 
02722 static Scheme_Object *wxDCGlobalwxDrawTab(int n,  Scheme_Object *p[])
02723 {
02724   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02725   REMEMBER_VAR_STACK();
02726   class wxDC* x0 INIT_NULLED_OUT;
02727   string x1 INIT_NULLED_OUT;
02728   double x2;
02729   double x3;
02730   double x4;
02731   double x5;
02732   int x6;
02733 
02734   SETUP_VAR_STACK_REMEMBERED(3);
02735   VAR_STACK_PUSH(0, p);
02736   VAR_STACK_PUSH(1, x0);
02737   VAR_STACK_PUSH(2, x1);
02738 
02739   
02740   x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[0+0], "draw-tab in dc%", 0));
02741   x1 = (string)WITH_VAR_STACK(objscheme_unbundle_string(p[0+1], "draw-tab in dc%"));
02742   x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[0+2], "draw-tab in dc%"));
02743   x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[0+3], "draw-tab in dc%"));
02744   x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[0+4], "draw-tab in dc%"));
02745   x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[0+5], "draw-tab in dc%"));
02746   x6 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0+6], "draw-tab in dc%"));
02747 
02748   
02749   WITH_VAR_STACK(wxDrawTab(x0, x1, x2, x3, x4, x5, x6));
02750 
02751   
02752   
02753   READY_TO_RETURN;
02754   return scheme_void;
02755 }
02756 
02757 static Scheme_Object *wxDCGlobalwxDrawTabBase(int n,  Scheme_Object *p[])
02758 {
02759   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02760   REMEMBER_VAR_STACK();
02761   class wxDC* x0 INIT_NULLED_OUT;
02762   double x1;
02763   double x2;
02764   double x3;
02765   double x4;
02766   int x5;
02767 
02768   SETUP_VAR_STACK_REMEMBERED(2);
02769   VAR_STACK_PUSH(0, p);
02770   VAR_STACK_PUSH(1, x0);
02771 
02772   
02773   x0 = WITH_VAR_STACK(objscheme_unbundle_wxDC(p[0+0], "draw-tab-base in dc%", 0));
02774   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[0+1], "draw-tab-base in dc%"));
02775   x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[0+2], "draw-tab-base in dc%"));
02776   x3 = WITH_VAR_STACK(objscheme_unbundle_double(p[0+3], "draw-tab-base in dc%"));
02777   x4 = WITH_VAR_STACK(objscheme_unbundle_double(p[0+4], "draw-tab-base in dc%"));
02778   x5 = WITH_VAR_STACK(objscheme_unbundle_integer(p[0+5], "draw-tab-base in dc%"));
02779 
02780   
02781   WITH_VAR_STACK(wxDrawTabBase(x0, x1, x2, x3, x4, x5));
02782 
02783   
02784   
02785   READY_TO_RETURN;
02786   return scheme_void;
02787 }
02788 
02789 void objscheme_setup_wxDCGlobal(Scheme_Env *env)
02790 {
02791   Scheme_Object *functmp INIT_NULLED_OUT;
02792   SETUP_VAR_STACK(1);
02793   VAR_STACK_PUSH(0, env);
02794   functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxDCGlobalwxDrawTab, "draw-tab", 7, 7));
02795   WITH_VAR_STACK(scheme_install_xc_global("draw-tab", functmp, env));
02796   functmp = WITH_VAR_STACK(scheme_make_prim_w_arity((Scheme_Prim *)wxDCGlobalwxDrawTabBase, "draw-tab-base", 6, 6));
02797   WITH_VAR_STACK(scheme_install_xc_global("draw-tab-base", functmp, env));
02798   READY_TO_RETURN;
02799 }
02800 
02801 
02802 
02803 
02804 
02805 
02806 
02807 
02808 
02809 
02810 class os_wxMemoryDC : public wxMemoryDC {
02811  public:
02812 
02813   os_wxMemoryDC CONSTRUCTOR_ARGS(());
02814   ~os_wxMemoryDC();
02815 #ifdef MZ_PRECISE_GC
02816   void gcMark();
02817   void gcFixup();
02818 #endif
02819 };
02820 
02821 #ifdef MZ_PRECISE_GC
02822 void os_wxMemoryDC::gcMark() {
02823   wxMemoryDC::gcMark();
02824 }
02825 void os_wxMemoryDC::gcFixup() {
02826   wxMemoryDC::gcFixup();
02827 }
02828 #endif
02829 
02830 static Scheme_Object *os_wxMemoryDC_class;
02831 
02832 os_wxMemoryDC::os_wxMemoryDC CONSTRUCTOR_ARGS(())
02833 CONSTRUCTOR_INIT(: wxMemoryDC())
02834 {
02835 }
02836 
02837 os_wxMemoryDC::~os_wxMemoryDC()
02838 {
02839     objscheme_destroy(this, (Scheme_Object *) __gc_external);
02840 }
02841 
02842 static Scheme_Object *os_wxMemoryDCGetObject(int n,  Scheme_Object *p[])
02843 {
02844   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02845   REMEMBER_VAR_STACK();
02846   class wxBitmap* r;
02847   objscheme_check_valid(os_wxMemoryDC_class, "get-bitmap in bitmap-dc%", n, p);
02848 
02849   SETUP_VAR_STACK_REMEMBERED(1);
02850   VAR_STACK_PUSH(0, p);
02851 
02852   
02853 
02854   
02855   r = WITH_VAR_STACK(((wxMemoryDC *)((Scheme_Class_Object *)p[0])->primdata)->GetObject());
02856 
02857   
02858   
02859   READY_TO_RETURN;
02860   return WITH_REMEMBERED_STACK(objscheme_bundle_wxBitmap(r));
02861 }
02862 
02863 static Scheme_Object *os_wxMemoryDCSelectObject(int n,  Scheme_Object *p[])
02864 {
02865   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02866   REMEMBER_VAR_STACK();
02867   objscheme_check_valid(os_wxMemoryDC_class, "set-bitmap in bitmap-dc%", n, p);
02868   class wxBitmap* x0 INIT_NULLED_OUT;
02869 
02870   SETUP_VAR_STACK_REMEMBERED(2);
02871   VAR_STACK_PUSH(0, p);
02872   VAR_STACK_PUSH(1, x0);
02873 
02874   
02875   x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+0], "set-bitmap in bitmap-dc%", 1));
02876 
02877   if (x0) { if (!x0->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","set-bitmap"), "bad bitmap: ", p[POFFSET+0])); if (BM_SELECTED(x0)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","set-bitmap"), "bitmap is already installed into a bitmap-dc%: ", p[POFFSET+0])); if (BM_IN_USE(x0)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","set-bitmap"), "bitmap is currently installed as a control label or pen/brush stipple: ", p[POFFSET+0])); }
02878   WITH_VAR_STACK(((wxMemoryDC *)((Scheme_Class_Object *)p[0])->primdata)->SelectObject(x0));
02879 
02880   
02881   
02882   READY_TO_RETURN;
02883   return scheme_void;
02884 }
02885 
02886 static Scheme_Object *os_wxMemoryDCScaleSection(int n,  Scheme_Object *p[])
02887 {
02888   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02889   REMEMBER_VAR_STACK();
02890   objscheme_check_valid(os_wxMemoryDC_class, "draw-bitmap-section-smooth in bitmap-dc%", n, p);
02891   class wxBitmap* x0 INIT_NULLED_OUT;
02892   double x1;
02893   double x2;
02894   nndouble x3;
02895   nndouble x4;
02896   double x5;
02897   double x6;
02898   nndouble x7;
02899   nndouble x8;
02900   class wxBitmap* x9 INIT_NULLED_OUT;
02901 
02902   SETUP_VAR_STACK_REMEMBERED(3);
02903   VAR_STACK_PUSH(0, p);
02904   VAR_STACK_PUSH(1, x0);
02905   VAR_STACK_PUSH(2, x9);
02906 
02907   
02908   x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+0], "draw-bitmap-section-smooth in bitmap-dc%", 0));
02909   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "draw-bitmap-section-smooth in bitmap-dc%"));
02910   x2 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+2], "draw-bitmap-section-smooth in bitmap-dc%"));
02911   x3 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+3], "draw-bitmap-section-smooth in bitmap-dc%"));
02912   x4 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+4], "draw-bitmap-section-smooth in bitmap-dc%"));
02913   x5 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+5], "draw-bitmap-section-smooth in bitmap-dc%"));
02914   x6 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+6], "draw-bitmap-section-smooth in bitmap-dc%"));
02915   x7 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+7], "draw-bitmap-section-smooth in bitmap-dc%"));
02916   x8 = WITH_VAR_STACK(objscheme_unbundle_nonnegative_double(p[POFFSET+8], "draw-bitmap-section-smooth in bitmap-dc%"));
02917   if (n > (POFFSET+9)) {
02918     x9 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+9], "draw-bitmap-section-smooth in bitmap-dc%", 1));
02919   } else
02920     x9 = NULL;
02921 
02922   
02923   WITH_VAR_STACK(ScaleSection(((wxMemoryDC *)((Scheme_Class_Object *)p[0])->primdata), x0, x1, x2, x3, x4, x5, x6, x7, x8, x9));
02924 
02925   
02926   
02927   READY_TO_RETURN;
02928   return scheme_void;
02929 }
02930 
02931 static Scheme_Object *os_wxMemoryDCdcSetARGBPixels(int n,  Scheme_Object *p[])
02932 {
02933   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02934   REMEMBER_VAR_STACK();
02935   objscheme_check_valid(os_wxMemoryDC_class, "set-argb-pixels in bitmap-dc%", n, p);
02936   double x0;
02937   double x1;
02938   int x2;
02939   int x3;
02940   bstring x4 INIT_NULLED_OUT;
02941   Bool x5;
02942 
02943   SETUP_VAR_STACK_REMEMBERED(2);
02944   VAR_STACK_PUSH(0, p);
02945   VAR_STACK_PUSH(1, x4);
02946 
02947   
02948   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "set-argb-pixels in bitmap-dc%"));
02949   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "set-argb-pixels in bitmap-dc%"));
02950   x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+2], 0, 10000, "set-argb-pixels in bitmap-dc%"));
02951   x3 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+3], 0, 10000, "set-argb-pixels in bitmap-dc%"));
02952   x4 = (bstring)WITH_VAR_STACK(objscheme_unbundle_bstring(p[POFFSET+4], "set-argb-pixels in bitmap-dc%"));
02953   if (n > (POFFSET+5)) {
02954     x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "set-argb-pixels in bitmap-dc%"));
02955   } else
02956     x5 = FALSE;
02957 
02958   DO_OK_CHECK(METHODNAME("bitmap-dc%","set-argb-pixels"))if (SCHEME_BYTE_STRTAG_VAL(p[4+POFFSET]) < (x2 * x3 * 4)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","set-argb-pixels"), "byte string too short: ", p[4+POFFSET]));
02959   WITH_VAR_STACK(dcSetARGBPixels(((wxMemoryDC *)((Scheme_Class_Object *)p[0])->primdata), x0, x1, x2, x3, x4, x5));
02960 
02961   
02962   
02963   READY_TO_RETURN;
02964   return scheme_void;
02965 }
02966 
02967 static Scheme_Object *os_wxMemoryDCdcGetARGBPixels(int n,  Scheme_Object *p[])
02968 {
02969   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
02970   REMEMBER_VAR_STACK();
02971   objscheme_check_valid(os_wxMemoryDC_class, "get-argb-pixels in bitmap-dc%", n, p);
02972   double x0;
02973   double x1;
02974   int x2;
02975   int x3;
02976   wbstring x4 INIT_NULLED_OUT;
02977   Bool x5;
02978 
02979   SETUP_VAR_STACK_REMEMBERED(2);
02980   VAR_STACK_PUSH(0, p);
02981   VAR_STACK_PUSH(1, x4);
02982 
02983   
02984   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "get-argb-pixels in bitmap-dc%"));
02985   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "get-argb-pixels in bitmap-dc%"));
02986   x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+2], 0, 10000, "get-argb-pixels in bitmap-dc%"));
02987   x3 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+3], 0, 10000, "get-argb-pixels in bitmap-dc%"));
02988   x4 = (wbstring)WITH_VAR_STACK(objscheme_unbundle_mutable_bstring(p[POFFSET+4], "get-argb-pixels in bitmap-dc%"));
02989   if (n > (POFFSET+5)) {
02990     x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "get-argb-pixels in bitmap-dc%"));
02991   } else
02992     x5 = FALSE;
02993 
02994   DO_OK_CHECK(METHODNAME("bitmap-dc%","get-argb-pixels"))if (SCHEME_BYTE_STRTAG_VAL(p[4+POFFSET]) < (x2 * x3 * 4)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap-dc%","get-argb-pixels"), "byte string too short: ", p[4+POFFSET]));
02995   WITH_VAR_STACK(dcGetARGBPixels(((wxMemoryDC *)((Scheme_Class_Object *)p[0])->primdata), x0, x1, x2, x3, x4, x5));
02996 
02997   
02998   
02999   READY_TO_RETURN;
03000   return scheme_void;
03001 }
03002 
03003 static Scheme_Object *os_wxMemoryDCSetPixel(int n,  Scheme_Object *p[])
03004 {
03005   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
03006   REMEMBER_VAR_STACK();
03007   objscheme_check_valid(os_wxMemoryDC_class, "set-pixel in bitmap-dc%", n, p);
03008   double x0;
03009   double x1;
03010   class wxColour* x2 INIT_NULLED_OUT;
03011 
03012   SETUP_VAR_STACK_REMEMBERED(2);
03013   VAR_STACK_PUSH(0, p);
03014   VAR_STACK_PUSH(1, x2);
03015 
03016   
03017   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "set-pixel in bitmap-dc%"));
03018   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "set-pixel in bitmap-dc%"));
03019   x2 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+2], "set-pixel in bitmap-dc%", 0));
03020 
03021   DO_OK_CHECK(METHODNAME("bitmap-dc%","set-pixel"))
03022   WITH_VAR_STACK(((wxMemoryDC *)((Scheme_Class_Object *)p[0])->primdata)->SetPixel(x0, x1, x2));
03023 
03024   
03025   
03026   READY_TO_RETURN;
03027   return scheme_void;
03028 }
03029 
03030 static Scheme_Object *os_wxMemoryDCGetPixel(int n,  Scheme_Object *p[])
03031 {
03032   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
03033   REMEMBER_VAR_STACK();
03034   Bool r;
03035   objscheme_check_valid(os_wxMemoryDC_class, "get-pixel in bitmap-dc%", n, p);
03036   double x0;
03037   double x1;
03038   class wxColour* x2 INIT_NULLED_OUT;
03039 
03040   SETUP_VAR_STACK_REMEMBERED(2);
03041   VAR_STACK_PUSH(0, p);
03042   VAR_STACK_PUSH(1, x2);
03043 
03044   
03045   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "get-pixel in bitmap-dc%"));
03046   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "get-pixel in bitmap-dc%"));
03047   x2 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+2], "get-pixel in bitmap-dc%", 0));
03048 
03049   DO_OK_CHECK(METHODNAME("bitmap-dc%","get-pixel"))
03050   r = WITH_VAR_STACK(((wxMemoryDC *)((Scheme_Class_Object *)p[0])->primdata)->GetPixel(x0, x1, x2));
03051 
03052   
03053   
03054   READY_TO_RETURN;
03055   return (r ? scheme_true : scheme_false);
03056 }
03057 
03058 static Scheme_Object *os_wxMemoryDC_ConstructScheme(int n,  Scheme_Object *p[])
03059 {
03060   SETUP_PRE_VAR_STACK(1);
03061   PRE_VAR_STACK_PUSH(0, p);
03062   os_wxMemoryDC *realobj INIT_NULLED_OUT;
03063   REMEMBER_VAR_STACK();
03064 
03065   SETUP_VAR_STACK_PRE_REMEMBERED(2);
03066   VAR_STACK_PUSH(0, p);
03067   VAR_STACK_PUSH(1, realobj);
03068 
03069   
03070   if (n != (POFFSET+0)) 
03071     WITH_VAR_STACK(scheme_wrong_count_m("initialization in bitmap-dc%", POFFSET+0, POFFSET+0, n, p, 1));
03072 
03073   
03074   realobj = WITH_VAR_STACK(new os_wxMemoryDC CONSTRUCTOR_ARGS(()));
03075 #ifdef MZ_PRECISE_GC
03076   WITH_VAR_STACK(realobj->gcInit_wxMemoryDC());
03077 #endif
03078   realobj->__gc_external = (void *)p[0];
03079   
03080   
03081   READY_TO_RETURN;
03082   ((Scheme_Class_Object *)p[0])->primdata = realobj;
03083   ((Scheme_Class_Object *)p[0])->primflag = 1;
03084   WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
03085   return scheme_void;
03086 }
03087 
03088 void objscheme_setup_wxMemoryDC(Scheme_Env *env)
03089 {
03090   SETUP_VAR_STACK(1);
03091   VAR_STACK_PUSH(0, env);
03092 
03093   wxREGGLOB(os_wxMemoryDC_class);
03094 
03095   os_wxMemoryDC_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "bitmap-dc%", "dc%", (Scheme_Method_Prim *)os_wxMemoryDC_ConstructScheme, 7));
03096 
03097   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMemoryDC_class, "get-bitmap" " method", (Scheme_Method_Prim *)os_wxMemoryDCGetObject, 0, 0));
03098   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMemoryDC_class, "set-bitmap" " method", (Scheme_Method_Prim *)os_wxMemoryDCSelectObject, 1, 1));
03099   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMemoryDC_class, "draw-bitmap-section-smooth" " method", (Scheme_Method_Prim *)os_wxMemoryDCScaleSection, 9, 10));
03100   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMemoryDC_class, "set-argb-pixels" " method", (Scheme_Method_Prim *)os_wxMemoryDCdcSetARGBPixels, 5, 6));
03101   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMemoryDC_class, "get-argb-pixels" " method", (Scheme_Method_Prim *)os_wxMemoryDCdcGetARGBPixels, 5, 6));
03102   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMemoryDC_class, "set-pixel" " method", (Scheme_Method_Prim *)os_wxMemoryDCSetPixel, 3, 3));
03103   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxMemoryDC_class, "get-pixel" " method", (Scheme_Method_Prim *)os_wxMemoryDCGetPixel, 3, 3));
03104 
03105 
03106   WITH_VAR_STACK(scheme_made_class(os_wxMemoryDC_class));
03107 
03108   WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxMemoryDC, wxTYPE_DC_MEMORY));
03109 
03110   READY_TO_RETURN;
03111 }
03112 
03113 int objscheme_istype_wxMemoryDC(Scheme_Object *obj, const char *stop, int nullOK)
03114 {
03115   REMEMBER_VAR_STACK();
03116   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
03117   if (objscheme_is_a(obj,  os_wxMemoryDC_class))
03118     return 1;
03119   else {
03120     if (!stop)
03121        return 0;
03122     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "bitmap-dc% object or " XC_NULL_STR: "bitmap-dc% object", -1, 0, &obj));
03123     return 0;
03124   }
03125 }
03126 
03127 Scheme_Object *objscheme_bundle_wxMemoryDC(class wxMemoryDC *realobj)
03128 {
03129   Scheme_Class_Object *obj INIT_NULLED_OUT;
03130   Scheme_Object *sobj INIT_NULLED_OUT;
03131 
03132   if (!realobj) return XC_SCHEME_NULL;
03133 
03134   if (realobj->__gc_external)
03135     return (Scheme_Object *)realobj->__gc_external;
03136 
03137   SETUP_VAR_STACK(2);
03138   VAR_STACK_PUSH(0, obj);
03139   VAR_STACK_PUSH(1, realobj);
03140 
03141   if ((realobj->__type != wxTYPE_DC_MEMORY) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
03142     { READY_TO_RETURN; return sobj; }
03143   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxMemoryDC_class));
03144 
03145   obj->primdata = realobj;
03146   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
03147   obj->primflag = 0;
03148 
03149   realobj->__gc_external = (void *)obj;
03150   READY_TO_RETURN;
03151   return (Scheme_Object *)obj;
03152 }
03153 
03154 class wxMemoryDC *objscheme_unbundle_wxMemoryDC(Scheme_Object *obj, const char *where, int nullOK)
03155 {
03156   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
03157 
03158   REMEMBER_VAR_STACK();
03159 
03160   (void)objscheme_istype_wxMemoryDC(obj, where, nullOK);
03161   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
03162   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
03163   if (o->primflag)
03164     return (os_wxMemoryDC *)o->primdata;
03165   else
03166     return (wxMemoryDC *)o->primdata;
03167 }
03168 
03169 
03170 
03171 
03172 
03173 
03174 
03175 class os_wxPostScriptDC : public wxPostScriptDC {
03176  public:
03177 
03178   os_wxPostScriptDC CONSTRUCTOR_ARGS((Bool x0 = TRUE, class wxWindow* x1 = NULL, Bool x2 = FALSE, Bool x3 = TRUE));
03179   ~os_wxPostScriptDC();
03180 #ifdef MZ_PRECISE_GC
03181   void gcMark();
03182   void gcFixup();
03183 #endif
03184 };
03185 
03186 #ifdef MZ_PRECISE_GC
03187 void os_wxPostScriptDC::gcMark() {
03188   wxPostScriptDC::gcMark();
03189 }
03190 void os_wxPostScriptDC::gcFixup() {
03191   wxPostScriptDC::gcFixup();
03192 }
03193 #endif
03194 
03195 static Scheme_Object *os_wxPostScriptDC_class;
03196 
03197 os_wxPostScriptDC::os_wxPostScriptDC CONSTRUCTOR_ARGS((Bool x0, class wxWindow* x1, Bool x2, Bool x3))
03198 CONSTRUCTOR_INIT(: wxPostScriptDC(x0, x1, x2, x3))
03199 {
03200 }
03201 
03202 os_wxPostScriptDC::~os_wxPostScriptDC()
03203 {
03204     objscheme_destroy(this, (Scheme_Object *) __gc_external);
03205 }
03206 
03207 static Scheme_Object *os_wxPostScriptDC_ConstructScheme(int n,  Scheme_Object *p[])
03208 {
03209   SETUP_PRE_VAR_STACK(1);
03210   PRE_VAR_STACK_PUSH(0, p);
03211   os_wxPostScriptDC *realobj INIT_NULLED_OUT;
03212   REMEMBER_VAR_STACK();
03213   Bool x0;
03214   class wxWindow* x1 INIT_NULLED_OUT;
03215   Bool x2;
03216   Bool x3;
03217 
03218   SETUP_VAR_STACK_PRE_REMEMBERED(3);
03219   VAR_STACK_PUSH(0, p);
03220   VAR_STACK_PUSH(1, realobj);
03221   VAR_STACK_PUSH(2, x1);
03222 
03223   
03224   if ((n > (POFFSET+4))) 
03225     WITH_VAR_STACK(scheme_wrong_count_m("initialization in post-script-dc%", POFFSET+POFFSET, POFFSET+4, n, p, 1));
03226   if (n > (POFFSET+0)) {
03227     x0 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+0], "initialization in post-script-dc%"));
03228   } else
03229     x0 = TRUE;
03230   if (n > (POFFSET+1)) {
03231     x1 = WITH_VAR_STACK(objscheme_unbundle_wxWindow(p[POFFSET+1], "initialization in post-script-dc%", 1));
03232   } else
03233     x1 = NULL;
03234   if (n > (POFFSET+2)) {
03235     x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "initialization in post-script-dc%"));
03236   } else
03237     x2 = FALSE;
03238   if (n > (POFFSET+3)) {
03239     x3 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+3], "initialization in post-script-dc%"));
03240   } else
03241     x3 = TRUE;
03242 
03243   if (x1 && !wxSubType(((wxObject *)x1)->__type, wxTYPE_FRAME) && !wxSubType(((wxObject *)x1)->__type, wxTYPE_DIALOG_BOX)) scheme_wrong_type(METHODNAME("post-script-dc%","initialization"), "frame or dialog box", POFFSET+1, n, p);
03244   realobj = WITH_VAR_STACK(new os_wxPostScriptDC CONSTRUCTOR_ARGS((x0, x1, x2, x3)));
03245 #ifdef MZ_PRECISE_GC
03246   WITH_VAR_STACK(realobj->gcInit_wxPostScriptDC(x0, x1, x2, x3));
03247 #endif
03248   realobj->__gc_external = (void *)p[0];
03249   
03250   
03251   READY_TO_RETURN;
03252   ((Scheme_Class_Object *)p[0])->primdata = realobj;
03253   ((Scheme_Class_Object *)p[0])->primflag = 1;
03254   WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
03255   return scheme_void;
03256 }
03257 
03258 void objscheme_setup_wxPostScriptDC(Scheme_Env *env)
03259 {
03260   SETUP_VAR_STACK(1);
03261   VAR_STACK_PUSH(0, env);
03262 
03263   wxREGGLOB(os_wxPostScriptDC_class);
03264 
03265   os_wxPostScriptDC_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "post-script-dc%", "dc%", (Scheme_Method_Prim *)os_wxPostScriptDC_ConstructScheme, 0));
03266 
03267 
03268 
03269   WITH_VAR_STACK(scheme_made_class(os_wxPostScriptDC_class));
03270 
03271   WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_wxPostScriptDC, wxTYPE_DC_POSTSCRIPT));
03272 
03273   READY_TO_RETURN;
03274 }
03275 
03276 int objscheme_istype_wxPostScriptDC(Scheme_Object *obj, const char *stop, int nullOK)
03277 {
03278   REMEMBER_VAR_STACK();
03279   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
03280   if (objscheme_is_a(obj,  os_wxPostScriptDC_class))
03281     return 1;
03282   else {
03283     if (!stop)
03284        return 0;
03285     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "post-script-dc% object or " XC_NULL_STR: "post-script-dc% object", -1, 0, &obj));
03286     return 0;
03287   }
03288 }
03289 
03290 Scheme_Object *objscheme_bundle_wxPostScriptDC(class wxPostScriptDC *realobj)
03291 {
03292   Scheme_Class_Object *obj INIT_NULLED_OUT;
03293   Scheme_Object *sobj INIT_NULLED_OUT;
03294 
03295   if (!realobj) return XC_SCHEME_NULL;
03296 
03297   if (realobj->__gc_external)
03298     return (Scheme_Object *)realobj->__gc_external;
03299 
03300   SETUP_VAR_STACK(2);
03301   VAR_STACK_PUSH(0, obj);
03302   VAR_STACK_PUSH(1, realobj);
03303 
03304   if ((realobj->__type != wxTYPE_DC_POSTSCRIPT) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
03305     { READY_TO_RETURN; return sobj; }
03306   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxPostScriptDC_class));
03307 
03308   obj->primdata = realobj;
03309   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
03310   obj->primflag = 0;
03311 
03312   realobj->__gc_external = (void *)obj;
03313   READY_TO_RETURN;
03314   return (Scheme_Object *)obj;
03315 }
03316 
03317 class wxPostScriptDC *objscheme_unbundle_wxPostScriptDC(Scheme_Object *obj, const char *where, int nullOK)
03318 {
03319   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
03320 
03321   REMEMBER_VAR_STACK();
03322 
03323   (void)objscheme_istype_wxPostScriptDC(obj, where, nullOK);
03324   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
03325   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
03326   if (o->primflag)
03327     return (os_wxPostScriptDC *)o->primdata;
03328   else
03329     return (wxPostScriptDC *)o->primdata;
03330 }
03331 
03332 
03333 #ifdef MZ_PRECISE_GC
03334 END_XFORM_SKIP;
03335 #endif
03336 
03337 #ifdef wx_x
03338 
03339 class basePrinterDC : public wxObject
03340 {
03341 public:
03342   basePrinterDC(wxWindow *w);
03343 };
03344 
03345 basePrinterDC::basePrinterDC(wxWindow *)
03346 {
03347   scheme_raise_exn(MZEXN_FAIL_UNSUPPORTED,
03348                  "%s", 
03349                  METHODNAME("printer-dc%","initialization")": not supported for X Windows");
03350 }
03351 
03352 #else
03353 
03354 class basePrinterDC : public wxPrinterDC
03355 {
03356 public:
03357   basePrinterDC(wxWindow *w);
03358 };
03359 
03360 basePrinterDC::basePrinterDC(wxWindow *w) 
03361 : wxPrinterDC( )
03362 {
03363 }
03364 
03365 #endif
03366 
03367 #ifdef MZ_PRECISE_GC
03368 START_XFORM_SKIP;
03369 #endif
03370 
03371 
03372 
03373 
03374 class os_basePrinterDC : public basePrinterDC {
03375  public:
03376 
03377   os_basePrinterDC CONSTRUCTOR_ARGS((class wxWindow* x0 = NULL));
03378   ~os_basePrinterDC();
03379 #ifdef MZ_PRECISE_GC
03380   void gcMark();
03381   void gcFixup();
03382 #endif
03383 };
03384 
03385 #ifdef MZ_PRECISE_GC
03386 void os_basePrinterDC::gcMark() {
03387   basePrinterDC::gcMark();
03388 }
03389 void os_basePrinterDC::gcFixup() {
03390   basePrinterDC::gcFixup();
03391 }
03392 #endif
03393 
03394 static Scheme_Object *os_basePrinterDC_class;
03395 
03396 os_basePrinterDC::os_basePrinterDC CONSTRUCTOR_ARGS((class wxWindow* x0))
03397 CONSTRUCTOR_INIT(: basePrinterDC(x0))
03398 {
03399 }
03400 
03401 os_basePrinterDC::~os_basePrinterDC()
03402 {
03403     objscheme_destroy(this, (Scheme_Object *) __gc_external);
03404 }
03405 
03406 static Scheme_Object *os_basePrinterDC_ConstructScheme(int n,  Scheme_Object *p[])
03407 {
03408   SETUP_PRE_VAR_STACK(1);
03409   PRE_VAR_STACK_PUSH(0, p);
03410   os_basePrinterDC *realobj INIT_NULLED_OUT;
03411   REMEMBER_VAR_STACK();
03412   class wxWindow* x0 INIT_NULLED_OUT;
03413 
03414   SETUP_VAR_STACK_PRE_REMEMBERED(3);
03415   VAR_STACK_PUSH(0, p);
03416   VAR_STACK_PUSH(1, realobj);
03417   VAR_STACK_PUSH(2, x0);
03418 
03419   
03420   if ((n > (POFFSET+1))) 
03421     WITH_VAR_STACK(scheme_wrong_count_m("initialization in printer-dc%", POFFSET+POFFSET, POFFSET+1, n, p, 1));
03422   if (n > (POFFSET+0)) {
03423     x0 = WITH_VAR_STACK(objscheme_unbundle_wxWindow(p[POFFSET+0], "initialization in printer-dc%", 1));
03424   } else
03425     x0 = NULL;
03426 
03427   if (x0 && !wxSubType(((wxObject *)x0)->__type, wxTYPE_FRAME) && !wxSubType(((wxObject *)x0)->__type, wxTYPE_DIALOG_BOX)) scheme_wrong_type(METHODNAME("printer-dc%","initialization"), "frame or dialog box", POFFSET+0, n, p);
03428   realobj = WITH_VAR_STACK(new os_basePrinterDC CONSTRUCTOR_ARGS((x0)));
03429 #ifdef MZ_PRECISE_GC
03430   WITH_VAR_STACK(realobj->gcInit_basePrinterDC(x0));
03431 #endif
03432   realobj->__gc_external = (void *)p[0];
03433   
03434   
03435   READY_TO_RETURN;
03436   ((Scheme_Class_Object *)p[0])->primdata = realobj;
03437   ((Scheme_Class_Object *)p[0])->primflag = 1;
03438   WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
03439   return scheme_void;
03440 }
03441 
03442 void objscheme_setup_basePrinterDC(Scheme_Env *env)
03443 {
03444   SETUP_VAR_STACK(1);
03445   VAR_STACK_PUSH(0, env);
03446 
03447   wxREGGLOB(os_basePrinterDC_class);
03448 
03449   os_basePrinterDC_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "printer-dc%", "dc%", (Scheme_Method_Prim *)os_basePrinterDC_ConstructScheme, 0));
03450 
03451 
03452 
03453   WITH_VAR_STACK(scheme_made_class(os_basePrinterDC_class));
03454 
03455   WITH_VAR_STACK(objscheme_install_bundler((Objscheme_Bundler)objscheme_bundle_basePrinterDC, wxTYPE_DC_PRINTER));
03456 
03457   READY_TO_RETURN;
03458 }
03459 
03460 int objscheme_istype_basePrinterDC(Scheme_Object *obj, const char *stop, int nullOK)
03461 {
03462   REMEMBER_VAR_STACK();
03463   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
03464   if (objscheme_is_a(obj,  os_basePrinterDC_class))
03465     return 1;
03466   else {
03467     if (!stop)
03468        return 0;
03469     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "printer-dc% object or " XC_NULL_STR: "printer-dc% object", -1, 0, &obj));
03470     return 0;
03471   }
03472 }
03473 
03474 Scheme_Object *objscheme_bundle_basePrinterDC(class basePrinterDC *realobj)
03475 {
03476   Scheme_Class_Object *obj INIT_NULLED_OUT;
03477   Scheme_Object *sobj INIT_NULLED_OUT;
03478 
03479   if (!realobj) return XC_SCHEME_NULL;
03480 
03481   if (realobj->__gc_external)
03482     return (Scheme_Object *)realobj->__gc_external;
03483 
03484   SETUP_VAR_STACK(2);
03485   VAR_STACK_PUSH(0, obj);
03486   VAR_STACK_PUSH(1, realobj);
03487 
03488   if ((realobj->__type != wxTYPE_DC_PRINTER) && (sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
03489     { READY_TO_RETURN; return sobj; }
03490   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_basePrinterDC_class));
03491 
03492   obj->primdata = realobj;
03493   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
03494   obj->primflag = 0;
03495 
03496   realobj->__gc_external = (void *)obj;
03497   READY_TO_RETURN;
03498   return (Scheme_Object *)obj;
03499 }
03500 
03501 class basePrinterDC *objscheme_unbundle_basePrinterDC(Scheme_Object *obj, const char *where, int nullOK)
03502 {
03503   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
03504 
03505   REMEMBER_VAR_STACK();
03506 
03507   (void)objscheme_istype_basePrinterDC(obj, where, nullOK);
03508   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
03509   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
03510   if (o->primflag)
03511     return (os_basePrinterDC *)o->primdata;
03512   else
03513     return (basePrinterDC *)o->primdata;
03514 }
03515 
03516 
03517 
03518 #ifdef USE_GL
03519 extern void *wxWithGLContext(wxGL *gl, void *thunk, void *alt_waitable, int eb);
03520 #endif
03521 
03522 static void *WithContext(wxGL *gl, void *thunk, void *alt_waitable, int eb)
03523 {
03524 #ifdef USE_GL
03525   return wxWithGLContext(gl, thunk, alt_waitable, eb);
03526 #else
03527   return (void *)scheme_false;
03528 #endif
03529 }
03530 
03531 
03532 
03533 
03534 
03535 class os_wxGL : public wxGL {
03536  public:
03537 
03538   ~os_wxGL();
03539 #ifdef MZ_PRECISE_GC
03540   void gcMark();
03541   void gcFixup();
03542 #endif
03543 };
03544 
03545 #ifdef MZ_PRECISE_GC
03546 void os_wxGL::gcMark() {
03547   wxGL::gcMark();
03548 }
03549 void os_wxGL::gcFixup() {
03550   wxGL::gcFixup();
03551 }
03552 #endif
03553 
03554 static Scheme_Object *os_wxGL_class;
03555 static Scheme_Object *os_wxGL_interface;
03556 
03557 os_wxGL::~os_wxGL()
03558 {
03559     objscheme_destroy(this, (Scheme_Object *) __gc_external);
03560 }
03561 
03562 static Scheme_Object *os_wxGLWithContext(int n,  Scheme_Object *p[])
03563 {
03564   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
03565   REMEMBER_VAR_STACK();
03566   void* r;
03567   objscheme_check_valid(os_wxGL_class, "call-as-current in gl-context<%>", n, p);
03568   void* x0 INIT_NULLED_OUT;
03569   void* x1 INIT_NULLED_OUT;
03570   Bool x2;
03571 
03572   SETUP_VAR_STACK_REMEMBERED(3);
03573   VAR_STACK_PUSH(0, p);
03574   VAR_STACK_PUSH(1, x0);
03575   VAR_STACK_PUSH(2, x1);
03576 
03577   
03578   x0 = (void*)p[POFFSET+0];
03579   if (n > (POFFSET+1)) {
03580     x1 = (void*)p[POFFSET+1];
03581   } else
03582     x1 = NULL;
03583   if (n > (POFFSET+2)) {
03584     x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "call-as-current in gl-context<%>"));
03585   } else
03586     x2 = 0;
03587 
03588   if (!((wxGL *)((Scheme_Class_Object *)THEOBJ)->primdata)->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("gl-context<%>","swap-buffers"), "GL context is not ok: ", THEOBJ));
03589   r = WITH_VAR_STACK(WithContext(((wxGL *)((Scheme_Class_Object *)p[0])->primdata), x0, x1, x2));
03590 
03591   
03592   
03593   READY_TO_RETURN;
03594   return (Scheme_Object*)r;
03595 }
03596 
03597 static Scheme_Object *os_wxGLSwapBuffers(int n,  Scheme_Object *p[])
03598 {
03599   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
03600   REMEMBER_VAR_STACK();
03601   objscheme_check_valid(os_wxGL_class, "swap-buffers in gl-context<%>", n, p);
03602 
03603   SETUP_VAR_STACK_REMEMBERED(1);
03604   VAR_STACK_PUSH(0, p);
03605 
03606   
03607 
03608   if (!((wxGL *)((Scheme_Class_Object *)THEOBJ)->primdata)->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("gl-context<%>","swap-buffers"), "GL context is not ok: ", THEOBJ));
03609   WITH_VAR_STACK(((wxGL *)((Scheme_Class_Object *)p[0])->primdata)->SwapBuffers());
03610 
03611   
03612   
03613   READY_TO_RETURN;
03614   return scheme_void;
03615 }
03616 
03617 static Scheme_Object *os_wxGLOk(int n,  Scheme_Object *p[])
03618 {
03619   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
03620   REMEMBER_VAR_STACK();
03621   Bool r;
03622   objscheme_check_valid(os_wxGL_class, "ok? in gl-context<%>", n, p);
03623 
03624   SETUP_VAR_STACK_REMEMBERED(1);
03625   VAR_STACK_PUSH(0, p);
03626 
03627   
03628 
03629   
03630   r = WITH_VAR_STACK(((wxGL *)((Scheme_Class_Object *)p[0])->primdata)->Ok());
03631 
03632   
03633   
03634   READY_TO_RETURN;
03635   return (r ? scheme_true : scheme_false);
03636 }
03637 
03638 void objscheme_setup_wxGL(Scheme_Env *env)
03639 {
03640   SETUP_VAR_STACK(1);
03641   VAR_STACK_PUSH(0, env);
03642 
03643   wxREGGLOB(os_wxGL_class);
03644   wxREGGLOB(os_wxGL_interface);
03645 
03646   os_wxGL_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "gl-context%", "object%", NULL, 3));
03647 
03648   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGL_class, "call-as-current" " method", (Scheme_Method_Prim *)os_wxGLWithContext, 1, 3));
03649   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGL_class, "swap-buffers" " method", (Scheme_Method_Prim *)os_wxGLSwapBuffers, 0, 0));
03650   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGL_class, "ok?" " method", (Scheme_Method_Prim *)os_wxGLOk, 0, 0));
03651 
03652 
03653   WITH_VAR_STACK(scheme_made_class(os_wxGL_class));
03654 
03655   os_wxGL_interface = WITH_VAR_STACK(scheme_class_to_interface(os_wxGL_class, "gl-context" "<%>"));
03656 
03657   WITH_VAR_STACK(objscheme_add_global_interface(os_wxGL_interface, "gl-context" "<%>", env));
03658 
03659   READY_TO_RETURN;
03660 }
03661 
03662 int objscheme_istype_wxGL(Scheme_Object *obj, const char *stop, int nullOK)
03663 {
03664   REMEMBER_VAR_STACK();
03665   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
03666   if (objscheme_is_a(obj,  os_wxGL_class))
03667     return 1;
03668   else {
03669     if (!stop)
03670        return 0;
03671     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "gl-context% object or " XC_NULL_STR: "gl-context% object", -1, 0, &obj));
03672     return 0;
03673   }
03674 }
03675 
03676 Scheme_Object *objscheme_bundle_wxGL(class wxGL *realobj)
03677 {
03678   Scheme_Class_Object *obj INIT_NULLED_OUT;
03679   Scheme_Object *sobj INIT_NULLED_OUT;
03680 
03681   if (!realobj) return XC_SCHEME_NULL;
03682 
03683   if (realobj->__gc_external)
03684     return (Scheme_Object *)realobj->__gc_external;
03685 
03686   SETUP_VAR_STACK(2);
03687   VAR_STACK_PUSH(0, obj);
03688   VAR_STACK_PUSH(1, realobj);
03689 
03690   if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
03691     { READY_TO_RETURN; return sobj; }
03692   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxGL_class));
03693 
03694   obj->primdata = realobj;
03695   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
03696   obj->primflag = 0;
03697 
03698   realobj->__gc_external = (void *)obj;
03699   READY_TO_RETURN;
03700   return (Scheme_Object *)obj;
03701 }
03702 
03703 class wxGL *objscheme_unbundle_wxGL(Scheme_Object *obj, const char *where, int nullOK)
03704 {
03705   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
03706 
03707   REMEMBER_VAR_STACK();
03708 
03709   (void)objscheme_istype_wxGL(obj, where, nullOK);
03710   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
03711   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
03712   if (o->primflag)
03713     return (os_wxGL *)o->primdata;
03714   else
03715     return (wxGL *)o->primdata;
03716 }
03717 
03718 
03719 
03720 
03721 
03722 
03723 class os_wxGLConfig : public wxGLConfig {
03724  public:
03725 
03726   os_wxGLConfig CONSTRUCTOR_ARGS(());
03727   ~os_wxGLConfig();
03728 #ifdef MZ_PRECISE_GC
03729   void gcMark();
03730   void gcFixup();
03731 #endif
03732 };
03733 
03734 #ifdef MZ_PRECISE_GC
03735 void os_wxGLConfig::gcMark() {
03736   wxGLConfig::gcMark();
03737 }
03738 void os_wxGLConfig::gcFixup() {
03739   wxGLConfig::gcFixup();
03740 }
03741 #endif
03742 
03743 static Scheme_Object *os_wxGLConfig_class;
03744 
03745 os_wxGLConfig::os_wxGLConfig CONSTRUCTOR_ARGS(())
03746 CONSTRUCTOR_INIT(: wxGLConfig())
03747 {
03748 }
03749 
03750 os_wxGLConfig::~os_wxGLConfig()
03751 {
03752     objscheme_destroy(this, (Scheme_Object *) __gc_external);
03753 }
03754 
03755 static Scheme_Object *objscheme_wxGLConfig_GetdoubleBuffered(int n,  Scheme_Object *p[])
03756 {
03757   Scheme_Class_Object *cobj INIT_NULLED_OUT;
03758   Bool v;
03759   REMEMBER_VAR_STACK();
03760 
03761   objscheme_check_valid(os_wxGLConfig_class, "get-double-buffered in gl-config%", n, p);
03762   if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-double-buffered in gl-config%", POFFSET, POFFSET, n, p, 1));
03763   cobj = (Scheme_Class_Object *)p[0];
03764   if (cobj->primflag)
03765     v = ((os_wxGLConfig *)cobj->primdata)->wxGLConfig::doubleBuffered;
03766   else
03767     v = ((wxGLConfig *)cobj->primdata)->doubleBuffered;
03768 
03769   return (v ? scheme_true : scheme_false);
03770 }
03771 
03772 static Scheme_Object *objscheme_wxGLConfig_SetdoubleBuffered(int n,  Scheme_Object *p[])
03773 {
03774   Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
03775   Bool v;
03776   SETUP_VAR_STACK(1);
03777   VAR_STACK_PUSH(0, cobj);
03778 
03779   WITH_VAR_STACK(objscheme_check_valid(os_wxGLConfig_class, "set-double-buffered in gl-config%", n, p));
03780   if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-double-buffered in gl-config%", POFFSET+1, POFFSET+1, n, p, 1));
03781 
03782   v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-double-buffered in gl-config%"));
03783   ((wxGLConfig *)cobj->primdata)->doubleBuffered = v;
03784 
03785   READY_TO_RETURN;
03786   return scheme_void;
03787 }
03788 
03789 static Scheme_Object *objscheme_wxGLConfig_Getstereo(int n,  Scheme_Object *p[])
03790 {
03791   Scheme_Class_Object *cobj INIT_NULLED_OUT;
03792   Bool v;
03793   REMEMBER_VAR_STACK();
03794 
03795   objscheme_check_valid(os_wxGLConfig_class, "get-stereo in gl-config%", n, p);
03796   if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-stereo in gl-config%", POFFSET, POFFSET, n, p, 1));
03797   cobj = (Scheme_Class_Object *)p[0];
03798   if (cobj->primflag)
03799     v = ((os_wxGLConfig *)cobj->primdata)->wxGLConfig::stereo;
03800   else
03801     v = ((wxGLConfig *)cobj->primdata)->stereo;
03802 
03803   return (v ? scheme_true : scheme_false);
03804 }
03805 
03806 static Scheme_Object *objscheme_wxGLConfig_Setstereo(int n,  Scheme_Object *p[])
03807 {
03808   Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
03809   Bool v;
03810   SETUP_VAR_STACK(1);
03811   VAR_STACK_PUSH(0, cobj);
03812 
03813   WITH_VAR_STACK(objscheme_check_valid(os_wxGLConfig_class, "set-stereo in gl-config%", n, p));
03814   if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-stereo in gl-config%", POFFSET+1, POFFSET+1, n, p, 1));
03815 
03816   v = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET], "set-stereo in gl-config%"));
03817   ((wxGLConfig *)cobj->primdata)->stereo = v;
03818 
03819   READY_TO_RETURN;
03820   return scheme_void;
03821 }
03822 
03823 static Scheme_Object *objscheme_wxGLConfig_Getstencil(int n,  Scheme_Object *p[])
03824 {
03825   Scheme_Class_Object *cobj INIT_NULLED_OUT;
03826   int v;
03827   REMEMBER_VAR_STACK();
03828 
03829   objscheme_check_valid(os_wxGLConfig_class, "get-stencil-size in gl-config%", n, p);
03830   if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-stencil-size in gl-config%", POFFSET, POFFSET, n, p, 1));
03831   cobj = (Scheme_Class_Object *)p[0];
03832   if (cobj->primflag)
03833     v = ((os_wxGLConfig *)cobj->primdata)->wxGLConfig::stencil;
03834   else
03835     v = ((wxGLConfig *)cobj->primdata)->stencil;
03836 
03837   return scheme_make_integer(v);
03838 }
03839 
03840 static Scheme_Object *objscheme_wxGLConfig_Setstencil(int n,  Scheme_Object *p[])
03841 {
03842   Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
03843   int v;
03844   SETUP_VAR_STACK(1);
03845   VAR_STACK_PUSH(0, cobj);
03846 
03847   WITH_VAR_STACK(objscheme_check_valid(os_wxGLConfig_class, "set-stencil-size in gl-config%", n, p));
03848   if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-stencil-size in gl-config%", POFFSET+1, POFFSET+1, n, p, 1));
03849 
03850   v = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET], 0, 256, "set-stencil-size in gl-config%"));
03851   ((wxGLConfig *)cobj->primdata)->stencil = v;
03852 
03853   READY_TO_RETURN;
03854   return scheme_void;
03855 }
03856 
03857 static Scheme_Object *objscheme_wxGLConfig_Getaccum(int n,  Scheme_Object *p[])
03858 {
03859   Scheme_Class_Object *cobj INIT_NULLED_OUT;
03860   int v;
03861   REMEMBER_VAR_STACK();
03862 
03863   objscheme_check_valid(os_wxGLConfig_class, "get-accum-size in gl-config%", n, p);
03864   if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-accum-size in gl-config%", POFFSET, POFFSET, n, p, 1));
03865   cobj = (Scheme_Class_Object *)p[0];
03866   if (cobj->primflag)
03867     v = ((os_wxGLConfig *)cobj->primdata)->wxGLConfig::accum;
03868   else
03869     v = ((wxGLConfig *)cobj->primdata)->accum;
03870 
03871   return scheme_make_integer(v);
03872 }
03873 
03874 static Scheme_Object *objscheme_wxGLConfig_Setaccum(int n,  Scheme_Object *p[])
03875 {
03876   Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
03877   int v;
03878   SETUP_VAR_STACK(1);
03879   VAR_STACK_PUSH(0, cobj);
03880 
03881   WITH_VAR_STACK(objscheme_check_valid(os_wxGLConfig_class, "set-accum-size in gl-config%", n, p));
03882   if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-accum-size in gl-config%", POFFSET+1, POFFSET+1, n, p, 1));
03883 
03884   v = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET], 0, 256, "set-accum-size in gl-config%"));
03885   ((wxGLConfig *)cobj->primdata)->accum = v;
03886 
03887   READY_TO_RETURN;
03888   return scheme_void;
03889 }
03890 
03891 static Scheme_Object *objscheme_wxGLConfig_Getdepth(int n,  Scheme_Object *p[])
03892 {
03893   Scheme_Class_Object *cobj INIT_NULLED_OUT;
03894   int v;
03895   REMEMBER_VAR_STACK();
03896 
03897   objscheme_check_valid(os_wxGLConfig_class, "get-depth-size in gl-config%", n, p);
03898   if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-depth-size in gl-config%", POFFSET, POFFSET, n, p, 1));
03899   cobj = (Scheme_Class_Object *)p[0];
03900   if (cobj->primflag)
03901     v = ((os_wxGLConfig *)cobj->primdata)->wxGLConfig::depth;
03902   else
03903     v = ((wxGLConfig *)cobj->primdata)->depth;
03904 
03905   return scheme_make_integer(v);
03906 }
03907 
03908 static Scheme_Object *objscheme_wxGLConfig_Setdepth(int n,  Scheme_Object *p[])
03909 {
03910   Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
03911   int v;
03912   SETUP_VAR_STACK(1);
03913   VAR_STACK_PUSH(0, cobj);
03914 
03915   WITH_VAR_STACK(objscheme_check_valid(os_wxGLConfig_class, "set-depth-size in gl-config%", n, p));
03916   if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-depth-size in gl-config%", POFFSET+1, POFFSET+1, n, p, 1));
03917 
03918   v = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET], 0, 256, "set-depth-size in gl-config%"));
03919   ((wxGLConfig *)cobj->primdata)->depth = v;
03920 
03921   READY_TO_RETURN;
03922   return scheme_void;
03923 }
03924 
03925 static Scheme_Object *objscheme_wxGLConfig_Getmultisample(int n,  Scheme_Object *p[])
03926 {
03927   Scheme_Class_Object *cobj INIT_NULLED_OUT;
03928   int v;
03929   REMEMBER_VAR_STACK();
03930 
03931   objscheme_check_valid(os_wxGLConfig_class, "get-multisample-size in gl-config%", n, p);
03932   if (n > POFFSET) WITH_REMEMBERED_STACK(scheme_wrong_count_m("get-multisample-size in gl-config%", POFFSET, POFFSET, n, p, 1));
03933   cobj = (Scheme_Class_Object *)p[0];
03934   if (cobj->primflag)
03935     v = ((os_wxGLConfig *)cobj->primdata)->wxGLConfig::multisample;
03936   else
03937     v = ((wxGLConfig *)cobj->primdata)->multisample;
03938 
03939   return scheme_make_integer(v);
03940 }
03941 
03942 static Scheme_Object *objscheme_wxGLConfig_Setmultisample(int n,  Scheme_Object *p[])
03943 {
03944   Scheme_Class_Object *cobj = (Scheme_Class_Object *)p[0];
03945   int v;
03946   SETUP_VAR_STACK(1);
03947   VAR_STACK_PUSH(0, cobj);
03948 
03949   WITH_VAR_STACK(objscheme_check_valid(os_wxGLConfig_class, "set-multisample-size in gl-config%", n, p));
03950   if (n != (POFFSET+1)) WITH_VAR_STACK(scheme_wrong_count_m("set-multisample-size in gl-config%", POFFSET+1, POFFSET+1, n, p, 1));
03951 
03952   v = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET], 0, 256, "set-multisample-size in gl-config%"));
03953   ((wxGLConfig *)cobj->primdata)->multisample = v;
03954 
03955   READY_TO_RETURN;
03956   return scheme_void;
03957 }
03958 
03959 static Scheme_Object *os_wxGLConfig_ConstructScheme(int n,  Scheme_Object *p[])
03960 {
03961   SETUP_PRE_VAR_STACK(1);
03962   PRE_VAR_STACK_PUSH(0, p);
03963   os_wxGLConfig *realobj INIT_NULLED_OUT;
03964   REMEMBER_VAR_STACK();
03965 
03966   SETUP_VAR_STACK_PRE_REMEMBERED(2);
03967   VAR_STACK_PUSH(0, p);
03968   VAR_STACK_PUSH(1, realobj);
03969 
03970   
03971   if (n != (POFFSET+0)) 
03972     WITH_VAR_STACK(scheme_wrong_count_m("initialization in gl-config%", POFFSET+0, POFFSET+0, n, p, 1));
03973 
03974   
03975   realobj = WITH_VAR_STACK(new os_wxGLConfig CONSTRUCTOR_ARGS(()));
03976 #ifdef MZ_PRECISE_GC
03977   WITH_VAR_STACK(realobj->gcInit_wxGLConfig());
03978 #endif
03979   realobj->__gc_external = (void *)p[0];
03980   
03981   
03982   READY_TO_RETURN;
03983   ((Scheme_Class_Object *)p[0])->primdata = realobj;
03984   ((Scheme_Class_Object *)p[0])->primflag = 1;
03985   WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
03986   return scheme_void;
03987 }
03988 
03989 void objscheme_setup_wxGLConfig(Scheme_Env *env)
03990 {
03991   SETUP_VAR_STACK(1);
03992   VAR_STACK_PUSH(0, env);
03993 
03994   wxREGGLOB(os_wxGLConfig_class);
03995 
03996   os_wxGLConfig_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "gl-config%", "object%", (Scheme_Method_Prim *)os_wxGLConfig_ConstructScheme, 12));
03997 
03998 
03999   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"get-double-buffered" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_GetdoubleBuffered, 0, 0));
04000   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"set-double-buffered" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_SetdoubleBuffered, 1, 1));
04001   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"get-stereo" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_Getstereo, 0, 0));
04002   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"set-stereo" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_Setstereo, 1, 1));
04003   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"get-stencil-size" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_Getstencil, 0, 0));
04004   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"set-stencil-size" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_Setstencil, 1, 1));
04005   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"get-accum-size" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_Getaccum, 0, 0));
04006   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"set-accum-size" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_Setaccum, 1, 1));
04007   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"get-depth-size" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_Getdepth, 0, 0));
04008   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"set-depth-size" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_Setdepth, 1, 1));
04009   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"get-multisample-size" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_Getmultisample, 0, 0));
04010   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxGLConfig_class,"set-multisample-size" " method", (Scheme_Method_Prim *)objscheme_wxGLConfig_Setmultisample, 1, 1));
04011 
04012   WITH_VAR_STACK(scheme_made_class(os_wxGLConfig_class));
04013 
04014 
04015   READY_TO_RETURN;
04016 }
04017 
04018 int objscheme_istype_wxGLConfig(Scheme_Object *obj, const char *stop, int nullOK)
04019 {
04020   REMEMBER_VAR_STACK();
04021   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
04022   if (objscheme_is_a(obj,  os_wxGLConfig_class))
04023     return 1;
04024   else {
04025     if (!stop)
04026        return 0;
04027     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "gl-config% object or " XC_NULL_STR: "gl-config% object", -1, 0, &obj));
04028     return 0;
04029   }
04030 }
04031 
04032 Scheme_Object *objscheme_bundle_wxGLConfig(class wxGLConfig *realobj)
04033 {
04034   Scheme_Class_Object *obj INIT_NULLED_OUT;
04035   Scheme_Object *sobj INIT_NULLED_OUT;
04036 
04037   if (!realobj) return XC_SCHEME_NULL;
04038 
04039   if (realobj->__gc_external)
04040     return (Scheme_Object *)realobj->__gc_external;
04041 
04042   SETUP_VAR_STACK(2);
04043   VAR_STACK_PUSH(0, obj);
04044   VAR_STACK_PUSH(1, realobj);
04045 
04046   if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
04047     { READY_TO_RETURN; return sobj; }
04048   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxGLConfig_class));
04049 
04050   obj->primdata = realobj;
04051   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
04052   obj->primflag = 0;
04053 
04054   realobj->__gc_external = (void *)obj;
04055   READY_TO_RETURN;
04056   return (Scheme_Object *)obj;
04057 }
04058 
04059 class wxGLConfig *objscheme_unbundle_wxGLConfig(Scheme_Object *obj, const char *where, int nullOK)
04060 {
04061   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
04062 
04063   REMEMBER_VAR_STACK();
04064 
04065   (void)objscheme_istype_wxGLConfig(obj, where, nullOK);
04066   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
04067   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
04068   if (o->primflag)
04069     return (os_wxGLConfig *)o->primdata;
04070   else
04071     return (wxGLConfig *)o->primdata;
04072 }
04073 
04074 
04075