Permalink
Browse files

Remove unused code in GUIPrimitives.M

  • Loading branch information...
1 parent a4eee2d commit 5e127a45d41a61c53a31f591065752cc38358706 Scott Wilson committed Feb 28, 2010
Showing with 0 additions and 342 deletions.
  1. +0 −342 common/Source/app/GUIPrimitives.M
@@ -1314,28 +1314,6 @@ int slotGetCGRect(PyrSlot* a, CGRect *r)
return errNone;
}
-int slotGetQDRect(PyrSlot* a, Rect *r)
-{
- PyrSlot *slots = slotRawObject(a)->slots;
- int err;
- float x, y, width, height;
-
- err = slotFloatVal(slots+0, &x);
- if (err) return err;
- err = slotFloatVal(slots+1, &y);
- if (err) return err;
- err = slotFloatVal(slots+2, &width);
- if (err) return err;
- err = slotFloatVal(slots+3, &height);
- if (err) return err;
-
- r->left = (int)x;
- r->right = (int)(x + width);
- r->top = (int)(y - height);
- r->bottom = (int)y;
-
- return errNone;
-}
int slotGetPoint(PyrSlot* a, NSPoint *p)
{
@@ -2900,28 +2878,6 @@ int prPen_Skew(struct VMGlobals *g, int numArgsPushed)
return errNone;
}
-int prPen_DrawAquaButton(struct VMGlobals *g, int numArgsPushed);
-int prPen_DrawAquaButton(struct VMGlobals *g, int numArgsPushed)
-{
- if (!g->canCallOS) return errCantCallOS;
-
- PyrSlot *args = g->sp - 4;
-
- if (!(isKindOfSlot(args+1, s_rect->u.classobj))) return errWrongType;
-
- Rect qdrect;
- int err = slotGetQDRect(args+1, &qdrect);
- if (err) return err;
-
- ThemeButtonDrawInfo tinfo;
- tinfo.state = IsTrue(args+3) ? kThemeStatePressedDown : kThemeStatePressedUp ;
- tinfo.value = IsTrue(args+4) ? kThemeButtonOn : kThemeButtonOff ;
- tinfo.adornment = kThemeAdornmentDefault;
-
- DrawThemeButton(&qdrect, slotRawInt(&args[2]), &tinfo, nil, nil, nil, 0);
-
- return errNone;
-}
int prPen_SetBlend(struct VMGlobals *g, int numArgsPushed);
int prPen_SetBlend(struct VMGlobals *g, int numArgsPushed)
@@ -3592,302 +3548,6 @@ int prHasDeferred(struct VMGlobals *g, int numArgsPushed)
return errNone;
}
-int prDrawButtonState(struct VMGlobals *g, int numArgsPushed);
-int prDrawButtonState(struct VMGlobals *g, int numArgsPushed)
-{
- if (!g->canCallOS) return errCantCallOS;
-
- PyrSlot *slots = g->sp - 5;
-
- PyrSlot *rectSlot = slots + 0;
- PyrSlot *strokeColorSlot = slots + 1;
- PyrSlot *fillColorSlot = slots + 2;
- PyrSlot *stringColorSlot = slots + 3;
- PyrSlot *fontSlot = slots + 4;
- PyrSlot *stringSlot = slots + 5;
-
- int err;
-
- CGRect rect;
- err = slotGetCGRect(rectSlot, &rect);
- if (err) return err;
-
- NSGraphicsContext *gctx = [NSGraphicsContext currentContext];
- if (!gctx) return errFailed;
- CGContextRef cgc = (CGContextRef)[gctx graphicsPort];
-
- CGContextSaveGState(cgc);
-
- SCColor fillColor;
- err = slotColorVal(fillColorSlot, &fillColor);
- if (!err) {
- CGContextSetRGBFillColor(cgc, fillColor.red, fillColor.green, fillColor.blue, fillColor.alpha);
- CGContextFillRect(cgc, rect);
- }
-
- SCColor strokeColor;
- err = slotColorVal(strokeColorSlot, &strokeColor);
- if (!err) {
- CGContextSetRGBStrokeColor(cgc,
- strokeColor.red, strokeColor.green, strokeColor.blue, strokeColor.alpha);
- CGContextStrokeRect(cgc, rect);
- }
-
- if (isKindOfSlot(stringSlot, class_string)) {
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- err = addFontAttribute(dict, fontSlot);
- if (err) return err;
- err = addFontColorAttribute(dict, stringColorSlot);
- if (err) return err;
-
- PyrString *scstring = slotRawString(stringSlot);
- NSString *nsstring = [NSString stringWithCString: scstring->s length: scstring->size];
- if (!nsstring) return errFailed;
- NSSize strsize = [nsstring sizeWithAttributes: dict];
-
- NSPoint p;
- p.x = rect.origin.x + rect.size.width/2 - strsize.width/2;
- p.y = rect.origin.y + rect.size.height/2 - strsize.height/2;
-
- [nsstring drawAtPoint: p withAttributes: dict];
- }
-
- CGContextRestoreGState(cgc);
-
- return errNone;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////
-
-
-int slotGetRoundRect(PyrSlot* a, Rect *r, int *radius);
-int slotGetRoundRect(PyrSlot* a, Rect *r, int *radius)
-{
- PyrSlot *slots = slotRawObject(a)->slots;
- int err;
- err = slotGetQDRect(a, r);
- if (err) return err;
-
- err = slotIntVal(slots+4, radius);
- if (err) return err;
-
- return errNone;
-}
-
-int slotBevelRect(PyrSlot* a, Rect *r, int *width, bool *inout);
-int slotBevelRect(PyrSlot* a, Rect *r, int *width, bool *inout)
-{
- PyrSlot *slots = slotRawObject(a)->slots;
- int err;
- err = slotGetQDRect(a, r);
- if (err) return err;
-
- err = slotIntVal(slots+4, width);
- if (err) return err;
-
- if (IsTrue(slots+5)) *inout = true;
- else *inout = false;
-
- return errNone;
-}
-
-int slotGetArc(PyrSlot* a, Rect *r, int *startAngle, int *arcAngle);
-int slotGetArc(PyrSlot* a, Rect *r, int *startAngle, int *arcAngle)
-{
- PyrSlot *slots = slotRawObject(a)->slots;
- int err;
- err = slotGetQDRect(a, r);
- if (err) return err;
-
- err = slotIntVal(slots+4, startAngle);
- if (err) return err;
- err = slotIntVal(slots+5, arcAngle);
- if (err) return err;
-
- return errNone;
-}
-enum {
- drawop_Invert = -1,
- drawop_Erase,
- drawop_Stroke,
- drawop_Fill
-};
-
-
-void hilite_color(RGBColor *rgb);
-void hilite_color(RGBColor *rgb)
-{
- rgb->red = 65535L - ((65535L - rgb->red ) >> 2);
- rgb->green = 65535L - ((65535L - rgb->green) >> 2);
- rgb->blue = 65535L - ((65535L - rgb->blue ) >> 2);
-}
-
-void shadow_color(RGBColor *rgb);
-void shadow_color(RGBColor *rgb)
-{
- rgb->red >>= 1;
- rgb->green >>= 1;
- rgb->blue >>= 1;
-}
-
-void dim_color(RGBColor *rgb);
-void dim_color(RGBColor *rgb)
-{
- rgb->red = (32768L + rgb->red ) >> 1;
- rgb->green = (32768L + rgb->green) >> 1;
- rgb->blue = (32768L + rgb->blue ) >> 1;
-}
-/*
-void bevelRect(Rect *r0, int width,
- RGBColor *color1, RGBColor *color2, RGBColor *color3, bool fill);
-void bevelRect(Rect *r0, int width,
- RGBColor *color1, RGBColor *color2, RGBColor *color3, bool fill)
-{
- Rect r;
- PenState ps;
- RGBColor saveForeColor;
-
- GetPenState(&ps);
- GetForeColor(&saveForeColor);
- r = *r0;
- PenNormal();
- PenSize(width, width);
- RGBForeColor(color1);
- MoveTo(r.left, r.top);
- LineTo(r.right-width, r.top);
- MoveTo(r.left, r.top);
- LineTo(r.left, r.bottom-width);
- PenSize(1, 1);
- RGBForeColor(color2);
- while (width--) {
- MoveTo(r.right-1, r.top);
- LineTo(r.right-1, r.bottom-1);
- MoveTo(r.left, r.bottom-1);
- LineTo(r.right-1, r.bottom-1);
- InsetRect(&r,1,1);
- }
- RGBForeColor(color3);
- if (fill) {
- PaintRect(&r);
- }
- SetPenState(&ps);
- RGBForeColor(&saveForeColor);
-}
-
-void bevelInRect(Rect *r, int width, RGBColor colorFill, bool fill);
-void bevelInRect(Rect *r, int width, RGBColor colorFill, bool fill)
-{
- RGBColor hilite, shadow;
-
- hilite = shadow = colorFill;
-
- hilite_color(&hilite);
- shadow_color(&shadow);
-
- bevelRect(r, width, &shadow, &hilite, &colorFill, fill);
-}
-
-void bevelOutRect(Rect *r, int width, RGBColor colorFill, bool fill);
-void bevelOutRect(Rect *r, int width, RGBColor colorFill, bool fill)
-{
- RGBColor hilite, shadow;
-
- hilite = shadow = colorFill;
-
- hilite_color(&hilite);
- shadow_color(&shadow);
-
- bevelRect(r, width, &hilite, &shadow, &colorFill, fill);
-}
-
-int drawBevelRect(Rect r, int width, int inout, RGBColor color, int drawop);
-int drawBevelRect(Rect r, int width, int inout, RGBColor color, int drawop)
-{
- if (inout) {
- switch (drawop) {
- case drawop_Invert : InvertRect(&r); break;
- case drawop_Erase : EraseRect(&r); break;
- case drawop_Stroke : bevelInRect(&r, width, color, false); break;
- case drawop_Fill : bevelInRect(&r, width, color, true); break;
- }
- } else {
- switch (drawop) {
- case drawop_Invert : InvertRect(&r); break;
- case drawop_Erase : EraseRect(&r); break;
- case drawop_Stroke : bevelOutRect(&r, width, color, false); break;
- case drawop_Fill : bevelOutRect(&r, width, color, true); break;
- }
- }
- return errNone;
-}
-
-*/
-inline Point origin(Rect a)
-{
- Point p;
- p.h = a.left;
- p.v = a.top;
- return p;
-}
-
-inline Point extent(Rect a)
-{
- Point p;
- p.h = a.right - a.left;
- p.v = a.bottom - a.top;
- return p;
-}
-
-inline Point operator+(Point a, Point b)
-{
- Point p;
- p.h = a.h + b.h;
- p.v = a.v + b.v;
- return p;
-}
-
-inline Point operator-(Point a, Point b)
-{
- Point p;
- p.h = a.h - b.h;
- p.v = a.v - b.v;
- return p;
-}
-
-inline Point operator/(Point a, int z)
-{
- Point p;
- p.h = a.h / z;
- p.v = a.v / z;
- return p;
-}
-
-Point centerRectIn(Rect &a, Rect &b);
-Point centerRectIn(Rect &a, Rect &b)
-{
- Point spacing = (extent(b) - extent(a)) / 2;
- Point newOrigin = origin(b) - origin(a) + spacing;
- return newOrigin;
-}
-
-/*
-void stringBounds(char *s, int len, Rect &r);
-void stringBounds(char *s, int len, Rect &r)
-{
- FontInfo finfo;
- GetFontInfo(&finfo);
-
- int width = TextWidth(s, 0, len);
-
- r.left = 0;
- r.top = -finfo.ascent;
- r.right = width;
- r.bottom = finfo.descent;
-}
-*/
int prNewMenuItem(struct VMGlobals *g, int numArgsPushed);
int prNewMenuItem(struct VMGlobals *g, int numArgsPushed)
@@ -4351,8 +4011,6 @@ void initGUIPrimitives()
definePrimitive(base, index++, "_Pen_FillPath", prPen_FillPath, 1, 0);
definePrimitive(base, index++, "_Pen_ClipPath", prPen_ClipPath, 1, 0);
- definePrimitive(base, index++, "_Pen_DrawAquaButton", prPen_DrawAquaButton, 5, 0);
-
definePrimitive(base, index++, "_Pen_AddQuadCurve", prPen_AddBezierQuadCurve, 3, 0);
definePrimitive(base, index++, "_Pen_AddCubicCurve", prPen_AddBezierCubicCurve, 4, 0);
definePrimitive(base, index++, "_Pen_AddArcToPoint", prPen_AddArcToPoint, 4, 0);

0 comments on commit 5e127a4

Please sign in to comment.