Calendrier avec changement de mois et d'année VectorDrawing

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 avec changement de mois et d'année VectorDrawing

Message par Micoute »

Bonjour à tous, voici enfin mon calendrier terminé, on peut donc choisir l'année ou le mois, le fichier Json est ci-après

Code : Tout sélectionner

;Calendrier des fêtes fixes avec changement de mois et d'année por SpinGadgets + Vector Drawing.pb

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

Enumeration Gadgets	;
  #Cnv
  #Txt_Mois
  #Txt_Annee
  #Bouton_Quitter
  #Spin_Annee
  #Spin_Mois
  #Police
EndEnumeration

Enumeration Fichier
  #FichierJson
EndEnumeration 

Enumeration Actions 
  #f_sortie 
  #f_aucune 
EndEnumeration 

Enumeration Table_de_verite
  #Faux
  #Vrai
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.s Masque = "%dddd %dd %mmm %yyyy",
      NomJours.s = "dimanche lundi mardi mercredi jeudi vendredi samedi",
      NomJoursAbr.s = "dim lun mar mer jeu ven sam",
      NomMois.s = "janvier février mars avril mai juin juillet août septembre octobre novembre décembre",
      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)
Global.s NewMap Fete()

;-
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 Texte$, JourSemaine, JourMois
Global V, JDA = 1, X = 0 , Y = 20, L = EspaceMois, 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)
Declare Ouvrir_Fenetre_Principale()

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

Macro se
  Si(JourSemaine = "Dimanche", VectorSourceColor(RGBA(255, 0, 0, 255)), 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
EndMacro

Procedure Init()
  ; 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
  
EndProcedure  

Procedure Calculer()
    
  CadreColore(XX, YY - 20, EspaceMois, H, 1, $000000, $C0FFFF) ; Cadre du calendrier
  
  ;Afficher les mois, du mois courant à la fin de l'année courante
  Num_Mois = MoisEnCours
  Affiche(Annee)
  XX = 0 : YY = 20
  
  Select Mois$(MoisEnCours)
    Case "Janvier", "Février", "Décembre"
      ; Hiver 
      CoulFond = $EEEEEE
      
    Case "Mars", "Avril", "Mai"
      ; Printemps
      CoulFond = $72D772
      
    Case "Juin", "Juillet", "Août"
      ; été
      CoulFond = $00F0F0
      
    Case "Septembre", "Octobre", "Novembre"
      ; Automne
      CoulFond = $81C5FE
  EndSelect
  
  CadreColore(XX, YY-20, EspaceMois, 20, 1, 0, CoulFond)
  VectorSourceColor(RGBA(0, 0, 0, 255))
  MovePathCursor((XX+EspaceMois/2)-VectorTextHeight(Mois$(MoisEnCours)) , YY-21)
  DrawVectorText(Mois$(MoisEnCours))
  
  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(JDA-1)\Jour = i
      MaDonnee(JDA-1)\Mois = j
      MaDonnee(JDA-1)\NSem = NumSem(Date(Year(Date()), j, i, 0, 0, 0))
      JDA + 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))
    
    Select JourSemaine ; sélection Jds    
      Case "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"
        se ; afficher le texte en noir
      Case "Dimanche" ; sélection dimanche
        se ; afficher le texte en rouge
        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
    JDA = DayOfYear(Date(annee,Num_Mois,Val(JourMois),0,0,0))
    If SiBissextile(annee)
      JDA - 2
    Else
      JDA - 1
    EndIf  
    
    VectorSourceColor(RGBA(0, 0, 0, 255)) ;Couleur du texte noire pour les fêtes à souhaiter
    MovePathCursor(XX + 70, YY)           ; déplacer le curseur à la position adéquate
    DrawVectorText(Fete(JourMois+"/"+RSet(Str(Num_Mois), 2, "0"))) ;Affichage de la fête à souhaiter
    
    VectorSourceColor(RGBA(255, 0, 0, 255)) ;Couleur du texte rouge pour les fêtes fixes
    
    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
    
    ; Encadrer auJourd'hui
    If JourMois = RSet(Str(Day(Date())), 2, "0") And Num_Mois = Month(Date())
      Cadre(XX + 2, YY, EspaceMois-6, 20, 3)
    EndIf
    
    YY + VectorTextHeight(" ") + 2
  Next
  XX + EspaceMois
  YY = Y
EndProcedure

Procedure DefinirAnnee()
  annee = GetGadgetState(#Spin_Annee)
  CloseWindow(#Fenetre_principale)
  Ouvrir_Fenetre_Principale()
EndProcedure

Procedure DefinirMois()
  MoisEnCours = GetGadgetState(#Spin_Mois)
  CloseWindow(#Fenetre_principale)
  Ouvrir_Fenetre_Principale()
EndProcedure

Procedure Ouvrir_Fenetre_Principale()
  ; 
  ; ouvrir une fenêtre maximisée
  ;   
  F_principale_h = OpenWindow(#Fenetre_principale, 0, 0, L, H + 30, "Calendrier des fêtes fixes", 
                              #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, L, H)
  ;
  ; créer des SpinGadgets pour changer le mois ou l'année
  ;
  TextGadget(#Txt_Mois, 10, H+7, 25, 20, "Mois")
  SpinGadget(#Spin_Mois, GadgetWidth(#Txt_Mois)+10, H+5, (EspaceMois/2)-100, 20, 1, 12, #PB_Spin_Numeric)
  SpinGadget(#Spin_Annee, WindowWidth(#Fenetre_principale)-(EspaceMois/2)+90, H+5, (EspaceMois/2)-100, 20, 1970, 2034, #PB_Spin_Numeric)
  TextGadget(#Txt_Annee, GadgetX(#Spin_Annee)-35, H+7, 30, 20, "Année")
  
  SetGadgetState(#Spin_Annee, annee)
  SetGadgetState(#Spin_Mois, MoisEnCours)
  ;
  ; utiliser la bibliothèque de dessin vectoriel
  ;
  StartVectorDrawing(CanvasVectorOutput(#Cnv))
  ;
  ; police à utiliser pour le dessin vectoriel
  ;
  VectorFont(Calibri_12)
  ;
  ; calculer les couleurs des saisons et afficher les mois et les jours
  ;
  Calculer()
  ;
  ; terminer le dessin vectoriel
  ;
  StopVectorDrawing()
  ;
  ; ajouter les événements des SpinGadgets
  ;
  BindGadgetEvent(#Spin_Annee, @DefinirAnnee())
  BindGadgetEvent(#Spin_Mois, @DefinirMois())
EndProcedure

Lire_les_donnees()
  
  Init()
  
  CalculerNumSem()

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())
    
    For I = 0 To ArraySize( Ephemeride())
      AddMapElement(Fete(), Ephemeride(I)\Quand)
      Fete() = Ephemeride(I)\Prenom    
    Next
  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 lun. 14/mars/2016 17:16, modifié 3 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 avec changement de mois et d'année VectorDraw

Message par Micoute »

Et voici le fichier "Data\Fetes_a_souhaiter.Json".
  • [{"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 lun. 14/mars/2016 21:20, modifié 2 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 avec changement de mois et d'année VectorDraw

Message par Kwai chang caine »

Marche chez moi, le combo année n'est pas assez large pour voir apparaitre tout le nombre :wink:
Merci 8)
ImageLe bonheur est une route...
Pas une destination

PureBasic Forum Officiel - Site PureBasic
Avatar de l’utilisateur
Ar-S
Messages : 9472
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: Calendrier avec changement de mois et d'année VectorDraw

Message par Ar-S »

C'est très propre,
y'a un problème de superposition de la "police" rouge (voir moi de mai)
~~~~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
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Calendrier avec changement de mois et d'année VectorDraw

Message par Micoute »

@KCC pour les combos, il y a toujours la possibilité de les modifier à ta guise, car le code est fourni.

@Ar-s problème réglé, c'était le 25 décembre, du coup j'ai supprimé Noël.

Merci pour les retours.

Mise à jour dans le premier post.
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 : 9472
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: Calendrier avec changement de mois et d'année VectorDraw

Message par Ar-S »

J'ai toujours une superposition de rouge sur noir le 1 janvier 2016, 8 mai, le 14 juillet...
Revois la position en X de tes fêtes, elles se superposent sur les prenoms
~~~~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
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Calendrier avec changement de mois et d'année VectorDraw

Message par Micoute »

Fichier Json modifié en conséquence.
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 !
beruska
Messages : 21
Inscription : sam. 28/mai/2011 12:32

Re: Calendrier avec changement de mois et d'année VectorDraw

Message par beruska »

Une petite idée pour le calendrier.

Code : Tout sélectionner

; calendrier légèrement simplifié: by Beruska 2016  -  PB 5.40
; avec l'aide du jour julien plus de problème pour les années bissextiles ou non
; pgup et pg down pour changer de mois; home pour revenir à la date du jour

Enumeration
  #fen        ;fenêtre principale
  #listicon   ;listicon
  #car        ;font caractères
EndEnumeration

Declare Julien()
Declare Execute()

Global giorni$ = "Dim,Lun,Mar,Mer,Jeu,Ven,Sam"
Global mesi$ = "Janvier,Février,Mars,Avril,Mai,Juin,Juillet,Août,Septembre,Octobre,Novembre,Décembre"
Global mois, g$, m$, MoisChoisi, Annee
Global j,m,y,e,yy,mm,jj.f
Global Dim Ephemeride.s(371)    ; de 0 a 371 = 12 mois de 31 jours!! dans la DataSection

LoadFont(#car,"arial",10,#PB_Font_Bold)
SetGadgetFont(#PB_Default,FontID(#car))
MoisChoisi = Month(Date())                ; démarrage avec la date du jour
Annee = Year(Date())

OpenWindow(#fen,800,80,300,580,"Fêtes du Calendrier", #PB_Window_SystemMenu);#PB_Window_BorderLess)
ListIconGadget(#listicon,10,10,280,560,"",40,#PB_ListIcon_FullRowSelect)   ; nom du jour
  AddGadgetColumn(#listicon,1,"",30)                                       ; numéro du jour
  AddGadgetColumn(#listicon,2,"",200)                                      ; prénom fêté
  SetGadgetColor(#listicon,#PB_Gadget_BackColor,RGB(247, 254, 193))
  
Restore fetes
  For i = 0 To 371
    Read.s Ephemeride(i)
  Next i 
  
  Execute() 

  ; --------
  ;- BOUCLE
  ; --------
  
Repeat
  
  Event = WaitWindowEvent()    
  
  Select event            
           
    Case #WM_KEYDOWN
      
      Select EventwParam()
            
        Case 27 ; [ESC]                                     -->pour sortir
          End
          
        Case 33 ; [PgUp]                                    -->un mois en avant
          MoisChoisi + 1
          If MoisChoisi>12: MoisChoisi=1:Annee+1:EndIf
          Execute()
          
        Case 34 ; [PgDown]                                  -->un mois en arrière
          MoisChoisi - 1
          If MoisChoisi<1: MoisChoisi=12: Annee-1:EndIf
          Execute()
          
        Case 36 ; [Home]                                    -->retour à la date du jour
          MoisChoisi = Month(Date()): Annee = Year(Date())  
          Execute()
                    
      EndSelect
          
  EndSelect    
              
  Until Event = #PB_Event_CloseWindow

    
Procedure julien()
    
; recherche du jour julien pour trouver le jour de la semaine de chaque date
  
  If m < 3 : m+12 : y-1 : EndIf
  a = Int(y/100)
  b = 2-a+Int(a/4)
  c = Int(365.25 * y)
  d = Int(30.6001 * (m+1))
  jj = b + c + d + j + 1720994.5         ; jj est le n° du jour julien
  e = jj + 1.5
  g$ = StringField(giorni$,(e%7+1),",") ;  g$ donne le jour de la semaine
  
; Conversion pour la recherche du mois de chaque date

    z = JJ + 0.5                            ; début de l'algorithme
  cod = Int((z - 1867216.25)/36524.25)
  a = z + 1 + cod - Int(cod/4)
  b = a + 1524
  c = Int((b - 122.1)/365.25)
  d = Int(365.25 * c)
  g = Int((b-d)/30.6001)                  ; fin del l'algorithme
       
  If g < 13.5                             
    mois = g - 1
  Else
    mois = g - 13
  EndIf
    
EndProcedure

  Procedure Execute()
  m$ = (StringField(mesi$,MoisChoisi,","))                         ; nom du mois en cours

  ClearGadgetItems(#listicon)
  depart= 31*(MoisChoisi-1)-1       ; numéro de départ dans la liste des prénoms
  
  For j = 0 To 31
    m = MoisChoisi 
    mm = m                  ; conserver la valeur originaire du mois
    y = annee
    yy = y                  ; conserver la valeur originaire de l'année
    
    julien()                ; recherche du jour et du mois de chaque jour julien
    
    If mois = mm                      ; choisira seulement les noms qui regardent le mois en cours
      AddGadgetItem(#listicon,-1,g$ + Chr(10) + Str(j) + Chr(10) + ephemeride(depart + j)) ; en listicon
    EndIf
  Next
  
    SetGadgetItemText(#listicon, -1, m$ + " " + Str(yy),2)      ; mois et année dans l'entête

    If MoisChoisi = Month(Date())                          ; met date d'aujourd'hui en évidence
      SetGadgetItemColor(#listicon,(Day(Date())-1),#PB_Gadget_BackColor,RGB(190, 139, 252)) 
    EndIf
    
    For k = 0 To CountGadgetItems(#listicon)                    ; dimanches en rouge
      If GetGadgetItemText(#listicon,k) = "Dim"
        SetGadgetItemColor(#listicon,k,#PB_Gadget_FrontColor,RGB(255, 0, 0))
      EndIf
    Next
    
  EndProcedure
  
DataSection 
  
  fetes:
  Data.s "Jour de l'An","Basile","Geneviève","Odilon","Edouard","Mélaine","Raymond"
  Data.s "Lucien","Alix","Guillaume","Pauline","Tatiana","Yvette","Nina"
  Data.s "Rémi","Marcel","Roseline","Prisca","Marius","Sébastien","Agnès"
  Data.s "Vincent","Barnard","François de Sales","Conversion de Paul","Paule","Angèle","Thomas d'Aquin"
  Data.s "Gildas","Martine","Marcelle"
  
  Data.s "Ella","Présentation","Blaise","Véronique","Agathe","Gaston","Eugénie"
  Data.s "Jacqueline","Apolline","Arnaud","Notre Dame de Lourdes","Félix","Béatrice","Valentin"
  Data.s "Claude","Julienne","Alexis","Bernadette","Gabin","Aimée","Damien"
  Data.s "Isabelle","Lazare","Modeste","Roméo","Nestor","Honorine","Romain","Auguste"," "," "
  
  Data.s "Aubin","Charles le Bon","Guénolé","Casimir","Olive","Colette","Félicité"
  Data.s "Jean de Dieu","Françoise","Vivien","Rosine","Justine","Rodrigue","Mathilde"
  Data.s "Louise","Bénédicte","Patrice","Cyrille","Joseph","Anatole","Clémence"
  Data.s "Léa","Victorien","Catherine","Annonciation","Larissa","Habib","Gontran"
  Data.s "Gladys","Amédée","Benjamin"
  
  Data.s "Hugues","Sandrine","Richard","Isidore","Irène","Marcellin","Jean-Baptiste de la Salle"
  Data.s "Julie","Gautier","Fulbert","Stanislas","Jules","Ida","Maxime"
  Data.s "Paterne","Benoît-Joseph","Anicet","Parfait","Emma","Odette","Anselme"
  Data.s "Alexandre","Georges","Fidèle","Marc","Alida","Zita","Valérie"
  Data.s "Catherine de Sienne","Robert"," "
  
  Data.s "Fête du travail","Boris","Philippe / Jacques","Sylvain","Judith","Prudence","Gisèle"
  Data.s "Armistice 1945","Pacôme","Solange","Estelle","Achille","Rolande","Matthias"
  Data.s "Denise","Honoré","Pascal","Eric","Yves","Bernardin","Constantin"
  Data.s "Emile","Didier","Donatien","Sophie","Bérenger","Augustin","Germain"
  Data.s "Aymar","Ferdinand","Visitation de la Sainte Vierge"
  
  Data.s "Justin","Blandine","Kévin","Clotilde","Igor","Norbert","Gilbert"
  Data.s "Médard","Diane","Landry","Barnabé","Guy","Antoine de Padoue","Elisée"
  Data.s "Germaine","Jean-François / Régis","Hervé","Léonce","Romuald","Silvère","Héraclide / Rodolphe"
  Data.s "Alban","Audrey","Jean-Baptiste","Prosper","Anthelme","Fernand","Irénée"
  Data.s "Pierre / Paul","Martial"," "
  
  Data.s "Thierry","Martinien","Thomas","Florent","Antoine","Mariette","Raoul"
  Data.s "Thibault","Amandine","Ulrich","Benoît","Olivier","Henri / Joël","Fête Nationale"
  Data.s "Donald","Notre Dame du Mont Carmel","Charlotte","Frédéric","Arsène","Marina","Victor"
  Data.s "Marie-Madeleine","Brigitte","Christine","Jacques","Anne / Joachim","Nathalie","Samson"
  Data.s "Marthe","Juliette","Ignace de Loyola"
  
  Data.s "Alphonse","Julien / Eymard","Lydie","Jean-Marie Vianney","Abel","Transfiguration","Gaétan"
  Data.s "Dominique","Amour","Laurent","Claire","Clarisse","Hippolyte","Evrard"
  Data.s "Assomption","Armel","Hyacinthe","Hélène","Jean-Eudes","Bernard","Christophe"
  Data.s "Fabrice","Rose de Lima","Barthélémy","Louis","Natacha","Monique","Augustin"
  Data.s "Sabine","Fiacre","Aristide"
  
  Data.s "Gilles","Ingrid","Grégoire","Rosalie","Raïssa","Bertrand","Reine"
  Data.s "Nativité de Marie","Alain","Inès","Adelphe","Apollinaire","Aimé","Croix Glorieuse"
  Data.s "Roland","Edith","Renaud","Nadège","Emilie","Davy","Matthieu"
  Data.s "Maurice","Constant","Thècle","Hermann","Côme / Damien","Vincent de Paul","Venceslas"
  Data.s "Michel / Gabriel / Raphaël","Jérôme"," "
  
  Data.s "Thérèse de l'Enfant Jésus","Léger","Gérard","François d'Assise","Fleur","Bruno","Serge"
  Data.s "Pélagie","Denis","Ghislain","Firmin","Wilfried","Géraud","Juste"
  Data.s "Thérèse d'Avila","Edwige","Baudoin","Luc","René","Adeline","Céline"
  Data.s "Elodie","Jean de Capistran","Florentin","Crépin","Dimitri","Emeline","Jude"
  Data.s "Narcisse","Bienvenu","Quentin"
  
  Data.s "Toussaint","Défunts","Hubert","Charles","Sylvie","Bertille","Carine"
  Data.s "Geoffroy","Théodore","Léon","Armistice 1918","Christian","Brice","Sidoine"
  Data.s "Albert","Marguerite","Elisabeth","Aude","Tanguy","Edmond","Présentation de Marie"
  Data.s "Cécile","Clément","Flora","Catherine","Delphine","Sévrin","Jacques de la Marche"
  Data.s "Saturnin","André"," "
  
  Data.s "Florence","Viviane","François-Xavier","Barbara","Gérald","Nicolas","Ambroise"
  Data.s "Immaculée Conception","Pierre Fourier","Romaric","Daniel","Jeanne-Françoise de Chantal","Lucie","Odile"
  Data.s "Ninon","Alice","Gaël","Gatien","Urbain","Théophile","Pierre Canisius"
  Data.s "Françoise-Xavière","Armand","Adèle","Noël / Emmanuel","Etienne","Jean","Innocents"
  Data.s "David","Roger","Sylvestre"
  
EndDataSection
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Calendrier avec changement de mois et d'année VectorDraw

Message par Micoute »

Bien vu !
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