Example #1
0
 public BasePropertyMenu createPropertyMenu(object obj, bool instrument, NodeClick click)
 {
     if (obj is PartTreeNode && !instrument)
     {
         return(new PartProperties((PartTreeNode)obj, executor, click));
     }
     else if (obj is PartTreeNode && instrument)
     {
         return(new InstrumentProperties((PartTreeNode)obj, executor, click));
     }
     else if (obj is MeasureTreeNode)
     {
         return(new MeasureProperties((MeasureTreeNode)obj, executor, click));
     }
     else if (obj is ChordTreeNode)
     {
         return(new ChordProperties((ChordTreeNode)obj, executor, click));
     }
     else if (obj is NoteTreeNode)
     {
         return(new NoteProperties((NoteTreeNode)obj, executor, click));
     }
     else
     {
         return(null);
     }
 }
        public void executeChangeNotePositionNewChord(NodeClick click, int position)
        {
            selections.Position = position;
            selections.String   = info.Position.getStringFromYPosition((int)click.Point.Y);

            executeCommandBase(click, CommandType.ChangeNotePositionNewChord, UpdateType.UpdateMeasuresAtAndAfter, true, false);
        }
        public void continueChangeNoteFret(NodeClick click, int fret)
        {
            selections.Fret = fret;

            executeCommandBase(click, CommandType.ChangeNoteFret, UpdateType.UpdateChord, false, false);
            Updater.updateDrawing(click.NoteNodes.FirstOrDefault());
        }
        public void executeAddNoteToMeasure(NodeClick click, int position)
        {
            selections.Position = position;
            selections.String   = info.Position.getStringFromYPosition((int)click.Point.Y);

            executeFretMenuBase(continueAddNoteToMeasure, click);
        }
        public void runUpdate(NodeClick click, UpdateType update)
        {
            switch (update)
            {
            case UpdateType.UpdatePart:
                Updater.updatePartBounds(click.PartNode);
                break;

            case UpdateType.UpdateMeasuresAtAndAfter:
                MeasureTreeNode first_node = click.getFirstMeasureNodeByPosition();
                if (first_node == null)
                {
                    return;
                }

                MeasureTreeNode        prev_node = click.PartNode.getMeasureNodeAtPosition(first_node.getMeasure().Position.Index - 1);
                List <MeasureTreeNode> to_update = click.PartNode.getMeasureNodesAtAndAfterPosition(first_node.getMeasure().Position.Index);
                Updater.updateMeasureBoundsAtAndAfter(prev_node, to_update);
                break;

            case UpdateType.UpdateMeasure:
                Updater.updateMeasureBounds(click.MeasureNodes.FirstOrDefault());
                break;

            case UpdateType.UpdateChord:
                Updater.updateChordBounds(click.ChordNodes.FirstOrDefault());
                Updater.updateDrawing(click.ChordNodes.FirstOrDefault());
                break;

            case UpdateType.RedrawPart:
                Updater.updateRootDrawing();
                break;
            }
        }
        public void executeChangeInstrumentInfoFromProp(NodeClick click, InstrumentType type, int string_num)
        {
            selections.Instrument = type;
            selections.StringNum  = string_num;

            executeCommandBase(click, CommandType.ChangeInstrumentInfo, UpdateType.RedrawPart, false, false);
        }
 public void executeAddBendToNoteProp(NodeClick click, double amount, bool returns)
 {
     selections.BendAmount         = amount;
     selections.Returns            = returns;
     selections.SelectedEffectType = EffectType.Bend;
     executeAddEffectToNote(click);
 }
Example #8
0
 public TupletSelectEventArgs(NodeClick click, Action <NodeClick, NoteLength> command, TupletType type, NoteLength length)
 {
     Click    = click;
     Delegate = (c, l) => command(c, l);
     Type     = type;
     Length   = length;
 }
Example #9
0
 public PartMenuEventArgs(NodeClick click, bool instrument, int width, int height)
     : base(click)
 {
     InstrumentMenu = instrument;
     Width          = width;
     Height         = height;
 }
        public void executeNoteSelectMenuBase(Action <NodeClick> action, NodeClick click)
        {
            var args = new NoteSelectLaunchEventArgs(click, action);

            NoteSelectMenuLaunched?.Invoke(this, args);
            click.setHandled();
        }
Example #11
0
 public void populateFromClick(NodeClick click)
 {
     Clear();
     setSelected(click);
     refreshSelectedTree();
     SelectedView.setSelectedObjects(selected.ToList());
 }
        public void executeFretMenuBase(Action <NodeClick, int> action, NodeClick click)
        {
            var args = new IntMenuEventArgs(click, action);

            FretMenuLaunched?.Invoke(this, args);
            click.setHandled();
        }
        public void executeCommandBase(NodeClick click, CommandType type, UpdateType update, bool rebar, bool update_measure_heads)
        {
            click.populateCommandSelections(selections);
            IActionBuilder builder = ExecutorFactory.getBuilderFromType(type, selections);

            bool result = executor.executeCommand(builder);

            if (result)
            {
                Updater.populateMouseClick(click);
                if (update_measure_heads)
                {
                    click.PartNode.beginRedrawMeasureHeads();
                }
                runUpdate(click, update);
                if (rebar)
                {
                    Updater.rebarMeasures(click.MeasureNodes);
                }
                if (update_measure_heads)
                {
                    click.PartNode.endRedrawMeasureheads();
                }
            }

            click.setHandled();
            selections.Clear();
        }
        public void executeChangeMeasureTimeSigFromMenu(NodeClick click, int beats, NoteLength type)
        {
            selections.NumBeats = beats;
            selections.BeatType = type;

            executeChangeMeasureTimeSig(click);
        }
Example #15
0
 public void populateNodeClick(NodeClick click)
 {
     click.PartNode     = PartNode;
     click.MeasureNodes = MeasureNodes;
     click.ChordNodes   = ChordNodes;
     click.NoteNodes    = NoteNodes;
     click.EffectNode   = EffectNode;
 }
 public BendMenuStrategy(GuiCommandExecutor gui, NodeClick click, Bend bend)
     : base(gui, click, EffectType.Bend)
 {
     init_amount  = bend?.Amount ?? 1;
     init_returns = bend?.BendReturns ?? false;
     Amount       = init_amount.ToString();
     Returns      = init_returns;
 }
Example #17
0
 //this needs to recieve dimension updates
 public void launchMenu(ContinueCommandDelegate command, NodeClick click)
 {
     ContinueDelegate = command;
     Click            = click;
     Left             = Math.Max(0, (int)click.Point.X - WIDTH / 2);
     Top     = Math.Min((int)click.Point.Y + HEIGHT / 2 - scroll, screen - 2 * HEIGHT);
     Visible = Visibility.Visible;
 }
        public void executeChangeSongInfoFromProp(NodeClick click, string name, string artist, string album)
        {
            selections.Name   = name;
            selections.Artist = artist;
            selections.Album  = album;

            executeCommandBase(click, CommandType.ChangeSongInfo, UpdateType.RedrawPart, false, false);
        }
Example #19
0
        public ChordProperties(ChordTreeNode c, GuiCommandExecutor ex, NodeClick cl)
            : base(cl, ex)
        {
            chord = c.getChord();

            CurrentLength = chord.Length.NoteType.getStringFromNoteLength();
            Lengths       = NoteLengthExtensions.getAllLengthStrings();
        }
        public void executeRemoveEffectFromNote(NodeClick click, IEffect effect)
        {
            EffectTreeNode node = click.NoteNodes.First()?.findChild(effect) as EffectTreeNode;

            click.EffectNode = node;

            executeCommandBase(click, CommandType.RemoveNoteEffect, UpdateType.UpdateMeasure, false, false);
        }
Example #21
0
 public void resetFields()
 {
     Fret             = "0";
     Left             = 0;
     Top              = 0;
     Visible          = Visibility.Collapsed;
     ContinueDelegate = null;
     Click            = null;
 }
Example #22
0
        public void handleSetMeasureTimeSig()
        {
            var click = new NodeClick(default(Point));

            selected.populateNodeClick(click);

            executor.executeChangeMeasureTimeSig(click);
            selected.populateFromClick(click);
        }
        public void handleInstrumentPropertyMenu()
        {
            var click = new NodeClick(new Point(0, 0));

            click.PartNode = tree.Root as PartTreeNode;
            var args = new PartMenuEventArgs(click, true, Width, Height);

            PartMenuLaunched?.Invoke(this, args);
        }
Example #24
0
        public PartProperties(PartTreeNode node, GuiCommandExecutor ex, NodeClick click)
            : base(click, ex)
        {
            part = node.getPart();

            Name   = part.SongInfo.SongName;
            Artist = part.SongInfo.ArtistName;
            Album  = part.SongInfo.AlbumName;
        }
Example #25
0
 public void launchMenu(NodeClick new_click)
 {
     ref_click = new_click;
     Selected  = new_click.getFirstSelected();
     Visible   = Visibility.Visible;
     Left      = Math.Max(0, (int)new_click.Point.X - WIDTH / 2);
     //this needs to be improved somehow
     Top = Math.Min((int)new_click.Point.Y + HEIGHT / 2 - scroll, screen - HEIGHT * 4);
 }
        public InstrumentProperties(PartTreeNode n, GuiCommandExecutor ex, NodeClick cl)
            : base(cl, ex)
        {
            part = n.getPart();

            Instrument  = part.InstrumentInfo.Type.getStringFromInstrumentType();
            Instruments = InstrumentTypeExtensions.getAllInstrumentTypeStrings();

            Strings = part.InstrumentInfo.Strings.ToString();
        }
Example #27
0
        public void launchPartMenu(NodeClick node, int width, int height, bool instrument)
        {
            ref_click       = node;
            instrument_menu = instrument;

            Selected = node.PartNode;
            Visible  = Visibility.Visible;
            Left     = info.Dimensions.PageWidth / 2 - WIDTH / 2;
            Top      = HEIGHT;
        }
        public void executeChangeMultipleChordPositionNewMeasure(NodeClick click)
        {
            Part part = click.PartNode.getPart();

            selections.BPM      = part.DefaultBPM;
            selections.NumBeats = part.TimeSignature.NumberOfBeats;
            selections.BeatType = part.TimeSignature.BeatType;
            selections.Position = part.ModelCollection.Count();

            executeCommandBase(click, CommandType.ChangeMultipleChordPositionNewMeasure, UpdateType.UpdateMeasuresAtAndAfter, true, true);
        }
 public void executeAddEffectToNote(NodeClick click)
 {
     if (selections.SelectedEffectType == EffectType.Palm_Mute)
     {
         executeCommandBase(click, CommandType.AddPalmMuteEffect, UpdateType.UpdateMeasure, false, false);
     }
     else
     {
         executeCommandBase(click, CommandType.AddSingleNoteEffect, UpdateType.UpdateMeasure, false, false);
     }
 }
Example #30
0
        public void noteSelected(NodeClick click)
        {
            if (click.NoteNodes.Any())
            {
                NodeClick combined = createCombinedClick(click);
                continue_command?.Invoke(combined);
            }

            Visibility       = Visibility.Collapsed;
            initial_click    = null;
            continue_command = null;
        }