Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
Fixed scale bug
  • Loading branch information
hailstorm75 committed Jan 27, 2017
1 parent 422fae5 commit 5b0efe7
Show file tree
Hide file tree
Showing 21 changed files with 43 additions and 37 deletions.
Binary file modified .vs/guitarToolsForm/v15/.suo
Binary file not shown.
3 changes: 3 additions & 0 deletions guitarTools/Classes/Fretboard/FretNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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];
}
}
Expand Down
45 changes: 27 additions & 18 deletions guitarTools/Classes/Fretboard/Fretboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<string>("SELECT Interval FROM tableScales WHERE Name = '" + Scale + "'")[0].Split(' ');
string[] scale = SQLCommands.FetchList<string>("SELECT Interval FROM tableScales WHERE Name = '" + Scale + "'")[0].Split(' ');

// Shifting scale to new root note
foreach (List<FretNote> String in NoteList)
{
foreach (FretNote Note in String)
// Shifting scale to new root note
foreach (List<FretNote> 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);
}
}
}
}

Expand All @@ -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<string>("SELECT Interval FROM tableScales WHERE Name = '" + Scale + "'")[0].Split(' ');
Expand All @@ -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);
}
}
}
}
}
}
16 changes: 8 additions & 8 deletions guitarTools/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
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">
<Border BorderBrush="#FF2B2424" BorderThickness="1">
<StackPanel>
<Border x:Name="WindowTop" Background="#FF2B2424" Height="31" Width="auto" MouseDown="WindowTop_MouseDown">
<Border x:Name="WindowTop" ClipToBounds="True" Background="#FF2B2424" Height="31" Width="auto" MouseDown="WindowTop_MouseDown">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<DockPanel Grid.Column="0">
<Image Source="icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0,0,0" Height="25" Width="25" />
<Image Source="Resources/icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0,0,0" Height="25" Width="25" />
<Label HorizontalAlignment="Center" Content="{Binding Title, ElementName=mainWindow}" Foreground="White" Margin="5,0,0,0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" Height="{Binding ActualHeight, ElementName=WindowTop, Mode=OneWay}"/>
</DockPanel>
<DockPanel Grid.Column="2">
Expand Down Expand Up @@ -85,13 +85,13 @@
<DockPanel Margin="0,10,0,0">
<Label Content="Tuning: " HorizontalAlignment="Center" Name="lbTuning" />
<ComboBox Name="cbTuning" MinWidth="100" SelectionChanged="cbTuning_SelectionChanged"/>
<Button Width="{Binding ActualHeight, ElementName=cbTuning, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=cbTuning, Mode=OneWay}" HorizontalContentAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" Content="+">
<Button Width="{Binding ActualHeight, ElementName=cbTuning, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=cbTuning, Mode=OneWay}" HorizontalContentAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" Content="+" IsEnabled="False">
</Button>
</DockPanel>
<DockPanel Margin="0,10,0,0">
<Label Content="Scale: " HorizontalAlignment="Center" Name="lbScale" Width="{Binding ActualWidth, ElementName=lbTuning, Mode=OneWay}" />
<ComboBox Name="cbScale" MinWidth="100" SelectionChanged="cbScale_SelectionChanged"/>
<Button Width="{Binding ActualHeight, ElementName=cbScale, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=cbScale, Mode=OneWay}" HorizontalAlignment="Left" Margin="10,0,0,0" Content="+">
<Button Width="{Binding ActualHeight, ElementName=cbScale, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=cbScale, Mode=OneWay}" HorizontalAlignment="Left" Margin="10,0,0,0" Content="+" IsEnabled="False">

</Button>
<Button Name="btnSearchScale" Width="{Binding ActualHeight, ElementName=cbScale, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=cbScale, Mode=OneWay}" HorizontalAlignment="Left" Margin="10,0,0,0" Content="?" Click="btnSearchScale_Click">
Expand All @@ -106,7 +106,7 @@
Cursor="SizeWE"
SmallChange="1" LargeChange="2"
AutoToolTipPlacement="BottomRight"
IsSnapToTickEnabled="True" VerticalAlignment="Center"/>
IsSnapToTickEnabled="True" VerticalAlignment="Center" IsEnabled="False"/>
</DockPanel>
<DockPanel>
<Label Name="lbStrings" Content="Strings: " Width="auto"/>
Expand All @@ -115,9 +115,9 @@
Cursor="SizeWE"
SmallChange="1" LargeChange="2"
AutoToolTipPlacement="BottomRight"
IsSnapToTickEnabled="True" Value="6" VerticalAlignment="Center" />
IsSnapToTickEnabled="True" Value="6" VerticalAlignment="Center" IsEnabled="False" />
</DockPanel>
<Button Content="Apply" Margin="0,5,0,0"/>
<Button Content="Apply" Margin="0,5,0,0" IsEnabled="False"/>
</StackPanel>
</Grid>
</Border>
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion guitarTools/ScaleSearchWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace guitarTools
/// </summary>
public partial class ScaleSearchWindow : Window
{
#region
#region Properties
public bool init = false;
public string[] MusicKeys = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
public ComboBox[,] Menu;
Expand Down
Binary file removed guitarTools/addIcon.png
Binary file not shown.
Binary file modified guitarTools/bin/Debug/Data.mdf
Binary file not shown.
Binary file modified guitarTools/bin/Debug/Data_log.ldf
Binary file not shown.
Binary file modified guitarTools/bin/Debug/guitarTools.exe
Binary file not shown.
Binary file modified guitarTools/bin/Debug/guitarTools.pdb
Binary file not shown.
4 changes: 1 addition & 3 deletions guitarTools/guitarTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,15 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="addIcon.png" />
<Content Include="Data.mdf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Data_log.ldf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<DependentUpon>Data.mdf</DependentUpon>
</Content>
<Resource Include="searchIcon.png" />
<None Include="Resources\searchIcon.png" />
<Resource Include="icon.png" />
<Resource Include="Resources\icon.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Binary file modified guitarTools/obj/Debug/MainWindow.baml
Binary file not shown.
2 changes: 1 addition & 1 deletion guitarTools/obj/Debug/MainWindow.g.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C39772BE7697D59B3D5053CAE469FEB9"
#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C4421A4FE005A018018497FCEB2EFF68"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
Expand Down
2 changes: 1 addition & 1 deletion guitarTools/obj/Debug/MainWindow.g.i.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C39772BE7697D59B3D5053CAE469FEB9"
#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C4421A4FE005A018018497FCEB2EFF68"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
Expand Down
Binary file modified guitarTools/obj/Debug/guitarTools.exe
Binary file not shown.
Binary file modified guitarTools/obj/Debug/guitarTools.g.resources
Binary file not shown.
Binary file modified guitarTools/obj/Debug/guitarTools.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion guitarTools/obj/Debug/guitarTools_MarkupCompile.i.cache
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ C:\Users\hp\Documents\Projects\Visual Studio\C#\guitarToolsForm\guitarTools\App.
15767094614
MainWindow.xaml;ScaleSearchWindow.xaml;

True
False

4 changes: 0 additions & 4 deletions guitarTools/obj/Debug/guitarTools_MarkupCompile.i.lref

This file was deleted.

Binary file removed guitarTools/searchIcon.png
Binary file not shown.

0 comments on commit 5b0efe7

Please sign in to comment.