From 5b0efe72cdb056c1a6b4c2423b7b3456b4d6114d Mon Sep 17 00:00:00 2001 From: Deno Date: Fri, 27 Jan 2017 10:04:16 +0100 Subject: [PATCH] Bug fix Fixed scale bug --- .vs/guitarToolsForm/v15/.suo | Bin 261120 -> 261120 bytes guitarTools/Classes/Fretboard/FretNote.cs | 3 ++ guitarTools/Classes/Fretboard/Fretboard.cs | 45 +++++++++++------- guitarTools/MainWindow.xaml | 16 +++---- guitarTools/{ => Resources}/icon.png | Bin guitarTools/ScaleSearchWindow.xaml.cs | 2 +- guitarTools/addIcon.png | Bin 4410 -> 0 bytes guitarTools/bin/Debug/Data.mdf | Bin 8388608 -> 8388608 bytes guitarTools/bin/Debug/Data_log.ldf | Bin 8388608 -> 8388608 bytes guitarTools/bin/Debug/guitarTools.exe | Bin 193024 -> 178176 bytes guitarTools/bin/Debug/guitarTools.pdb | Bin 62976 -> 62976 bytes guitarTools/guitarTools.csproj | 4 +- guitarTools/obj/Debug/MainWindow.baml | Bin 6364 -> 6441 bytes guitarTools/obj/Debug/MainWindow.g.cs | 2 +- guitarTools/obj/Debug/MainWindow.g.i.cs | 2 +- guitarTools/obj/Debug/guitarTools.exe | Bin 193024 -> 178176 bytes guitarTools/obj/Debug/guitarTools.g.resources | Bin 101281 -> 86476 bytes guitarTools/obj/Debug/guitarTools.pdb | Bin 62976 -> 62976 bytes .../Debug/guitarTools_MarkupCompile.i.cache | 2 +- .../Debug/guitarTools_MarkupCompile.i.lref | 4 -- guitarTools/searchIcon.png | Bin 10406 -> 0 bytes 21 files changed, 43 insertions(+), 37 deletions(-) rename guitarTools/{ => Resources}/icon.png (100%) delete mode 100644 guitarTools/addIcon.png delete mode 100644 guitarTools/obj/Debug/guitarTools_MarkupCompile.i.lref delete mode 100644 guitarTools/searchIcon.png diff --git a/.vs/guitarToolsForm/v15/.suo b/.vs/guitarToolsForm/v15/.suo index 34bd281c1cba4bdc01da6442a05460ec3fb5e73e..06fb61f7acfff18d2aa989650102ecf01bfaa154 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W$+9tFj;znY{FKAQ$3$-e|-^@j^*U&`@~M~Rd_xOT#n#Uv|^?oOI+kj^)0zNnjOleKTqlIGK7 zWisS4?GqoQk8pd*)O?;&m`wSIPK#3OCfRy{5=7&}X4(BNHH#fJQJ%_^w3G>0J!+!uLm^~5z diff --git a/guitarTools/Classes/Fretboard/FretNote.cs b/guitarTools/Classes/Fretboard/FretNote.cs index 48a13eb..2f83232 100644 --- a/guitarTools/Classes/Fretboard/FretNote.cs +++ b/guitarTools/Classes/Fretboard/FretNote.cs @@ -64,6 +64,8 @@ public FretNote(int index, double size, bool isActive, int root, Point xy, Grid noteBody.Child = box; + noteBody.ToolTip = Index.ToString(); + Grid.SetColumn(noteBody, (int)xy.X); Grid.SetRow(noteBody, (int)xy.Y); @@ -86,6 +88,7 @@ public void HighlightRoot(int root) public void ShiftTuning(int ShiftBy) { Index = ShiftBy; + noteBody.ToolTip = Index.ToString(); noteText.Content = MusicKeys[(new IntLimited(ShiftBy, 0, 12)).GetValue]; } } diff --git a/guitarTools/Classes/Fretboard/Fretboard.cs b/guitarTools/Classes/Fretboard/Fretboard.cs index f1d9c8f..9d94973 100644 --- a/guitarTools/Classes/Fretboard/Fretboard.cs +++ b/guitarTools/Classes/Fretboard/Fretboard.cs @@ -75,8 +75,12 @@ private void CreateNotes() IntLimited key = new IntLimited(numFret, 0, 12); key.GetValue = key + index; + IntLimited a = new IntLimited(key.GetValue - Root, 0, 12); + + //MessageBox.Show(a.Value.ToString()); + // Checking if note fits scale - bool IsActive = scale.Contains(key.GetValue.ToString()) ? true : false; + bool IsActive = scale.Contains(a.Value.ToString()) ? true : false; // Creating the note FretNote note = new FretNote(key.GetValue, Size * 0.8, IsActive, Root, new Point(numFret, numString), NoteGrid); @@ -127,20 +131,22 @@ private void DrawFretboard() public void UpdateRoot(int newRoot) { - IntLimited currentRoot = new IntLimited(Root, 0, 12); - Root = newRoot; + if (newRoot != Root) + { + Root = newRoot; - string[] scale = SQLCommands.FetchList("SELECT Interval FROM tableScales WHERE Name = '" + Scale + "'")[0].Split(' '); + string[] scale = SQLCommands.FetchList("SELECT Interval FROM tableScales WHERE Name = '" + Scale + "'")[0].Split(' '); - // Shifting scale to new root note - foreach (List String in NoteList) - { - foreach (FretNote Note in String) + // Shifting scale to new root note + foreach (List String in NoteList) { - IntLimited a = new IntLimited(Note.Index - Root, 0, 12); - Note.ChangeState(scale.Contains((a.GetValue).ToString()) ? true : false); - Note.HighlightRoot(Root); - } + foreach (FretNote Note in String) + { + IntLimited a = new IntLimited(Note.Index - Root, 0, 12); + Note.ChangeState(scale.Contains((a.GetValue).ToString()) ? true : false); + Note.HighlightRoot(Root); + } + } } } @@ -162,7 +168,7 @@ public void UpdateScale(string newScale) public void UpdateTuning(string newTuning) { - // TODO Fill method logic + // TODO Clean up Tuning = newTuning; string[] scale = SQLCommands.FetchList("SELECT Interval FROM tableScales WHERE Name = '" + Scale + "'")[0].Split(' '); @@ -175,16 +181,19 @@ public void UpdateTuning(string newTuning) for (int numFret = 0; numFret < NoteList[numString].Count; numFret++) { // Calculating note order based on tuning and root note - IntLimited key = new IntLimited(numFret, 0, 12); + IntLimited key = new IntLimited(numFret, 0, 12); key.GetValue = key + index; - // Creating the note + // Shifting the note NoteList[numString][numFret].ShiftTuning(key.GetValue); - // Checking if note fits scale - bool IsActive = scale.Contains(key.GetValue.ToString()) ? true : false; + // Checking if note fits scale + NoteList[numString][numFret].ChangeState(scale.Contains(new IntLimited(key.GetValue - Root, 0, 12).Value.ToString()) ? true : false); + + // Highlighting the root + NoteList[numString][numFret].HighlightRoot(Root); } } } } -} +} \ No newline at end of file diff --git a/guitarTools/MainWindow.xaml b/guitarTools/MainWindow.xaml index 1afd96f..9d5f12d 100644 --- a/guitarTools/MainWindow.xaml +++ b/guitarTools/MainWindow.xaml @@ -7,10 +7,10 @@ mc:Ignorable="d" Title="Guitar tools" Height="386" Width="525" MinHeight="360" MinWidth="525" - Name="mainWindow" WindowStartupLocation="Manual" Icon="icon.png" Foreground="Black" StateChanged="mainWindow_StateChanged" Activated="MainWindow_OnActivated" WindowStyle="None" AllowsTransparency="True"> + Name="mainWindow" WindowStartupLocation="Manual" Icon="Resources/icon.png" Foreground="Black" StateChanged="mainWindow_StateChanged" Activated="MainWindow_OnActivated" WindowStyle="None" AllowsTransparency="True"> - + @@ -18,7 +18,7 @@ - + @@ -85,13 +85,13 @@