Ejemplo n.º 1
0
        public ControllerConfigScreen(Skin skin)
            : base(skin)
        {
            _CurrentName = new BigButton(Skin);
              _CurrentName.Bounds = new Rectangle(10, 10, ClientSize.Width-20, 32);
              _CurrentName.Text = "Name: ";
              _CurrentName.Click += new EventHandler(EditName);
              _CurrentName.Parent = this;

              _CurrentCC = new BigButton(Skin);
              _CurrentCC.Bounds = new Rectangle(10, 50, ClientSize.Width-20, 32);
              _CurrentCC.Text = "CC: ";
              _CurrentCC.Click += new EventHandler(EditCC);
              _CurrentCC.Parent = this;

              _OK = new BigButton(Skin);
              _OK.BackColor = Color.DarkGreen;
              _OK.Bounds = new Rectangle(10, 90, ClientSize.Width/2-15, 32);
              _OK.Text = "OK";
              _OK.Click += new EventHandler(OnOK);
              _OK.Parent = this;

              _Cancel = new BigButton(Skin);
              _Cancel.BackColor = Color.DarkRed;
              _Cancel.Bounds = new Rectangle(ClientSize.Width/2+5, 90, ClientSize.Width/2-15, 32);
              _Cancel.Text = "Cancel";
              _Cancel.Click += new EventHandler(OnCancel);
              _Cancel.Parent = this;
        }
Ejemplo n.º 2
0
        public SelectionScreen(Skin skin)
            : base(skin)
        {
            _Items = new ArrayList();
              _Page = 0;

              _Item = new BigButton[7];
              for(int i = 0; i < 7; i++) {
            _Item[i] = new BigButton(Skin);
            _Item[i].Bounds = new Rectangle(10, 10+i*40, ClientSize.Width-20, 32);
            _Item[i].Click += new EventHandler(OnChoose);
            _Item[i].Parent = this;
              }

              _PrevPage = new BigButton(Skin);
              _PrevPage.Bounds = new Rectangle(10, 290, ClientSize.Width/4-20, 32);
              _PrevPage.Text = "<";
              _PrevPage.Click += new EventHandler(OnPrevPage);
              _PrevPage.Parent = this;

              _NextPage = new BigButton(Skin);
              _NextPage.Bounds = new Rectangle(_PrevPage.Bounds.Right+10, 290, ClientSize.Width/4-20, 32);
              _NextPage.Text = ">";
              _NextPage.Click += new EventHandler(OnNextPage);
              _NextPage.Parent = this;

              _Cancel = new BigButton(Skin);
              _Cancel.BackColor = Color.DarkRed;
              _Cancel.Bounds = new Rectangle(ClientSize.Width/2+5, 290, ClientSize.Width/2-15, 32);
              _Cancel.Text = "Cancel";
              _Cancel.Click += new EventHandler(OnCancel);
              _Cancel.Parent = this;
        }
Ejemplo n.º 3
0
 public static TextInputScreen GetTextInputScreen(Skin skin)
 {
     if(_TextInputScreen == null) {
     _TextInputScreen = new TextInputScreen(skin);
       } else {
     if(_TextInputScreen.Skin != skin) {
       _TextInputScreen.Skin = skin;
     }
       }
       return _TextInputScreen;
 }
Ejemplo n.º 4
0
 public static SelectionScreen GetSelectionScreen(Skin skin)
 {
     if(_SelectionScreen == null) {
     _SelectionScreen = new SelectionScreen(skin);
       } else {
     if(_SelectionScreen.Skin != skin) {
       _SelectionScreen.Skin = skin;
     }
       }
       return _SelectionScreen;
 }
Ejemplo n.º 5
0
 public static NumberInputScreen GetNumberInputScreen(Skin skin)
 {
     if(_NumberInputScreen == null) {
     _NumberInputScreen = new NumberInputScreen(skin);
       } else {
     if(_NumberInputScreen.Skin != skin) {
       _NumberInputScreen.Skin = skin;
     }
       }
       return _NumberInputScreen;
 }
Ejemplo n.º 6
0
        public XyPad(Skin skin)
            : base(skin)
        {
            AdditionalProperty propSpeed = new AdditionalProperty();
              propSpeed.Name = "speed";
              propSpeed.Label = "Speed";
              propSpeed.Min = 0;
              propSpeed.Max = 10;
              propSpeed.Value = 0;
              _Config.AdditionalProperties.Add(propSpeed);

              AdditionalProperty propRestX = new AdditionalProperty();
              propRestX.Name = "restx";
              propRestX.Label = "Rest X";
              propRestX.Min = 0;
              propRestX.Max = 127;
              propRestX.Value = 64;
              _Config.AdditionalProperties.Add(propRestX);

              AdditionalProperty propRestY = new AdditionalProperty();
              propRestY.Name = "resty";
              propRestY.Label = "Rest Y";
              propRestY.Min = 0;
              propRestY.Max = 127;
              propRestY.Value = 64;
              _Config.AdditionalProperties.Add(propRestY);

              _Config.CCMeaning = "X";
              _Config.CC2Meaning = "Y";

              BackToRest = new Timer();
              BackToRest.Interval = 20;
              BackToRest.Tick += new EventHandler(BackToRest_Tick);

              Width = 138;
              Height = 138;

              _BackBrush = new SolidBrush(Color.Black);
              _SelBrush = new SolidBrush(Color.Red);
              _BackRect = new Rectangle(1, 11, Width-2, 127);
              _SelRect = new Rectangle(1, 30, 34, 30);
              _Value = 64;
              _Value2 = 64;
              CalcSelRect();

              _MagentaKiller = new ImageAttributes();
              _MagentaKiller.SetColorKey(Color.Magenta, Color.Magenta);

              this.MouseDown += new MouseEventHandler(OnMouseDown);
              this.MouseMove += new MouseEventHandler(OnMouseMove);
              this.MouseUp += new MouseEventHandler(OnMouseUp);
              CalcSelRect();
        }
Ejemplo n.º 7
0
        public PushButton(Skin skin)
            : base(skin)
        {
            Width = 36;
              Height = 45;

              _BlackBrush = new SolidBrush(Color.Black);

              _MagentaKiller = new ImageAttributes();
              _MagentaKiller.SetColorKey(Color.Magenta, Color.Magenta);

              this.MouseDown += new MouseEventHandler(OnMouseDown);
              InitGraphics();
        }
Ejemplo n.º 8
0
        public ScreenBase(Skin skin)
            : base()
        {
            _Skin = skin;
              BackColor = _Skin.BackgroundColor;

              if(System.Environment.OSVersion.Platform != PlatformID.WinCE) {
            Width = 240;
            Height = 320 + 34;
              } else {
            this.WindowState = FormWindowState.Maximized;
            this.FormBorderStyle = FormBorderStyle.None;
            this.ControlBox = false;
            this.Menu = null;
              }
        }
Ejemplo n.º 9
0
        public PushButton(Skin skin)
            : base(skin)
        {
            _Config.CCMeaning = "normal";
              _Config.CC2Meaning = "inverted";

              Width = 36;
              Height = 45;

              _BlackBrush = new SolidBrush(Color.Black);

              _MagentaKiller = new ImageAttributes();
              _MagentaKiller.SetColorKey(Color.Magenta, Color.Magenta);

              this.MouseDown += new MouseEventHandler(OnMouseDown);
              InitGraphics();
        }
Ejemplo n.º 10
0
        public NumberInputScreen(Skin skin)
            : base(skin)
        {
            // keyboard
              string[] kbd = new string[12] {
            "1", "2", "3",
            "4", "5", "6",
            "7", "8", "9",
            "<", "0", "«"
              };
              _Keyboard = new BigButton[12];
              for(int r = 0; r < 4; r++) {
            for(int c = 0; c < 3; c++) {
              int i = r*3+c;
              string t = kbd[i];
              int x = 23*4 + 23*c;
              int y = 50 + 23*r;
              _Keyboard[i] = new BigButton(Skin);
              _Keyboard[i].Bounds = new Rectangle(x, y, 22, 22);
              _Keyboard[i].Text = t;
              _Keyboard[i].Click += new EventHandler(OnKeypress);
              _Keyboard[i].Parent = this;
            }
              }

              _Display = new BigButton(Skin);
              _Display.Bounds = new Rectangle(10, 10, ClientSize.Width-20, 32);
              _Display.Text = _String;
              _Display.Parent = this;

              _OK = new BigButton(Skin);
              _OK.BackColor = Color.DarkGreen;
              _OK.Bounds = new Rectangle(10, 150, ClientSize.Width/2-15, 32);
              _OK.Text = "OK";
              _OK.Click += new EventHandler(OnOK);
              _OK.Parent = this;

              _Cancel = new BigButton(Skin);
              _Cancel.BackColor = Color.DarkRed;
              _Cancel.Bounds = new Rectangle(ClientSize.Width/2+5, 150, ClientSize.Width/2-15, 32);
              _Cancel.Text = "Cancel";
              _Cancel.Click += new EventHandler(OnCancel);
              _Cancel.Parent = this;
        }
Ejemplo n.º 11
0
        public TextInputScreen(Skin skin)
            : base(skin)
        {
            // keyboard
              string[] kbd = new string[40] {
            "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
            "q", "w", "e", "r", "t", "y", "u", "i", "o", "p",
            "a", "s", "d", "f", "g", "h", "j", "k", "l", "<",
            "z", "x", "c", "v", "b", "n", "m", "-", ".", "«"
              };
              _Keyboard = new BigButton[40];
              for(int r = 0; r < 4; r++) {
            for(int c = 0; c < 10; c++) {
              int i = r*10+c;
              string t = kbd[i];
              int x = 23*c;
              int y = 50 + 23*r;
              _Keyboard[i] = new BigButton(Skin);
              _Keyboard[i].Bounds = new Rectangle(x, y, 22, 22);
              _Keyboard[i].Text = t;
              _Keyboard[i].Click += new EventHandler(OnKeypress);
              _Keyboard[i].Parent = this;
            }
              }

              _Display = new BigButton(Skin);
              _Display.Bounds = new Rectangle(10, 10, ClientSize.Width-20, 32);
              _Display.Text = _String;
              _Display.Parent = this;

              _OK = new BigButton(Skin);
              _OK.BackColor = Color.DarkGreen;
              _OK.Bounds = new Rectangle(10, 150, ClientSize.Width/2-15, 32);
              _OK.Text = "OK";
              _OK.Click += new EventHandler(OnOK);
              _OK.Parent = this;

              _Cancel = new BigButton(Skin);
              _Cancel.BackColor = Color.DarkRed;
              _Cancel.Bounds = new Rectangle(ClientSize.Width/2+5, 150, ClientSize.Width/2-15, 32);
              _Cancel.Text = "Cancel";
              _Cancel.Click += new EventHandler(OnCancel);
              _Cancel.Parent = this;
        }
Ejemplo n.º 12
0
        public Fader(Skin skin)
            : base(skin)
        {
            Width = 36;
              Height = 138;

              _BackBrush = new SolidBrush(Color.Black);
              _SelBrush = new SolidBrush(Color.Red);
              _BackRect = new Rectangle(1, 11, Width-2, 127);
              _SelRect = new Rectangle(1, 20, Width-2, 30);

              _MagentaKiller = new ImageAttributes();
              _MagentaKiller.SetColorKey(Color.Magenta, Color.Magenta);

              this.MouseDown += new MouseEventHandler(OnMouseDown);
              this.MouseMove += new MouseEventHandler(OnMouseMove);
              this.MouseUp += new MouseEventHandler(OnMouseUp);
              CalcSelRect();
        }
Ejemplo n.º 13
0
        public bool Load(string filename)
        {
            StreamReader file = new StreamReader(filename);
              string xml = file.ReadToEnd();
              file.Close();
              XmlDocument x = new XmlDocument();
              x.LoadXml(xml);
              foreach(XmlNode n in x.ChildNodes[0].ChildNodes) {

            if(n.NodeType == XmlNodeType.Element) {

              switch(n.Name) {
              case "Layout":
            Master.LoadLayout(n.Attributes["name"].Value);
            break;
              case "Skin":
            Skin skin = new Skin();
            skin.Load(n.Attributes["name"].Value);
            Master.ChangeSkin(skin);
            break;
              case "Controller":
            int id = Convert.ToInt32(n.Attributes["id"].Value);
            int cc = Convert.ToInt32(n.Attributes["cc"].Value);
            int value = Convert.ToInt32(n.Attributes["value"].Value);
            foreach(Control c in Master.Controls) {
              if(c is IMidiController) {
            IMidiController controller = (IMidiController) c;
            if(controller.ID == id) {
              controller.Config.Name = n.Attributes["name"].Value;
              controller.Config.CC = cc;
              controller.Value = value;
              Master.OnControlChange(controller, new EventArgs());
            }
              }
            }
            break;
              }
            }
              }
              return true;
        }
Ejemplo n.º 14
0
        public Pager(Skin skin)
            : base(skin)
        {
            _Pages = new ArrayList();

              Width = 72;
              Height = 45;

              _PrevPage = new BigButton(Skin);
              _PrevPage.Bounds = new Rectangle(4, 13, 31, 29);
              _PrevPage.Text = "<";
              _PrevPage.Click += new EventHandler(OnPrevPage);
              _PrevPage.Parent = this;

              _NextPage = new BigButton(Skin);
              _NextPage.Bounds = new Rectangle(39, 13, 31, 29);
              _NextPage.Text = ">";
              _NextPage.Click += new EventHandler(OnNextPage);
              _NextPage.Parent = this;

              this.MouseDown += new MouseEventHandler(OnMouseDown);
        }
Ejemplo n.º 15
0
        public BigButton(Skin skin)
            : base()
        {
            _RA = new Rectangle(0, 0, 0, 0);
              _RUL = new Rectangle(0, 0, 0, 0);
              _RUR = new Rectangle(0, 0, 0, 0);
              _RBL = new Rectangle(0, 0, 0, 0);
              _RBR = new Rectangle(0, 0, 0, 0);
              _RIH = new Rectangle(0, 0, 0, 0);
              _RIV = new Rectangle(0, 0, 0, 0);
              _TextRect = new RectangleF(0, 0, 0, 0);

              _BackBrush = new SolidBrush(Color.Gray);
              _ForeBrush = new SolidBrush(Color.White);

              _Skin = skin;

              this.Paint += new PaintEventHandler(OnPaint);
              this.Resize += new EventHandler(OnResize);
              if(System.Environment.OSVersion.Platform == PlatformID.WinCE) {
            OnResize(this, new EventArgs());
              }
        }
Ejemplo n.º 16
0
        public ConnectionScreen(Skin skin)
            : base(skin)
        {
            _Connection = new ConnectionDetails();

              _UseActiveSync = new BigButton(Skin);
              _UseActiveSync.Bounds = new Rectangle(10, 10, ClientSize.Width-20, 32);
              _UseActiveSync.Text = "Use ActiveSync";
              _UseActiveSync.Click += new EventHandler(SelectActiveSync);
              _UseActiveSync.Parent = this;

              _Host = new BigButton(Skin);
              _Host.Bounds = new Rectangle(10, 50, ClientSize.Width-20, 32);
              _Host.FitText("Use WLAN: ", _Connection.Host);
              _Host.Click += new EventHandler(EditHost);
              _Host.Parent = this;

              _Cancel = new BigButton(Skin);
              _Cancel.BackColor = Color.DarkRed;
              _Cancel.Bounds = new Rectangle(10, 290, ClientSize.Width-20, 32);
              _Cancel.Text = "Close";
              _Cancel.Click += new EventHandler(OnCancel);
              _Cancel.Parent = this;
        }
Ejemplo n.º 17
0
 public MidiControllerBase(Skin skin)
     : base()
 {
     _Skin = skin;
       _Config = new ControllerConfig();
       this.Paint += new PaintEventHandler(OnPaint);
       this.Resize += new EventHandler(OnResize);
       InitGraphics();
 }
Ejemplo n.º 18
0
 private void OnChooseSkin(object sender, EventArgs e)
 {
     SelectionScreen select = Global.GetSelectionScreen(Skin);
       select.Items.Clear();
       foreach(string file in Directory.GetFiles(AppPath + "\\Skins")) {
     if(file.ToLower().EndsWith(".xml")) {
       string name = Path.GetFileNameWithoutExtension(file);
       select.Items.Add(name);
     }
       }
       select.ShowPage();
       DialogResult r = select.ShowDialog();
       if(r == DialogResult.OK) {
     Skin skin = new Skin();
     skin.Load(select.Items[select.SelectedIndex].ToString());
     Master.ChangeSkin(skin);
     _ChooseSkin.Text = "Skin: " + Master.CurrentSkin.Name;
       }
 }
Ejemplo n.º 19
0
        public Client()
        {
            Assembly me = Assembly.GetExecutingAssembly();

              if(System.Environment.OSVersion.Platform != PlatformID.WinCE) {
            Width = 240;
            Height = 320 + 34;
              } else {
            this.WindowState = FormWindowState.Maximized;
            this.FormBorderStyle = FormBorderStyle.None;
            this.ControlBox = false;
            this.Menu = null;
              }

              _MagentaKiller = new ImageAttributes();
              _MagentaKiller.SetColorKey(Color.Magenta, Color.Magenta);

              _CurrentConnection = new ConnectionDetails();
              _CurrentConnection.UseActiveSync = true;

              // load default skin
              _DefaultSkin = new Skin();
              _DefaultSkin.Load("Default");

              // reload last settings
              string layout = "Default";
              string skin = "Default";
              _LastDeviceUsed = 0;
              if(File.Exists(AppPath + "\\Last.xml")) {
            StreamReader file = new StreamReader(AppPath + "\\Last.xml");
            string xml = file.ReadToEnd();
            file.Close();
            XmlDocument x = new XmlDocument();
            x.LoadXml(xml);
            foreach(XmlNode n in x.ChildNodes[0].ChildNodes) {
              if(n.NodeType == XmlNodeType.Element) {
            switch(n.Name) {
            case "Connection":
              _CurrentConnection.UseActiveSync = Convert.ToBoolean(n.Attributes["activesync"].Value);
              _CurrentConnection.Host = n.Attributes["host"].Value;
              _CurrentConnection.Port = Convert.ToInt32(n.Attributes["port"].Value);
              break;
            case "Layout":
              layout = n.Attributes["name"].Value;
              break;
            case "Skin":
              skin = n.Attributes["name"].Value;
              break;
            case "Device":
              _LastDeviceUsed = Convert.ToInt32(n.Attributes["id"].Value);
              break;
            }
              }
            }
              }

              CurrentSkin = new Skin();
              CurrentSkin.Load(skin, _DefaultSkin);

              this.BackColor = CurrentSkin.BackgroundColor;
              this.Text = String.Format("Theresa v{0}.{1}.{2}",
            me.GetName().Version.Major,
            me.GetName().Version.Minor,
            me.GetName().Version.Build
              );
              if(me.GetManifestResourceStream("Theresa.Mae.ico") != null) {
            this.Icon = new Icon(me.GetManifestResourceStream("Theresa.Mae.ico"));
              }

              if(me.GetManifestResourceStream("Theresa.Logo.png") != null) {
            _LogoBitmap = new Bitmap(me.GetManifestResourceStream("Theresa.Logo.png"));
              } else {
            _LogoBitmap = new Bitmap(87, 25);
              }
              _Logo = new Control();
              _Logo.BackColor = CurrentSkin.BackgroundColor;
              _Logo.Bounds = new Rectangle(0, 0, _LogoBitmap.Size.Width, _LogoBitmap.Size.Height);
              _Logo.Paint += new PaintEventHandler(PaintLogo);
              _Logo.Parent = this;

              _Quit = new BigButton(CurrentSkin);
              if(me.GetManifestResourceStream("Theresa.Button-Quit.png") != null) {
            _Quit.Picture = new Bitmap(me.GetManifestResourceStream("Theresa.Button-Quit.png"));
              }
              _Quit.BackColor = Color.DarkRed;
              _Quit.Bounds = new Rectangle(this.ClientSize.Width-25, 0, 24, 24);
              _Quit.Text = "Q";
              _Quit.Click += new EventHandler(OnQuit);
              _Quit.Parent = this;

              _Settings = new BigButton(CurrentSkin);
              if(me.GetManifestResourceStream("Theresa.Button-Configure.png") != null) {
            _Settings.Picture = new Bitmap(me.GetManifestResourceStream("Theresa.Button-Configure.png"));
              }
              _Settings.Bounds = new Rectangle(this.ClientSize.Width-50, 0, 24, 24);
              _Settings.Text = "C";
              _Settings.Click += new EventHandler(OnSettings);
              _Settings.Parent = this;

              _DisplayMode = new BigButton(CurrentSkin);
              if(me.GetManifestResourceStream("Theresa.Button-DisplayMode.png") != null) {
            _DisplayMode.Picture = new Bitmap(me.GetManifestResourceStream("Theresa.Button-DisplayMode.png"));
              }
              _DisplayMode.Bounds = new Rectangle(this.ClientSize.Width-75, 0, 24, 24);
              _DisplayMode.Text = "#";
              _DisplayMode.Click += new EventHandler(OnChangeDisplayMode);
              _DisplayMode.Parent = this;

              _SavePreset = new BigButton(CurrentSkin);
              if(me.GetManifestResourceStream("Theresa.Button-Save.png") != null) {
            _SavePreset.Picture = new Bitmap(me.GetManifestResourceStream("Theresa.Button-Save.png"));
              }
              _SavePreset.Bounds = new Rectangle(this.ClientSize.Width-100, 0, 24, 24);
              _SavePreset.Text = "S";
              _SavePreset.Click += new EventHandler(OnSavePreset);
              _SavePreset.Parent = this;

              _LoadPreset = new BigButton(CurrentSkin);
              if(me.GetManifestResourceStream("Theresa.Button-Quit.png") != null) {
            _LoadPreset.Picture = new Bitmap(me.GetManifestResourceStream("Theresa.Button-Load.png"));
              }
              _LoadPreset.Bounds = new Rectangle(this.ClientSize.Width-125, 0, 24, 24);
              _LoadPreset.Text = "L";
              _LoadPreset.Click += new EventHandler(OnLoadPreset);
              _LoadPreset.Parent = this;

              _TryToConnect = new System.Windows.Forms.Timer();
              _TryToConnect.Tick += new EventHandler(OnTryToConnect);
              _TryToConnect.Interval = 1000;
              _TryToConnect.Enabled = false;

              LoadLayout(layout);
              Connect();

              if(_Connected) {
            CurrentDevice = Devices[_LastDeviceUsed];
              } else {
            _Devices = new MidiDevice[0];
            _CurrentDevice = new MidiDevice();
            _CurrentDevice.ID = 0;
            _CurrentDevice.Name = "none";
            Console.WriteLine("Can't connect");
            // _TryToConnect.Enabled = true;
              }
        }
Ejemplo n.º 20
0
 public void ChangeSkin(Skin skin)
 {
     _CurrentSkin = skin;
       BackColor = skin.BackgroundColor;
       if(_Logo != null) _Logo.BackColor = CurrentSkin.BackgroundColor;
       foreach(Control c in Controls) {
     if(c is ISkinned) {
       ISkinned skinned = (ISkinned) c;
       skinned.Skin = CurrentSkin;
       c.Invalidate();
     }
       }
       Invalidate();
 }