EVR.History.View.Level.Mode.Time = function(row, time, index, relative)
{
   this.row = row;
   this.index = index;
   this.relative = relative;
   this.glyphs = [];
   this.set_time_string(time);
   this.add();
}
EVR.History.View.Level.Mode.Time.prototype.set_time_string = function(time)
{
   if (time === null)
   {
      time = HISTORY_BLANK_TIME;
   }
   else
   {
      time = time.toString();
   }
   this.time = time;
}
EVR.History.View.Level.Mode.Time.prototype.add = function()
{
   var cell, style, font, glyph, row = this.row;
   var time = this.time;
   for (var ii = 0; ii < time.length; ii++)
   {
      cell = row.insertCell(-1);
      if (this.index < 3)
      {
	 cell.colSpan = ii == 3 || ii == 4 ? 3 : 2;
      }
      style = cell.style;
      style.background = this.select_color();
      style.padding = HISTORY_CELL_PADDING + " 0";
      font = HISTORY_FONT;
      size = this.select_size();
      ch = time.charAt(ii);
      glyph = new EVR.Text(cell, ch, font, null, size, this.relative);
      this.glyphs.push(glyph);
   }
}
EVR.History.View.Level.Mode.Time.prototype.select_color = function()
{
   var color, index = this.index;
   if (index < 3)
   {
      return HISTORY_TIME_COLORS[index];
   }
   return HISTORY_TIME_COLORS[3];
}
EVR.History.View.Level.Mode.Time.prototype.select_size = function()
{
   var color, index = this.index;
   if (index < 3)
   {
      return HISTORY_FONT_SIZES[index];
   }
   return HISTORY_FONT_SIZES[3];
}
EVR.History.View.Level.Mode.Time.prototype.draw = function()
{
   var glyphs = this.glyphs;
   for (var ii = 0; ii < glyphs.length; ii++)
   {
      glyphs[ii].set_font_size();
   }
}
EVR.History.View.Level.Mode.Time.prototype.toString = function()
{
   return "[object EVR.History.View.Level.Mode.Time]";
}
EVR.Menu.Cursor = function(container, indicator)
{
   this.container = container;
   this.attach_indicator(indicator);
   this.set_step();
}
EVR.Menu.Cursor.prototype.draw = function()
{
   this.indicator.draw();
}
EVR.Menu.Cursor.prototype.shape = function()
{
   this.indicator.shape();
}
EVR.Menu.Cursor.prototype.reset = function()
{
   this.indicator.place(0, 0);
}
EVR.Menu.Cursor.prototype.attach_indicator = function(indicator)
{
   this.indicator = indicator;
   this.indicator.set_container(this.container);
   this.indicator.place(0, 0);
   this.indicator.aligner.alignment = ALIGN_TOP_LEFT;
   this.indicator.append();
}
EVR.Menu.Cursor.prototype.set_step = function()
{
   this.step = BEAM_HEIGHT_RATIO + MENU_OPTION_MARGIN;
}
EVR.Menu.Cursor.prototype.get_width = function()
{
   return this.indicator.get_dimensions(true)[0];
}
EVR.Menu.Cursor.prototype.move = function(direction)
{
   this.indicator.move(null, direction * this.step);
}
EVR.Menu.Cursor.prototype.toString = function()
{
   return "[object EVR.Menu.Cursor]";
}
EVR.Menu.Option = function(
   container, dispatcher, index, text, width, height, margin, visible, command)
{
   EVR.Graphic.call(
      this, container, RATIO_HEIGHT, null, ALIGN_TOP_RIGHT,
      container.container);
   this.dispatcher = dispatcher;
   this.index = index;
   this.margin = margin;
   this.command = command;
   this.set_proportions(width, height);
   this.set_visibility(visible);
   this.set_text(text, OPTION_FONT_FAMILY, "#282828", OPTION_FONT_SIZE_RATIO);
   this.style();
   this.set_step();
   this.position(height);
}
EVR.Menu.Option.prototype = new EVR.Graphic;
EVR.Menu.Option.prototype.draw = function()
{
   EVR.Graphic.prototype.draw.call(this);
   this.set_line_height();
}
EVR.Menu.Option.prototype.position = function(height)
{
   var y = (height + this.margin) * this.index;
   this.place(null, y);
}
EVR.Menu.Option.prototype.set_visibility = function(visible)
{
   if (visible && !this.attached)
   {
      this.append();
   }
   else if (!visible && this.attached)
   {
      this.remove();
   }
}
EVR.Menu.Option.prototype.style = function()
{
   this.set_line_height();
   this.css.textAlign = "left";
   this.css.overflow = "hidden";
   this.css.whiteSpace = "nowrap";
   this.css.letterSpacing = 1;
   this.text.css.marginLeft = "7px";
}
EVR.Menu.Option.prototype.set_step = function()
{
   this.step = BEAM_HEIGHT_RATIO + MENU_OPTION_MARGIN;
}
EVR.Menu.Option.prototype.set_line_height = function()
{
   this.css.lineHeight = this.get_dimensions()[1] + "px";
}
EVR.Menu.Option.prototype.move = function(direction)
{
   EVR.Graphic.prototype.move.call(this, null, direction * this.step);
}
EVR.Menu.Option.prototype.execute = function()
{
   if (!!this.children)
   {
      this.container.set_options(this.children, true);
   }
   else
   {
      var dispatcher = this.dispatcher;
      var command = this.command;
      dispatcher[command.name].apply(dispatcher, command.parameters);
   }
}
EVR.Menu.Option.prototype.toString = function()
{
   return "[object EVR.Menu.Option]";
}
EVR.Menu.Command = function(node)
{
   this.name = "";
   this.parameters = [];
   this.parse(node);
}
EVR.Menu.Command.prototype.parse = function(node)
{
   this.name = node.getAttribute("action");
   var parameters = node.getElementsByTagName("parameter");
   for (var ii = 0; ii < parameters.length; ii++)
   {
      this.add_parameter(parameters[ii].firstChild.nodeValue);
   }
}
EVR.Menu.Command.prototype.add_parameter = function(value)
{
   this.parameters.push(value);
}
EVR.Menu.Command.prototype.toString = function()
{
   return "[object EVR.Menu.Command]";
}
54.221.76.68
54.221.76.68
54.221.76.68
 
June 5, 2016

↠ RSS Feed ↞