Пример #1
0
        public MusicTrack(
            EditorFile file,
            IStorageObject storage,
            TrackControllerSettings settings
            ) : base(
                storage.ID,
                file
                )
        {
            melody           = new MelodyTrack(storage.GetOrMake("melody").ID, file);
            rhythm           = new RhythmTrack(storage.GetOrMake("rhythm").ID, file);
            adornment        = new AdornmentTrack(storage.GetOrMake("adornment").ID, file);
            tempo            = new TempoTrack(storage.GetOrMake("tempo").ID, file);
            memory           = new PerceptualMemory();
            propertygraphlet = new StoragePropertyGraphlet <NoteID>(storage, propertymanager);
            propertymanager  = settings.PropertyManager;

            this.settings = settings;

            melody.FieldChanged += Melody_FieldChanged;
            rhythm.MeterSignatures.FieldChanged  += MeterSignatures_FieldChanged;
            rhythm.TimeSignatures.FieldChanged   += TimeSignatures_FieldChanged;
            adornment.KeySignatures.FieldChanged += KeySignatures_FieldChanged;
            adornment.Staffs.FieldChanged        += Staffs_FieldChanged;

            if (!storage.HasChild("state") || storage.Get("state").ReadAllString() != "inited")
            {
                Init();
                storage.GetOrMake("state").WriteAllString("inited");
            }

            Init_memory();
        }
        public TrackControllerContainer(
            StorageObjectID storageobjectID,
            EditorFile file,
            IFactory <IContainer> factory,

            FactorySet <ITrack> tracks_factoryset,
            ViewerSet <ITrack> tracks_viewerset,

            FactorySet <ITrackController> controllers_factoryset,
            ViewerSet <ITrackController> controllers_viewerset
            ) :
            base(
                storageobjectID,
                file,
                factory,
                ItemName,
                ItemCodeName
                )
        {
            var obj = file.Storage[storageobjectID];

            settings =
                new TrackControllerSettings(
                    obj.GetOrMake("settings"),
                    file
                    );

            tracks =
                new BoundList <ITrack>(
                    obj.GetOrMake("tracks").ID,
                    file,
                    tracks_factoryset,
                    tracks_viewerset
                    );

            controllers =
                new BoundList <ITrackController>(
                    obj.GetOrMake("controllers").ID,
                    file,
                    controllers_factoryset,
                    controllers_viewerset
                    );
        }