Mise à jour main et interface

This commit is contained in:
Mika 2014-05-20 23:26:25 +02:00
parent c08705dcb9
commit 558938498b
3 changed files with 1902 additions and 186 deletions

1663
sources/boutonsdemerde.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -23,9 +23,9 @@
#include <string.h> #include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "../motifs/motifs.h" #include "motifs/motifs.h"
#include "../melodie/melodie.h" #include "melodie/melodie.h"
#include "../lecture/lecture.h" #include "lecture/lecture.h"
//#include <SDL2/SDL.h> //#include <SDL2/SDL.h>
//#include <SDL2/SDL_mixer.h> //#include <SDL2/SDL_mixer.h>
//#include <SDL2/SDL_main.h> //#include <SDL2/SDL_main.h>
@ -34,6 +34,24 @@
#define MAX_PATTERNS 256 #define MAX_PATTERNS 256
Motif* m; Motif* m;
char *Do="Do";
char *DoD="Do#";
char *Re="Re";
char *ReD="Re#";
char *Mi="Mi";
char *Fa="Fa";
char *FaD="Fa#";
char *Sol="Sol";
char *SolD="Sol#";
char *La="La";
char *LaD="La#";
char *Si="Si";
char *SiD="Si#";
char *N1="1";
char *N2="2";
char *N3="3";
char *N4="4";
char *N5="5";
void remplissageNote (GtkWidget *widget, gpointer *data); void remplissageNote (GtkWidget *widget, gpointer *data);
@ -141,20 +159,142 @@ int main( int argc, char *argv[] ){
// insérer code GTK ici // insérer code GTK ici
GtkBuilder *monBuilder; GtkBuilder *monBuilder;
GtkWidget *maFenetre; GtkWidget *maFenetre;
char *str; char *str=NULL;
gtk_init( &argc, &argv ); gtk_init( &argc, &argv );
monBuilder = gtk_builder_new(); monBuilder = gtk_builder_new();
gtk_builder_add_from_file( monBuilder, "ponytrackertest.glade", NULL); gtk_builder_add_from_file( monBuilder, "GUI/ponytrackertest.glade", NULL);
gtk_builder_connect_signals( monBuilder, NULL); gtk_builder_connect_signals( monBuilder, NULL);
maFenetre = GTK_WIDGET( gtk_builder_get_object( monBuilder, "fenetreprincipale")); maFenetre = GTK_WIDGET( gtk_builder_get_object( monBuilder, "fenetreprincipale"));
GtkLabel *labelNote = (GtkLabel*) gtk_builder_get_object(monBuilder,"button16"); GtkLabel *labelNote = (GtkLabel*) gtk_builder_get_object(monBuilder,"button16");
if (getNote(m,0,0)==0) str="Do"; switch (getNote(m,0,0)) {
else if (getNote(m,0,0)==1) str="Re"; case 0 :
str="Do ";
break;
case 1 :
str="Do# ";
break;
case 2 :
str="Re ";
break;
case 3 :
str="Re# ";
break;
case 4 :
str="Mi ";
break;
case 5 :
str="Fa ";
break;
case 6 :
str="Fa# ";
break;
case 7 :
str="Sol ";
break;
case 8 :
str="Sol# ";
break;
case 9 :
str="La ";
break;
case 10 :
str="La# ";
break;
case 11 :
str="Si ";
break;
case 12 :
str="Si# ";
break;
default :
break;
}
switch (getOctave(m,0,0)) {
case 0 :
strcat(str, "1 ");
break;
case 1 :
strcat(str, "2 ");
break;
case 2 :
strcat(str, "3 ");
break;
case 3 :
strcat(str, "4 ");
break;
case 4 :
strcat(str, "5 ");
break;
default :
break;
}
switch (getInstrument(m,0,0)) {
case 0 :
strcat(str, "1 ");
break;
case 1 :
strcat(str, "2 ");
break;
case 2 :
strcat(str, "3 ");
break;
case 3 :
strcat(str, "4 ");
break;
case 4 :
strcat(str, "5 ");
break;
default :
break;
}
switch (getVolume(m,0,0)) {
case 0 :
strcat(str, "1 ");
break;
case 1 :
strcat(str, "2 ");
break;
case 2 :
strcat(str, "3 ");
break;
case 3 :
strcat(str, "4 ");
break;
case 4 :
strcat(str, "5 ");
break;
default :
break;
}
switch (getEffet(m,0,0)) {
case 0 :
strcat(str, "1 ");
break;
case 1 :
strcat(str, "2 ");
break;
case 2 :
strcat(str, "3 ");
break;
case 3 :
strcat(str, "4 ");
break;
case 4 :
strcat(str, "5 ");
break;
default :
break;
}
gtk_label_set_text(labelNote, str); gtk_label_set_text(labelNote, str);
gtk_widget_show_all (maFenetre); gtk_widget_show_all (maFenetre);
@ -162,18 +302,35 @@ int main( int argc, char *argv[] ){
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
void fenetreNote ( int argc, char *argv[] )
{
GtkBuilder *monBuilderNote;
GtkWidget *maFenetreNote;
gtk_init( &argc, &argv );
monBuilderNote = gtk_builder_new();
gtk_builder_add_from_file( monBuilderNote, "GUI/ponytrackertest.glade", NULL);
gtk_builder_connect_signals( monBuilderNote, NULL);
maFenetreNote = GTK_WIDGET( gtk_builder_get_object( monBuilderNote, "ajoutnote"));
GtkButton *button = (GtkButton*) gtk_builder_get_object(monBuilderNote, "buttonok");
g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(remplissageNote),
GTK_WIDGET( gtk_builder_get_object( monBuilderNote, "ajoutnote")));
gtk_widget_show_all (maFenetreNote);
}
void remplissageNote (GtkWidget *widget, gpointer *data){ void remplissageNote (GtkWidget *widget, gpointer *data){
char *Do="Do";
char *Re="Re";
char *Mi="Mi";
char *N1="1";
char *N2="2";
GtkBuilder *monBuilderNote; GtkBuilder *monBuilderNote;
monBuilderNote = gtk_builder_new(); monBuilderNote = gtk_builder_new();
gtk_builder_add_from_file( monBuilderNote, "ponytrackertest.glade", NULL); gtk_builder_add_from_file( monBuilderNote, "GUI/ponytrackertest.glade", NULL);
gtk_builder_connect_signals( monBuilderNote, NULL); gtk_builder_connect_signals( monBuilderNote, NULL);
GtkEntry *entryNote = (GtkEntry*) gtk_builder_get_object(monBuilderNote,"choisirnote"); GtkEntry *entryNote = (GtkEntry*) gtk_builder_get_object(monBuilderNote,"choisirnote");
@ -184,25 +341,69 @@ void remplissageNote (GtkWidget *widget, gpointer *data){
if (strcmp(Do,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,1); if (strcmp(Do,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,1);
else else
if (strcmp(Re,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,2); if (strcmp(DoD,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,2);
else else
if (strcmp(Mi,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,3); if (strcmp(Re,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,3);
else
if (strcmp(ReD,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,4);
else
if (strcmp(Mi,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,5);
else
if (strcmp(Fa,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,6);
else
if (strcmp(FaD,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,7);
else
if (strcmp(Sol,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,8);
else
if (strcmp(SolD,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,9);
else
if (strcmp(La,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,10);
else
if (strcmp(LaD,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,11);
else
if (strcmp(Si,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,12);
else
if (strcmp(SiD,gtk_entry_get_text(entryNote))==0) definirNote(m,0,0,13);
if (strcmp(N1,gtk_entry_get_text(entryOctave))==0) definirOctave(m,0,0,1); if (strcmp(N1,gtk_entry_get_text(entryOctave))==0) definirOctave(m,0,0,1);
else else
if (strcmp(N2,gtk_entry_get_text(entryOctave))==0) definirOctave(m,0,0,2); if (strcmp(N2,gtk_entry_get_text(entryOctave))==0) definirOctave(m,0,0,2);
else
if (strcmp(N3,gtk_entry_get_text(entryOctave))==0) definirOctave(m,0,0,3);
else
if (strcmp(N4,gtk_entry_get_text(entryOctave))==0) definirOctave(m,0,0,4);
else
if (strcmp(N5,gtk_entry_get_text(entryOctave))==0) definirOctave(m,0,0,5);
if (strcmp(N1,gtk_entry_get_text(entryInstrument))==0) definirInstrument(m,0,0,1); if (strcmp(N1,gtk_entry_get_text(entryInstrument))==0) definirInstrument(m,0,0,1);
else else
if (strcmp(N2,gtk_entry_get_text(entryInstrument))==0) definirInstrument(m,0,0,2); if (strcmp(N2,gtk_entry_get_text(entryInstrument))==0) definirInstrument(m,0,0,2);
else
if (strcmp(N3,gtk_entry_get_text(entryInstrument))==0) definirInstrument(m,0,0,3);
else
if (strcmp(N4,gtk_entry_get_text(entryInstrument))==0) definirInstrument(m,0,0,4);
else
if (strcmp(N5,gtk_entry_get_text(entryInstrument))==0) definirInstrument(m,0,0,5);
if (strcmp(N1,gtk_entry_get_text(entryVolume))==0) definirVolume(m,0,0,1); if (strcmp(N1,gtk_entry_get_text(entryVolume))==0) definirVolume(m,0,0,1);
else else
if (strcmp(N2,gtk_entry_get_text(entryVolume))==0) definirVolume(m,0,0,2); if (strcmp(N2,gtk_entry_get_text(entryVolume))==0) definirVolume(m,0,0,2);
else
if (strcmp(N3,gtk_entry_get_text(entryVolume))==0) definirVolume(m,0,0,3);
else
if (strcmp(N4,gtk_entry_get_text(entryVolume))==0) definirVolume(m,0,0,4);
else
if (strcmp(N5,gtk_entry_get_text(entryVolume))==0) definirVolume(m,0,0,5);
if (strcmp(N1,gtk_entry_get_text(entryEffet))==0) definirEffet(m,0,0,1); if (strcmp(N1,gtk_entry_get_text(entryEffet))==0) definirEffet(m,0,0,1);
else else
if (strcmp(N2,gtk_entry_get_text(entryEffet))==0) definirEffet(m,0,0,2); if (strcmp(N2,gtk_entry_get_text(entryEffet))==0) definirEffet(m,0,0,2);
else
if (strcmp(N3,gtk_entry_get_text(entryEffet))==0) definirEffet(m,0,0,3);
else
if (strcmp(N4,gtk_entry_get_text(entryEffet))==0) definirEffet(m,0,0,4);
else
if (strcmp(N5,gtk_entry_get_text(entryEffet))==0) definirEffet(m,0,0,5);
} }
void fenetreSample ( int argc, char *argv[] ) void fenetreSample ( int argc, char *argv[] )
@ -214,7 +415,7 @@ void fenetreSample ( int argc, char *argv[] )
monBuilderSample = gtk_builder_new(); monBuilderSample = gtk_builder_new();
gtk_builder_add_from_file( monBuilderSample, "ponytrackertest.glade", NULL); gtk_builder_add_from_file( monBuilderSample, "GUI/ponytrackertest.glade", NULL);
gtk_builder_connect_signals( monBuilderSample, NULL); gtk_builder_connect_signals( monBuilderSample, NULL);
maFenetreSample = GTK_WIDGET( gtk_builder_get_object( monBuilderSample, "ajoutsample")); maFenetreSample = GTK_WIDGET( gtk_builder_get_object( monBuilderSample, "ajoutsample"));
@ -231,7 +432,7 @@ void fenetreInstrument ( int argc, char *argv[] )
monBuilderInstrument = gtk_builder_new(); monBuilderInstrument = gtk_builder_new();
gtk_builder_add_from_file( monBuilderInstrument, "ponytrackertest.glade", NULL); gtk_builder_add_from_file( monBuilderInstrument, "GUI/ponytrackertest.glade", NULL);
gtk_builder_connect_signals( monBuilderInstrument, NULL); gtk_builder_connect_signals( monBuilderInstrument, NULL);
maFenetreInstrument = GTK_WIDGET( gtk_builder_get_object( monBuilderInstrument, "ajoutinstrument")); maFenetreInstrument = GTK_WIDGET( gtk_builder_get_object( monBuilderInstrument, "ajoutinstrument"));
@ -248,7 +449,7 @@ void fenetreMotif ( int argc, char *argv[] )
monBuilderMotif = gtk_builder_new(); monBuilderMotif = gtk_builder_new();
gtk_builder_add_from_file( monBuilderMotif, "ponytrackertest.glade", NULL); gtk_builder_add_from_file( monBuilderMotif, "GUI/ponytrackertest.glade", NULL);
gtk_builder_connect_signals( monBuilderMotif, NULL); gtk_builder_connect_signals( monBuilderMotif, NULL);
maFenetreMotif = GTK_WIDGET( gtk_builder_get_object( monBuilderMotif, "ajoutmotif")); maFenetreMotif = GTK_WIDGET( gtk_builder_get_object( monBuilderMotif, "ajoutmotif"));
@ -256,28 +457,6 @@ void fenetreMotif ( int argc, char *argv[] )
gtk_widget_show_all (maFenetreMotif); gtk_widget_show_all (maFenetreMotif);
} }
void fenetreNote ( int argc, char *argv[] )
{
GtkBuilder *monBuilderNote;
GtkWidget *maFenetreNote;
gtk_init( &argc, &argv );
monBuilderNote = gtk_builder_new();
gtk_builder_add_from_file( monBuilderNote, "ponytrackertest.glade", NULL);
gtk_builder_connect_signals( monBuilderNote, NULL);
maFenetreNote = GTK_WIDGET( gtk_builder_get_object( monBuilderNote, "ajoutnote"));
GtkButton *button = (GtkButton*) gtk_builder_get_object(monBuilderNote, "buttonok");
g_signal_connect(G_OBJECT(button),"changed",G_CALLBACK(remplissageNote),
GTK_WIDGET( gtk_builder_get_object( monBuilderNote, "ajoutnote")));
gtk_widget_show_all (maFenetreNote);
}
void lancerLecture () void lancerLecture ()
{ {
Motif* melodie[MAX_PATTERNS] = {NULL}; Motif* melodie[MAX_PATTERNS] = {NULL};

View File

@ -957,10 +957,19 @@
<property name="entry_text_column">0</property> <property name="entry_text_column">0</property>
<property name="id_column">1</property> <property name="id_column">1</property>
<items> <items>
<item translatable="yes">Choisissez une note</item>
<item translatable="yes">Do</item> <item translatable="yes">Do</item>
<item translatable="yes">Do#</item>
<item translatable="yes">Re</item> <item translatable="yes">Re</item>
<item translatable="yes">Re#</item>
<item translatable="yes">Mi</item> <item translatable="yes">Mi</item>
<item translatable="yes">Fa</item>
<item translatable="yes">Fa#</item>
<item translatable="yes">Sol</item>
<item translatable="yes">Sol#</item>
<item translatable="yes">La</item>
<item translatable="yes">La#</item>
<item translatable="yes">Si</item>
<item translatable="yes">Si#</item>
</items> </items>
</object> </object>
<packing> <packing>
@ -976,7 +985,6 @@
<property name="entry_text_column">0</property> <property name="entry_text_column">0</property>
<property name="id_column">1</property> <property name="id_column">1</property>
<items> <items>
<item translatable="yes">Choisissez une octave</item>
<item translatable="yes">1</item> <item translatable="yes">1</item>
<item translatable="yes">2</item> <item translatable="yes">2</item>
</items> </items>
@ -994,9 +1002,11 @@
<property name="entry_text_column">0</property> <property name="entry_text_column">0</property>
<property name="id_column">1</property> <property name="id_column">1</property>
<items> <items>
<item translatable="yes">Choisissez un instrument</item>
<item translatable="yes">1</item> <item translatable="yes">1</item>
<item translatable="yes">2</item> <item translatable="yes">2</item>
<item translatable="yes">3</item>
<item translatable="yes">4</item>
<item translatable="yes">5</item>
</items> </items>
</object> </object>
<packing> <packing>
@ -1012,9 +1022,11 @@
<property name="entry_text_column">0</property> <property name="entry_text_column">0</property>
<property name="id_column">1</property> <property name="id_column">1</property>
<items> <items>
<item translatable="yes">Choisissez un volume</item>
<item translatable="yes">1</item> <item translatable="yes">1</item>
<item translatable="yes">2</item> <item translatable="yes">2</item>
<item translatable="yes">3</item>
<item translatable="yes">4</item>
<item translatable="yes">5</item>
</items> </items>
</object> </object>
<packing> <packing>
@ -1030,9 +1042,11 @@
<property name="entry_text_column">0</property> <property name="entry_text_column">0</property>
<property name="id_column">1</property> <property name="id_column">1</property>
<items> <items>
<item translatable="yes">Choisissez un effet</item>
<item translatable="yes">1</item> <item translatable="yes">1</item>
<item translatable="yes">2</item> <item translatable="yes">2</item>
<item translatable="yes">3</item>
<item translatable="yes">4</item>
<item translatable="yes">5</item>
</items> </items>
</object> </object>
<packing> <packing>
@ -2443,34 +2457,6 @@
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="button34">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">16</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button35">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">17</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child> <child>
<object class="GtkButton" id="button36"> <object class="GtkButton" id="button36">
<property name="label" translatable="yes">button</property> <property name="label" translatable="yes">button</property>
@ -2667,34 +2653,6 @@
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="button50">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">16</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button51">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">17</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child> <child>
<object class="GtkButton" id="button52"> <object class="GtkButton" id="button52">
<property name="label" translatable="yes">button</property> <property name="label" translatable="yes">button</property>
@ -3031,34 +2989,6 @@
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="button76">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">16</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button77">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">17</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child> <child>
<object class="GtkButton" id="button78"> <object class="GtkButton" id="button78">
<property name="label" translatable="yes">button</property> <property name="label" translatable="yes">button</property>
@ -3171,34 +3101,6 @@
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="button86">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">16</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button87">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">17</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child> <child>
<object class="GtkButton" id="button88"> <object class="GtkButton" id="button88">
<property name="label" translatable="yes">button</property> <property name="label" translatable="yes">button</property>
@ -3423,34 +3325,6 @@
<property name="height">1</property> <property name="height">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="button104">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">16</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button105">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">17</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>