Skip to content

Commit

Permalink
1.1.4
Browse files Browse the repository at this point in the history
Correction de bugs
  • Loading branch information
zonetecde committed Jun 2, 2023
1 parent 15e7180 commit 2f3fe8a
Show file tree
Hide file tree
Showing 5 changed files with 187 additions and 112 deletions.
33 changes: 22 additions & 11 deletions SignaMath/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns:local="clr-namespace:SignaMath.UC"
xmlns:local2="clr-namespace:SignaMath"
mc:Ignorable="d"
Title="SignaMath" FontFamily="{StaticResource jakarta_regular}" MinHeight="700" MinWidth="1000" d:Width="1200" Icon="assets/icon.png" ContentRendered="Window_ContentRendered" WindowStartupLocation="CenterScreen">
Title="SignaMath" FontFamily="{StaticResource jakarta_regular}" MinHeight="650" MinWidth="1000" d:Width="1200" Icon="assets/icon.png" ContentRendered="Window_ContentRendered" WindowStartupLocation="CenterScreen">
<Window.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFAFFF9" Offset="0.143"/>
Expand All @@ -25,7 +25,7 @@
<Image x:Name="img_arrowTemplateTop" Source="/assets/arrow_top.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed"/>
<Image x:Name="img_arrowTemplateBottom" Source="assets/arrow_bottom.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed"/>
<!-- -->

<Border Grid.Row="0" Margin="20,10,20,0">
<TabControl FocusVisualStyle="{x:Null}" Height="100" BorderBrush="#7F000000" Background="Transparent" BorderThickness="0.5,0.5,0.5,0.5" >

Expand All @@ -48,15 +48,15 @@
<StackPanel Grid.Column="0" Orientation="Vertical" HorizontalAlignment="Left">
<Label Content="Fonction du tableau de signe :" Margin="18,0,0,0" Foreground="#B2000000"/>
<DockPanel>
<local2:UserControl_FormulaTextBox DockPanel.Dock="Left" x:Name="formulaTextBox_fName" Grid.Column="3" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" MinWidth="50" MinHeight="50" HorizontalAlignment="Left" Margin="20,-10,0,0" ToolTip="Format : f(x) et remplacez 'f' et 'x'"/>
<local2:UserControl_FormulaTextBox DockPanel.Dock="Right" x:Name="formulaTextBox_content" Grid.Column="3" VerticalContentAlignment="Center" MinWidth="100" MinHeight="50" Margin="10,-10,0,0" HorizontalAlignment="Left" ToolTip="Séparer les expressions qui doivent être dans différentes lignes du tableau par des parenthèses"/>
<local2:UserControl_FormulaTextBox DockPanel.Dock="Left" x:Name="formulaTextBox_fName" Grid.Column="3" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" MinWidth="50" MinHeight="50" HorizontalAlignment="Left" Margin="20,-7.5,0,0" ToolTip="Format : f(x) et remplacez 'f' et 'x'"/>
<local2:UserControl_FormulaTextBox DockPanel.Dock="Right" x:Name="formulaTextBox_content" Grid.Column="3" VerticalContentAlignment="Center" MinWidth="100" MinHeight="50" Margin="10,-7.5,0,0" HorizontalAlignment="Left" ToolTip="Séparer les expressions qui doivent être dans différentes lignes du tableau par des parenthèses"/>
</DockPanel>
</StackPanel>

<StackPanel Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Left">
<Grid>
<Label Content="Formule à utiliser dans le tableau de variation :" Foreground="#B2000000"/>
<local2:UserControl_FormulaTextBox DockPanel.Dock="Right" x:Name="formulaTextBox_tabDeVariation" Grid.Column="3" VerticalContentAlignment="Center" MinWidth="100" MinHeight="50" Margin="10,7.5,0,0" HorizontalAlignment="Left" ToolTip="N'oubliez-pas d'utiliser la même variable que celle choisi, par défaut c'est 'x'"/>
<local2:UserControl_FormulaTextBox DockPanel.Dock="Right" x:Name="formulaTextBox_tabDeVariation" Grid.Column="3" VerticalContentAlignment="Center" MinWidth="100" MinHeight="50" Margin="10,10,0,0" HorizontalAlignment="Left" ToolTip="N'oubliez-pas d'utiliser la même variable que celle choisi, par défaut c'est 'x'"/>
</Grid>
</StackPanel>

Expand Down Expand Up @@ -85,7 +85,7 @@

<TabItem BorderBrush="#0C000000" Header="Customisation" Width="150" Background="#00000000" >

<StackPanel Margin="0,5,0,0">
<StackPanel Margin="0,8.5,0,0">
<ScrollViewer FocusVisualStyle="{x:Null}" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Auto">
<ScrollViewer.Resources>
<sys:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarHeightKey}">5</sys:Double>
Expand Down Expand Up @@ -176,9 +176,20 @@
<TextBlock x:Name="textBlock_InfoBulle" Text="Appuyez sur la touche &quot;Entrée&quot; pour valider la saisie" FontSize="16" Padding="20,5,20,5" TextAlignment="Center" MinHeight="20" MaxHeight="40"/>
</Border>

<Viewbox x:Name="viewBox_tableau" Grid.Row="1" Margin="50,30,50,35" >
<local:UserControl_TableauDeSigne Width="{Binding ElementName=WidthSlider, Path=Value}" MinHeight="{Binding ElementName=HeightSlider, Path=Value}" x:Name="UC_TableauDeSigne"/>
</Viewbox>
<Grid Grid.Row="1" Margin="50,30,50,35" Background="#00000000" >
<Grid.ContextMenu>
<ContextMenu>
<MenuItem Header="Ajouter une ligne" Click="MenuItem_AddRow_Click"/>
<MenuItem Header="Ajouter une ligne de valeur interdite" Click="MenuItem_AddForbiddenValueRow_Click"/>
<MenuItem Header="Ajouter/Supprimer la ligne concluante" Click="MenuItem_AddConclusionRow_Click"/>
<MenuItem Header="Ajouter/Supprimer le tableau de variation" Click="MenuItem_Click"/>
</ContextMenu>
</Grid.ContextMenu>

<Viewbox x:Name="viewBox_tableau" >
<local:UserControl_TableauDeSigne Width="{Binding ElementName=WidthSlider, Path=Value}" MinHeight="{Binding ElementName=HeightSlider, Path=Value}" x:Name="UC_TableauDeSigne"/>
</Viewbox>
</Grid>

<Label Grid.RowSpan="2" Content="Afficher une zone de texte libre" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,115,0,0" ToolTip="Utile pour pouvoir copier une formule dans le presse papier puis y effectuer une opération à l'aide des 4 boutons de l'onglet &quot;Formule&quot;" FontStyle="Italic" Foreground="#7F000000" Cursor="Hand" MouseLeftButtonDown="Label_ShowFreeTextZone_MouseLeftButtonDown"/>

Expand All @@ -190,7 +201,7 @@
<Button Content="Copier" HorizontalAlignment="Right" Padding="10,1,10,1" Background="White" Cursor="Hand" Margin="0,0,-60,0" Click="Button_CopyFormula_Click"/>
</Grid>


<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0,5,0,5" HorizontalAlignment="Center" VerticalAlignment="Bottom" >
<Button Width="125" x:Name="button_Help" Content="Aide" Background="White" FontSize="16" ButtonBase.Click="button_Help_Click" Margin="0,0,5,0" />
<Button Width="165" x:Name="button_Save" Content="Enregistrer" Background="#FFFFFFFF" Click="button_Save_Click" FontSize="16" Margin="5,0,5,0" />
Expand All @@ -210,7 +221,7 @@
<TextBlock TextWrapping="Wrap" FontSize="16" TextAlignment="Justify" >
<Run Text="Pour insérer une racine carrée dans une expression, il faut écrire"/>
<Run Text="sqrt(x)" FontWeight="Bold"/>
<Run Text="en remplaçant x par le nombre souhaité, ou par une variable."/>
<Run Text="en remplaçant x par l'expression souhaitée."/>
</TextBlock>

<TextBlock TextWrapping="Wrap" Text="Comment écrire un exposant ?" FontSize="20" Margin="0,10,0,0" />
Expand Down
119 changes: 82 additions & 37 deletions SignaMath/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public partial class MainWindow : Window
{
internal static MainWindow _MainWindow { get; set; }

private const string VERSION = "1.1.3";
private const string VERSION = "1.1.4";
internal static string BASE_URL { get; } = "https://zoneck.bsite.net";
private Software Software { get; set; }

Expand Down Expand Up @@ -246,6 +246,9 @@ private void ChangeRowHeight(double newValue, RowType rowType)
/// </summary>
private void Button_AddRow_Click(object sender, RoutedEventArgs? e)
{
// Supprime toutes les rows avec une textbox vide
TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().Where(x => String.IsNullOrEmpty(x.TextBox_Expression.textBox_clear.Text)).ToList().ForEach(x => TableauDeSigne.StackPanel_Row.Children.Remove(x));

UC_TableauDeSigne.StackPanel_Row.Children.Add(new UserControl_Row(RowType.MIDDLE, new Random().Next(999999)) { Height = HeightRowSlider.Value });

button_AjoutLigneConcluante.IsEnabled = true;
Expand All @@ -254,37 +257,15 @@ private void Button_AddRow_Click(object sender, RoutedEventArgs? e)
MoveDownConclusionRow();
}

/// <summary>
/// Méthode appelée lors du clic sur le bouton "Ajouter une ligne concluante".
/// Ajoute ou supprime une ligne concluante du tableau.
/// </summary>
internal void Button_AjoutLigneConcluante_Click(object sender, RoutedEventArgs? e)
{
if (button_AjoutLigneConcluante.Content.ToString()!.Contains("Ajouter"))
{
UC_TableauDeSigne.StackPanel_Row.Children.Add(new UserControl_Row(RowType.CONCLUANTE, new Random().Next(999999)) { Height = HeightRowSlider.Value });
button_AjoutLigneConcluante.Content = "Supprimer la ligne concluante";
}
else
{
UC_TableauDeSigne.StackPanel_Row.Children.Remove(UC_TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().ToList().First(x => x.RowType == RowType.CONCLUANTE));
button_AjoutLigneConcluante.Content = "Ajouter la ligne concluante";

// supprime aussi le tableau de variation
if (button_AjoutTableauVariation.Content.ToString()!.Contains("Supprimer"))
{
button_AjoutTableauVariation.Content = "Ajouter le tableau de variation";
UC_TableauDeSigne.StackPanel_Row.Children.Remove(UC_TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().ToList().FindAll(x => x.RowType == RowType.TABLEAU_DE_VARIATION).First());
}
}
}

/// <summary>
/// Méthode appelée lors du clic sur le bouton "Ajouter une valeur interdite".
/// Ajoute une ligne au tableau avec une valeur interdite.
/// </summary>
private void Button_AddForbiddenValueRow_Click(object sender, RoutedEventArgs? e)
{
// Supprime toutes les rows avec une textbox vide
TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().Where(x => String.IsNullOrEmpty(x.TextBox_Expression.textBox_clear.Text)).ToList().ForEach(x => TableauDeSigne.StackPanel_Row.Children.Remove(x));

UC_TableauDeSigne.StackPanel_Row.Children.Add(new UserControl_Row(RowType.MIDDLE_INTERDITE, new Random().Next(999999)) { Height = HeightRowSlider.Value });

button_AjoutLigneConcluante.IsEnabled = true;
Expand All @@ -293,24 +274,32 @@ private void Button_AddForbiddenValueRow_Click(object sender, RoutedEventArgs? e
MoveDownConclusionRow();
}


/// <summary>
/// Déplace la ligne concluante et le tableau de variation vers la fin du tableau.
/// Méthode appelée lors du clic sur le bouton "Ajouter une ligne concluante".
/// Ajoute ou supprime une ligne concluante du tableau.
/// </summary>
private void MoveDownConclusionRow()
internal void Button_AjoutLigneConcluante_Click(object sender, RoutedEventArgs? e)
{
if (!button_AjoutLigneConcluante.Content.ToString()!.Contains("Ajouter"))
// Supprime toutes les rows avec une textbox vide
TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().Where(x => String.IsNullOrEmpty(x.TextBox_Expression.textBox_clear.Text)).ToList().ForEach(x => TableauDeSigne.StackPanel_Row.Children.Remove(x));

if (button_AjoutLigneConcluante.Content.ToString()!.Contains("Ajouter"))
{
UC_TableauDeSigne.StackPanel_Row.Children.Remove(UC_TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().ToList().First(x => x.RowType == RowType.CONCLUANTE));
UC_TableauDeSigne.StackPanel_Row.Children.Add(new UserControl_Row(RowType.CONCLUANTE, new Random().Next(999999)) { Height = HeightRowSlider.Value });
button_AjoutLigneConcluante.Content = "Supprimer la ligne concluante";
}

if (!button_AjoutTableauVariation.Content.ToString()!.Contains("Ajouter"))
else
{
UC_TableauDeSigne.StackPanel_Row.Children.Remove(UC_TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().ToList().First(x => x.RowType == RowType.TABLEAU_DE_VARIATION));
UC_TableauDeSigne.StackPanel_Row.Children.Add(new UserControl_Row(RowType.TABLEAU_DE_VARIATION, new Random().Next(999999))
UC_TableauDeSigne.StackPanel_Row.Children.Remove(UC_TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().ToList().First(x => x.RowType == RowType.CONCLUANTE));
button_AjoutLigneConcluante.Content = "Ajouter la ligne concluante";

// supprime aussi le tableau de variation
if (button_AjoutTableauVariation.Content.ToString()!.Contains("Supprimer"))
{
Height = HeightTableauDeVariationSlider.Value,
});
button_AjoutTableauVariation.Content = "Ajouter le tableau de variation";
UC_TableauDeSigne.StackPanel_Row.Children.Remove(UC_TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().ToList().FindAll(x => x.RowType == RowType.TABLEAU_DE_VARIATION).First());
}
}
}

Expand All @@ -320,6 +309,9 @@ private void MoveDownConclusionRow()
/// </summary>
internal void Button_AjoutTableauVariation_Click(object sender, RoutedEventArgs? e)
{
// Supprime toutes les rows avec une textbox vide
TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().Where(x => String.IsNullOrEmpty(x.TextBox_Expression.textBox_clear.Text)).ToList().ForEach(x => TableauDeSigne.StackPanel_Row.Children.Remove(x));

if (button_AjoutTableauVariation.Content.ToString()!.Contains("Ajouter"))
{
if (button_AjoutLigneConcluante.Content.ToString()!.Contains("Ajouter"))
Expand All @@ -343,6 +335,27 @@ internal void Button_AjoutTableauVariation_Click(object sender, RoutedEventArgs?
}
}

/// <summary>
/// Déplace la ligne concluante et le tableau de variation vers la fin du tableau.
/// </summary>
private void MoveDownConclusionRow()
{
if (!button_AjoutLigneConcluante.Content.ToString()!.Contains("Ajouter"))
{
UC_TableauDeSigne.StackPanel_Row.Children.Remove(UC_TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().ToList().First(x => x.RowType == RowType.CONCLUANTE));
UC_TableauDeSigne.StackPanel_Row.Children.Add(new UserControl_Row(RowType.CONCLUANTE, new Random().Next(999999)) { Height = HeightRowSlider.Value });
}

if (!button_AjoutTableauVariation.Content.ToString()!.Contains("Ajouter"))
{
UC_TableauDeSigne.StackPanel_Row.Children.Remove(UC_TableauDeSigne.StackPanel_Row.Children.OfType<UserControl_Row>().ToList().First(x => x.RowType == RowType.TABLEAU_DE_VARIATION));
UC_TableauDeSigne.StackPanel_Row.Children.Add(new UserControl_Row(RowType.TABLEAU_DE_VARIATION, new Random().Next(999999))
{
Height = HeightTableauDeVariationSlider.Value,
});
}
}

/// <summary>
/// Init les formulas box de la fenêtre principale
/// </summary>
Expand Down Expand Up @@ -591,7 +604,7 @@ private void Button_ResetBoard_Click(object sender, RoutedEventArgs? e)
/// <summary>
/// Actualise le tableau
/// </summary>
private void button_RefreshBoard_Click(object sender, RoutedEventArgs e)
internal void button_RefreshBoard_Click(object sender, RoutedEventArgs? e)
{
GlobalVariable.UpdateColumn();
}
Expand Down Expand Up @@ -821,5 +834,37 @@ private void Label_ShowFreeTextZone_MouseLeftButtonDown(object sender, MouseButt
{
SetCopiedFormulaTextBox(textBox_copiedFormula.Text);
}

/// <summary>
/// Ajoute une ligne au tableau
/// </summary>
private void MenuItem_AddRow_Click(object sender, RoutedEventArgs e)
{
Button_AddRow_Click(this, null);
}

/// <summary>
/// Ajoute une ligne de valeur interdite au tableau
/// </summary>
private void MenuItem_AddForbiddenValueRow_Click(object sender, RoutedEventArgs e)
{
Button_AddForbiddenValueRow_Click(this, null);
}

/// <summary>
/// Ajoute une ligne concluante
/// </summary>
private void MenuItem_AddConclusionRow_Click(object sender, RoutedEventArgs e)
{
Button_AjoutLigneConcluante_Click(this, null);
}

/// <summary>
/// Ajoute le tableau de variation
/// </summary>
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
Button_AjoutTableauVariation_Click(this, null);
}
}
}
Loading

0 comments on commit 2f3fe8a

Please sign in to comment.