Example #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;
        }
Example #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;
        }
Example #3
0
        public SettingsScreen(Client master)
            : base(master.CurrentSkin)
        {
            _Master = master;

              _ChooseDevice = new BigButton(Skin);
              _ChooseDevice.Bounds = new Rectangle(10, 10, ClientSize.Width-20, 32);
              // ChooseDevice.Text = "Device: " + Master.CurrentDevice.ToString();
              FitTextInButton(_ChooseDevice, "Device: ", Master.CurrentDevice.ToString());
              _ChooseDevice.Click += new EventHandler(OnChooseDevice);
              _ChooseDevice.Parent = this;

              _ChooseSkin = new BigButton(Skin);
              _ChooseSkin.Bounds = new Rectangle(10, 50, ClientSize.Width-20, 32);
              _ChooseSkin.Text = "Skin: " + Master.CurrentSkin.Name;
              _ChooseSkin.Click += new EventHandler(OnChooseSkin);
              _ChooseSkin.Parent = this;

              _ChooseLayout = new BigButton(Skin);
              _ChooseLayout.Bounds = new Rectangle(10, 90, ClientSize.Width-20, 32);
              _ChooseLayout.Text = "Layout: " + Master.CurrentLayout;
              _ChooseLayout.Click += new EventHandler(OnChooseLayout);
              _ChooseLayout.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;
        }
Example #4
0
 private void FitTextInButton(BigButton button, string prefix, string text)
 {
     int w = button.MeasureString(prefix+text);
       while(w > button.Width - 10) {
     text = "..." + text.Substring(4, text.Length-4);
     w = button.MeasureString(prefix+text);
       }
       button.Text = prefix+text;
 }
Example #5
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;
        }
Example #6
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;
        }
Example #7
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);
        }
Example #8
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;
        }
Example #9
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;
              }
        }
Example #10
0
 private void FitTextInButton(BigButton button, string text)
 {
     FitTextInButton(button, String.Empty, text);
 }
Example #11
0
        private void BuildAdditionalProperties()
        {
            foreach(BigButton b in _AdditionalButtons) {
            b.Parent = null;
              }
              _AdditionalButtons.Clear();

              int y = 130;
              foreach(AdditionalProperty prop in _Config.AdditionalProperties.Values) {
            BigButton b = new BigButton(Skin);
            b.Bounds = new Rectangle(10, y, ClientSize.Width-20, 32);
            b.Name = prop.Name;
            b.Text = prop.Label;
            b.Click += new EventHandler(EditAdditionalProperty);
            b.Parent = this;
            _AdditionalButtons.Add(b);
            y += 40;
              }
              _OK.Top = y;
              _Cancel.Top = y;
        }