From f6a8be8006af1298d33fcf4318a411d18cd7b4b6 Mon Sep 17 00:00:00 2001 From: yomguy Date: Tue, 15 Mar 2011 15:17:12 +0000 Subject: [PATCH] add divmarker.js --- timeside/ui/src/divmarker.js | 266 +++++++++++++++++++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 timeside/ui/src/divmarker.js diff --git a/timeside/ui/src/divmarker.js b/timeside/ui/src/divmarker.js new file mode 100644 index 0000000..a38f0ff --- /dev/null +++ b/timeside/ui/src/divmarker.js @@ -0,0 +1,266 @@ +/** + * TimeSide - Web Audio Components + * Copyright (c) 2008-2009 Samalyse + * Author: Riccardo Zaccarelli + * License: GNU General Public License version 2.0 + */ + +TimeSide(function($N, $J) { + + $N.Class.create("DivMarker", $N.Core, { + //static constant variables to retireve the Marker Html Elements (MHE) + //to be used with the function below getHtmElm, eg: + //getHtmElm(marker, this.MHE_OFFSET_LABEL) + e_indexLabel:null, + e_descriptionText:null, + e_offsetLabel:null, + e_deleteButton:null, + e_okButton:null, + e_header:null, + e_editButton:null, + e_titleText:null, + me:null, + markerMap:null, + markerIndex:-1, + //static constant variables for edit mode: + EDIT_MODE_SAVED:0, + EDIT_MODE_EDIT_TEXT:1, + EDIT_MODE_MARKER_MOVED:2, + + initialize: function($super, markermap) { + $super(); + //sets the fields required???? see ruler.js createPointer + this.configure({ + //why instantiating a variable to null? + parent: [null, 'required'] + }); + this.cfg.parent = $J("#markers_div_id"); + this.markerMap = markermap; + this.me = this.createDiv(); + //set the index insert the div and set events on elements + //this.setIndex(insertionIndex); + }, + + + //creates a new div. By default, text is hidden and edit button is visible + createDiv: function(){ + + var div = this.cfg.parent; + var markerDiv; + if(div){ + + + //var indexLabel, descriptionText, offsetLabel, deleteButton, okButton, header, editButton, descriptionLabel; + var margin = '1ex'; + + //index label + this.e_indexLabel = $J('') + .addClass('markersdivIndexLabel') + .addClass('markersdivTopElement'); + + //offset label + this.e_offsetLabel = $J('') + .addClass('markersdivTopElement') + .addClass('markersdivOffset') + + + //title text + this.e_titleText = $J('') + .attr('type','text') + .addClass('markersdivTitle') + .addClass('markersdivTopElement') + + + //close button + this.e_deleteButton = $J('') + .addClass('markersdivDelete') + .addClass('markersdivTopElement') + .attr('title','delete marker') + .attr("href","#") + + //edit button + this.e_editButton = $J('') + .addClass('roundBorder4') + .addClass('markersdivEdit') + .addClass('markersdivTopElement') + .attr('title','edit marker description') + .attr("href","#") + .html('EDIT') + + + //add all elements to header: + this.e_header = $J('
') + .append(this.e_indexLabel) + .append(this.e_offsetLabel) + .append(this.e_titleText) + .append(this.e_deleteButton) + .append(this.e_editButton); + + //description text + this.e_descriptionText = $J('