Example #1
0
        private void InitializeComponent()
        {
            Bounds = LayoutManager.Instance.ControlPanelBounds;
            EnableDragging = false;
            SkinName = "control.panel";

            // Construct children
            arrowLeftButton = new SkinNamedButtonControl();
            arrowRightButton = new SkinNamedButtonControl();
            generateSongButton = new SkinNamedButtonControl();
            newButton = new SkinNamedButtonControl();
            openButton = new SkinNamedButtonControl();
            saveButton = new SkinNamedButtonControl();
            exportButton = new SkinNamedButtonControl();
            cutButton = new SkinNamedButtonControl();
            copyButton = new SkinNamedButtonControl();
            pasteButton = new SkinNamedButtonControl();
            undoButton = new SkinNamedButtonControl();
            redoButton = new SkinNamedButtonControl();
            addCellsButton = new SkinNamedButtonControl();
            removeCellsButton = new SkinNamedButtonControl();

            buttonsetBounds = LayoutManager.Instance.GetButtonsetBounds(12, 0);
            ResetButtonsetBounds();

            //
            // arrowLeftButton
            //
            arrowLeftButton.Bounds = LayoutManager.Instance.ControlArrowLeftBounds;
            arrowLeftButton.Pressed += new EventHandler(ArrowLeftPressed);
            arrowLeftButton.SkinName = "arrow.left";

            //
            // arrowRightButton
            //
            arrowRightButton.Bounds = LayoutManager.Instance.ControlArrowRightBounds;
            arrowRightButton.Pressed += new EventHandler(ArrowRightPressed);
            arrowRightButton.SkinName = "arrow.right";

            //
            // generateSongButton
            //
            generateSongButton.Pressed += new EventHandler(GenerateSongButtonPressed);
            generateSongButton.SkinName = "generate.song";

            //
            // newButton
            //
            newButton.Pressed += new EventHandler(NewButtonPressed);
            newButton.SkinName = "new";

            //
            // openButton
            //
            openButton.Pressed += new EventHandler(OpenButtonPressed);
            openButton.SkinName = "open";

            //
            // saveButton
            //
            saveButton.Pressed += new EventHandler(SaveButtonPressed);
            saveButton.SkinName = "save";

            //
            // exportButton
            //
            exportButton.Pressed += new EventHandler(ExportButtonPressed);
            exportButton.SkinName = "export";

            //
            // cutButton
            //
            cutButton.Pressed += new EventHandler(CutButtonPressed);
            cutButton.SkinName = "cut";

            //
            // copyButton
            //
            copyButton.Pressed += new EventHandler(CopyButtonPressed);
            copyButton.SkinName = "copy";

            //
            // pasteButton
            //
            pasteButton.Pressed += new EventHandler(PasteButtonPressed);
            pasteButton.SkinName = "paste";

            //
            // undoButton
            //
            undoButton.Pressed += new EventHandler(UndoButtonPressed);
            undoButton.SkinName = "undo";

            //
            // redoButton
            //
            redoButton.Pressed += new EventHandler(RedoButtonPressed);
            redoButton.SkinName = "redo";

            //
            // addButton
            //
            addCellsButton.Pressed += new EventHandler(AddCellsButtonPressed);
            addCellsButton.SkinName = "add.cells";

            //
            // removeButton
            //
            removeCellsButton.Pressed += new EventHandler(RemoveCellsButtonPressed);
            removeCellsButton.SkinName = "remove.cells";

            //
            // Add Children
            //
            Children.Add(arrowLeftButton);
            Children.Add(arrowRightButton);

            Children.Add(generateSongButton);
            Children.Add(newButton);
            Children.Add(openButton);
            Children.Add(saveButton);
            Children.Add(exportButton);
            Children.Add(cutButton);
            Children.Add(copyButton);
            Children.Add(pasteButton);
            Children.Add(undoButton);
            Children.Add(redoButton);
            Children.Add(addCellsButton);
            Children.Add(removeCellsButton);
        }
Example #2
0
        private void InitializeComponent()
        {
            Bounds = LayoutManager.Instance.ParametersPanelBounds;
            EnableDragging = false;
            SkinName = "parameters.panel";

            //
            // Contruct Children
            //
            globalRandomizeButton = new SkinNamedButtonControl();
            okButton = new SkinNamedButtonControl();
            cancelButton = new SkinNamedButtonControl();

            //
            // globalRandomizeButton
            //
            globalRandomizeButton.Bounds = LayoutManager.Instance.GlobalRandomizeButtonBounds;
            globalRandomizeButton.Pressed += new EventHandler(GlobalRandomizeButtonPressed);
            globalRandomizeButton.SkinName = "global.randomize";

            //
            // okButton
            //
            okButton.Bounds = LayoutManager.Instance.OkButtonBounds;
            okButton.Pressed += new EventHandler(OkButtonPressed);
            okButton.SkinName = "ok";

            //
            // cancelButton
            //
            cancelButton.Bounds = LayoutManager.Instance.CancelButtonBounds;
            cancelButton.Pressed += new EventHandler(CancelButtonPressed);
            cancelButton.SkinName = "cancel";

            //
            // Add Children
            //
            Children.Add(globalRandomizeButton);
            Children.Add(okButton);
            Children.Add(cancelButton);

            //
            // Dynamically create sliders for each of the input parameters that needs to be hooked up to a slider
            //
            foreach (PropertyInfo inputParameterInfo in typeof(InputParameters).GetProperties())
            {
                // Do something only if the current parameter is a ParameterWrapper<T>, where T implements ZeroOneParameter
                if (inputParameterInfo.PropertyType.IsGenericType
                    && inputParameterInfo.PropertyType.GetGenericArguments()[0].GetInterfaces().Length != 0
                    && inputParameterInfo.PropertyType.GetGenericArguments()[0].GetInterfaces()[0] == typeof(ZeroOneParameter))
                {
                    MethodInfo method = typeof(ParameterWrapperFactory).GetMethod(ParameterWrapperFactory.DoubleMethodName).MakeGenericMethod(inputParameterInfo.PropertyType.GetGenericArguments()[0]);

                    SkinNamedHorizontalSliderControl parameterSlider = new SkinNamedHorizontalSliderControl();
                    LayoutManager.Instance.Register(parameterSlider);
                    parameterSlider.ThumbSize = 0.1f;
                    parameterSlider.ThumbPosition = (float)(double)method.Invoke(null, new object[] { inputParameterInfo.GetGetMethod().Invoke(InputParameters.Instance, null) });
                    parameterSlider.Moved += new EventHandler(ParameterSliderMoved);
                    parameterSlider.SkinName = "navigator";

                    SkinNamedLabelControl sliderLabel = new SkinNamedLabelControl();
                    LayoutManager.Instance.Register(sliderLabel);
                    sliderLabel.Text = inputParameterInfo.Name;
                    sliderLabel.SkinName = "parameter";

                    Children.Add(parameterSlider);
                    Children.Add(sliderLabel);
                    slidersHookUp.Add(parameterSlider, inputParameterInfo);
                }
            }
        }
Example #3
0
        private void InitializeComponent()
        {
            Bounds = LayoutManager.Instance.NavigatorPanelBounds;
            EnableDragging = false;
            SkinName = "navigator.panel";

            //Contruct Children
            horizontalSlider = new SkinNamedHorizontalSliderControl();
            verticalSlider = new SkinNamedVerticalSliderControl();
            playPauseButton = new OptionControl();
            stopButton = new SkinNamedButtonControl();
            tempoLabel = new SkinNamedLabelControl();
            timeSignatureNLabel = new SkinNamedLabelControl();
            timeSignatureDLabel = new SkinNamedLabelControl();

            //
            // playPauseButton
            //
            playPauseButton.Bounds = LayoutManager.Instance.PlayPauseButtonBounds;
            playPauseButton.Changed += new EventHandler(PlayPauseButtonToggled);
            playPauseButton.Selected = false;

            //
            // stopButton
            //
            stopButton.Bounds = LayoutManager.Instance.StopButtonBounds;
            stopButton.Pressed += new EventHandler(StopButtonPressed);
            stopButton.SkinName = "stop";

            //
            // horizontalSlider
            //
            horizontalSlider.Bounds = LayoutManager.Instance.HorizontalScrollBarBounds;
            horizontalSlider.ThumbPosition = LayoutManager.Instance.HorizontalSliderThumbSize;
            horizontalSlider.Moved += new EventHandler(HorizontalSliderMoved);
            horizontalSlider.SkinName = "navigator";

            //
            // verticalSlider
            //
            verticalSlider.Bounds = LayoutManager.Instance.VerticalScrollBarBounds;
            verticalSlider.ThumbPosition = LayoutManager.Instance.VerticalSliderThumbSize;
            verticalSlider.Moved += new EventHandler(VerticalSliderMoved);
            verticalSlider.SkinName = "navigator";

            //
            // tempoLabel
            //
            tempoLabel.Bounds = LayoutManager.Instance.TempoLabelBounds;
            tempoLabel.Text = "Tempo: " + InputParameters.Instance.Tempo.ToString();
            tempoLabel.SkinName = "settings";

            //
            // timeSignatureNLabel
            //
            timeSignatureNLabel.Bounds = LayoutManager.Instance.TimeSignatureNLabelBounds;
            timeSignatureNLabel.Text = "Time Signature: " + InputParameters.Instance.TimeSignatureN.ToString();
            timeSignatureNLabel.SkinName = "settings";

            //
            // timeSignatureDLabel
            //
            timeSignatureDLabel.Bounds = LayoutManager.Instance.TimeSignatureDLabelBounds;
            timeSignatureDLabel.Text = InputParameters.Instance.TimeSignatureD.ToString();
            timeSignatureDLabel.SkinName = "settings";

            //Add Children
            Children.Add(playPauseButton);
            Children.Add(stopButton);
            Children.Add(horizontalSlider);
            Children.Add(verticalSlider);
            Children.Add(tempoLabel);
            Children.Add(timeSignatureNLabel);
            Children.Add(timeSignatureDLabel);
        }