Permalink
Browse files

- reorganized folders (sorry Aaron :)), added scripts.json and build…

….lua to build your art.js file.
  • Loading branch information...
1 parent 54d9c05 commit b86d7b18b4c450d28f4c83afe489e7774e49db25 @kamicane kamicane committed Apr 2, 2009
View
@@ -0,0 +1 @@
+art.js
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,9 @@
-// Canvas Adapter.
+/*
+Script: ART.Adapter.Canvas.js
+
+License:
+ MIT-style license.
+*/
ART.Adapter.Canvas = new Class({
@@ -1,4 +1,9 @@
-// art.adapter.js
+/*
+Script: ART.Adapter.js
+
+License:
+ MIT-style license.
+*/
// Generic adapter base Class.
@@ -1,4 +1,9 @@
-// art.paint.js
+/*
+Script: ART.Paint.js
+
+License:
+ MIT-style license.
+*/
// kappa!
@@ -1,4 +1,9 @@
-// art.shape.js
+/*
+Script: ART.Shape.js
+
+License:
+ MIT-style license.
+*/
// ART.Shape Class stub.
// Will probably support defining shapes as json at some point.
@@ -1,4 +1,9 @@
-// art.font.js
+/*
+Script: ART.Font.js
+
+License:
+ MIT-style license.
+*/
// ==========================================
// This file implements code from Cufón
View
@@ -0,0 +1,74 @@
+{
+
+ "Base": {
+
+ "ART": {
+ "deps": [],
+ "desc": "The base ART Class."
+ },
+
+ "ART.Widget": {
+ "deps": ["ART"],
+ "desc": "Barebones ART Widget."
+ }
+
+ },
+
+ "Paint": {
+
+ "ART.Adapter": {
+ "deps": ["ART"],
+ "desc": "ART Graphic Adapter."
+ },
+
+ "ART.Adapter.Canvas": {
+ "deps": ["ART.Adapter"],
+ "desc": "Adds Canvas support to ART.Adapter."
+ },
+
+ "ART.Paint": {
+ "deps": ["ART.Adapter.Canvas"],
+ "desc": "Public Class for painting stuff. Extends ART.Adapter."
+ },
+
+ "ART.Shape": {
+ "deps": ["ART.Paint"],
+ "desc": "Adds some shapes, and implements the shape method to ART.Paint."
+ },
+
+ "ART.Text": {
+ "deps": ["ART.Paint"],
+ "desc": "Adds font drawing support (thanks to Cufón), and implements the text method to ART.Paint."
+ }
+
+ },
+
+ "Fonts": {
+
+ "MgOpen.Moderna": {
+ "deps": ["ART.Text"],
+ "desc": "Open source font to use with ART.Paint."
+ },
+
+ "MgOpen.Moderna.Bold": {
+ "deps": ["ART.Text"],
+ "desc": "Bold version of the Moderna Font."
+ }
+
+ },
+
+ "Widgets": {
+
+ "ART.Widget.Button": {
+ "deps": ["ART.Widget", "ART.Text"],
+ "desc": "Button widget."
+ },
+
+ "ART.Widget.Window": {
+ "deps": ["ART.Widget", "ART.Text"],
+ "desc": "Window widget."
+ }
+
+ }
+
+}
View
@@ -1,103 +0,0 @@
-// art.button.js
-
-// Button Widget. Work in progress.
-
-ART.Button = new Class({
-
- Extends: ART.Widget,
-
- name: 'button',
-
- style: {
-
- base: {
-
- 'height': 20,
- 'width': 100,
-
- 'glyph': false,
- 'glyph-stroke': 2,
- 'glyph-color': hsb(0, 0, 0, 0.8),
- 'glyph-height': 10,
- 'glyph-width': 10,
- 'glyph-top': 2,
- 'glyph-left': 2,
-
- 'pill': false,
-
- 'corner-radius': 3,
- 'background-color': {0: hsb(0, 0, 80), 1: hsb(0, 0, 60)},
- 'border-color': hsb(0, 0, 0, 0.7),
- 'reflection-color': {0: hsb(0, 0, 100, 1), 1: hsb(0, 0, 0, 0)},
- 'shadow-color': hsb(0, 0, 100, 0.6)
- },
-
- active: {
- 'background-color': hsb(0, 0, 40),
- 'border-color': hsb(0, 0, 0, 0.8),
- 'reflection-color': {0: hsb(0, 0, 30, 1), 1: hsb(0, 0, 0, 0)}
- }
-
- },
-
- options: {},
-
- initialize: function(options){
- this.parent(options);
-
- this.paint = new ART.Paint();
- $(this.paint).inject(this.element);
-
- var self = this;
-
- var deactivate = function(){
- self.deactivate();
- document.removeEvent('mouseup', deactivate);
- };
-
- this.element.addEvent('mousedown', function(){
- self.activate();
- document.addEvent('mouseup', deactivate);
- });
-
- this.render();
- },
-
- render: function(style){
- if (!this.paint) return this;
- if (style) $extend(this.style.now, style);
-
- var now = {};
- for (var p in this.style.now) now[p.camelCase()] = this.style.now[p];
-
- this.paint.resize({x: now.width, y: now.height + 1});
- this.element.setStyles({width: now.width, height: now.height + 1});
-
- var shape = (now.pill) ? (now.width > now.height) ? 'horizontal-pill' : 'vertical-pill' : 'rounded-rectangle';
-
- this.paint.start({x: 0, y: 0});
- this.paint.shape(shape, {x: now.width, y: now.height + 1}, now.cornerRadius + 1);
- this.paint.end({'fill': true, 'fill-color': now.shadowColor});
-
- this.paint.start({x: 0, y: 0});
- this.paint.shape(shape, {x: now.width, y: now.height}, now.cornerRadius + 1);
- this.paint.end({'fill': true, 'fill-color': now.borderColor});
-
- this.paint.start({x: 1, y: 1});
- this.paint.shape(shape, {x: now.width - 2, y: now.height - 2}, now.cornerRadius);
- this.paint.end({'fill': true, 'fill-color': now.reflectionColor});
-
- this.paint.start({x: 1, y: 2});
- this.paint.shape(shape, {x: now.width - 2, y: now.height - 3}, now.cornerRadius);
- this.paint.end({'fill': true, 'fill-color': now.backgroundColor});
-
- if (now.glyph){
- this.paint.start({x: now.glyphLeft, y: now.glyphTop});
- this.paint.shape(now.glyph, {x: now.glyphWidth, y: now.glyphHeight});
- this.paint.end({'stroke': true, 'stroke-width': now.glyphStroke, 'stroke-color': now.glyphColor});
- }
-
- return this;
- }
-
-});
View
5 art.js
@@ -1,5 +0,0 @@
-// art.js
-
-// NS.
-
-var ART = function(){};
View
@@ -1,144 +0,0 @@
-// art.widget.js
-
-// Base widget class. Based on » http://gist.github.com/85837
-
-ART.Widget = new Class({
-
- Implements: [Options, Events],
-
- ns: 'art',
- name: 'widget',
-
- options: {
- // onShow: $empty,
- // onHide: $empty,
- // onFocus: $empty,
- // onBlur: $empty,
- // onEnable: $empty,
- // onDisable: $empty,
- style: null
- },
-
- style: {
- base: null,
- active: null,
- disabled: null,
- focused: null,
- hidden: null
- },
-
- initialize: function(options){
- if (options) this.setOptions(options);
-
- if (this.options.style) this.style = $merge(this.style, this.options.style);
-
- this.prefix = this.ns + '-' + this.name;
- this.element = new Element('div');
- this.element.addClass(this.ns).addClass(this.prefix);
-
- this.style.now = $unlink(this.style.base);
-
- // initial render
- this.render();
- },
-
- // render placeholder
-
- render: function(style){
- if (style) $extend(this.style.now, style);
-
- this.element.setStyles(this.style.now);
- return this;
- },
-
- // special states
-
- hide: function(){
- if (!this.hidden){
- this.hidden = true;
- this.fireEvent('hide');
- this.element.addClass(this.prefix + '-hidden');
- this.render(this.style.hidden);
- }
- return this;
- },
-
- activate: function(){
- if (!this.active){
- this.active = true;
- this.fireEvent('activate');
- this.element.addClass(this.prefix + '-active');
- this.render(this.style.active);
- }
- return this;
- },
-
- focus: function(){
- if (!this.focused){
- this.focused = true;
- this.fireEvent('focus');
- this.element.addClass(this.prefix + '-focused');
- this.render(this.style.focused);
- }
- return this;
- },
-
- disable: function(){
- if (!this.disabled){
- this.disabled = true;
- this.fireEvent('disable');
- this.element.addClass(this.prefix + '-disabled');
- this.render(this.style.disabled);
- }
- return this;
- },
-
- // normal states
-
- show: function(){
- if (this.hidden){
- this.hidden = false;
- this.fireEvent('show');
- this.element.removeClass(this.prefix + '-hidden');
- this.render(this.style.base);
- }
- return this;
- },
-
- deactivate: function(){
- if (this.active){
- this.active = false;
- this.fireEvent('deactivate');
- this.element.removeClass(this.prefix + '-active');
- this.render(this.style.base);
- }
- return this;
- },
-
- blur: function(){
- if (this.focused){
- this.focused = false;
- this.fireEvent('blur');
- this.element.removeClass(this.prefix + '-focused');
- this.render(this.style.base);
- }
- return this;
- },
-
- enable: function(){
- if (this.disabled){
- this.disabled = false;
- this.fireEvent('enable');
- this.element.removeClass(this.prefix + '-disabled');
- this.render(this.style.base);
- }
- return this;
- },
-
- // toElement
-
- toElement: function(){
- return this.element;
- }
-
-});
Oops, something went wrong.

0 comments on commit b86d7b1

Please sign in to comment.