public CommandMoveSegmentsToGroup(List<Segment> movedSegments, Group targetGroup, int targetIndex)
        {
            #if DEBUG
                Console.WriteLine("CommandMoveSegmentsToGroup()  CTOR " + this.GetHashCode() + "  move " + movedSegments.Count + " to group " + targetGroup + " at index " + targetIndex);
            #endif

            _targetGroup = targetGroup;
            _targetIndex = targetIndex;
            _oldGroupContents = new Dictionary<Group, List<Segment>>();
            _affectedGroups = new List<Group>();
            _movedSegments = movedSegments.ToArray<Segment>();   // we need to copy the contents to make sure the List will not be cleared outside the Command, like when clearing the cut/paste-Buffer

            // create a list of all affected groups
            _affectedGroups.Add(_targetGroup);
            foreach (Segment snippet in _movedSegments)
            {
                if (!_affectedGroups.Contains(snippet.Group))
                {
                    _affectedGroups.Add(snippet.Group);
                }
            }

            string affectedGroupsString = " affectedGroups=";
            foreach(Group group in _affectedGroups)
            {
                affectedGroupsString += " ";
                affectedGroupsString +=  group.ToString();
            }

            #if DEBUG
                Console.WriteLine(affectedGroupsString);
            #endif
        }
Example #2
0
 public bool IsManualBridgeSegmentForSourceGroup(Group sourceGroup)
 {
     return (sourceGroup.ManualBridgeSnippetsOfTargetGroups.Contains(this));
 }
Example #3
0
 public void DeleteGroup(Group group)
 {
     if (group != _groups[0])    // the default group cannot be deleted
     {
         _groups.Remove(group);
     }
 }
Example #4
0
        public bool AddGroup(Group groupToAdd)
        {
            // the group name has to be unique
            foreach (Group group in _groups)
            {
                if (group.Name.Equals(groupToAdd.Name))
                    return false;
            }

            _groups.Add(groupToAdd);

            HashSet<Segment> allSnippets = GetSegmentsOfAllGroups();
            foreach (Segment snippet in allSnippets)
            {
                snippet.ThemeId = this.Id;
            }

            return true;
        }
Example #5
0
        public static Theme getTestTheme2()
        {
            Theme theme = new Theme(2, "Cave");
            theme.ThemeTypeInt = 1;
            Group groupStreicher = new Group(theme, "cave horns");
            Group groupChoir = new Group(theme, "cave choir");
            Segment snippetCaveHorns1 = new Segment(201, "cave_horns_1", (int)SegmentSuitability.start, 0.4f);
            Segment snippetCaveHorns2 = new Segment(202, "cave_horns_2", (int)SegmentSuitability.middle, 0.4f);
            Segment snippetCaveHorns3 = new Segment(203, "cave_horns_3", (int)SegmentSuitability.middle, 0.6f);
            Segment snippetCaveHorns4 = new Segment(204, "cave_horns_4", (int)SegmentSuitability.middle, 0.6f);
            Segment snippetCaveHorns5 = new Segment(205, "cave_horns_5", (int)SegmentSuitability.middle, 1.0f);
            Segment snippetCaveHorns6 = new Segment(206, "cave_horns_6", (int)SegmentSuitability.end, 1.0f);

            Segment snippetCaveChoir1 = new Segment(211, "cave_choir_1", (int)SegmentSuitability.start, 0.4f);
            Segment snippetCaveChoir2 = new Segment(212, "cave_choir_2", (int)SegmentSuitability.middle, 0.4f);
            Segment snippetCaveChoir3 = new Segment(213, "cave_choir_3", (int)SegmentSuitability.middle, 0.6f);
            Segment snippetCaveChoir4 = new Segment(214, "cave_choir_4", (int)SegmentSuitability.middle, 0.6f);
            Segment snippetCaveChoir5 = new Segment(215, "cave_choir_5", (int)SegmentSuitability.middle, 1.0f);
            Segment snippetCaveChoir6 = new Segment(216, "cave_choir_6", (int)SegmentSuitability.end, 1.0f);

            groupStreicher.AddSegment(snippetCaveHorns1);
            groupStreicher.AddSegment(snippetCaveHorns2);
            groupStreicher.AddSegment(snippetCaveHorns3);
            groupStreicher.AddSegment(snippetCaveHorns4);
            groupStreicher.AddSegment(snippetCaveHorns5);
            groupStreicher.AddSegment(snippetCaveHorns6);

            groupChoir.AddSegment(snippetCaveChoir1);
            groupChoir.AddSegment(snippetCaveChoir2);
            groupChoir.AddSegment(snippetCaveChoir3);
            groupChoir.AddSegment(snippetCaveChoir4);
            groupChoir.AddSegment(snippetCaveChoir5);
            groupChoir.AddSegment(snippetCaveChoir6);

            theme.AddGroup(groupStreicher);
            theme.AddGroup(groupChoir);

            return theme;
        }
Example #6
0
        public static Theme getTestTheme1()
        {
            Theme theme = new Theme(1, "Forest");
            theme.ThemeTypeInt = 1;
            Group groupStreicher = new Group(theme, "wald_streicher");
            Group groupChoir = new Group(theme, "wald_choir");
            Segment snippetWaldStreicher1 = new Segment(101, "wald_streicher_1", (int)SegmentSuitability.start, 0.4f);
            Segment snippetWaldStreicher2 = new Segment(102, "wald_streicher_2", (int)SegmentSuitability.middle, 0.4f);
            Segment snippetWaldStreicher3 = new Segment(103, "wald_streicher_3", (int)SegmentSuitability.middle, 0.6f);
            Segment snippetWaldStreicher4 = new Segment(104, "wald_streicher_4", (int)SegmentSuitability.end, 0.6f);
            Segment snippetWaldStreicher5 = new Segment(105, "wald_streicher_5", (int)SegmentSuitability.start, 1.0f);
            Segment snippetWaldStreicher6 = new Segment(106, "wald_streicher_6", (int)SegmentSuitability.end, 1.0f);

            Segment snippetWaldChoir1 = new Segment(111, "wald_choir_1", (int)SegmentSuitability.start, 0.4f);
            Segment snippetWaldChoir2 = new Segment(112, "wald_choir_2", (int)SegmentSuitability.middle, 0.4f);
            Segment snippetWaldChoir3 = new Segment(113, "wald_choir_3", (int)SegmentSuitability.middle, 0.6f);
            Segment snippetWaldChoir4 = new Segment(114, "wald_choir_4", (int)SegmentSuitability.start, 0.6f);
            Segment snippetWaldChoir5 = new Segment(115, "wald_choir_5", (int)SegmentSuitability.end, 1.0f);
            Segment snippetWaldChoir6 = new Segment(116, "wald_choir_6", (int)SegmentSuitability.end, 1.0f);

            groupStreicher.AddSegment(snippetWaldStreicher1);
            groupStreicher.AddSegment(snippetWaldStreicher2);
            groupStreicher.AddSegment(snippetWaldStreicher3);
            groupStreicher.AddSegment(snippetWaldStreicher4);
            groupStreicher.AddSegment(snippetWaldStreicher5);
            groupStreicher.AddSegment(snippetWaldStreicher6);

            groupChoir.AddSegment(snippetWaldChoir1);
            groupChoir.AddSegment(snippetWaldChoir2);
            groupChoir.AddSegment(snippetWaldChoir3);
            groupChoir.AddSegment(snippetWaldChoir4);
            groupChoir.AddSegment(snippetWaldChoir5);
            groupChoir.AddSegment(snippetWaldChoir6);

            theme.AddGroup(groupStreicher);
            theme.AddGroup(groupChoir);

            return theme;
        }
Example #7
0
 public bool CheckIfThereIsAtLeastOneBridgeSnippetFromSourceGroupToTargetGroup(Group sourceGroup, Group targetGroup)
 {
     return (targetGroup.ContainsAtLeastOneAutomaticBridgeSegment() || targetGroup.ContainsAtLeastOneManualBridgeSegmentForSourceGroup(sourceGroup));
 }
Example #8
0
 public bool CheckIfSnippetIsManualBridgeSnippetForSourceGroup(Segment snippet, Group sourceGroup)
 {
     return (sourceGroup.ManualBridgeSnippetsOfTargetGroups.Contains(snippet));
 }
 public CommandAddSegments(PsaiProject psaiProject, string[] filenames, Group parentGroup)
 {
     _psaiProject = psaiProject;
     _filenames = filenames;
     _parentGroup = parentGroup;
 }
 public EventArgs_BridgeSegmentToggled(Segment snippet, Group sourceGroup)
 {
     _segment = snippet;
     _sourceGroup = sourceGroup;
 }
 internal CommandRevertBridgeSnippet(Segment snippet, Group sourceGroup)
 {
     _snippet = snippet;
     _sourceGroup = sourceGroup;
 }
 internal CommandDeclareManualBridgeSegment(Segment snippet, Group sourceGroup)
 {
     _snippet = snippet;
     _sourceGroup = sourceGroup;
 }
 internal CommandDeleteGroup(PsaiProject project, Group groupToDelete)
 {
     _psaiProject = project;
     _entityToDelete = groupToDelete;
     _groupToDelete = groupToDelete;
 }
Example #14
0
        public bool HasAtLeastOneBridgeSegmentToTargetGroup(Group targetGroup)
        {
            // 1. check for manual bridge Segments
            foreach (Segment bridgeSnippet in _manualBridgeSnippetsOfTargetGroups)
            {
                if (bridgeSnippet.Group == targetGroup)
                    return true;
            }

            // 2. check for Automatic Bridge Segments
            return (targetGroup.ContainsAtLeastOneAutomaticBridgeSegment());
        }
Example #15
0
        public bool ContainsAtLeastOneManualBridgeSegmentForSourceGroup(Group sourceGroup)
        {
            foreach (Segment bridgeSnippet in sourceGroup.ManualBridgeSnippetsOfTargetGroups)
            {
                if (bridgeSnippet.Group == this)
                    return true;
            }

            return false;
        }