From: Richard K. <ric...@us...> - 2005-05-17 16:26:42
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21328 Modified Files: ASTheme.as ASThemeProtocol.as NSButtonCell.as NSTextFieldCell.as Log Message: renamed methods in theme to simplify drawing Index: ASThemeProtocol.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASThemeProtocol.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ASThemeProtocol.as 17 May 2005 15:59:36 -0000 1.4 --- ASThemeProtocol.as 17 May 2005 16:26:29 -0000 1.5 *************** *** 51,67 **** /** ! * Draws a NSButton bezel with the supplied colorset (up, down, disabled) in the view. */ ! public function drawButtonBezeledWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); /** ! * Draws a NSButton bordered with the supplied colorset (up, down, disabled) in the view. */ ! public function drawButtonBorderedWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); /** * Draws an NSTextFieldCell with the supplied colorset ("defaultTextfield") in the view. */ ! public function drawTextFieldWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView); /** --- 51,83 ---- /** ! * Draws a NSButton in the up state bezeled with the supplied rect in the view. */ ! public function drawBezelButtonUpWithRectInView(rect:NSRect, view:NSView); /** ! * Draws a NSButton in the down state bezeled with the supplied rect in the view. */ ! public function drawBezelButtonDownWithRectInView(rect:NSRect, view:NSView); ! ! /** ! * Draws a NSButton in the disabled state bezeled with the supplied rect in the view. ! */ ! public function drawBezelButtonDisabledWithRectInView(rect:NSRect, view:NSView); ! ! /** ! * Draws a NSButton bordered with the supplied rect in the view. ! */ ! public function drawBorderButtonWithRectInView(rect:NSRect, view:NSView); ! ! /** ! * Draws a NSButton bordered with the supplied rect in the view. ! */ ! public function drawBorderButtonDisabledWithRectInView(rect:NSRect, view:NSView); ! /** * Draws an NSTextFieldCell with the supplied colorset ("defaultTextfield") in the view. */ ! public function drawTextFieldWithRectInView(rect:NSRect, view:NSView); /** Index: NSButtonCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSButtonCell.as,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** NSButtonCell.as 17 May 2005 15:59:36 -0000 1.14 --- NSButtonCell.as 17 May 2005 16:26:29 -0000 1.15 *************** *** 585,601 **** } ! var colorset; ! if (m_enabled) { ! if (m_highlighted) { ! colorset = "down"; } else { ! colorset = "up"; } - } else { - colorset = "disabled"; - } - - if (m_bordered) { - ASTheme.current().drawButtonBorderedWithRectColorsetInView(cellFrame, colorset, inView); } else if (m_bezeled) { if (m_highlighted || !m_enabled) { --- 585,594 ---- } ! if (m_bordered) { ! if (m_enabled) { ! ASTheme.current().drawBorderButtonWithRectInView(cellFrame, inView); } else { ! ASTheme.current().drawBorderButtonDisabledWithRectInView(cellFrame, inView); } } else if (m_bezeled) { if (m_highlighted || !m_enabled) { *************** *** 605,609 **** imageLocation.y += 1; } ! ASTheme.current().drawButtonBezeledWithRectColorsetInView(cellFrame, colorset, inView); } --- 598,612 ---- imageLocation.y += 1; } ! if (m_enabled) { ! if (m_highlighted) { ! ASTheme.current().drawBezelButtonDownWithRectInView(cellFrame, inView); ! } else { ! ASTheme.current().drawBezelButtonUpWithRectInView(cellFrame, inView); ! } ! } else { ! ASTheme.current().drawBezelButtonDisabledWithRectInView(cellFrame, inView); ! } ! ! } Index: NSTextFieldCell.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSTextFieldCell.as,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NSTextFieldCell.as 17 May 2005 15:59:36 -0000 1.9 --- NSTextFieldCell.as 17 May 2005 16:26:29 -0000 1.10 *************** *** 167,171 **** if (m_drawsBackground) { ! ASTheme.current().drawTextFieldWithRectColorsetInView(cellFrame, "defaultTextfield", inView); } --- 167,171 ---- if (m_drawsBackground) { ! ASTheme.current().drawTextFieldWithRectInView(cellFrame, inView); } Index: ASTheme.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/ASTheme.as,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ASTheme.as 17 May 2005 15:59:36 -0000 1.4 --- ASTheme.as 17 May 2005 16:26:27 -0000 1.5 *************** *** 49,53 **** private static var g_colorSets = { ! up: { top: 0x82858E, top1: 0xDFE2E9, --- 49,53 ---- private static var g_colorSets = { ! buttonUp: { top: 0x82858E, top1: 0xDFE2E9, *************** *** 63,67 **** right1: 0x858992, middle: 0xC7CAD1}, ! down: { top: 0x6A6E79, top1: 0x747883, --- 63,67 ---- right1: 0x858992, middle: 0xC7CAD1}, ! buttonDown: { top: 0x6A6E79, top1: 0x747883, *************** *** 77,81 **** right1: 0xCACED1, middle: 0xB0B4BD}, ! disabled: { top: 0x81858E, top1: 0x858992, --- 77,81 ---- right1: 0xCACED1, middle: 0xB0B4BD}, ! buttonDisabled: { top: 0x81858E, top1: 0x858992, *************** *** 91,95 **** right1: 0xE9ECF1, middle: 0xC7CACF}, ! defaultTextfield: { top: 0x81858E, top1: 0x858992, --- 91,95 ---- right1: 0xE9ECF1, middle: 0xC7CACF}, ! textfield: { top: 0x81858E, top1: 0x858992, *************** *** 131,177 **** } ! public function drawButtonBorderedWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { ! var x = rect.origin.x; ! var y = rect.origin.y; ! var width = rect.size.width-1; ! var height = rect.size.height-1; ! var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; ! ASDraw.drawFill(mc, colors.middle, x, y, width, height); ! ASDraw.drawRect(mc, 1, 0, x, y, width, height); ! } ! ! ! public function drawButtonBezeledWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { ! var x = rect.origin.x; ! var y = rect.origin.y; ! var width = rect.size.width-1; ! var height = rect.size.height-1; ! var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; ! ! //draw top lines ! ASDraw.drawFill(mc, colors.middle, x, y, width, height); ! ASDraw.drawHLine(mc, colors.top , x, x+width, y); ! ASDraw.drawHLine(mc, colors.top1, x, x+width, y+1); ! ASDraw.drawHLine(mc, colors.top2, x, x+width, y+2); ! ASDraw.drawHLine(mc, colors.top3, x, x+width, y+3); ! //draw bottom lines ! ASDraw.drawHLine(mc, colors.bottom , x, x+width, y+height ); ! ASDraw.drawHLine(mc, colors.bottom1, x, x+width, y+height-1); ! ASDraw.drawHLine(mc, colors.bottom2, x, x+width, y+height-2); ! ASDraw.drawHLine(mc, colors.bottom3, x, x+width, y+height-3); ! //draw left lines ! ASDraw.drawVLine(mc, colors.left , y, y+height, x ); ! ASDraw.drawVLineEdgeFade(mc, colors.left1, y, y+height, x+1, 5); ! //draw right lines ! ASDraw.drawVLine(mc, colors.right , y, y+height, x+width ); ! ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); } ! public function drawTextFieldWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { var x = rect.origin.x; var y = rect.origin.y; --- 131,157 ---- } ! public function drawBorderButtonWithRectInView(rect:NSRect, view:NSView) { ! drawBorderButtonWithRectColorsetInView(rect, "buttonUp", view); ! } ! public function drawBorderButtonDisabledWithRectInView(rect:NSRect, view:NSView) { ! drawBorderButtonWithRectColorsetInView(rect, "buttonDisabled", view); ! } ! ! public function drawBezelButtonUpWithRectInView(rect:NSRect, view:NSView) { ! drawBezelButtonWithRectColorsetInView(rect, "buttonUp", view); ! } ! public function drawBezelButtonDownWithRectInView(rect:NSRect, view:NSView) { ! drawBezelButtonWithRectColorsetInView(rect, "buttonDown", view); ! } ! public function drawBezelButtonDisabledWithRectInView(rect:NSRect, view:NSView) { ! drawBezelButtonWithRectColorsetInView(rect, "buttonDisabled", view); } ! ! ! public function drawTextFieldWithRectInView(rect:NSRect, view:NSView) { var x = rect.origin.x; var y = rect.origin.y; *************** *** 179,183 **** var height = rect.size.height-1; var mc = view.mcBounds(); ! var colors = g_colorSets[colorSet]; ASDraw.drawFill(mc, colors.middle, 0, 0, width, height); --- 159,163 ---- var height = rect.size.height-1; var mc = view.mcBounds(); ! var colors = g_colorSets["textfield"]; ASDraw.drawFill(mc, colors.middle, 0, 0, width, height); *************** *** 235,238 **** --- 215,259 ---- } + private function drawBorderButtonWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width-1; + var height = rect.size.height-1; + var mc = view.mcBounds(); + var colors = g_colorSets[colorSet]; + ASDraw.drawFill(mc, colors.middle, x, y, width, height); + ASDraw.drawRect(mc, 1, 0, x, y, width, height); + } + + private function drawBezelButtonWithRectColorsetInView(rect:NSRect, colorSet:String, view:NSView) { + var x = rect.origin.x; + var y = rect.origin.y; + var width = rect.size.width-1; + var height = rect.size.height-1; + var mc = view.mcBounds(); + var colors = g_colorSets[colorSet]; + + //draw top lines + ASDraw.drawFill(mc, colors.middle, x, y, width, height); + ASDraw.drawHLine(mc, colors.top , x, x+width, y); + ASDraw.drawHLine(mc, colors.top1, x, x+width, y+1); + ASDraw.drawHLine(mc, colors.top2, x, x+width, y+2); + ASDraw.drawHLine(mc, colors.top3, x, x+width, y+3); + + //draw bottom lines + ASDraw.drawHLine(mc, colors.bottom , x, x+width, y+height ); + ASDraw.drawHLine(mc, colors.bottom1, x, x+width, y+height-1); + ASDraw.drawHLine(mc, colors.bottom2, x, x+width, y+height-2); + ASDraw.drawHLine(mc, colors.bottom3, x, x+width, y+height-3); + + //draw left lines + ASDraw.drawVLine(mc, colors.left , y, y+height, x ); + ASDraw.drawVLineEdgeFade(mc, colors.left1, y, y+height, x+1, 5); + + //draw right lines + ASDraw.drawVLine(mc, colors.right , y, y+height, x+width ); + ASDraw.drawVLineEdgeFade(mc, colors.right1, y, y+height, x+width-1, 5); + } + //****************************************************** //* Public Static Properties * |