Calendrier défilant.

Programmation d'applications complexes
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Calendrier défilant.

Message par Micoute »

Bonjour à tous,

Je viens partager avec vous mon calendrier défilant affichant les 6 mois à venir.
Il affiche la fête à souhaiter de tous les jours de l'année ainsi que les fêtes fixes.

je vous ai mis le fichier .Json sous forme de liste, il est préférable de ne pas changer son nom, sinon changez-le dans le programme.
Fetes_a_souhaiter.Json
  • [{"Prenom": "Jour de l'an", "Quand": "01/01"}, {"Prenom": "Basile", "Quand": "02/01"}, {"Prenom": "Geneviève", "Quand": "03/01"}, {"Prenom": "Odilon", "Quand": "04/01"}, {"Prenom": "Edouard", "Quand": "05/01"}, {"Prenom": "Mélaine", "Quand": "06/01"}, {"Prenom": "Raymond", "Quand": "07/01"}, {"Prenom": "Lucien", "Quand": "08/01"}, {"Prenom": "Alix", "Quand": "09/01"}, {"Prenom": "Guillaume", "Quand": "10/01"}, {"Prenom": "Pauline", "Quand": "11/01"}, {"Prenom": "Tatiana", "Quand": "12/01"}, {"Prenom": "Yvette", "Quand": "13/01"}, {"Prenom": "Nina", "Quand": "14/01"}, {"Prenom": "Rémi", "Quand": "15/01"}, {"Prenom": "Marcel", "Quand": "16/01"}, {"Prenom": "Roseline", "Quand": "17/01"}, {"Prenom": "Prisca", "Quand": "18/01"}, {"Prenom": "Marius", "Quand": "19/01"}, {"Prenom": "Sébastien", "Quand": "20/01"}, {"Prenom": "Agnès", "Quand": "21/01"}, {"Prenom": "Vincent", "Quand": "22/01"}, {"Prenom": "Barnard", "Quand": "23/01"}, {"Prenom": "François de Sales", "Quand": "24/01"}, {"Prenom": "Conversion de Paul", "Quand": "25/01"}, {"Prenom": "Paule", "Quand": "26/01"}, {"Prenom": "Angèle", "Quand": "27/01"}, {"Prenom": "Thomas d'Aquin", "Quand": "28/01"}, {"Prenom": "Gildas", "Quand": "29/01"}, {"Prenom": "Martine", "Quand": "30/01"}, {"Prenom": "Marcelle", "Quand": "31/01"}, {"Prenom": "Ella", "Quand": "01/02"}, {"Prenom": "Présentation", "Quand": "02/02"}, {"Prenom": "Blaise", "Quand": "03/02"}, {"Prenom": "Véronique", "Quand": "04/02"}, {"Prenom": "Agathe", "Quand": "05/02"}, {"Prenom": "Gaston", "Quand": "06/02"}, {"Prenom": "Eugènie", "Quand": "07/02"}, {"Prenom": "Jacqueline", "Quand": "08/02"}, {"Prenom": "Apolline", "Quand": "09/02"}, {"Prenom": "Arnaud", "Quand": "10/02"}, {"Prenom": "Notre Dame de Lourdes", "Quand": "11/02"}, {"Prenom": "Félix", "Quand": "12/02"}, {"Prenom": "Béatrice", "Quand": "13/02"}, {"Prenom": "Valentin", "Quand": "14/02"}, {"Prenom": "Claude", "Quand": "15/02"}, {"Prenom": "Julienne", "Quand": "16/02"}, {"Prenom": "Alexis", "Quand": "17/02"}, {"Prenom": "Bernadette", "Quand": "18/02"}, {"Prenom": "Gabin", "Quand": "19/02"}, {"Prenom": "Aimée", "Quand": "20/02"}, {"Prenom": "Damien", "Quand": "21/02"}, {"Prenom": "Isabelle", "Quand": "22/02"}, {"Prenom": "Lazare", "Quand": "23/02"}, {"Prenom": "Modeste", "Quand": "24/02"}, {"Prenom": "Roméo", "Quand": "25/02"}, {"Prenom": "Nestor", "Quand": "26/02"}, {"Prenom": "Honorine", "Quand": "27/02"}, {"Prenom": "Romain", "Quand": "28/02"}, {"Prenom": "Aubin", "Quand": "01/03"}, {"Prenom": "Charles le Bon", "Quand": "02/03"}, {"Prenom": "Guénolé", "Quand": "03/03"}, {"Prenom": "Casimir", "Quand": "04/03"}, {"Prenom": "Olive", "Quand": "05/03"}, {"Prenom": "Colette", "Quand": "06/03"}, {"Prenom": "Félicité", "Quand": "07/03"}, {"Prenom": "Jean de Dieu", "Quand": "08/03"}, {"Prenom": "Françoise", "Quand": "09/03"}, {"Prenom": "Vivien", "Quand": "10/03"}, {"Prenom": "Rosine", "Quand": "11/03"}, {"Prenom": "Justine", "Quand": "12/03"}, {"Prenom": "Rodrigue", "Quand": "13/03"}, {"Prenom": "Mathilde", "Quand": "14/03"}, {"Prenom": "Louise", "Quand": "15/03"}, {"Prenom": "Bénédicte", "Quand": "16/03"}, {"Prenom": "Patrice", "Quand": "17/03"}, {"Prenom": "Cyrille", "Quand": "18/03"}, {"Prenom": "Joseph", "Quand": "19/03"}, {"Prenom": "Anatole", "Quand": "20/03"}, {"Prenom": "Clémence", "Quand": "21/03"}, {"Prenom": "Léa", "Quand": "22/03"}, {"Prenom": "Victorien", "Quand": "23/03"}, {"Prenom": "Catherine", "Quand": "24/03"}, {"Prenom": "Annonciation", "Quand": "25/03"}, {"Prenom": "Larissa", "Quand": "26/03"}, {"Prenom": "Habib", "Quand": "27/03"}, {"Prenom": "Gontran", "Quand": "28/03"}, {"Prenom": "Gwladys", "Quand": "29/03"}, {"Prenom": "Amédée", "Quand": "30/03"}, {"Prenom": "Benjamin", "Quand": "31/03"}, {"Prenom": "Hugues", "Quand": "01/04"}, {"Prenom": "Sandrine", "Quand": "02/04"}, {"Prenom": "Richard", "Quand": "03/04"}, {"Prenom": "Isidore", "Quand": "04/04"}, {"Prenom": "Irène", "Quand": "05/04"}, {"Prenom": "Marcellin", "Quand": "06/04"}, {"Prenom": "Jean-Baptiste de la Salle", "Quand": "07/04"}, {"Prenom": "Julie", "Quand": "08/04"}, {"Prenom": "Gautier", "Quand": "09/04"}, {"Prenom": "Fulbert", "Quand": "10/04"}, {"Prenom": "Stanislas", "Quand": "11/04"}, {"Prenom": "Jules", "Quand": "12/04"}, {"Prenom": "Ida", "Quand": "13/04"}, {"Prenom": "Maxime", "Quand": "14/04"}, {"Prenom": "Paterne", "Quand": "15/04"}, {"Prenom": "Benoît-Joseph", "Quand": "16/04"}, {"Prenom": "Anicet", "Quand": "17/04"}, {"Prenom": "Parfait", "Quand": "18/04"}, {"Prenom": "Emma", "Quand": "19/04"}, {"Prenom": "Odette", "Quand": "20/04"}, {"Prenom": "Anselme", "Quand": "21/04"}, {"Prenom": "Alexandre", "Quand": "22/04"}, {"Prenom": "Georges", "Quand": "23/04"}, {"Prenom": "Fidèle", "Quand": "24/04"}, {"Prenom": "Marc", "Quand": "25/04"}, {"Prenom": "Alida", "Quand": "26/04"}, {"Prenom": "Zita", "Quand": "27/04"}, {"Prenom": "Valérie", "Quand": "28/04"}, {"Prenom": "Catherine de Sienne", "Quand": "29/04"}, {"Prenom": "Robert", "Quand": "30/04"}, {"Prenom": "Fête du travail", "Quand": "01/05"}, {"Prenom": "Boris", "Quand": "02/05"}, {"Prenom": "Philippe / Jacques", "Quand": "03/05"}, {"Prenom": "Sylvain", "Quand": "04/05"}, {"Prenom": "Judith", "Quand": "05/05"}, {"Prenom": "Prudence", "Quand": "06/05"}, {"Prenom": "Gisèle", "Quand": "07/05"}, {"Prenom": "Jeanne d'Arc", "Quand": "08/05"}, {"Prenom": "Pacôme", "Quand": "09/05"}, {"Prenom": "Solange", "Quand": "10/05"}, {"Prenom": "Estelle", "Quand": "11/05"}, {"Prenom": "Achille", "Quand": "12/05"}, {"Prenom": "Rolande", "Quand": "13/05"}, {"Prenom": "Matthias", "Quand": "14/05"}, {"Prenom": "Denise", "Quand": "15/05"}, {"Prenom": "Honoré", "Quand": "16/05"}, {"Prenom": "Pascal", "Quand": "17/05"}, {"Prenom": "Eric", "Quand": "18/05"}, {"Prenom": "Yves", "Quand": "19/05"}, {"Prenom": "Bernardin", "Quand": "20/05"}, {"Prenom": "Constantin", "Quand": "21/05"}, {"Prenom": "Emile", "Quand": "22/05"}, {"Prenom": "Didier", "Quand": "23/05"}, {"Prenom": "Donatien", "Quand": "24/05"}, {"Prenom": "Sophie", "Quand": "25/05"}, {"Prenom": "Bérenger", "Quand": "26/05"}, {"Prenom": "Augustin", "Quand": "27/05"}, {"Prenom": "Germain", "Quand": "28/05"}, {"Prenom": "Aymar", "Quand": "29/05"}, {"Prenom": "Ferdinand", "Quand": "30/05"}, {"Prenom": "Visitation de la Sainte Vierge", "Quand": "31/05"}, {"Prenom": "Justin", "Quand": "01/06"}, {"Prenom": "Blandine", "Quand": "02/06"}, {"Prenom": "Kévin", "Quand": "03/06"}, {"Prenom": "Clotilde", "Quand": "04/06"}, {"Prenom": "Igor", "Quand": "05/06"}, {"Prenom": "Norbert", "Quand": "06/06"}, {"Prenom": "Gilbert", "Quand": "07/06"}, {"Prenom": "Médard", "Quand": "08/06"}, {"Prenom": "Diane", "Quand": "09/06"}, {"Prenom": "Landry", "Quand": "10/06"}, {"Prenom": "Barnabé", "Quand": "11/06"}, {"Prenom": "Guy", "Quand": "12/06"}, {"Prenom": "Antoine de Padoue", "Quand": "13/06"}, {"Prenom": "Elisée", "Quand": "14/06"}, {"Prenom": "Germaine", "Quand": "15/06"}, {"Prenom": "Jean-François / Régis", "Quand": "16/06"}, {"Prenom": "Hervé", "Quand": "17/06"}, {"Prenom": "Léonce", "Quand": "18/06"}, {"Prenom": "Romuald", "Quand": "19/06"}, {"Prenom": "Silvère", "Quand": "20/06"}, {"Prenom": "Héraclide / Rodolphe", "Quand": "21/06"}, {"Prenom": "Alban", "Quand": "22/06"}, {"Prenom": "Audrey", "Quand": "23/06"}, {"Prenom": "Jean-Baptiste", "Quand": "24/06"}, {"Prenom": "Prosper", "Quand": "25/06"}, {"Prenom": "Anthelme", "Quand": "26/06"}, {"Prenom": "Fernand", "Quand": "27/06"}, {"Prenom": "Irénée", "Quand": "28/06"}, {"Prenom": "Pierre / Paul", "Quand": "29/06"}, {"Prenom": "Martial", "Quand": "30/06"}, {"Prenom": "Thierry", "Quand": "01/07"}, {"Prenom": "Martinien", "Quand": "02/07"}, {"Prenom": "Thomas", "Quand": "03/07"}, {"Prenom": "Florent", "Quand": "04/07"}, {"Prenom": "Antoine", "Quand": "05/07"}, {"Prenom": "Mariette", "Quand": "06/07"}, {"Prenom": "Raoul", "Quand": "07/07"}, {"Prenom": "Thibault", "Quand": "08/07"}, {"Prenom": "Amandine", "Quand": "09/07"}, {"Prenom": "Ulrich", "Quand": "10/07"}, {"Prenom": "Benoît", "Quand": "11/07"}, {"Prenom": "Olivier", "Quand": "12/07"}, {"Prenom": "Henri / Joël", "Quand": "13/07"}, {"Prenom": "Fête nationale", "Quand": "14/07"}, {"Prenom": "Donald", "Quand": "15/07"}, {"Prenom": "Notre Dame du Mont Carmel", "Quand": "16/07"}, {"Prenom": "Charlotte", "Quand": "17/07"}, {"Prenom": "Frédéric", "Quand": "18/07"}, {"Prenom": "Arsène", "Quand": "19/07"}, {"Prenom": "Marina", "Quand": "20/07"}, {"Prenom": "Victor", "Quand": "21/07"}, {"Prenom": "Marie-Madeleine", "Quand": "22/07"}, {"Prenom": "Brigitte", "Quand": "23/07"}, {"Prenom": "Christine", "Quand": "24/07"}, {"Prenom": "Jacques", "Quand": "25/07"}, {"Prenom": "Anne / Joachin", "Quand": "26/07"}, {"Prenom": "Nathalie", "Quand": "27/07"}, {"Prenom": "Samson", "Quand": "28/07"}, {"Prenom": "Marthe", "Quand": "29/07"}, {"Prenom": "Juliette", "Quand": "30/07"}, {"Prenom": "Ignace de Loyola", "Quand": "31/07"}, {"Prenom": "Alphonse", "Quand": "01/08"}, {"Prenom": "Julien / Eymard", "Quand": "02/08"}, {"Prenom": "Lydie", "Quand": "03/08"}, {"Prenom": "Jean-Marie Vianney", "Quand": "04/08"}, {"Prenom": "Abel", "Quand": "05/08"}, {"Prenom": "Transfiguration", "Quand": "06/08"}, {"Prenom": "Gaétan", "Quand": "07/08"}, {"Prenom": "Dominique", "Quand": "08/08"}, {"Prenom": "Amour", "Quand": "09/08"}, {"Prenom": "Laurent", "Quand": "10/08"}, {"Prenom": "Claire", "Quand": "11/08"}, {"Prenom": "Clarisse", "Quand": "12/08"}, {"Prenom": "Hippolyte", "Quand": "13/08"}, {"Prenom": "Evrard", "Quand": "14/08"}, {"Prenom": "Assomption", "Quand": "15/08"}, {"Prenom": "Armel", "Quand": "16/08"}, {"Prenom": "Hyacinthe", "Quand": "17/08"}, {"Prenom": "Hélène", "Quand": "18/08"}, {"Prenom": "Jean-Eudes", "Quand": "19/08"}, {"Prenom": "Bernard", "Quand": "20/08"}, {"Prenom": "Christophe", "Quand": "21/08"}, {"Prenom": "Fabrice", "Quand": "22/08"}, {"Prenom": "Rose de Lima", "Quand": "23/08"}, {"Prenom": "Barthélémy", "Quand": "24/08"}, {"Prenom": "Louis", "Quand": "25/08"}, {"Prenom": "Natacha", "Quand": "26/08"}, {"Prenom": "Monique", "Quand": "27/08"}, {"Prenom": "Augustin", "Quand": "28/08"}, {"Prenom": "Sabine", "Quand": "29/08"}, {"Prenom": "Fiacre", "Quand": "30/08"}, {"Prenom": "Aristide", "Quand": "31/08"}, {"Prenom": "Gilles", "Quand": "01/09"}, {"Prenom": "Ingrid", "Quand": "02/09"}, {"Prenom": "Grégoire", "Quand": "03/09"}, {"Prenom": "Rosalie", "Quand": "04/09"}, {"Prenom": "Raïssa", "Quand": "05/09"}, {"Prenom": "Bertrand", "Quand": "06/09"}, {"Prenom": "Reine", "Quand": "07/09"}, {"Prenom": "Nativité", "Quand": "08/09"}, {"Prenom": "Alain", "Quand": "09/09"}, {"Prenom": "Inès", "Quand": "10/09"}, {"Prenom": "Adelphe", "Quand": "11/09"}, {"Prenom": "Apollinaire", "Quand": "12/09"}, {"Prenom": "Aimé", "Quand": "13/09"}, {"Prenom": "Croix Glorieuse", "Quand": "14/09"}, {"Prenom": "Roland", "Quand": "15/09"}, {"Prenom": "Edith", "Quand": "16/09"}, {"Prenom": "Renaud", "Quand": "17/09"}, {"Prenom": "Nadège", "Quand": "18/09"}, {"Prenom": "Emilie", "Quand": "19/09"}, {"Prenom": "Davy", "Quand": "20/09"}, {"Prenom": "Matthieu", "Quand": "21/09"}, {"Prenom": "Maurice", "Quand": "22/09"}, {"Prenom": "Constant", "Quand": "23/09"}, {"Prenom": "Thècle", "Quand": "24/09"}, {"Prenom": "Hermann", "Quand": "25/09"}, {"Prenom": "Côme / Damien", "Quand": "26/09"}, {"Prenom": "Vincent de Paul", "Quand": "27/09"}, {"Prenom": "Venceslas", "Quand": "28/09"}, {"Prenom": "Michel / Gabriel / Raphaël", "Quand": "29/09"}, {"Prenom": "Jérôme", "Quand": "30/09"}, {"Prenom": "Thérèse de l' Enfant Jésus", "Quand": "01/10"}, {"Prenom": "Léger", "Quand": "02/10"}, {"Prenom": "Gérard", "Quand": "03/10"}, {"Prenom": "François d'Assise", "Quand": "04/10"}, {"Prenom": "Fleur", "Quand": "05/10"}, {"Prenom": "Bruno", "Quand": "06/10"}, {"Prenom": "Serge", "Quand": "07/10"}, {"Prenom": "Pélagie", "Quand": "08/10"}, {"Prenom": "Denis", "Quand": "09/10"}, {"Prenom": "Ghislain", "Quand": "10/10"}, {"Prenom": "Firmin", "Quand": "11/10"}, {"Prenom": "Wilfried", "Quand": "12/10"}, {"Prenom": "Géraud", "Quand": "13/10"}, {"Prenom": "Juste", "Quand": "14/10"}, {"Prenom": "Thérèse d'Avila", "Quand": "15/10"}, {"Prenom": "Edwige", "Quand": "16/10"}, {"Prenom": "Baudoin", "Quand": "17/10"}, {"Prenom": "Luc", "Quand": "18/10"}, {"Prenom": "René", "Quand": "19/10"}, {"Prenom": "Adeline", "Quand": "20/10"}, {"Prenom": "Céline", "Quand": "21/10"}, {"Prenom": "Elodie", "Quand": "22/10"}, {"Prenom": "Jean de Capistran", "Quand": "23/10"}, {"Prenom": "Florentin", "Quand": "24/10"}, {"Prenom": "Crépin", "Quand": "25/10"}, {"Prenom": "Dimitri", "Quand": "26/10"}, {"Prenom": "Emeline", "Quand": "27/10"}, {"Prenom": "Jude", "Quand": "28/10"}, {"Prenom": "Narcisse", "Quand": "29/10"}, {"Prenom": "Bienvenu", "Quand": "30/10"}, {"Prenom": "Quentin", "Quand": "31/10"}, {"Prenom": "Toussaint", "Quand": "01/11"}, {"Prenom": "Défunts", "Quand": "02/11"}, {"Prenom": "Hubert", "Quand": "03/11"}, {"Prenom": "Charles", "Quand": "04/11"}, {"Prenom": "Sylvie", "Quand": "05/11"}, {"Prenom": "Bertille", "Quand": "06/11"}, {"Prenom": "Carine", "Quand": "07/11"}, {"Prenom": "Geoffroy", "Quand": "08/11"}, {"Prenom": "Théodore", "Quand": "09/11"}, {"Prenom": "Léon", "Quand": "10/11"}, {"Prenom": "Armistice 14-18", "Quand": "11/11"}, {"Prenom": "Christian", "Quand": "12/11"}, {"Prenom": "Brice", "Quand": "13/11"}, {"Prenom": "Sidoine", "Quand": "14/11"}, {"Prenom": "Albert", "Quand": "15/11"}, {"Prenom": "Marguerite", "Quand": "16/11"}, {"Prenom": "Elisabeth", "Quand": "17/11"}, {"Prenom": "Aude", "Quand": "18/11"}, {"Prenom": "Tanguy", "Quand": "19/11"}, {"Prenom": "Edmond", "Quand": "20/11"}, {"Prenom": "Christ Roi / Prés de Marie", "Quand": "21/11"}, {"Prenom": "Cécile", "Quand": "22/11"}, {"Prenom": "Clément", "Quand": "23/11"}, {"Prenom": "Flora", "Quand": "24/11"}, {"Prenom": "Catherine", "Quand": "25/11"}, {"Prenom": "Delphine", "Quand": "26/11"}, {"Prenom": "Sévrin", "Quand": "27/11"}, {"Prenom": "Jacques de la Marche", "Quand": "28/11"}, {"Prenom": "Saturnin", "Quand": "29/11"}, {"Prenom": "André", "Quand": "30/11"}, {"Prenom": "Florence", "Quand": "01/12"}, {"Prenom": "Viviane", "Quand": "02/12"}, {"Prenom": "François-Xavier", "Quand": "03/12"}, {"Prenom": "Barbara", "Quand": "04/12"}, {"Prenom": "Gérald", "Quand": "05/12"}, {"Prenom": "Nicolas", "Quand": "06/12"}, {"Prenom": "Ambroise", "Quand": "07/12"}, {"Prenom": "Immaculée Conception", "Quand": "08/12"}, {"Prenom": "Pierre Fourier", "Quand": "09/12"}, {"Prenom": "Romaric", "Quand": "10/12"}, {"Prenom": "Daniel", "Quand": "11/12"}, {"Prenom": "Jeanne-Françoise de Chantal", "Quand": "12/12"}, {"Prenom": "Lucie", "Quand": "13/12"}, {"Prenom": "Odile", "Quand": "14/12"}, {"Prenom": "Ninon", "Quand": "15/12"}, {"Prenom": "Alice", "Quand": "16/12"}, {"Prenom": "Gaël", "Quand": "17/12"}, {"Prenom": "Gatien", "Quand": "18/12"}, {"Prenom": "Urbain", "Quand": "19/12"}, {"Prenom": "Théophile", "Quand": "20/12"}, {"Prenom": "Pierre Canisius", "Quand": "21/12"}, {"Prenom": "Françoise-Xavière", "Quand": "22/12"}, {"Prenom": "Armand", "Quand": "23/12"}, {"Prenom": "Adèle", "Quand": "24/12"}, {"Prenom": "Emmanuel", "Quand": "25/12"}, {"Prenom": "Etienne", "Quand": "26/12"}, {"Prenom": "Jean", "Quand": "27/12"}, {"Prenom": "Innocents", "Quand": "28/12"}, {"Prenom": "David", "Quand": "29/12"}, {"Prenom": "Roger", "Quand": "30/12"}, {"Prenom": "Sylvestre", "Quand": "31/12"}, {"Prenom": "Auguste", "Quand": "29/02"}]

Code : Tout sélectionner

;Almanach défilant 6 mois.pb

InitSprite() 
InitKeyboard()
InitMouse()
; 
Enumeration Fenetre
  #Fenetre_principale
EndEnumeration

Enumeration Gadgets	;
  #Bouton_Quitter
  #Police
  #Police2
  #Police_Lune
  #Police_Bouton_Quitter
EndEnumeration

Enumeration Fichier
  #FichierJson
EndEnumeration

Enumeration Actions 
  #f_sortie 
  #f_aucune 
EndEnumeration	

Enumeration Images
EndEnumeration 

Enumeration Table_de_verite
  #Faux
  #Vrai
EndEnumeration

#SecsParJour = 86400
Enumeration
  #Date_Annee
  #Date_Mois
  #Date_Semaine
  #Date_Jour
  #Date_Heure
  #Date_Minute
  #Date_Seconde
EndEnumeration

#Quantite = 365

Structure MaDate
  Jour.i
  Mois.i
  NSem.i ;Numéro de semaine
EndStructure

Structure Eph
  Prenom.s
  Quand.s
EndStructure  

Global annee.w
Global NumSem.b, NbJMR.b, date, NumJS
Global JourCourant.s, MoisCourant.s, DateCourante.s
Global Semaine.b
Global Masque.s = "%dddd %dd %mmm %yyyy" 
Global NomJours.s = "dimanche lundi mardi mercredi jeudi vendredi samedi"
Global NomJoursAbr.s = "dim lun mar mer jeu ven sam"
Global NomMois.s = "janvier février mars avril mai juin juillet août septembre octobre novembre décembre"
Global NomMoisAbr.s = "jan. fév. mars avr. mai juin juil. août sept. oct. nov. déc."

If LoadFont(#Police, "Calibri", 12, #PB_Font_Bold)
  Global Calibri_12 = FontID(#Police)
EndIf

Global Dim Mois$(12)
Global.MaDate Dim MaDonnee(365)
Global.Eph Dim Ephemeride(#Quantite)

;-
Global.b Quitter = #Faux

Global CoulFond = $C0FFFF, CoulTexte, MoisEnCours = Month(Date()), Annee = Year(Date())
Global.s Masque = "%dddd %dd", Masque2 = "%dddd %dd %mmmm %yyyy", Texte$, JourSemaine, JourMois
Global V, W = 1, X = 2 , Y = 60, Z, i, Num_Mois, XX = X, YY = Y, EspaceMois, F_principale_h, Resultat

Global.s DateJour, JourSemaine, JourMois, JourMois2
Global DizJourMois, UnJourMois
ExamineDesktops() 
Global Largeur_ecran = DesktopWidth(0) 
Global Hauteur_ecran = DesktopHeight(0) 
Global Prof_ecran = DesktopDepth(0) 
Global.s Fichier_de_donnees = "Data\Fetes_a_souhaiter.Json"
EspaceMois = Largeur_ecran / 6

Declare Lire_les_donnees()
Declare.s ChaineDate(Masque.s, date.l)
Declare.b SiBissextile(Annee=-1) ; Retourne Vrai si l'année est une année bissextile (366 jours)
Declare.b JoursDansMois(annee=-1, mois=-1) ; Retourne le nombre de jours dans le mois donné (28 .. 31)
Declare TraitVertical(X, Y, Hauteur, Epaisseur = 1, Couleur = 0) ; Trace un trait vertical avec épaisseur et couleur choisies
Declare TraitHorizontal(X, Y, Longueur, Epaisseur = 1, Couleur = 0) ; Trace un trait horizontal avec épaisseur et couleur choisies
Declare Cadre(X, Y, Largeur, Hauteur, Epaisseur = 1, CouleurCadre = 0); Trace un cadre simple de la couleur choisie
Declare CadreColore(X, Y, Largeur, Hauteur, Epaisseur = 1, CouleurCadre = 0, CouleurFond = 0); Trace un cadre plein avec la couleur choisie
Declare CentrerTexte(Fenetre.I, Y.I, Texte.s, Couleur1, Couleur2 = $FF89C0) ; Centre le texte dans la fenêtre à la hauteur et à la couleur choisies.
Declare Calculer()
Declare.i MonJDS (date.i)
Declare.i NumSem(date.i)
Declare CalculerNumSem()
Declare Affiche(Annee)

Lire_les_donnees()

; 
; ouvrir une fenêtre maximisée la même taille que le bureau et sans bordure
; 
F_principale_h = OpenWindow(#Fenetre_principale, 0, 0, Largeur_ecran, Hauteur_ecran, "", 
                            #PB_Window_BorderLess|#PB_Window_ScreenCentered|#PB_Window_Maximize) 
; 
; ouvrir un écran de la même taille que la fenêtre (c'est à dire couvrant l'ensemble)
; 
OpenWindowedScreen(F_principale_h, 0, 0, Largeur_ecran, Hauteur_ecran, 0, 0, 0, #PB_Screen_SmartSynchronization) 

SetClassLongPtr_(ScreenID(), #GCL_HCURSOR, LoadCursor_(0, #IDC_HAND)) ; SetClassLongPtr_ = Compatibilité 32-64 bits
ShowCursor_(#True)                                                    ; montrer le curseur

ClearScreen($FF89C0)
StartDrawing(ScreenOutput())

DrawingFont(Calibri_12)
DrawingMode(#PB_2DDrawing_AlphaChannel)
FrontColor($000000) : BackColor($FFC0C0)

Procedure Lire_les_donnees()
    If ReadFile(#FichierJson, Fichier_de_donnees)
    CloseFile(#FichierJson)
    
    ;Lire un fichier JSON (Analyser les données JSON à partir d'un fichier)
    LoadJSON(#FichierJson, Fichier_de_donnees)
    
    ;Extraire les éléments dans le tableau spécifié
    ExtractJSONArray(JSONValue(#FichierJson), Ephemeride())
  Else
    action = #f_sortie
    MessageRequester("ATTENTION","Impossible de charger le fichier")
    End
  EndIf
EndProcedure

Procedure.s ChaineDate(Masque.s, date.l) 
  
  Masque = ReplaceString (Masque, "%dddd" , StringField ( NomJours , DayOfWeek (date) + 1, " " )) 
  Masque = ReplaceString (Masque, "%ddd" , StringField ( NomJoursAbr , DayOfWeek (date) + 1, " " )) 
  Masque = ReplaceString (Masque, "%mmmm" , StringField ( NomMois , Month (date), " " )) 
  Masque = ReplaceString (Masque, "%mmm" , StringField ( NomMoisAbr , Month (date), " " )) 
  
  ProcedureReturn FormatDate (Masque, date) 
  
EndProcedure

Procedure.b SiBissextile(Annee=-1)
  ; Retourne Vrai si l'année est une année bissextile (366 jours)
  ; S'il n'y a aucun argument, l'année en cours est utilisée
  ;   Dans le calendrier grégorien, l'année bissextile est
  ;   toute année divisible par 4, sauf
  ;   année du centenaire non divisible par 400
  ; L'année équinoxe de printemps est d'environ 365.242374 jours longs (et croissants)
  
  If Annee<=0: Annee = Year(Date()): EndIf ; Cette année
  If (Mod(Annee,4)=0 And Mod(Annee,100)<>0) Or (Mod(Annee,400)=0)
    ProcedureReturn #True
  EndIf
  ProcedureReturn #False
EndProcedure

Procedure.b JoursDansMois(annee=-1, mois=-1)
  ; Retourne le nombre de jours dans le mois donné (28 .. 31)
  ; Si l'année est absente, l'année en cours est utilisée
  ; Si l'année est présente mais le mois est absent, février est utilisé
  ; Si l'année et le mois sont tous deux absents, le mois courant de l'année en cours est utilisé
  Protected Jours
  If annee<=0
    annee = Year(Date())
    If mois<=0: mois = Month(Date()): EndIf
  Else
    If mois<=0: mois = 2: EndIf
  EndIf
  If mois=2
    Jours = 28+SiBissextile(annee);
  Else
    jours = 31-$A55>>mois&1
  EndIf
  ProcedureReturn jours
EndProcedure

Procedure TraitVertical(X, Y, Hauteur, Epaisseur = 1, Couleur = 0) ; Trace un trait vertical avec épaisseur et couleur choisies
  Protected.i i = 0
  
  If Epaisseur > 0
    While i < Epaisseur
      Line(X + i, Y, 1, Hauteur, Couleur)
      i + 1
    Wend
  Else
    Line(X, Y, 1, Hauteur, Couleur)
  EndIf
EndProcedure

Procedure TraitHorizontal(X, Y, Longueur, Epaisseur = 1, Couleur = 0) ; Trace un trait horizontal avec épaisseur et couleur choisies
  Protected.i i = 0
  
  If Epaisseur > 0
    While i < Epaisseur
      Line(X, Y + i, Longueur, 1, Couleur)
      i + 1
    Wend
  Else
    Line(X, Y, Longueur, 1, Couleur)
  EndIf
EndProcedure

Procedure Cadre(X, Y, Largeur, Hauteur, Epaisseur = 1, CouleurCadre = 0); Trace un cadre simple de la couleur choisie                                                                        
  TraitHorizontal(X, Y, Largeur, Epaisseur, CouleurCadre)               ;Ligne supérieure
  
  TraitVertical(X, Y, Hauteur + Epaisseur, Epaisseur, CouleurCadre);Ligne gauche
  
  TraitVertical(X + Largeur, Y, Hauteur + Epaisseur, Epaisseur, CouleurCadre);Ligne droite
  
  TraitHorizontal(X, Y + Hauteur, Largeur, Epaisseur, CouleurCadre);Ligne inférieure
EndProcedure


Procedure CadreColore(X, Y, Largeur, Hauteur, Epaisseur = 1, CouleurCadre = 0, CouleurFond = 0); Trace un cadre plein avec la couleur choisie
  Cadre(X, Y, Largeur, Hauteur, Epaisseur, CouleurCadre)
  
  FillArea(X + Largeur / 2, Y + Hauteur / 2, CouleurCadre, CouleurFond);Remplir le cadre
EndProcedure

Macro Si(expression,Vrai,Faux)
  If Bool(expression)
    Vrai
  Else
    Faux
  EndIf
EndMacro

Procedure CentrerTexte(Fenetre.I, Y.I, Texte.s, Couleur1, Couleur2 = $FF89C0) ; Centre le texte dans la fenêtre à la hauteur et à la couleur choisies.
  DrawText((DesktopWidth(Fenetre) - TextWidth(Texte)) / 2, Y, Texte, Couleur1, Couleur2)
EndProcedure

Procedure Calculer()
  
  CadreColore(XX, YY - 20, EspaceMois * 6, 670, 1, $000000, $C0FFFF) ; Cadre du calendrier
  
  ; Initialiser les noms de mois
  For i = 1 To 12
    Mois$(i) = StringField(NomMois.s, i, " ")
    Mois$(i) = UCase(Left(Mois$(i), 1)) + Mid(Mois$(i), 2)
  Next i
  ;Afficher les mois du mois courant à la fin de l'année courante
  z = 0
  Num_Mois = MoisEnCours
  While Num_Mois < 13
    Affiche(Annee)
    Num_Mois + 1
    If Num_Mois = 13
      Num_Mois = 1
      Annee + 1
    EndIf
    z + 1
    If z < 5 And Num_Mois > 12
      Num_Mois = 1
      Annee + 1
      While Num_Mois < 13 And z < 5
        Affiche(Annee)
        Num_Mois + 1
        z + 1
      Wend
    EndIf
    If z > 5 ; si 6 mois sont affichés c'est suffisant
      Break
    EndIf
  Wend
  
  XX = X
  
  For i = 1 To 5
    TraitVertical(((i * EspaceMois) + XX),YY - 20, 670, 2, $000000) ; Traits entre chaque mois
  Next
  
  TraitHorizontal(XX, YY, EspaceMois * 6, 2, $000000) ; Trait sous les mois
  
  XX + 20
  ;- Hiver	
  If Mois$(MoisEnCours) = "Janvier"
    FillArea(XX , 50, $000000, $EEEEEE) ; hiver 2
    DrawText(XX , 41, Mois$(1), $000000, $EEEEEE)
    FillArea(XX + EspaceMois, 50, $000000, $EEEEEE) ; hiver 3
    DrawText(XX + EspaceMois, 41, Mois$(2), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $72D772) ; printemps 1
    DrawText(XX + (EspaceMois * 2), 41, Mois$(3), $000000, $72D772)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $72D772) ; printemps 2
    DrawText(XX + (EspaceMois * 3), 41, Mois$(4), $000000, $72D772)
    FillArea(XX + (EspaceMois * 4) , 50, $000000, $72D772) ; printemps 3
    DrawText(XX + (EspaceMois * 4) , 41, Mois$(5), $000000, $72D772)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $00F0F0) ; été 1
    DrawText(XX + (EspaceMois * 5), 41, Mois$(6), $000000, $00F0F0)
  EndIf
  
  If Mois$(MoisEnCours) = "Février"
    FillArea(XX , 50, $000000, $EEEEEE) ; hiver 3
    DrawText(XX , 41, Mois$(2), $000000, $EEEEEE)
    FillArea(XX + EspaceMois, 50, $000000, $72D772) ; printemps 1
    DrawText(XX + EspaceMois, 41, Mois$(3), $000000, $72D772)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $72D772) ; printemps 2
    DrawText(XX + (EspaceMois * 2), 41, Mois$(4), $000000, $72D772)
    FillArea(XX + (EspaceMois * 3) , 50, $000000, $72D772) ; printemps 3
    DrawText(XX + (EspaceMois * 3) , 41, Mois$(5), $000000, $72D772)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $00F0F0) ; été 1
    DrawText(XX + (EspaceMois * 4), 41, Mois$(6), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $00F0F0) ; été 2
    DrawText(XX + (EspaceMois * 5), 41, Mois$(7), $000000, $00F0F0)
  EndIf
  
  ;- Printemps
  If  Mois$(MoisEnCours) = "Mars"
    FillArea(XX , 50, $000000, $72D772) ; printemps 1
    DrawText(XX , 41, Mois$(3), $000000, $72D772)
    FillArea(XX + EspaceMois, 50, $000000, $72D772) ; printemps 2
    DrawText(XX + EspaceMois, 41, Mois$(4), $000000, $72D772)
    FillArea(XX + (EspaceMois * 2) , 50, $000000, $72D772) ; printemps 3
    DrawText(XX + (EspaceMois * 2) , 41, Mois$(5), $000000, $72D772)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $00F0F0) ; été 1
    DrawText(XX +(EspaceMois * 3), 41, Mois$(6), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $00F0F0) ; été 2
    DrawText(XX + (EspaceMois * 4), 41, Mois$(7), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $00F0F0) ; été 3
    DrawText(XX + (EspaceMois * 5), 41, Mois$(8), $000000, $00F0F0)	
  EndIf
  
  If  Mois$(MoisEnCours) = "Avril"
    FillArea(XX, 50, $000000, $72D772) ; printemps 2
    DrawText(XX, 41, Mois$(4), $000000, $72D772)
    FillArea(XX + EspaceMois , 50, $000000, $72D772) ; printemps 3
    DrawText(XX + EspaceMois , 41, Mois$(5), $000000, $72D772)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $00F0F0) ; été 1
    DrawText(XX + (EspaceMois * 2), 41, Mois$(6), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $00F0F0) ; été 2
    DrawText(XX + (EspaceMois * 3), 41, Mois$(7), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $00F0F0) ; été 3
    DrawText(XX + (EspaceMois * 4), 41, Mois$(8), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $81C5FE) ; automne 1
    DrawText(XX + (EspaceMois * 5), 41, Mois$(9), $000000, $81C5FE)	
  EndIf
  
  If  Mois$(MoisEnCours) = "Mai"
    FillArea(XX , 50, $000000, $72D772) ; printemps 3
    DrawText(XX , 41, Mois$(5), $000000, $72D772)
    FillArea(XX + EspaceMois, 50, $000000, $00F0F0) ; été 1
    DrawText(XX + (EspaceMois), 41, Mois$(6), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $00F0F0) ; été 2
    DrawText(XX + (EspaceMois * 2), 41, Mois$(7), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $00F0F0) ; été 3
    DrawText(XX + (EspaceMois * 3), 41, Mois$(8), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $81C5FE) ; automne 1
    DrawText(XX + (EspaceMois * 4), 41, Mois$(9), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $81C5FE) ; automne 2
    DrawText(XX + (EspaceMois * 5), 41, Mois$(10), $000000, $81C5FE)	
  EndIf
  
  ;- été
  If  Mois$(MoisEnCours) = "Juin"
    FillArea(XX , 50, $000000, $00F0F0) ; été 1
    DrawText(XX , 41, Mois$(6), $000000, $00F0F0)
    FillArea(XX + EspaceMois, 50, $000000, $00F0F0) ; été 2
    DrawText(XX + EspaceMois, 41, Mois$(7), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $00F0F0) ; été 3
    DrawText(XX + (EspaceMois * 2), 41, Mois$(8), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $81C5FE) ; automne 1
    DrawText(XX + (EspaceMois * 3), 41, Mois$(9), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $81C5FE) ; automne 2
    DrawText(XX + (EspaceMois * 4), 41, Mois$(10), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $81C5FE) ; automne 3
    DrawText(XX + (EspaceMois * 5), 41, Mois$(11), $000000, $81C5FE)	
  EndIf
  
  If  Mois$(MoisEnCours) = "Juillet"
    FillArea(XX , 50, $000000, $00F0F0) ; été 2
    DrawText(XX , 41, Mois$(7), $000000, $00F0F0)
    FillArea(XX + EspaceMois, 50, $000000, $00F0F0) ; été 3
    DrawText(XX + EspaceMois, 41, Mois$(8), $000000, $00F0F0)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $81C5FE) ; automne 1
    DrawText(XX + (EspaceMois * 2), 41, Mois$(9), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $81C5FE) ; automne 2
    DrawText(XX + (EspaceMois * 3), 41, Mois$(10), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $81C5FE) ; automne 3
    DrawText(XX + (EspaceMois * 4), 41, Mois$(11), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $EEEEEE) ; hiver 1
    DrawText(XX + (EspaceMois * 5), 41, Mois$(12), $000000, $EEEEEE)
  EndIf
  
  If  Mois$(MoisEnCours) = "Août"
    FillArea(XX , 50, $000000, $00F0F0) ; été 3
    DrawText(XX , 41, Mois$(8), $000000, $00F0F0)
    FillArea(XX + EspaceMois, 50, $000000, $81C5FE) ; automne 1
    DrawText(XX + EspaceMois, 41, Mois$(9), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $81C5FE) ; automne 2
    DrawText(XX + (EspaceMois * 2), 41, Mois$(10), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $81C5FE) ; automne 3
    DrawText(XX + (EspaceMois * 3), 41, Mois$(11), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $EEEEEE) ; hiver 1
    DrawText(XX + (EspaceMois * 4), 41, Mois$(12), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $EEEEEE) ; hiver 2
    DrawText(XX + (EspaceMois * 5), 41, Mois$(1), $000000, $EEEEEE)
  EndIf
  
  
  ;- Automne
  If  Mois$(MoisEnCours) = "Septembre"
    FillArea(XX , 50, $000000, $81C5FE) ; automne 1
    DrawText(XX , 41, Mois$(9), $000000, $81C5FE)
    FillArea(XX + EspaceMois, 50, $000000, $81C5FE) ; automne 2
    DrawText(XX + (EspaceMois), 41, Mois$(10), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $81C5FE) ; automne 3
    DrawText(XX + (EspaceMois * 2), 41, Mois$(11), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $EEEEEE) ; hiver 1
    DrawText(XX + (EspaceMois * 3), 41, Mois$(12), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $EEEEEE) ; hiver 2
    DrawText(XX + (EspaceMois * 4), 41, Mois$(1), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $EEEEEE) ; hiver 3
    DrawText(XX + (EspaceMois * 5), 41, Mois$(2), $000000, $EEEEEE)
  EndIf
  
  If  Mois$(MoisEnCours) = "Octobre"
    FillArea(XX, 50, $000000, $81C5FE) ; automne 2
    DrawText(XX , 41, Mois$(10), $000000, $81C5FE)
    FillArea(XX + EspaceMois, 50, $000000, $81C5FE)
    DrawText(XX + (EspaceMois), 41, Mois$(11), $000000, $81C5FE)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $EEEEEE) ; hiver 1
    DrawText(XX + (EspaceMois * 2), 41, Mois$(12), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $EEEEEE) ; hiver 2
    DrawText(XX + (EspaceMois * 3), 41, Mois$(1), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $EEEEEE) ; hiver 3
    DrawText(XX + (EspaceMois * 4), 41, Mois$(2), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $72D772) ; printemps 1
    DrawText(XX + (EspaceMois * 5), 41, Mois$(3), $000000, $72D772)
  EndIf
  
  If  Mois$(MoisEnCours) = "Novembre"
    FillArea(XX, 50, $000000, $81C5FE) ; automne 3
    DrawText(XX, 41, Mois$(11), $000000, $81C5FE)
    FillArea(XX + (EspaceMois), 50, $000000, $EEEEEE) ; hiver 1
    DrawText(XX + (EspaceMois), 41, Mois$(12), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $EEEEEE) ; hiver 2
    DrawText(XX + (EspaceMois * 2), 41, Mois$(1), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $EEEEEE) ; hiver 3
    DrawText(XX + (EspaceMois * 3), 41, Mois$(2), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $72D772) ; printemps 1
    DrawText(XX + (EspaceMois * 4), 41, Mois$(3), $000000, $72D772)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $72D772) ; printemps 2
    DrawText(XX + (EspaceMois * 5), 41, Mois$(4), $000000, $72D772)
  EndIf
  
  If Mois$(MoisEnCours) = "Décembre"
    FillArea(XX , 50, $000000, $EEEEEE) ; hiver 1
    DrawText(XX , 41, Mois$(12), $000000, $EEEEEE)
    DrawText(XX + EspaceMois, 41, Mois$(12), $000000, $EEEEEE)
    FillArea(XX + EspaceMois, 50, $000000, $EEEEEE) ; hiver 2
    DrawText(XX + EspaceMois, 41, Mois$(1), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 2), 50, $000000, $EEEEEE) ; hiver 3
    DrawText(XX + (EspaceMois * 2), 41, Mois$(2), $000000, $EEEEEE)
    FillArea(XX + (EspaceMois * 3), 50, $000000, $72D772) ; printemps 1
    DrawText(XX + (EspaceMois * 3), 41, Mois$(3), $000000, $72D772)
    FillArea(XX + (EspaceMois * 4), 50, $000000, $72D772) ; printemps 2
    DrawText(XX + (EspaceMois * 4), 41, Mois$(4), $000000, $72D772)
    FillArea(XX + (EspaceMois * 5), 50, $000000, $72D772) ; printemps 3
    DrawText(XX + (EspaceMois * 5), 41, Mois$(5), $000000, $72D772)
  EndIf
  
  XX = X
EndProcedure

Procedure.i MonJDS (date.i)
   Protected d.i
   
   d = DayOfWeek(date)
   If d = 0
      d = 7             ; pour le dimanche, retourne 7 au lieu de 0
   EndIf
   ProcedureReturn d
EndProcedure


Procedure.i NumSem(date.i)
   ; Les calculs sont basés sur le fait que la première semaine de l'année
   ; contient toujours le 4 Janvier.
   ; [conformément à http://en.wikipedia.org/wiki/Seven-day_week#Week_numbering
   ;  ou mieux    http://de.wikipedia.org/wiki/Woche#Kalenderwoche]
   
   Protected jda.i=DayOfYear(date), annee.i=Year(date)
   Protected DernPrec.i  ; dernier jour de la dernière semaine de l'année précédente
   Protected DernCour.i  ; dernier jour de la dernière semaine de l'année en cours
   
   DernPrec = 4 - MonJDS(Date(annee, 1, 4, 0,0,0))
   DernCour = 4 - MonJDS(Date(annee,12,28, 0,0,0)) + DayOfYear(Date(annee,12,31, 0,0,0))
   
   If jda <= DernCour
      If jda <= DernPrec
         ; Le jour donné est dans la dernière semaine de l'année précédente.
         jda + DayOfYear(Date(annee-1,12,31, 0,0,0))
         DernPrec = 4 - MonJDS(Date(annee-1,1,4, 0,0,0))
      EndIf
      ProcedureReturn Round((jda-DernPrec)/7, #PB_Round_Up)
   Else
      ; Le jour donné est dans la première semaine de l'année prochaine.
      ProcedureReturn 1
   EndIf
EndProcedure

Procedure CalculerNumSem()
  For j = 1 To 12
    For i = 1 To JoursDansMois(Year(Date()), j)
      MaDonnee(W-1)\Jour = i
      MaDonnee(W-1)\Mois = j
      MaDonnee(W-1)\NSem = NumSem(Date(Year(Date()), j, i, 0, 0, 0))
      W + 1
    Next i
  Next j 
EndProcedure

 Procedure Affiche(Annee) 
  For i = 1 To JoursDansMois(Annee, Num_Mois)
    DateJour = ChaineDate(Masque, Date(Annee, Num_Mois, i, 0, 0, 0))
    JourSemaine = StringField(DateJour, 1, " ")
    JourSemaine = UCase(Left(JourSemaine, 1)) + Right(JourSemaine, Len(JourSemaine) - 1)
    JourMois = StringField(DateJour, 2, " ")
    DizJourMois = Val(Left(JourMois, 1))
    UnJourMois = Val(Right(JourMois ,1))
    
    FrontColor(0)
    BackColor(CoulFond)
    DrawingFont(Calibri_12)
    Texte$ = ""
    
    Select JourSemaine ;- sélection Jds
      Case "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"
        FrontColor($00)
        BackColor(CoulFond)
        DrawText(XX + 2, YY, LSet(JourSemaine, 2, " ") + "   ") ; Jours de semaine en noir
        If UnJourMois > 0 And DizJourMois
          DrawText(XX + 26, YY, Str(DizJourMois)) ; dizaine du mois
          DrawText(XX + 26 + TextWidth("0"), YY, Str(UnJourMois)) ; Jour du mois
        ElseIf DizJourMois < 1
          DrawText(XX + 26 + TextWidth("0"), YY, Str(UnJourMois)) ; dizaine du mois
        ElseIf DizJourMois > 0 And UnJourMois = 0                 ; 10 20 ou 30
          DrawText(XX + 26, YY, Str(DizJourMois))                 ; dizaine du mois
          DrawText(XX + 26 + TextWidth("0"), YY, "0")             ; Jour du mois			
        EndIf
        
      Case "Dimanche" ;- sélection dimanche
        FrontColor($FF)
        BackColor(CoulFond)
        DrawText(XX + 2, YY, LSet(JourSemaine, 2, " ") + "   ") ; dimanche en rouge
        If UnJourMois > 0 And DizJourMois
          DrawText(XX + 26, YY, Str(DizJourMois)) ; dizaine du MoisEnCours
          DrawText(XX + 26 + TextWidth("0"), YY, Str(UnJourMois)) ; Jour du MoisEnCours
        ElseIf DizJourMois < 1
          DrawText(XX + 26 + TextWidth("0"), YY, Str(UnJourMois)) ; dizaine du MoisEnCours
        ElseIf DizJourMois > 0 And UnJourMois = 0                 ; 10 20 ou 30
          DrawText(XX + 26, YY, Str(DizJourMois))                 ; dizaine du mois
          DrawText(XX + 26 + TextWidth("0"), YY, "0")             ; Jour du mois					
        EndIf
        TraitHorizontal(XX, YY + TextHeight(" "), EspaceMois)
        V = DayOfYear(Date(Annee,Num_Mois,Val(JourMois),0,0,0))
        DrawText(XX + 290, YY, Str(MaDonnee(V-1)\NSem),0)
    EndSelect
    
    ;- Fêtes fixes
    W = DayOfYear(Date(annee,Num_Mois,Val(JourMois),0,0,0))
    If SiBissextile(annee)
      w - 2
    Else
      w - 1
    EndIf  
    
    If Ephemeride(w)\Quand = JourMois + "/" + RSet(Str(Num_Mois), 2, "0")
      DrawText(XX + 70, YY, Ephemeride(w)\Prenom,0)
    EndIf
    
    If JourMois = "01" And Num_Mois = 1 : DrawText(XX + 70, YY, "Nouvel An", $FF) : EndIf		
    If JourMois = "01" And Num_Mois = 5 : DrawText(XX + 70, YY, "Fête du travail", $FF) : EndIf
    If JourMois = "08" And Num_Mois = 5 : DrawText(XX + 70, YY, "Victoire 1945", $FF) : EndIf		
    If JourMois = "14" And Num_Mois = 7 : DrawText(XX + 70, YY, "Fête Nationale", $FF) : EndIf		
    If JourMois = "15" And Num_Mois = 8 : DrawText(XX + 70, YY, "Assomption", $FF) : EndIf		
    If JourMois = "01" And Num_Mois = 11 : DrawText(XX + 70, YY, "Toussaint", $FF) : EndIf		
    If JourMois = "11" And Num_Mois = 11 : DrawText(XX + 70, YY, "Armistice 1918", $FF) : EndIf		
    If JourMois = "25" And Num_Mois = 12 : DrawText(XX + 70, YY, "Noël", $FF) : EndIf
    
    If JourMois = RSet(Str(Day(Date())), 2, "0") And Num_Mois = Month(Date()) ;- AuJourd'hui
      Si( JourSemaine = "Dimanche", CoulTexte = $FF, CoulTexte = 0) ; Blanc sur fond rouge ou blanc sur fond noir
      
      DrawText(XX + 2, YY, LSet(JourSemaine, 2, " ") + "    ", $FFFFFF, CoulTexte)
      si(JourMois >= "10", JourMois = Left(JourMois, 2), JourMois = "  " + Right(JourMois, 1))
      DrawText(XX + 26, YY, JourMois + " ", $FFFFFF, CoulTexte)
    EndIf
    YY + TextHeight(" ") + 2
  Next
  XX + EspaceMois
  YY = Y
EndProcedure

CalculerNumSem()
Calculer()

CentrerTexte(#Fenetre_principale, 10, "Pressez une touche ou cliquez un bouton de la souris pour sortir", $FFFFFF)

StopDrawing()
FlipBuffers()

;- 
;- gestion des événements en boucle sans fin
; 
Global action.i = #f_aucune 
Repeat 
  Global event.i = WindowEvent() 
  Select event 
    Case #PB_Event_CloseWindow 
      action = #f_sortie 
    Case 0 
      ; 
      ; il n'Y a pas d'événements, donc faisons nos trucs graphiques
      ; 
      ExamineKeyboard() 
      If KeyboardPushed(#PB_Key_All) 
        action = #f_sortie 
      EndIf 
      
      ExamineMouse()
      Resultat = MouseButton(#PB_MouseButton_Left)
      If  Resultat = 1
        action = #f_sortie
      EndIf
      Resultat = MouseButton(#PB_MouseButton_Middle)
      If  Resultat = 1
        action = #f_sortie
      EndIf
      Resultat = MouseButton(#PB_MouseButton_Right)
      If  Resultat = 1
        action = #f_sortie
      EndIf
      ; 
      ; et montrons les choses sur l'écran
      ; 
      FlipBuffers() 
      ; 
  EndSelect 
Until action = #f_sortie 
; 
; fermer l'écran et la fenêtre en douceur
; 
CloseScreen() 
CloseWindow(#Fenetre_principale)

Dernière modification par Micoute le mer. 09/mars/2016 11:57, modifié 1 fois.
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 5.73 PB 6.00 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Avatar de l’utilisateur
Kwai chang caine
Messages : 6962
Inscription : sam. 23/sept./2006 18:32
Localisation : Isere

Re: Calendrier défilant.

Message par Kwai chang caine »

Au premier abord, deux problémes :

- Quand je clic quelque part sur le calendrier l'appli se ferme 8O
- Si il trouve pas le fichier, la msgbox apparait mais quand on clic ok, l'appli reste grise sans rien faire, je pense qu'ils serait bon pour le coups, que cette fois l'appli se termine :lol: :wink:

Merci pour ce partage 8)
ImageLe bonheur est une route...
Pas une destination

PureBasic Forum Officiel - Site PureBasic
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Calendrier défilant.

Message par Micoute »

Code corrigé dans le premier post.

Je n'ai pas expliqué le mode d'emploi : Le calendrier affiche toutes les dates de l'année avec les fêtes à souhaiter ainsi que les fêtes fixes 1/1, 1/5, 8/5, 14/7, etc... et affiche 6 mensualités en partant du premier du mois en cours, il ne fait que cela.

Si on clique dans l'écran ou qu'on appuie sur une touche, il se ferme.

Je compte l'améliorer, pour qu'il fasse d'autres fonctions telles que les lunaisons, le jour de l'année, le nombre de jour pour finir l'année, etc...
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 5.73 PB 6.00 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Avatar de l’utilisateur
Kwai chang caine
Messages : 6962
Inscription : sam. 23/sept./2006 18:32
Localisation : Isere

Re: Calendrier défilant.

Message par Kwai chang caine »

Si on clique dans l'écran ou qu'on appuie sur une touche, il se ferme.
Drole de comportement ton enfant 8O
Apres tout...c'est toi le papa qui l'éleve :wink:
ImageLe bonheur est une route...
Pas une destination

PureBasic Forum Officiel - Site PureBasic
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Calendrier défilant.

Message par Micoute »

Oui, je sais, mais je l'ai mis dans un écran fenêtré et je crois que je devrais plutôt utiliser les canvas, ce qui me permettrait de mélanger gadgets et écritures pour ainsi pouvoir interagir avec eux.

Il faut savoir qu'au départ je n'avais qu'une vague idée de ce que je voulais faire, donc je n'ai pas fait d'analyse ni de plan, mais je m'aperçois qu'au fil de sa croissance, des idées me viennent et que je cherche le moyen de les réaliser, donc finalement je vais faire une analyse en vue de la programmation de son petit frère.
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 5.73 PB 6.00 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Avatar de l’utilisateur
Ar-S
Messages : 9478
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: Calendrier défilant.

Message par Ar-S »

Et oui, bien penser un programme avant de s'y mettre est une étape à ne vraiment pas négliger.
je code actuellement un nouveau petit soft d'effets d'images et je suis aussi partie un peu vite, ce qui m'a fait perdre du temps en cours de conception. :)
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Marc56
Messages : 2148
Inscription : sam. 08/févr./2014 15:19

Re: Calendrier défilant.

Message par Marc56 »

Micoute a écrit :Oui, je sais, mais je l'ai mis dans un écran fenêtré et je crois que je devrais plutôt utiliser les canvas, ce qui me permettrait de mélanger gadgets et écritures pour ainsi pouvoir interagir avec eux.
Tu peux aussi faire un ListIconGadget de 12 colonnes et 31 lignes (ou plus si tu veux aligner les jours de la semaine)
ou 12 ListIconGadget

:wink:
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Calendrier défilant.

Message par Micoute »

Oui, c'est pas idiot comme idée.
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 5.73 PB 6.00 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Avatar de l’utilisateur
Kwai chang caine
Messages : 6962
Inscription : sam. 23/sept./2006 18:32
Localisation : Isere

Re: Calendrier défilant.

Message par Kwai chang caine »

ars a écrit : Et oui, bien penser un programme avant de s'y mettre est une étape à ne vraiment pas négliger.
Je crois que la vraie différence entre un developeur et un amateur se loge en très grosse partie sur ce point.

Je suis électricien de formation, et il me semble inconcevable de réaliser une installation quelle qu'elle soit sans élaborer un schéma, que ce soit dans ma tête ou sur papier si l'on dépasse l'installation de base d'une maison.
Ca me rassure, m'aide, m'évite l'erreur et me fait gagner un temps incalculable.

Alors on pourrait croire que fort de cette expérience, la gamelle qui me sert de cerveau, aurait compris et serait convaincue du bien fondé de cet outil.
Surtout que certains schémas électrotechniques de feu de carrefours, ou bien de lancement de moteurs n'ont rien à envier à la complexité de certains programmes.

Et bien que neni, j'ai essayé maintes fois de coucher sur le papier un programme, ou bien avec des superbes logiciels freeware comme DIA, ou bien d'autres. ..
J'ai même décidé de commencer le miens en croyant que si mon cerveau ne pouvait se plier au dessin, peut être que le dessin pourrait se plier à mon cerveau par l'entremise d'un soft aussi tordu que mon gadin, et donc de par le fait, forcément, enfin le croyais je à l'époque, neuro compatible avec mon esprit.

Et bien mesdames et messieurs, force est de constater, que j'ai lamentablement échoué, et ceci, malgré le prix de tous mes efforts, à toutes les tentatives de virtalisation de mes nombreux programmes, qui pour la majorité restent le bide ouvert...

J'ai donc abandonné, devant l'ampleur de la tâche, et continue à coder au pif, avançant un jour et reculant de 2 jours lorsque je m'aperçois du mauvais chemin que j'ai emprunté.
Je prie juste les dieux de l'informatique tous les matins de ne pas m'apercevoir de cette bévue seulement le jour où j'appose le mot END à ma prose "algorithmale"

Encore ce jour, je me bat depuis 10 jours à 10h/jours, avec un utilitaire de calcul de charges immobilière, qui me paraissait au demeurant d'une simplicité néonatale, et que je recode quasi entièrement tous les jours pour atteindre le nirvana de ma satisfaction

Alors tout ça pour dire oui, et comme me l'a confirmé le geek full machin...le codage n'a aucune importance, le langage guerre mieux, sauf cas rares, tout est dans l'étude et la reflexion pré codage.

D'ailleurs ne disait t'on pas auparavant programmeur "analyste" ???
ImageLe bonheur est une route...
Pas une destination

PureBasic Forum Officiel - Site PureBasic
Avatar de l’utilisateur
Kwai chang caine
Messages : 6962
Inscription : sam. 23/sept./2006 18:32
Localisation : Isere

Re: Calendrier défilant.

Message par Kwai chang caine »

Et des fois aussi chomeurs pendant leur temps libre !!!! :lol:
ton genie, est certainement plus analyste que codeur
Oui tu as raison, sa vocation va être de piloter des equipes de développeurs aux "younitaide staite" :mrgreen:
Il m'a montré des vidéos de son gourou (un ancien de son école) qui y vit actuellement, qui donne des cours par videoconference à ce qu'il considere être une elite de 40 personnes, qui a bossé chez crosoft, et pour AMAZON, c'est un jeunot, mais il fait pas rire de prétention 8O
Je me suis pas caché de le lui dire....ça lui a pas bien plu du reste :|
ImageLe bonheur est une route...
Pas une destination

PureBasic Forum Officiel - Site PureBasic
Avatar de l’utilisateur
Kwai chang caine
Messages : 6962
Inscription : sam. 23/sept./2006 18:32
Localisation : Isere

Re: Calendrier défilant.

Message par Kwai chang caine »

J'avais entendu dire ça aussi.
Maintenant quand tu penses que ya whatmiles développeurs, de nationalités différentes, sûrement de niveaux différents...
En sachant que même de la même année, dans la même école et la même classe, personne ne code pareil...

Ça me rappelle une maison en moellons que ma femme et moi avons monté avec l'aide d'un maçon. ...
Le problème c'est que les moellons avaient plusieurs années à avoir été transportés, venaient de plusieurs fabricants différents, de plusieurs décennies aussi, car y'en avait a mon père, puis utilisés comme cale, bordure de chemin, bref j'en passe et des meilleures.

Mais comme je suis né d'un temps que les jeunes de 20 ans ne peuvent pas connaître. ..chez moi rien ne se jette..

Tu verrais la gueule de ma maison, tous les matins, quand je pars au boulot, je la regarde et je me dit qu'en plus d'être maçon il était magicien le mec, pour que le mur finalement soit droit.
C'est pas le CAP qu'on aurait du lui décerner, mais la légion d'honneur :mrgreen:
Car tu aurais vu la gueule qu'il faisait à chacun des "presque" moellons terreux que je lui ammenais de mon terrain

Ben la c'est pareil, le mec qui assemble les tombereaux de pavés de codes venant des divers services, il doit se pignoler quand enfin le compilateur arrive jusqu'au END :lol:

On comprend mieux pourquoi le grand DENIS il (nabucco de) verdit ses codes en prenant exemple sur bilou :mrgreen:
ImageLe bonheur est une route...
Pas une destination

PureBasic Forum Officiel - Site PureBasic
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Calendrier défilant.

Message par Micoute »

Le même, mais avec Vector Drawing.
  • [{"Prenom": "", "Quand": "01/01"}, {"Prenom": "Basile", "Quand": "02/01"}, {"Prenom": "Geneviève", "Quand": "03/01"}, {"Prenom": "Odilon", "Quand": "04/01"}, {"Prenom": "Edouard", "Quand": "05/01"}, {"Prenom": "Mélaine", "Quand": "06/01"}, {"Prenom": "Raymond", "Quand": "07/01"}, {"Prenom": "Lucien", "Quand": "08/01"}, {"Prenom": "Alix", "Quand": "09/01"}, {"Prenom": "Guillaume", "Quand": "10/01"}, {"Prenom": "Pauline", "Quand": "11/01"}, {"Prenom": "Tatiana", "Quand": "12/01"}, {"Prenom": "Yvette", "Quand": "13/01"}, {"Prenom": "Nina", "Quand": "14/01"}, {"Prenom": "Rémi", "Quand": "15/01"}, {"Prenom": "Marcel", "Quand": "16/01"}, {"Prenom": "Roseline", "Quand": "17/01"}, {"Prenom": "Prisca", "Quand": "18/01"}, {"Prenom": "Marius", "Quand": "19/01"}, {"Prenom": "Sébastien", "Quand": "20/01"}, {"Prenom": "Agnès", "Quand": "21/01"}, {"Prenom": "Vincent", "Quand": "22/01"}, {"Prenom": "Barnard", "Quand": "23/01"}, {"Prenom": "François de Sales", "Quand": "24/01"}, {"Prenom": "Conversion de Paul", "Quand": "25/01"}, {"Prenom": "Paule", "Quand": "26/01"}, {"Prenom": "Angèle", "Quand": "27/01"}, {"Prenom": "Thomas d'Aquin", "Quand": "28/01"}, {"Prenom": "Gildas", "Quand": "29/01"}, {"Prenom": "Martine", "Quand": "30/01"}, {"Prenom": "Marcelle", "Quand": "31/01"}, {"Prenom": "Ella", "Quand": "01/02"}, {"Prenom": "Présentation", "Quand": "02/02"}, {"Prenom": "Blaise", "Quand": "03/02"}, {"Prenom": "Véronique", "Quand": "04/02"}, {"Prenom": "Agathe", "Quand": "05/02"}, {"Prenom": "Gaston", "Quand": "06/02"}, {"Prenom": "Eugènie", "Quand": "07/02"}, {"Prenom": "Jacqueline", "Quand": "08/02"}, {"Prenom": "Apolline", "Quand": "09/02"}, {"Prenom": "Arnaud", "Quand": "10/02"}, {"Prenom": "Notre Dame de Lourdes", "Quand": "11/02"}, {"Prenom": "Félix", "Quand": "12/02"}, {"Prenom": "Béatrice", "Quand": "13/02"}, {"Prenom": "Valentin", "Quand": "14/02"}, {"Prenom": "Claude", "Quand": "15/02"}, {"Prenom": "Julienne", "Quand": "16/02"}, {"Prenom": "Alexis", "Quand": "17/02"}, {"Prenom": "Bernadette", "Quand": "18/02"}, {"Prenom": "Gabin", "Quand": "19/02"}, {"Prenom": "Aimée", "Quand": "20/02"}, {"Prenom": "Damien", "Quand": "21/02"}, {"Prenom": "Isabelle", "Quand": "22/02"}, {"Prenom": "Lazare", "Quand": "23/02"}, {"Prenom": "Modeste", "Quand": "24/02"}, {"Prenom": "Roméo", "Quand": "25/02"}, {"Prenom": "Nestor", "Quand": "26/02"}, {"Prenom": "Honorine", "Quand": "27/02"}, {"Prenom": "Romain", "Quand": "28/02"}, {"Prenom": "Aubin", "Quand": "01/03"}, {"Prenom": "Charles le Bon", "Quand": "02/03"}, {"Prenom": "Guénolé", "Quand": "03/03"}, {"Prenom": "Casimir", "Quand": "04/03"}, {"Prenom": "Olive", "Quand": "05/03"}, {"Prenom": "Colette", "Quand": "06/03"}, {"Prenom": "Félicité", "Quand": "07/03"}, {"Prenom": "Jean de Dieu", "Quand": "08/03"}, {"Prenom": "Françoise", "Quand": "09/03"}, {"Prenom": "Vivien", "Quand": "10/03"}, {"Prenom": "Rosine", "Quand": "11/03"}, {"Prenom": "Justine", "Quand": "12/03"}, {"Prenom": "Rodrigue", "Quand": "13/03"}, {"Prenom": "Mathilde", "Quand": "14/03"}, {"Prenom": "Louise", "Quand": "15/03"}, {"Prenom": "Bénédicte", "Quand": "16/03"}, {"Prenom": "Patrice", "Quand": "17/03"}, {"Prenom": "Cyrille", "Quand": "18/03"}, {"Prenom": "Joseph", "Quand": "19/03"}, {"Prenom": "Anatole", "Quand": "20/03"}, {"Prenom": "Clémence", "Quand": "21/03"}, {"Prenom": "Léa", "Quand": "22/03"}, {"Prenom": "Victorien", "Quand": "23/03"}, {"Prenom": "Catherine", "Quand": "24/03"}, {"Prenom": "Annonciation", "Quand": "25/03"}, {"Prenom": "Larissa", "Quand": "26/03"}, {"Prenom": "Habib", "Quand": "27/03"}, {"Prenom": "Gontran", "Quand": "28/03"}, {"Prenom": "Gwladys", "Quand": "29/03"}, {"Prenom": "Amédée", "Quand": "30/03"}, {"Prenom": "Benjamin", "Quand": "31/03"}, {"Prenom": "Hugues", "Quand": "01/04"}, {"Prenom": "Sandrine", "Quand": "02/04"}, {"Prenom": "Richard", "Quand": "03/04"}, {"Prenom": "Isidore", "Quand": "04/04"}, {"Prenom": "Irène", "Quand": "05/04"}, {"Prenom": "Marcellin", "Quand": "06/04"}, {"Prenom": "Jean-Baptiste de la Salle", "Quand": "07/04"}, {"Prenom": "Julie", "Quand": "08/04"}, {"Prenom": "Gautier", "Quand": "09/04"}, {"Prenom": "Fulbert", "Quand": "10/04"}, {"Prenom": "Stanislas", "Quand": "11/04"}, {"Prenom": "Jules", "Quand": "12/04"}, {"Prenom": "Ida", "Quand": "13/04"}, {"Prenom": "Maxime", "Quand": "14/04"}, {"Prenom": "Paterne", "Quand": "15/04"}, {"Prenom": "Benoît-Joseph", "Quand": "16/04"}, {"Prenom": "Anicet", "Quand": "17/04"}, {"Prenom": "Parfait", "Quand": "18/04"}, {"Prenom": "Emma", "Quand": "19/04"}, {"Prenom": "Odette", "Quand": "20/04"}, {"Prenom": "Anselme", "Quand": "21/04"}, {"Prenom": "Alexandre", "Quand": "22/04"}, {"Prenom": "Georges", "Quand": "23/04"}, {"Prenom": "Fidèle", "Quand": "24/04"}, {"Prenom": "Marc", "Quand": "25/04"}, {"Prenom": "Alida", "Quand": "26/04"}, {"Prenom": "Zita", "Quand": "27/04"}, {"Prenom": "Valérie", "Quand": "28/04"}, {"Prenom": "Catherine de Sienne", "Quand": "29/04"}, {"Prenom": "Robert", "Quand": "30/04"}, {"Prenom": "", "Quand": "01/05"}, {"Prenom": "Boris", "Quand": "02/05"}, {"Prenom": "Philippe / Jacques", "Quand": "03/05"}, {"Prenom": "Sylvain", "Quand": "04/05"}, {"Prenom": "Judith", "Quand": "05/05"}, {"Prenom": "Prudence", "Quand": "06/05"}, {"Prenom": "Gisèle", "Quand": "07/05"}, {"Prenom": "", "Quand": "08/05"}, {"Prenom": "Pacôme", "Quand": "09/05"}, {"Prenom": "Solange", "Quand": "10/05"}, {"Prenom": "Estelle", "Quand": "11/05"}, {"Prenom": "Achille", "Quand": "12/05"}, {"Prenom": "Rolande", "Quand": "13/05"}, {"Prenom": "Matthias", "Quand": "14/05"}, {"Prenom": "Denise", "Quand": "15/05"}, {"Prenom": "Honoré", "Quand": "16/05"}, {"Prenom": "Pascal", "Quand": "17/05"}, {"Prenom": "Eric", "Quand": "18/05"}, {"Prenom": "Yves", "Quand": "19/05"}, {"Prenom": "Bernardin", "Quand": "20/05"}, {"Prenom": "Constantin", "Quand": "21/05"}, {"Prenom": "Emile", "Quand": "22/05"}, {"Prenom": "Didier", "Quand": "23/05"}, {"Prenom": "Donatien", "Quand": "24/05"}, {"Prenom": "Sophie", "Quand": "25/05"}, {"Prenom": "Bérenger", "Quand": "26/05"}, {"Prenom": "Augustin", "Quand": "27/05"}, {"Prenom": "Germain", "Quand": "28/05"}, {"Prenom": "Aymar", "Quand": "29/05"}, {"Prenom": "Ferdinand", "Quand": "30/05"}, {"Prenom": "Visitation de la Sainte Vierge", "Quand": "31/05"}, {"Prenom": "Justin", "Quand": "01/06"}, {"Prenom": "Blandine", "Quand": "02/06"}, {"Prenom": "Kévin", "Quand": "03/06"}, {"Prenom": "Clotilde", "Quand": "04/06"}, {"Prenom": "Igor", "Quand": "05/06"}, {"Prenom": "Norbert", "Quand": "06/06"}, {"Prenom": "Gilbert", "Quand": "07/06"}, {"Prenom": "Médard", "Quand": "08/06"}, {"Prenom": "Diane", "Quand": "09/06"}, {"Prenom": "Landry", "Quand": "10/06"}, {"Prenom": "Barnabé", "Quand": "11/06"}, {"Prenom": "Guy", "Quand": "12/06"}, {"Prenom": "Antoine de Padoue", "Quand": "13/06"}, {"Prenom": "Elisée", "Quand": "14/06"}, {"Prenom": "Germaine", "Quand": "15/06"}, {"Prenom": "Jean-François / Régis", "Quand": "16/06"}, {"Prenom": "Hervé", "Quand": "17/06"}, {"Prenom": "Léonce", "Quand": "18/06"}, {"Prenom": "Romuald", "Quand": "19/06"}, {"Prenom": "Silvère", "Quand": "20/06"}, {"Prenom": "Héraclide / Rodolphe", "Quand": "21/06"}, {"Prenom": "Alban", "Quand": "22/06"}, {"Prenom": "Audrey", "Quand": "23/06"}, {"Prenom": "Jean-Baptiste", "Quand": "24/06"}, {"Prenom": "Prosper", "Quand": "25/06"}, {"Prenom": "Anthelme", "Quand": "26/06"}, {"Prenom": "Fernand", "Quand": "27/06"}, {"Prenom": "Irénée", "Quand": "28/06"}, {"Prenom": "Pierre / Paul", "Quand": "29/06"}, {"Prenom": "Martial", "Quand": "30/06"}, {"Prenom": "Thierry", "Quand": "01/07"}, {"Prenom": "Martinien", "Quand": "02/07"}, {"Prenom": "Thomas", "Quand": "03/07"}, {"Prenom": "Florent", "Quand": "04/07"}, {"Prenom": "Antoine", "Quand": "05/07"}, {"Prenom": "Mariette", "Quand": "06/07"}, {"Prenom": "Raoul", "Quand": "07/07"}, {"Prenom": "Thibault", "Quand": "08/07"}, {"Prenom": "Amandine", "Quand": "09/07"}, {"Prenom": "Ulrich", "Quand": "10/07"}, {"Prenom": "Benoît", "Quand": "11/07"}, {"Prenom": "Olivier", "Quand": "12/07"}, {"Prenom": "Henri / Joël", "Quand": "13/07"}, {"Prenom": "", "Quand": "14/07"}, {"Prenom": "Donald", "Quand": "15/07"}, {"Prenom": "Notre Dame du Mont Carmel", "Quand": "16/07"}, {"Prenom": "Charlotte", "Quand": "17/07"}, {"Prenom": "Frédéric", "Quand": "18/07"}, {"Prenom": "Arsène", "Quand": "19/07"}, {"Prenom": "Marina", "Quand": "20/07"}, {"Prenom": "Victor", "Quand": "21/07"}, {"Prenom": "Marie-Madeleine", "Quand": "22/07"}, {"Prenom": "Brigitte", "Quand": "23/07"}, {"Prenom": "Christine", "Quand": "24/07"}, {"Prenom": "Jacques", "Quand": "25/07"}, {"Prenom": "Anne / Joachin", "Quand": "26/07"}, {"Prenom": "Nathalie", "Quand": "27/07"}, {"Prenom": "Samson", "Quand": "28/07"}, {"Prenom": "Marthe", "Quand": "29/07"}, {"Prenom": "Juliette", "Quand": "30/07"}, {"Prenom": "Ignace de Loyola", "Quand": "31/07"}, {"Prenom": "Alphonse", "Quand": "01/08"}, {"Prenom": "Julien / Eymard", "Quand": "02/08"}, {"Prenom": "Lydie", "Quand": "03/08"}, {"Prenom": "Jean-Marie Vianney", "Quand": "04/08"}, {"Prenom": "Abel", "Quand": "05/08"}, {"Prenom": "Transfiguration", "Quand": "06/08"}, {"Prenom": "Gaétan", "Quand": "07/08"}, {"Prenom": "Dominique", "Quand": "08/08"}, {"Prenom": "Amour", "Quand": "09/08"}, {"Prenom": "Laurent", "Quand": "10/08"}, {"Prenom": "Claire", "Quand": "11/08"}, {"Prenom": "Clarisse", "Quand": "12/08"}, {"Prenom": "Hippolyte", "Quand": "13/08"}, {"Prenom": "Evrard", "Quand": "14/08"}, {"Prenom": "", "Quand": "15/08"}, {"Prenom": "Armel", "Quand": "16/08"}, {"Prenom": "Hyacinthe", "Quand": "17/08"}, {"Prenom": "Hélène", "Quand": "18/08"}, {"Prenom": "Jean-Eudes", "Quand": "19/08"}, {"Prenom": "Bernard", "Quand": "20/08"}, {"Prenom": "Christophe", "Quand": "21/08"}, {"Prenom": "Fabrice", "Quand": "22/08"}, {"Prenom": "Rose de Lima", "Quand": "23/08"}, {"Prenom": "Barthélémy", "Quand": "24/08"}, {"Prenom": "Louis", "Quand": "25/08"}, {"Prenom": "Natacha", "Quand": "26/08"}, {"Prenom": "Monique", "Quand": "27/08"}, {"Prenom": "Augustin", "Quand": "28/08"}, {"Prenom": "Sabine", "Quand": "29/08"}, {"Prenom": "Fiacre", "Quand": "30/08"}, {"Prenom": "Aristide", "Quand": "31/08"}, {"Prenom": "Gilles", "Quand": "01/09"}, {"Prenom": "Ingrid", "Quand": "02/09"}, {"Prenom": "Grégoire", "Quand": "03/09"}, {"Prenom": "Rosalie", "Quand": "04/09"}, {"Prenom": "Raïssa", "Quand": "05/09"}, {"Prenom": "Bertrand", "Quand": "06/09"}, {"Prenom": "Reine", "Quand": "07/09"}, {"Prenom": "Nativité", "Quand": "08/09"}, {"Prenom": "Alain", "Quand": "09/09"}, {"Prenom": "Inès", "Quand": "10/09"}, {"Prenom": "Adelphe", "Quand": "11/09"}, {"Prenom": "Apollinaire", "Quand": "12/09"}, {"Prenom": "Aimé", "Quand": "13/09"}, {"Prenom": "Croix Glorieuse", "Quand": "14/09"}, {"Prenom": "Roland", "Quand": "15/09"}, {"Prenom": "Edith", "Quand": "16/09"}, {"Prenom": "Renaud", "Quand": "17/09"}, {"Prenom": "Nadège", "Quand": "18/09"}, {"Prenom": "Emilie", "Quand": "19/09"}, {"Prenom": "Davy", "Quand": "20/09"}, {"Prenom": "Matthieu", "Quand": "21/09"}, {"Prenom": "Maurice", "Quand": "22/09"}, {"Prenom": "Constant", "Quand": "23/09"}, {"Prenom": "Thècle", "Quand": "24/09"}, {"Prenom": "Hermann", "Quand": "25/09"}, {"Prenom": "Côme / Damien", "Quand": "26/09"}, {"Prenom": "Vincent de Paul", "Quand": "27/09"}, {"Prenom": "Venceslas", "Quand": "28/09"}, {"Prenom": "Michel / Gabriel / Raphaël", "Quand": "29/09"}, {"Prenom": "Jérôme", "Quand": "30/09"}, {"Prenom": "Thérèse de l' Enfant Jésus", "Quand": "01/10"}, {"Prenom": "Léger", "Quand": "02/10"}, {"Prenom": "Gérard", "Quand": "03/10"}, {"Prenom": "François d'Assise", "Quand": "04/10"}, {"Prenom": "Fleur", "Quand": "05/10"}, {"Prenom": "Bruno", "Quand": "06/10"}, {"Prenom": "Serge", "Quand": "07/10"}, {"Prenom": "Pélagie", "Quand": "08/10"}, {"Prenom": "Denis", "Quand": "09/10"}, {"Prenom": "Ghislain", "Quand": "10/10"}, {"Prenom": "Firmin", "Quand": "11/10"}, {"Prenom": "Wilfried", "Quand": "12/10"}, {"Prenom": "Géraud", "Quand": "13/10"}, {"Prenom": "Juste", "Quand": "14/10"}, {"Prenom": "Thérèse d'Avila", "Quand": "15/10"}, {"Prenom": "Edwige", "Quand": "16/10"}, {"Prenom": "Baudoin", "Quand": "17/10"}, {"Prenom": "Luc", "Quand": "18/10"}, {"Prenom": "René", "Quand": "19/10"}, {"Prenom": "Adeline", "Quand": "20/10"}, {"Prenom": "Céline", "Quand": "21/10"}, {"Prenom": "Elodie", "Quand": "22/10"}, {"Prenom": "Jean de Capistran", "Quand": "23/10"}, {"Prenom": "Florentin", "Quand": "24/10"}, {"Prenom": "Crépin", "Quand": "25/10"}, {"Prenom": "Dimitri", "Quand": "26/10"}, {"Prenom": "Emeline", "Quand": "27/10"}, {"Prenom": "Jude", "Quand": "28/10"}, {"Prenom": "Narcisse", "Quand": "29/10"}, {"Prenom": "Bienvenu", "Quand": "30/10"}, {"Prenom": "Quentin", "Quand": "31/10"}, {"Prenom": "", "Quand": "01/11"}, {"Prenom": "Défunts", "Quand": "02/11"}, {"Prenom": "Hubert", "Quand": "03/11"}, {"Prenom": "Charles", "Quand": "04/11"}, {"Prenom": "Sylvie", "Quand": "05/11"}, {"Prenom": "Bertille", "Quand": "06/11"}, {"Prenom": "Carine", "Quand": "07/11"}, {"Prenom": "Geoffroy", "Quand": "08/11"}, {"Prenom": "Théodore", "Quand": "09/11"}, {"Prenom": "Léon", "Quand": "10/11"}, {"Prenom": "", "Quand": "11/11"}, {"Prenom": "Christian", "Quand": "12/11"}, {"Prenom": "Brice", "Quand": "13/11"}, {"Prenom": "Sidoine", "Quand": "14/11"}, {"Prenom": "Albert", "Quand": "15/11"}, {"Prenom": "Marguerite", "Quand": "16/11"}, {"Prenom": "Elisabeth", "Quand": "17/11"}, {"Prenom": "Aude", "Quand": "18/11"}, {"Prenom": "Tanguy", "Quand": "19/11"}, {"Prenom": "Edmond", "Quand": "20/11"}, {"Prenom": "Christ Roi / Prés de Marie", "Quand": "21/11"}, {"Prenom": "Cécile", "Quand": "22/11"}, {"Prenom": "Clément", "Quand": "23/11"}, {"Prenom": "Flora", "Quand": "24/11"}, {"Prenom": "Catherine", "Quand": "25/11"}, {"Prenom": "Delphine", "Quand": "26/11"}, {"Prenom": "Sévrin", "Quand": "27/11"}, {"Prenom": "Jacques de la Marche", "Quand": "28/11"}, {"Prenom": "Saturnin", "Quand": "29/11"}, {"Prenom": "André", "Quand": "30/11"}, {"Prenom": "Florence", "Quand": "01/12"}, {"Prenom": "Viviane", "Quand": "02/12"}, {"Prenom": "François-Xavier", "Quand": "03/12"}, {"Prenom": "Barbara", "Quand": "04/12"}, {"Prenom": "Gérald", "Quand": "05/12"}, {"Prenom": "Nicolas", "Quand": "06/12"}, {"Prenom": "Ambroise", "Quand": "07/12"}, {"Prenom": "Immaculée Conception", "Quand": "08/12"}, {"Prenom": "Pierre Fourier", "Quand": "09/12"}, {"Prenom": "Romaric", "Quand": "10/12"}, {"Prenom": "Daniel", "Quand": "11/12"}, {"Prenom": "Jeanne-Françoise de Chantal", "Quand": "12/12"}, {"Prenom": "Lucie", "Quand": "13/12"}, {"Prenom": "Odile", "Quand": "14/12"}, {"Prenom": "Ninon", "Quand": "15/12"}, {"Prenom": "Alice", "Quand": "16/12"}, {"Prenom": "Gaël", "Quand": "17/12"}, {"Prenom": "Gatien", "Quand": "18/12"}, {"Prenom": "Urbain", "Quand": "19/12"}, {"Prenom": "Théophile", "Quand": "20/12"}, {"Prenom": "Pierre Canisius", "Quand": "21/12"}, {"Prenom": "Françoise-Xavière", "Quand": "22/12"}, {"Prenom": "Armand", "Quand": "23/12"}, {"Prenom": "Adèle", "Quand": "24/12"}, {"Prenom": "Emmanuel", "Quand": "25/12"}, {"Prenom": "Etienne", "Quand": "26/12"}, {"Prenom": "Jean", "Quand": "27/12"}, {"Prenom": "Innocents", "Quand": "28/12"}, {"Prenom": "David", "Quand": "29/12"}, {"Prenom": "Roger", "Quand": "30/12"}, {"Prenom": "Sylvestre", "Quand": "31/12"}, {"Prenom": "Auguste", "Quand": "29/02"}]
Dernière modification par Micoute le jeu. 10/mars/2016 19:56, modifié 1 fois.
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 5.73 PB 6.00 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Calendrier défilant.

Message par Micoute »

Code : Tout sélectionner

;Almanach défilant 6 mois .Json + Vector Drawing.pb

InitSprite() 
InitKeyboard()
InitMouse()
; 
Enumeration Fenetre
  #Fenetre_principale
EndEnumeration

Enumeration Gadgets	;
  #Cnv
  #Bouton_Quitter
  #Police
  #Police2
  #Police_Lune
  #Police_Bouton_Quitter
EndEnumeration

Enumeration Fichier
  #FichierJson
EndEnumeration

Enumeration Actions 
  #f_sortie 
  #f_aucune 
EndEnumeration	

Enumeration Images
EndEnumeration 

Enumeration Table_de_verite
  #Faux
  #Vrai
EndEnumeration

#SecsParJour = 86400
Enumeration
  #Date_Annee
  #Date_Mois
  #Date_Semaine
  #Date_Jour
  #Date_Heure
  #Date_Minute
  #Date_Seconde
EndEnumeration

#Quantite = 365

Structure MaDate
  Jour.i
  Mois.i
  NSem.i ;Numéro de semaine
EndStructure

Structure Eph
  Prenom.s
  Quand.s
EndStructure  

Global annee.w
Global NumSem.b, NbJMR.b, date, NumJS
Global JourCourant.s, MoisCourant.s, DateCourante.s
Global Semaine.b
Global Masque.s = "%dddd %dd %mmm %yyyy" 
Global NomJours.s = "dimanche lundi mardi mercredi jeudi vendredi samedi"
Global NomJoursAbr.s = "dim lun mar mer jeu ven sam"
Global NomMois.s = "janvier février mars avril mai juin juillet août septembre octobre novembre décembre"
Global NomMoisAbr.s = "jan. fév. mars avr. mai juin juil. août sept. oct. nov. déc."
Global TaillePolice = 12
If LoadFont(#Police, "Calibri", TaillePolice, #PB_Font_Bold)
  Global Calibri_12 = FontID(#Police)
EndIf

Global Dim Mois$(12)
Global.MaDate Dim MaDonnee(365)
Global.Eph Dim Ephemeride(#Quantite)

;-
ExamineDesktops() 
Global Largeur_ecran = DesktopWidth(0) 
Global Hauteur_ecran = DesktopHeight(0) 
Global Prof_ecran = DesktopDepth(0) 
Global.s Fichier_de_donnees = "Data\Fetes_a_souhaiter.Json"

Global.b Quitter = #Faux

Global EspaceMois = Largeur_ecran / 6
Global CoulFond = $C0FFFF, CoulTexte, MoisEnCours = Month(Date()), Annee = Year(Date())
Global.s Masque = "%dddd %dd", Masque2 = "%dddd %dd %mmmm %yyyy", Texte$, JourSemaine, JourMois
Global V, W = 1, X = 0 , Y = 20, L = EspaceMois * 6, H = 700, Z, i, Num_Mois, XX = X, YY = Y, F_principale_h, Resultat

Global.s DateJour, JourSemaine, JourMois, JourMois2
Global DizJourMois, UnJourMois

Declare Lire_les_donnees()
Declare.s ChaineDate(Masque.s, date.l)
Declare.b SiBissextile(Annee=-1) ; Retourne Vrai si l'année est une année bissextile (366 jours)
Declare.b JoursDansMois(annee=-1, mois=-1) ; Retourne le nombre de jours dans le mois donné (28 .. 31)
Declare TraitVertical(X, Y, Hauteur, Epaisseur = 1, Couleur = 0) ; Trace un trait vertical avec épaisseur et couleur choisies
Declare TraitHorizontal(X, Y, Longueur, Epaisseur = 1, Couleur = 0) ; Trace un trait horizontal avec épaisseur et couleur choisies
Declare Cadre(X, Y, Largeur, Hauteur, Epaisseur = 1, CouleurCadre = 0); Trace un cadre simple de la couleur choisie
Declare CadreColore(X, Y, Largeur, Hauteur, Epaisseur = 1, CouleurCadre = 0, CouleurFond = 0); Trace un cadre plein avec la couleur choisie
Declare Calculer()
Declare.i MonJDS (date.i)
Declare.i NumSem(date.i)
Declare CalculerNumSem()
Declare Affiche(Annee)

Macro Si(expression,Vrai,Faux)
  If Bool(expression)
    Vrai
  Else
    Faux
  EndIf
EndMacro

Lire_les_donnees()


Procedure Calculer()
  
  CadreColore(XX, YY - 20, (L) - 3, H, 1, $000000, $C0FFFF) ; Cadre du calendrier
  
  ; Initialiser les noms de mois
  For i = 1 To 12
    Mois$(i) = StringField(NomMois.s, i, " ")
    Mois$(i) = UCase(Left(Mois$(i), 1)) + Mid(Mois$(i), 2)
  Next i
  ;Afficher les mois, du mois courant à la fin de l'année courante
  z = 0
  Num_Mois = MoisEnCours
  While Num_Mois < 13
    Affiche(Annee)
    Num_Mois + 1
    If Num_Mois = 13
      Num_Mois = 1
      Annee + 1
    EndIf
    z + 1
    If z < 5 And Num_Mois > 12
      Num_Mois = 1
      Annee + 1
      While Num_Mois < 13 And z < 5
        Affiche(Annee)
        Num_Mois + 1
        z + 1
      Wend
    EndIf
    If z > 5 ; si 6 mois sont affichés c'est suffisant
      Break
    EndIf
  Wend
  
  XX = X
  
  For i = 1 To 5
    TraitVertical(((i * EspaceMois) + XX),YY - 20, H, 2, $000000) ; Traits entre chaque mois
  Next
  
  TraitHorizontal(XX, YY, L, 2, $000000) ; Trait sous les mois
  
  XX + 20
  
  ;- Hiver  
  If Mois$(MoisEnCours) = "Janvier"
    ; hiver 2
    CoulFond = $EEEEEE
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX , YY-21)
    DrawVectorText(Mois$(1))
    ; hiver 3
    CadreColore(XX+EspaceMois-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + EspaceMois, YY-21)
    DrawVectorText(Mois$(2))
    ; printemps 1
    CoulFond = $72D772
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(3))
    ; printemps 2
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(4))
    ; printemps 3
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4) , YY-21)
    DrawVectorText(Mois$(5))
    ; été 1
    CoulFond = $00F0F0
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(6))
  EndIf
  
  If Mois$(MoisEnCours) = "Février"
    ; hiver 3
    CoulFond = $EEEEEE
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX , YY-21)
    DrawVectorText(Mois$(2))
    ; printemps 1
    CoulFond = $72D772
    CadreColore(XX+(EspaceMois)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + EspaceMois, YY-21)
    DrawVectorText(Mois$(3))
    ; printemps 2
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(4))
    ; printemps 3
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3) , YY-21)
    DrawVectorText(Mois$(5))
    ; été 1
    CoulFond = $00F0F0
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(6))
    ; été 2
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(7))
  EndIf
  
  ;- Printemps
  If  Mois$(MoisEnCours) = "Mars"
    ; printemps 1
    CoulFond = $72D772
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX , YY-21)
    DrawVectorText(Mois$(3))
    ; printemps 2
    CadreColore(XX+EspaceMois-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + EspaceMois, YY-21)
    DrawVectorText(Mois$(4))
    ; printemps 3
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2) , YY-21)
    DrawVectorText(Mois$(5))
    ; été 1
    CoulFond = $00F0F0
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX +(EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(6))
    ; été 2
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(7))
    ; été 3
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(8))	
  EndIf
  
  If  Mois$(MoisEnCours) = "Avril"
    ; printemps 2
    CoulFond = $72D772
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX, YY-21)
    DrawVectorText(Mois$(4))
    ; printemps 3
    CadreColore(XX+(EspaceMois)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + EspaceMois , YY-21)
    DrawVectorText(Mois$(5))
    ; été 1
    CoulFond = $00F0F0
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(6))
    ; été 2
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(7))
    ; été 3
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(8))
    ; automne 1
    CoulFond = $81C5FE
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(9))	
  EndIf
  
  If  Mois$(MoisEnCours) = "Mai"
    ; printemps 3
    CoulFond = $72D772
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX , YY-21)
    DrawVectorText(Mois$(5))
    ; été 1
    CoulFond = $00F0F0
    CadreColore(XX+(EspaceMois)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois), YY-21)
    DrawVectorText(Mois$(6))
    ; été 2
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(7))
    ; été 3
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(8))
    ; automne 1
    CoulFond = $81C5FE
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(9))
    ; automne 2
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(10))	
  EndIf
  
  ;- été
  If  Mois$(MoisEnCours) = "Juin"
    ; été 1
    CoulFond = $00F0F0
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX , YY-21)
    DrawVectorText(Mois$(6))
    ; été 2
    CadreColore(XX+(EspaceMois)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + EspaceMois, YY-21)
    DrawVectorText(Mois$(7))
    ; été 3
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(8))
    ; automne 1
    CoulFond = $81C5FE
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(9))
    ; automne 2
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(10))
    ; automne 3
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(11))	
  EndIf
  
  If  Mois$(MoisEnCours) = "Juillet"
    ; été 2
    CoulFond = $00F0F0
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX , YY-21)
    DrawVectorText(Mois$(7))
    ; été 3
    CadreColore(XX+(EspaceMois)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + EspaceMois, YY-21)
    DrawVectorText(Mois$(8))
    ; automne 1
    CoulFond = $81C5FE
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(9))
    ; automne 2
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(10))
    ; automne 3
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(11))
    ; hiver 1
    CoulFond = $EEEEEE
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(12))
  EndIf
  
  If  Mois$(MoisEnCours) = "Août"
    ; été 3
    CoulFond = $00F0F0
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX , YY-21)
    DrawVectorText(Mois$(8))
    ; automne 1
    CoulFond = $81C5FE
    CadreColore(XX+(EspaceMois)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + EspaceMois, YY-21)
    DrawVectorText(Mois$(9))
    ; automne 2
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(10))
    ; automne 3
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(11))
    ; hiver 1
    CoulFond = $EEEEEE
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(12))
    ; hiver 2
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(1))
  EndIf  
  
  ;- Automne
  If  Mois$(MoisEnCours) = "Septembre"
    ; automne 1
    CoulFond = $81C5FE
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX , YY-21)
    DrawVectorText(Mois$(9))
    ; automne 2
    CadreColore(XX+(EspaceMois)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois), YY-21)
    DrawVectorText(Mois$(10))
    ; automne 3
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(11))
    ; hiver 1
    CoulFond = $EEEEEE
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(12))
    ; hiver 2
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(1))
    ; hiver 3
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(2))
  EndIf
  
  If  Mois$(MoisEnCours) = "Octobre"
    ; automne 2
    CoulFond = $81C5FE
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX , YY-21)
    DrawVectorText(Mois$(10))
    ; automne 3
    CadreColore(XX+(EspaceMois)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois), YY-21)
    DrawVectorText(Mois$(11))
    ; hiver 1
    CoulFond = $EEEEEE
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(12))
    ; hiver 2
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(1))
    ; hiver 3
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(2))
    ; printemps 1
    CoulFond = $72D772
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(3))
  EndIf
  
  If  Mois$(MoisEnCours) = "Novembre"
    ; automne 3
    CoulFond = $81C5FE
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX, YY-21)
    DrawVectorText(Mois$(11))
    ; hiver 1
    CoulFond = $EEEEEE
    CadreColore(XX+(EspaceMois)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois), YY-21)
    DrawVectorText(Mois$(12))
    ; hiver 2
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(1))
    ; hiver 3
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(2))
    ; printemps 1
    CoulFond = $72D772
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(3))
    ; printemps 2
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(4))
  EndIf
  
  If Mois$(MoisEnCours) = "Décembre"
    ; hiver 1
    CoulFond = $EEEEEE
    CadreColore(XX-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX , YY-21)
    DrawVectorText(Mois$(12))
    ; hiver 2
    CadreColore(XX+(EspaceMois)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + EspaceMois, YY-21)
    DrawVectorText(Mois$(1))
    ; hiver 3
    CadreColore(XX+(EspaceMois*2)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 2), YY-21)
    DrawVectorText(Mois$(2))
    ; printemps 1
    CoulFond = $72D772
    CadreColore(XX+(EspaceMois*3)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    VectorSourceColor(RGBA(0, 0, 0, 255))
    MovePathCursor(XX + (EspaceMois * 3), YY-21)
    DrawVectorText(Mois$(3))
    VectorSourceColor(RGBA(0, 0, 0, 255))
    ; printemps 2
    CadreColore(XX+(EspaceMois*4)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    MovePathCursor(XX + (EspaceMois * 4), YY-21)
    DrawVectorText(Mois$(4))
    VectorSourceColor(RGBA(0, 0, 0, 255))
    ; printemps 3
    CadreColore(XX+(EspaceMois*5)-20, YY-20, EspaceMois, 20, 1, 0, CoulFond)
    MovePathCursor(XX + (EspaceMois * 5), YY-21)
    DrawVectorText(Mois$(5))
    VectorSourceColor(RGBA(0, 0, 0, 255))
  EndIf
  
  XX = X
EndProcedure

Procedure.i MonJDS (date.i)
  Protected d.i
  
  d = DayOfWeek(date)
  If d = 0
    d = 7             ; pour le dimanche, retourne 7 au lieu de 0
  EndIf
  ProcedureReturn d
EndProcedure


Procedure.i NumSem(date.i)
  ; Les calculs sont basés sur le fait que la première semaine de l'année
  ; contient toujours le 4 Janvier.
  ; [conformément à http://en.wikipedia.org/wiki/Seven-day_week#Week_numbering
  ;  ou mieux    http://de.wikipedia.org/wiki/Woche#Kalenderwoche]
  
  Protected jda.i=DayOfYear(date), annee.i=Year(date)
  Protected DernPrec.i  ; dernier jour de la dernière semaine de l'année précédente
  Protected DernCour.i  ; dernier jour de la dernière semaine de l'année en cours
  
  DernPrec = 4 - MonJDS(Date(annee, 1, 4, 0,0,0))
  DernCour = 4 - MonJDS(Date(annee,12,28, 0,0,0)) + DayOfYear(Date(annee,12,31, 0,0,0))
  
  If jda <= DernCour
    If jda <= DernPrec
      ; Le jour donné est dans la dernière semaine de l'année précédente.
      jda + DayOfYear(Date(annee-1,12,31, 0,0,0))
      DernPrec = 4 - MonJDS(Date(annee-1,1,4, 0,0,0))
    EndIf
    ProcedureReturn Round((jda-DernPrec)/7, #PB_Round_Up)
  Else
    ; Le jour donné est dans la première semaine de l'année prochaine.
    ProcedureReturn 1
  EndIf
EndProcedure

Procedure CalculerNumSem()
  For j = 1 To 12
    For i = 1 To JoursDansMois(Year(Date()), j)
      MaDonnee(W-1)\Jour = i
      MaDonnee(W-1)\Mois = j
      MaDonnee(W-1)\NSem = NumSem(Date(Year(Date()), j, i, 0, 0, 0))
      W + 1
    Next i
  Next j 
EndProcedure

Procedure Affiche(Annee) 

  For i = 1 To JoursDansMois(Annee, Num_Mois)
    DateJour = ChaineDate(Masque, Date(Annee, Num_Mois, i, 0, 0, 0))
    JourSemaine = StringField(DateJour, 1, " ")
    JourSemaine = UCase(Left(JourSemaine, 1)) + Right(JourSemaine, Len(JourSemaine) - 1)
    JourMois = StringField(DateJour, 2, " ")
    DizJourMois = Val(Left(JourMois, 1))
    UnJourMois = Val(Right(JourMois ,1))
    
    Texte$ = ""
    
    Select JourSemaine ;- sélection Jds
      Case "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"
        VectorSourceColor(RGBA(0, 0, 0, 255))
        MovePathCursor(XX + 4, YY)
        DrawVectorText(LSet(JourSemaine, 2, " ") + "   ") ; Jours de semaine en noir
        If UnJourMois > 0 And DizJourMois
          MovePathCursor(XX + 28, YY)
          DrawVectorText(Str(DizJourMois)) ; dizaine du mois
          MovePathCursor(XX + 28 + VectorTextWidth("0"), YY)
          DrawVectorText(Str(UnJourMois)) ; Jour du mois
        ElseIf DizJourMois < 1
          MovePathCursor(XX + 28 + VectorTextWidth("0"), YY)
          DrawVectorText(Str(UnJourMois)) ; dizaine du mois
        ElseIf DizJourMois > 0 And UnJourMois = 0 ; 10 20 ou 30
          MovePathCursor(XX + 28, YY)
          DrawVectorText(Str(DizJourMois)) ; dizaine du mois
          MovePathCursor(XX + 28 + VectorTextWidth("0"), YY)
          DrawVectorText("0") ; Jour du mois			
        EndIf
        
      Case "Dimanche" ;- sélection dimanche
        VectorSourceColor(RGBA(255, 0, 0, 255))
        MovePathCursor(XX + 4, YY)
        DrawVectorText(LSet(JourSemaine, 2, " ") + "   ") ; dimanche en rouge
        If UnJourMois > 0 And DizJourMois
          MovePathCursor(XX + 28, YY)
          DrawVectorText(Str(DizJourMois)) ; dizaine du MoisEnCours
          MovePathCursor(XX + 28 + VectorTextWidth("0"), YY)
          DrawVectorText(Str(UnJourMois)) ; Jour du MoisEnCours
        ElseIf DizJourMois < 1
          MovePathCursor(XX + 28 + VectorTextWidth("0"), YY)
          DrawVectorText(Str(UnJourMois)) ; dizaine du MoisEnCours
        ElseIf DizJourMois > 0 And UnJourMois = 0 ; 10 20 ou 30
          MovePathCursor(XX + 28, YY)
          DrawVectorText(Str(DizJourMois)) ; dizaine du mois
          MovePathCursor(XX + 28 + VectorTextWidth("0"), YY)
          DrawVectorText("0") ; Jour du mois					
        EndIf
        TraitHorizontal(XX, YY + VectorTextHeight(" "), EspaceMois)
        V = DayOfYear(Date(Annee,Num_Mois,Val(JourMois),0,0,0))
        MovePathCursor(XX + 290, YY)
        DrawVectorText(Str(MaDonnee(V-1)\NSem))
    EndSelect
    
    ;- Fêtes fixes
    W = DayOfYear(Date(annee,Num_Mois,Val(JourMois),0,0,0))
    If SiBissextile(annee)
      w - 2
    Else
      w - 1
    EndIf  
    
    VectorSourceColor(RGBA(0, 0, 0, 255))
    
    If Ephemeride(w)\Quand = JourMois + "/" + RSet(Str(Num_Mois), 2, "0")
      MovePathCursor(XX + 70, YY)
      DrawVectorText(Ephemeride(w)\Prenom)
    EndIf
    
    VectorSourceColor(RGBA(255, 0, 0, 255))
    
    If JourMois = "01" And Num_Mois = 1  : MovePathCursor(XX + 70, YY) : DrawVectorText("Nouvel An") : EndIf		
    If JourMois = "01" And Num_Mois = 5  : MovePathCursor(XX + 70, YY) : DrawVectorText("Fête du travail") : EndIf
    If JourMois = "08" And Num_Mois = 5  : MovePathCursor(XX + 70, YY) : DrawVectorText("Victoire 1945") : EndIf		
    If JourMois = "14" And Num_Mois = 7  : MovePathCursor(XX + 70, YY) : DrawVectorText("Fête Nationale") : EndIf		
    If JourMois = "15" And Num_Mois = 8  : MovePathCursor(XX + 70, YY) : DrawVectorText("Assomption") : EndIf		
    If JourMois = "01" And Num_Mois = 11 : MovePathCursor(XX + 70, YY) : DrawVectorText("Toussaint") : EndIf		
    If JourMois = "11" And Num_Mois = 11 : MovePathCursor(XX + 70, YY) : DrawVectorText("Armistice 1918") : EndIf		
    If JourMois = "25" And Num_Mois = 12 : MovePathCursor(XX + 70, YY) : DrawVectorText("Noël") : EndIf
    
    If JourMois = RSet(Str(Day(Date())), 2, "0") And Num_Mois = Month(Date()) ;- AuJourd'hui
      Si(JourSemaine = "Dimanche", CoulTexte = RGBA(255, 0, 0, 255), CoulTexte = RGBA(0, 0, 0, 255)) ; Blanc sur fond rouge ou blanc
      
      VectorSourceColor(CoulTexte)
      MovePathCursor(XX + 4, YY)
      DrawVectorText(LSet(JourSemaine, 2, " ") + "    ")
      si(JourMois >= "10", JourMois = Left(JourMois, 2), JourMois = "  " + Right(JourMois, 1))
      Cadre(XX + 2, YY, EspaceMois-6, 20, 3)
      MovePathCursor(XX + 28, YY)
      DrawVectorText(JourMois + " ")
    EndIf
    YY + VectorTextHeight(" ") + 2
  Next
  XX + EspaceMois
  YY = Y
EndProcedure



Procedure Ouvrir_Fenetre_Principale()
  ; 
  ; ouvrir une fenêtre maximisée la même taille que le bureau et sans bordure
  ; 
  
  F_principale_h = OpenWindow(#Fenetre_principale, 0, 0, Largeur_ecran, Hauteur_ecran, "Calendrier des fêtes fixes avec fichier .Json et Vector Drawing", 
                              #PB_Window_ScreenCentered|#PB_Window_SystemMenu) 
  ; 
  ; ouvrir un canvas de la même taille que la fenêtre (c'est à dire couvrant l'ensemble)
  ; 
  
  CanvasGadget(#Cnv, 0, 0, Largeur_ecran, Hauteur_ecran)
  
  StartVectorDrawing(CanvasVectorOutput(#Cnv))
  
  VectorFont(Calibri_12)
  
  CalculerNumSem()
  
  Calculer()
  
  StopVectorDrawing()
EndProcedure

Ouvrir_Fenetre_Principale()

;- 
;- gestion des événements en boucle sans fin
; 

Global action.i = #f_aucune 
Repeat 
  Global event.i = WindowEvent() 
  Select event 
    Case #PB_Event_CloseWindow 
      action = #f_sortie  
  EndSelect 
Until action = #f_sortie 
; 
; fermer la fenêtre en douceur
; 

CloseWindow(#Fenetre_principale)

;
; procédures
;

Procedure Lire_les_donnees()
  If ReadFile(#FichierJson, Fichier_de_donnees)
    CloseFile(#FichierJson)
    
    ;Lire un fichier JSON (Analyser les données JSON à partir d'un fichier)
    LoadJSON(#FichierJson, Fichier_de_donnees)
    
    ;Extraire les éléments dans le tableau spécifié
    ExtractJSONArray(JSONValue(#FichierJson), Ephemeride())
  Else
    action = #f_sortie
    MessageRequester("ATTENTION","Impossible de charger le fichier")
    End
  EndIf
EndProcedure

Procedure.s ChaineDate(Masque.s, date.l) 
  
  Masque = ReplaceString (Masque, "%dddd" , StringField ( NomJours , DayOfWeek (date) + 1, " " )) 
  Masque = ReplaceString (Masque, "%ddd" , StringField ( NomJoursAbr , DayOfWeek (date) + 1, " " )) 
  Masque = ReplaceString (Masque, "%mmmm" , StringField ( NomMois , Month (date), " " )) 
  Masque = ReplaceString (Masque, "%mmm" , StringField ( NomMoisAbr , Month (date), " " )) 
  
  ProcedureReturn FormatDate (Masque, date) 
  
EndProcedure

Procedure.b SiBissextile(Annee=-1)
  ; Retourne Vrai si l'année est une année bissextile (366 jours)
  ; S'il n'y a aucun argument, l'année en cours est utilisée
  ;   Dans le calendrier grégorien, l'année bissextile est
  ;   toute année divisible par 4, sauf
  ;   année du centenaire non divisible par 400
  ; L'année équinoxe de printemps est d'environ 365.242374 jours longs (et croissants)
  
  If Annee<=0: Annee = Year(Date()): EndIf ; Cette année
  If (Mod(Annee,4)=0 And Mod(Annee,100)<>0) Or (Mod(Annee,400)=0)
    ProcedureReturn #True
  EndIf
  ProcedureReturn #False
EndProcedure

Procedure.b JoursDansMois(annee=-1, mois=-1)
  ; Retourne le nombre de jours dans le mois donné (28 .. 31)
  ; Si l'année est absente, l'année en cours est utilisée
  ; Si l'année est présente mais le mois est absent, février est utilisé
  ; Si l'année et le mois sont tous deux absents, le mois courant de l'année en cours est utilisé
  Protected Jours
  If annee<=0
    annee = Year(Date())
    If mois<=0: mois = Month(Date()): EndIf
  Else
    If mois<=0: mois = 2: EndIf
  EndIf
  If mois=2
    Jours = 28+SiBissextile(annee);
  Else
    jours = 31-$A55>>mois&1
  EndIf
  ProcedureReturn jours
EndProcedure

Procedure TraitHorizontal(X, Y, Largeur, Epaisseur = 1, Couleur = 0)
  MovePathCursor(X, Y) ; Déplace le curseur au nouvel emplacement
  AddPathLine(Largeur, 0, #PB_Path_Relative) ; Ajouter une ligne droite de la position actuelle aux coordonnées données
  VectorSourceColor(RGBA(Red(Couleur), Green(Couleur), Blue(Couleur), 255))
  StrokePath(Epaisseur)
EndProcedure

Procedure TraitVertical(X, Y, Hauteur, Epaisseur = 1, Couleur = 0)
  MovePathCursor(X, Y) ; Déplace le curseur au nouvel emplacement
  AddPathLine(0, Hauteur, #PB_Path_Relative) ; Ajouter une ligne droite de la position actuelle aux coordonnées données
  VectorSourceColor(RGBA(Red(Couleur), Green(Couleur), Blue(Couleur), 255))
  StrokePath(Epaisseur)
EndProcedure

Procedure Cadre(X, Y, Largeur, Hauteur, Epaisseur = 1, Couleur = 0)
  AddPathBox(X, Y, Largeur, Hauteur)
  VectorSourceColor(RGBA(Red(Couleur), Green(Couleur), Blue(Couleur), 255))
  StrokePath(Epaisseur)
EndProcedure

Procedure CadreColore(x, y, Largeur, Hauteur, Epaisseur=1, CouleurCadre=0, CouleurFond=0); Trace un cadre plein avec la couleur choisie
  Cadre(x+(Epaisseur/2), y+(Epaisseur/2), Largeur-(Epaisseur), Hauteur-(Epaisseur), Epaisseur, CouleurCadre)
  ;Remplir le cadre
  AddPathBox(x+Epaisseur, y+Epaisseur, Largeur-(Epaisseur*2), Hauteur-(Epaisseur*2))
  VectorSourceColor(RGBA(Red(CouleurFond), Green(CouleurFond), Blue(CouleurFond), 255))
  FillPath()
EndProcedure
Dernière modification par Micoute le ven. 11/mars/2016 12:24, modifié 1 fois.
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 5.73 PB 6.00 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Calendrier défilant.

Message par Micoute »

Bonjour Spock,
ça ne fonctionne pas ton système, car je me retrouve avec les deux premiers mois en hiver, les trois suivants au printemps et le dernier en été.
J'ai changé plusieurs fois la date , mais ça ne change rien à la configuration.
Merci d'avoir participé, mais ton idée n'est pas stupide et je vais m'en inspirer.
Maintenant, je n'utilise plus ce calendrier, mais celui en Vector Drawing, dernier post de la page 1.
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 5.73 PB 6.00 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Répondre