1 package org.herac.tuxguitar.gui.editors.chord; 2 3 public class ChordSettings { 4 5 private static ChordSettings instance; 6 7 private boolean emptyStringChords; 8 private float bassGrade; 9 private float fingeringGrade; 10 private float subsequentGrade; 11 private float requiredBasicsGrade; 12 private float manyStringsGrade; 13 private float goodChordSemanticsGrade; 14 private int chordsToDisplay; 15 private int howManyIncompleteChords; 16 private int chordTypeIndex; 17 private int findChordsMin; 18 private int findChordsMax; 19 ChordSettings()20 private ChordSettings() { 21 this.emptyStringChords = false; 22 this.bassGrade = 200.0f; 23 this.fingeringGrade = 150.0f; // was:200 24 this.subsequentGrade = 200.0f; 25 this.requiredBasicsGrade = 150.0f; 26 this.manyStringsGrade = 100.0f; 27 this.goodChordSemanticsGrade = 200.0f; 28 this.chordsToDisplay = 30; 29 this.howManyIncompleteChords = 4; 30 this.chordTypeIndex = 0; 31 this.findChordsMin=0; 32 this.findChordsMax=15; 33 } 34 instance()35 public static ChordSettings instance(){ 36 if( instance == null ){ 37 instance = new ChordSettings(); 38 } 39 return instance; 40 } 41 getBassGrade()42 public float getBassGrade() { 43 return this.bassGrade; 44 } 45 setBassGrade(float bassGrade)46 public void setBassGrade(float bassGrade) { 47 this.bassGrade = bassGrade; 48 } 49 getChordsToDisplay()50 public int getChordsToDisplay() { 51 return this.chordsToDisplay; 52 } 53 setChordsToDisplay(int chordsToDisplay)54 public void setChordsToDisplay(int chordsToDisplay) { 55 this.chordsToDisplay = chordsToDisplay; 56 } 57 isEmptyStringChords()58 public boolean isEmptyStringChords() { 59 return this.emptyStringChords; 60 } 61 setEmptyStringChords(boolean emptyStringChords)62 public void setEmptyStringChords(boolean emptyStringChords) { 63 this.emptyStringChords = emptyStringChords; 64 } 65 getFingeringGrade()66 public float getFingeringGrade() { 67 return this.fingeringGrade; 68 } 69 setFingeringGrade(float fingeringGrade)70 public void setFingeringGrade(float fingeringGrade) { 71 this.fingeringGrade = fingeringGrade; 72 } 73 getGoodChordSemanticsGrade()74 public float getGoodChordSemanticsGrade() { 75 return this.goodChordSemanticsGrade; 76 } 77 setGoodChordSemanticsGrade(float goodChordSemanticsGrade)78 public void setGoodChordSemanticsGrade(float goodChordSemanticsGrade) { 79 this.goodChordSemanticsGrade = goodChordSemanticsGrade; 80 } 81 getManyStringsGrade()82 public float getManyStringsGrade() { 83 return this.manyStringsGrade; 84 } 85 setManyStringsGrade(float manyStringsGrade)86 public void setManyStringsGrade(float manyStringsGrade) { 87 this.manyStringsGrade = manyStringsGrade; 88 } 89 getRequiredBasicsGrade()90 public float getRequiredBasicsGrade() { 91 return this.requiredBasicsGrade; 92 } 93 setRequiredBasicsGrade(float requiredBasicsGrade)94 public void setRequiredBasicsGrade(float requiredBasicsGrade) { 95 this.requiredBasicsGrade = requiredBasicsGrade; 96 } 97 getSubsequentGrade()98 public float getSubsequentGrade() { 99 return this.subsequentGrade; 100 } 101 setSubsequentGrade(float subsequentGrade)102 public void setSubsequentGrade(float subsequentGrade) { 103 this.subsequentGrade = subsequentGrade; 104 } 105 getIncompleteChords()106 public int getIncompleteChords() { 107 return this.howManyIncompleteChords; 108 } 109 setIncompleteChords(int incomplete)110 public void setIncompleteChords(int incomplete) { 111 this.howManyIncompleteChords = incomplete; 112 } 113 getFindChordsMin()114 public int getFindChordsMin() { 115 return this.findChordsMin; 116 } 117 setFindChordsMin(int min)118 public void setFindChordsMin(int min) { 119 this.findChordsMin = min; 120 } 121 getFindChordsMax()122 public int getFindChordsMax() { 123 return this.findChordsMax; 124 } 125 setFindChordsMax(int max)126 public void setFindChordsMax(int max) { 127 this.findChordsMax = max; 128 } 129 getChordTypeIndex()130 public int getChordTypeIndex() { 131 return this.chordTypeIndex; 132 } 133 setChordTypeIndex(int index)134 public void setChordTypeIndex(int index) { 135 switch (index) { 136 case 0 : // normal 137 this.bassGrade = 200.0f; 138 this.fingeringGrade = 150.0f; 139 this.subsequentGrade = 200.0f; 140 this.requiredBasicsGrade = 150.0f; 141 this.manyStringsGrade = 100.0f; 142 this.goodChordSemanticsGrade = 200.0f; 143 break; 144 case 1 : // inversions 145 this.bassGrade = -100.0f; 146 this.fingeringGrade = 150.0f; 147 this.subsequentGrade = 200.0f; 148 this.requiredBasicsGrade = 150.0f; 149 this.manyStringsGrade = 50.0f; 150 this.goodChordSemanticsGrade = 200.0f; 151 break; 152 case 2 : // close-voiced 153 this.bassGrade = 50.0f; 154 this.fingeringGrade = 200.0f; 155 this.subsequentGrade = 350.0f; 156 this.requiredBasicsGrade = 150.0f; 157 this.manyStringsGrade = -100.0f; 158 this.goodChordSemanticsGrade = 200.0f; 159 break; 160 case 3 : // open-voiced 161 this.bassGrade = 100.0f; 162 this.fingeringGrade = 100.0f; 163 this.subsequentGrade = -80.0f; 164 this.requiredBasicsGrade = 100.0f; 165 this.manyStringsGrade = -80.0f; 166 this.goodChordSemanticsGrade = 200.0f; 167 break; 168 } 169 this.chordTypeIndex = index; 170 } 171 } 172