Преглед на файлове

Fixing types & imports pt.2

Andrea Condoluci преди 9 години
родител
ревизия
5d3b9b9920

+ 1 - 1
src/MusicalScore/Instrument.ts

@@ -14,7 +14,7 @@ type InstrumentParameterChangedDelegate = any;
 
 export class Instrument extends InstrumentalGroup /*implements ISettableInstrument, IInstrument*/ {
     constructor(id: number, idString: string, phonicScoreInterface: IPhonicScoreInterface, musicSheet: MusicSheet, parent: InstrumentalGroup) {
-        super(musicSheet, parent);
+        super(undefined, musicSheet, parent);
         this.phonicScoreInterface = phonicScoreInterface;
         this.id = id;
         this.idString = idString;

+ 4 - 6
src/MusicalScore/InstrumentalGroup.ts

@@ -1,8 +1,6 @@
+import { MusicSheet } from "./MusicSheet"
+
 export class InstrumentalGroup {
-    constructor(musicSheet: MusicSheet, parent: InstrumentalGroup) {
-        this.musicSheet = musicSheet;
-        this.parent = parent;
-    }
     constructor(name: string, musicSheet: MusicSheet, parent: InstrumentalGroup) {
         this.name = name;
         this.musicSheet = musicSheet;
@@ -11,9 +9,9 @@ export class InstrumentalGroup {
     private name: string;
     private musicSheet: MusicSheet;
     private parent: InstrumentalGroup;
-    private instrumentalGroups: List<InstrumentalGroup> = new List<InstrumentalGroup>();
+    private instrumentalGroups: InstrumentalGroup[] = new Array();
     //private instruments: List<Instrument> = new List<Instrument>();
-    public get InstrumentalGroups(): List<InstrumentalGroup> {
+    public get InstrumentalGroups(): InstrumentalGroup[] {
         return this.instrumentalGroups;
     }
     public get Parent(): InstrumentalGroup {

+ 2 - 0
src/MusicalScore/Interfaces/IQualityFeedbackTone.ts

@@ -1,3 +1,5 @@
+import { Note } from "../VoiceData/Note";
+
 export interface IQualityFeedbackTone {
     ParentNote: Note;
     TimingScore: number;

+ 20 - 14
src/MusicalScore/Label.ts

@@ -1,22 +1,28 @@
+// FIXME
+type PSTextAlignment = any;
+type PSFontStyles = any;
+type PSColor = any;
+type PSFonts = any;
+
 export class Label {
-  constructor(arg1: any, alignment?: PSTextAlignment) {
-      if (arg1 instanceof string) {
-          this.text = <string>arg1;
-      } else if (arg1 instanceof FontInfo.MusicFontSymbol) {
-          this.font = PSFonts.PhonicScore;
-          let symbolInfo: FontInfo.SymbolInfo = FontInfo.Info.getSymbolInfo(<FontInfo.MusicFontSymbol>arg1);
-          this.text = symbolInfo.symbol;
-      }
+  constructor(arg1: string/*|FontInfo.MusicFontSymbol*/, alignment?: PSTextAlignment) {
+      //if (arg1 instanceof string) {
+      this.text = <string>arg1;
+      //} else if (arg1 instanceof FontInfo.MusicFontSymbol) {
+      //    this.font = PSFonts.PhonicScore;
+      //    let symbolInfo: FontInfo.SymbolInfo = FontInfo.Info.getSymbolInfo(<FontInfo.MusicFontSymbol>arg1);
+      //    this.text = symbolInfo.symbol;
+      //}
       if (alignment !== undefined) {
           this.textAlignment = alignment;
       }
-  }
+    }
 
-    private text: string;
-    private color: PSColor = PSColor.Black;
-    private font: PSFonts = PSFonts.TimesNewRoman;
-    private fontStyle: PSFontStyles = PSFontStyles.Regular;
-    private textAlignment: PSTextAlignment = PSTextAlignment.LeftBottom;
+    private text: string; // FIXME:
+    private color: PSColor; //= PSColor.Black;
+    private font: PSFonts; // = PSFonts.TimesNewRoman;
+    private fontStyle: PSFontStyles; // = PSFontStyles.Regular;
+    private textAlignment: PSTextAlignment; // = PSTextAlignment.LeftBottom;
     private fontHeight: number = 2;
 
     public get Text(): string {

+ 24 - 16
src/MusicalScore/MusicParts/MusicPartManager.ts

@@ -1,9 +1,17 @@
-export class MusicPartManager implements ISelectionListener {
+import { MusicSheet } from "../MusicSheet"
+import { PartListEntry } from "../MusicSource/PartListEntry"
+import { Repetition } from "../MusicSource/Repetition"
+import { Fraction } from "../../Common/DataObjects/fraction"
+import { MusicPartManagerIterator } from "./MusicPartManagerIterator"
+
+type TimestampTransform = any;
+
+export class MusicPartManager /*implements ISelectionListener*/ {
     constructor(musicSheet: MusicSheet) {
         this.musicSheet = musicSheet;
     }
-    private parts: List<PartListEntry>;
-    private timestamps: List<TimestampTransform>;
+    private parts: PartListEntry[];
+    private timestamps: TimestampTransform[];
     private musicSheet: MusicSheet;
     private sheetStart: Fraction;
     private sheetEnd: Fraction;
@@ -11,14 +19,14 @@ export class MusicPartManager implements ISelectionListener {
         this.init();
     }
     public init(): void {
-        this.parts = new List<PartListEntry>(this.musicSheet.Repetitions.ToArray());
+        this.parts = this.musicSheet.Repetitions.slice();
         this.sheetStart = this.musicSheet.SelectionStart = new Fraction(0, 1);
         this.sheetEnd = this.musicSheet.SelectionEnd = this.musicSheet.SheetEndTimestamp;
         this.calcMapping();
     }
     public getCurrentRepetitionTimestampTransform(curEnrolledTimestamp: Fraction): TimestampTransform {
         let curTransform: TimestampTransform = undefined;
-        for (let i: number = this.timestamps.Count - 1; i >= 0; i--) {
+        for (let i: number = this.timestamps.length - 1; i >= 0; i--) {
             curTransform = this.timestamps[i];
             if (curEnrolledTimestamp >= curTransform.$from) {
                 return curTransform;
@@ -27,22 +35,22 @@ export class MusicPartManager implements ISelectionListener {
         return this.timestamps[0];
     }
     public absoluteEnrolledToSheetTimestamp(timestamp: Fraction): Fraction {
-        if (this.timestamps.Count === 0) {
+        if (this.timestamps.length === 0) {
             return timestamp;
         }
         let transform: TimestampTransform = this.getCurrentRepetitionTimestampTransform(timestamp);
-        return timestamp + (transform.to - transform.$from);
+        return Fraction.plus(timestamp, <any>(transform.to - transform.$from)); // FIXME
     }
-    public get Parts(): List<PartListEntry> {
+    public get Parts(): PartListEntry[] {
         return this.parts;
     }
     public get MusicSheet(): MusicSheet {
         return this.musicSheet;
     }
-    public getIterator(): MusicPartManagerIterator {
-        return new MusicPartManagerIterator(this, this.musicSheet.SelectionStart, this.musicSheet.SelectionEnd);
-    }
-    public getIterator(start: Fraction): MusicPartManagerIterator {
+    public getIterator(start?: Fraction): MusicPartManagerIterator {
+        if (start === undefined) {
+          return new MusicPartManagerIterator(this, this.musicSheet.SelectionStart, this.musicSheet.SelectionEnd);
+        }
         return new MusicPartManagerIterator(this, start, undefined);
     }
     public setSelectionStart(beginning: Fraction): void {
@@ -54,7 +62,7 @@ export class MusicPartManager implements ISelectionListener {
         this.musicSheet.SelectionEnd = end === undefined ? this.sheetEnd : end;
     }
     private calcMapping(): void {
-        this.timestamps = new List<TimestampTransform>();
+        this.timestamps = new Array();
         let iterator: MusicPartManagerIterator = this.getIterator();
         let currentRepetition: Repetition = iterator.CurrentRepetition;
         let curTimestampTransform: TimestampTransform = new TimestampTransform(
@@ -63,7 +71,7 @@ export class MusicPartManager implements ISelectionListener {
             undefined,
             0,
         );
-        this.timestamps.Add(curTimestampTransform);
+        this.timestamps.push(curTimestampTransform);
         while (!iterator.EndReached) {
             if (iterator.JumpOccurred || currentRepetition !== iterator.CurrentRepetition) {
                 currentRepetition = iterator.CurrentRepetition;
@@ -72,7 +80,7 @@ export class MusicPartManager implements ISelectionListener {
                     curTimestampTransform.nextBackJump = iterator.CurrentEnrolledTimestamp;
                     curTimestampTransform.curRepetition = jumpRep;
                     curTimestampTransform.curRepetitionIteration = iterator.CurrentJumpResponsibleRepetitionIterationBeforeJump;
-                    for (let i: number = this.timestamps.Count - 2; i >= 0; i--) {
+                    for (let i: number = this.timestamps.length - 2; i >= 0; i--) {
                         if (jumpRep.AbsoluteTimestamp > this.timestamps[i].to || this.timestamps[i].curRepetition !== undefined) {
                             break;
                         }
@@ -87,7 +95,7 @@ export class MusicPartManager implements ISelectionListener {
                     undefined,
                     0,
                 );
-                this.timestamps.Add(curTimestampTransform);
+                this.timestamps.push(curTimestampTransform);
             }
             iterator.moveToNext();
         }

+ 1 - 9
src/MusicalScore/MusicParts/MusicPartManagerIterator.ts

@@ -1,13 +1,5 @@
 export class MusicPartManagerIterator {
-    constructor(manager: MusicPartManager) {
-        this(manager, undefined);
-
-    }
-    constructor(manager: MusicPartManager, startTimestamp: Fraction) {
-        this(manager, startTimestamp, undefined);
-
-    }
-    constructor(manager: MusicPartManager, startTimestamp: Fraction, endTimestamp: Fraction) {
+    constructor(manager: MusicPartManager, startTimestamp?: Fraction, endTimestamp?: Fraction) {
         try {
             this.frontReached = true;
             this.manager = manager;