コード例 #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);
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void continueChangeNoteFret(NodeClick click, int fret)
        {
            selections.Fret = fret;

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

            executeFretMenuBase(continueAddNoteToMeasure, click);
        }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
        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);
        }
コード例 #7
0
 public void executeAddBendToNoteProp(NodeClick click, double amount, bool returns)
 {
     selections.BendAmount         = amount;
     selections.Returns            = returns;
     selections.SelectedEffectType = EffectType.Bend;
     executeAddEffectToNote(click);
 }
コード例 #8
0
ファイル: MenuEvents.cs プロジェクト: NathanielBeen/GuitarTab
 public TupletSelectEventArgs(NodeClick click, Action <NodeClick, NoteLength> command, TupletType type, NoteLength length)
 {
     Click    = click;
     Delegate = (c, l) => command(c, l);
     Type     = type;
     Length   = length;
 }
コード例 #9
0
ファイル: MenuEvents.cs プロジェクト: NathanielBeen/GuitarTab
 public PartMenuEventArgs(NodeClick click, bool instrument, int width, int height)
     : base(click)
 {
     InstrumentMenu = instrument;
     Width          = width;
     Height         = height;
 }
コード例 #10
0
        public void executeNoteSelectMenuBase(Action <NodeClick> action, NodeClick click)
        {
            var args = new NoteSelectLaunchEventArgs(click, action);

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

            FretMenuLaunched?.Invoke(this, args);
            click.setHandled();
        }
コード例 #13
0
        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();
        }
コード例 #14
0
        public void executeChangeMeasureTimeSigFromMenu(NodeClick click, int beats, NoteLength type)
        {
            selections.NumBeats = beats;
            selections.BeatType = type;

            executeChangeMeasureTimeSig(click);
        }
コード例 #15
0
 public void populateNodeClick(NodeClick click)
 {
     click.PartNode     = PartNode;
     click.MeasureNodes = MeasureNodes;
     click.ChordNodes   = ChordNodes;
     click.NoteNodes    = NoteNodes;
     click.EffectNode   = EffectNode;
 }
コード例 #16
0
 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;
 }
コード例 #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;
 }
コード例 #18
0
        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);
        }
コード例 #19
0
        public ChordProperties(ChordTreeNode c, GuiCommandExecutor ex, NodeClick cl)
            : base(cl, ex)
        {
            chord = c.getChord();

            CurrentLength = chord.Length.NoteType.getStringFromNoteLength();
            Lengths       = NoteLengthExtensions.getAllLengthStrings();
        }
コード例 #20
0
        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);
        }
コード例 #21
0
 public void resetFields()
 {
     Fret             = "0";
     Left             = 0;
     Top              = 0;
     Visible          = Visibility.Collapsed;
     ContinueDelegate = null;
     Click            = null;
 }
コード例 #22
0
        public void handleSetMeasureTimeSig()
        {
            var click = new NodeClick(default(Point));

            selected.populateNodeClick(click);

            executor.executeChangeMeasureTimeSig(click);
            selected.populateFromClick(click);
        }
コード例 #23
0
        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);
        }
コード例 #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;
        }
コード例 #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);
 }
コード例 #26
0
        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();
        }
コード例 #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;
        }
コード例 #28
0
        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);
        }
コード例 #29
0
 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);
     }
 }
コード例 #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;
        }