aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/tools-list.reel/tools-list.js
blob: ed4ee45f6a18a3960633d5d932a14d7497c64676 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* <copyright>
This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
(c) Copyright 2011 Motorola Mobility, Inc.  All Rights Reserved.
</copyright> */

var Montage = require("montage/core/core").Montage;
var Component = require("montage/ui/component").Component;

exports.ToolsList = Montage.create(Component, {

    SelectionTool:          { value: null },
    SubselectionTool:       { value: null },
    Rotate3DTool:           { value: null },
    Translate3DTool:        { value: null },
    TagTool:                { value: null },
    PenTool:                { value: null },
    TextTool:               { value: null },
    ShapeTool:              { value: null },
    OvalTool:               { value: null },
    RectTool:               { value: null },
    LineTool:               { value: null },
    BrushTool:              { value: null },
    FillTool:               { value: null },
    InkBottleTool:          { value: null },
    EraserTool:             { value: null },
    RotateStageTool3D:      { value: null },
    PanTool:                { value: null },
    ZoomTool:               { value: null },
    disabled:               { value: true},

    handleOpenDocument: {
        value: function(){
            this.disabled = false;
        }
    },

    handleCloseDocument: {
        value: function(){
            if(!this.application.ninja.documentController.activeDocument) {
                this.disabled = true;
            }
        }
    },

    prepareForDraw: {
        enumerable: false,
        value: function() {
            this.eventManager.addEventListener( "openDocument", this, false);
            this.eventManager.addEventListener( "closeDocument", this, false);
            this.PenTool.options = this.application.ninja.toolsProperties.shapeProperties.lineProperties;//this.application.Ninja.toolsProperties.penProperties;

            this.SelectionTool.options = this.application.ninja.toolsProperties.selectionProperties;
            this.SubselectionTool.options = this.application.ninja.toolsProperties.subSelectionProperties;

            this.Rotate3DTool.options = this.application.ninja.toolsProperties.rotate3DProperties;
            this.Translate3DTool.options = this.application.ninja.toolsProperties.rotate3DProperties;
            this.TagTool.options = this.application.ninja.toolsProperties.tagProperties;
            this.PenTool.options = this.application.ninja.toolsProperties.penProperties;
            this.TextTool.options = this.application.ninja.toolsProperties.textProperties;

            this.FillTool.options = this.application.ninja.toolsProperties.fillProperties;
            this.InkBottleTool.options = this.application.ninja.toolsProperties.inkbottleProperties;

            this.ShapeTool.options = this.application.ninja.toolsProperties.shapeProperties;
            this.OvalTool.options = this.application.ninja.toolsProperties.shapeProperties.ovalProperties;
            this.RectTool.options = this.application.ninja.toolsProperties.shapeProperties.rectProperties;
            this.LineTool.options = this.application.ninja.toolsProperties.shapeProperties.lineProperties;
            this.BrushTool.options = this.application.ninja.toolsProperties.brushProperties;
            
            this.EraserTool.options = this.application.ninja.toolsProperties.eraserProperties;
            this.RotateStageTool3D.options = this.application.ninja.toolsProperties.rotateStageProperties;
            this.PanTool.options = this.application.ninja.toolsProperties.panProperties;
            this.ZoomTool.options = this.application.ninja.toolsProperties.zoomProperties;

        }
    },

    action: {
        value: function(value, args) {
            if(this.application.toolsData.selectedTool.container) {
                this[this.application.toolsData.selectedTool.subtools[this.application.toolsData._selectedSubToolIndex].action][value](args);
            } else {
                this[this.application.toolsData.selectedTool.action][value](args);
            }

        }
    },

    prop: {
        value: function(value, args) {
            if(this.application.toolsData.selectedTool.container) {
                return this[this.application.toolsData.selectedTool.subtools[this.application.toolsData._selectedSubToolIndex].action][value];
            } else {
                return this[this.application.toolsData.selectedTool.action][value];
            }

        }
    }

});