/************************************

  "waka" is a Japanese poetry 
         composed of 31 syllables. 

  (c) 2005 Pixel-Apes.

  -----------------------------------

  REFACTOR!

*************************************/

function wakaDoTodo() { this.isTodo = true; }
         wakaDoTodo.prototype = new wakaTodo();
         wakaDoTodo.prototype.constructor = 
         wakaDoTodo;


// private (compilation)
wakaDoTodo.prototype._compile   = function()
{
  this._compileEditableStruct();

  // wrap to Editable
  this._editable = new deskDoEditable_todo( this.wf.desk, this.wf.desk.nextId() );
  this._editable.setData( this._data );
  this._editable._token = this;
  this._html = this._editable.buildWrapper( this._editable.buildViewMode() );
}


wakaDoTodo.prototype._compileEditableStruct   = function()
{
  var inner = this.wf.format( this._data.inner, 
              this.wf.defaultPreset );
  var glued = this.wf.formatTree( this._tree,
              this.wf.defaultPreset );

  this._data._tree  = this._tree;
  this._data._inner = inner;
  this._data._glued = glued;
  this._data._leadingBr = false;

  if (this._prev && !this._prev.isTodo && !this._parent)
    this._data._leadingBr = true;

  this._data._css = {
      main      : this.wf.cssPrefix + "todo" + this.wf.cssPostfix,
      completed : this.wf.cssPrefix + "todo-completed" + this.wf.cssPostfix,
      open      : this.wf.cssPrefix + "todo-open" + this.wf.cssPostfix,
      title     : this.wf.cssPrefix + "todo-title" + this.wf.cssPostfix
                    };

  return this._data;
}


