home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 2010 Software/Programs / PCGuia_programas.iso / Software / Utils / Livebrush / Install-LivebrushLite.air / livebrush.swf / scripts / com / livebrush / ui / BrushPropsModel.as < prev    next >
Encoding:
Text File  |  2009-10-26  |  2.6 KB  |  87 lines

  1. package com.livebrush.ui
  2. {
  3.    import com.livebrush.data.FileManager;
  4.    import com.livebrush.data.Settings;
  5.    import com.livebrush.events.*;
  6.    import com.livebrush.styles.StyleManager;
  7.    import com.livebrush.utils.Update;
  8.    
  9.    public class BrushPropsModel extends UIModel
  10.    {
  11.       public static const BEHAVIOR:String = "behavorProps";
  12.       
  13.       public var lineStyleView:LineStyleView;
  14.       
  15.       public var currentGroup:int = 0;
  16.       
  17.       public var decoStyleView:DecoStyleView;
  18.       
  19.       public var brushBehaveView:BrushBehaveView;
  20.       
  21.       public var brushPropsView:BrushPropsView;
  22.       
  23.       public var propGroups:Array;
  24.       
  25.       public var ui:UI;
  26.       
  27.       public function BrushPropsModel(ui:UI)
  28.       {
  29.          super();
  30.          this.ui = ui;
  31.          this.init();
  32.       }
  33.       
  34.       public function toggleProps(index:int) : void
  35.       {
  36.          this.currentGroup = index;
  37.          updateViews(Update.uiUpdate());
  38.       }
  39.       
  40.       public function pullStyleProps() : void
  41.       {
  42.          var settings:Settings = new Settings();
  43.          settings.list = this.ui.styleListView.settings;
  44.          settings.behavior = this.brushBehaveView.settings;
  45.          settings.line = this.lineStyleView.settings;
  46.          settings.deco = this.decoStyleView.settings;
  47.          this.styleManager.pullStyle(settings);
  48.       }
  49.       
  50.       public function removeStyle(id:int) : void
  51.       {
  52.          this.ui.styleManager.removeStyle(id);
  53.       }
  54.       
  55.       private function init() : void
  56.       {
  57.          this.brushPropsView = BrushPropsView(registerView(new BrushPropsView(this)));
  58.          this.brushBehaveView = BrushBehaveView(registerView(new BrushBehaveView(this)));
  59.          this.lineStyleView = LineStyleView(registerView(new LineStyleView(this)));
  60.          this.decoStyleView = DecoStyleView(registerView(new DecoStyleView(this)));
  61.          this.propGroups = [this.brushBehaveView,this.lineStyleView,this.decoStyleView];
  62.          this.toggleProps(0);
  63.       }
  64.       
  65.       public function createStyle(name:String = null) : void
  66.       {
  67.          this.styleManager.createStyle(name == null || name == "" ? this.styleManager.activeStyle.name : name);
  68.       }
  69.       
  70.       public function importStyle() : void
  71.       {
  72.          this.ui.main.importToProject(FileManager.STYLE);
  73.       }
  74.       
  75.       public function get styleManager() : StyleManager
  76.       {
  77.          return this.ui.styleManager;
  78.       }
  79.       
  80.       public function exportStyle() : void
  81.       {
  82.          this.ui.main.export(FileManager.STYLE);
  83.       }
  84.    }
  85. }
  86.  
  87.