Ce n'est pas tout à fait un diagramme de Gantt, mais ça s'en approche.
Voici un petit utilitaire pour ceux que ça intéressent, ça permet de visualiser le temps passé sur chaque projet ^^. C'est assez utile pour voir si on a été efficace, ou bien là où on doit revoir nos méthodes.
On peut classer par année, par projet ou par nombre de jours que le projet a nécessité.
Par la suite, j'ajouterai des prévisions ou un nombre de jours prévus pour pouvoir comparer (prévision / temps réellement passé sur le projet)
Code : Tout sélectionner
;{ INFOS
; Nom :GanttDiagram
; pouvoir concevoir des diagram de type Gantt.
; by blendman
; 5.31
; date : 21/09/2015
;}
;{ BUGS
; pas ok
; ok
; - quand on ajoute un projet, alors que la date n'est pas encore ajoutée (avec addnewdate()), ça ne prend pas en compte cette date, elle est ajoutée en dernier.
;}
;{ CHANGES
; [01/10/2015] (0.14) (5)
; - si on ajoute des dates (nouvelle année) d'un projet xistant, on récupère la couleur
; New
; - ajout menu affichage : vue par projet
; - Ajout menu affichage : vue par année
; - Menu help : about -> open a simple message with some infos
; - Menu file : exit -> end the program
; - Menu file : new -> efface le document en cours
; - View by project : on peut visualiser les projets dans leur ensemble, avec les années cote à cote pour connaître le temps passé sur chacun
; - View by nbday : on peut visualiser les projets dans leur ensemble en fonction du nombre de jour par projet
; - shortcut menu file
; - menu file open document
; - menu file save document
; - qd on ajoute une nouvelle date, je vérifie si elle n'existe pas déjà dans le document. Si non, je l'ajoute et je trie par année.
; - on peut ajouter de nouvelles données pour un nouveau projet (ou pour un projet existant)
; [30/09/2015] (0.13) (4)
; - quelques ajouts mineur : on vérifie si on a déjà entré une date, et si on a déjà ajouter le projet
; [29/09/2015] (0.12) (3)
; - ajout scrollarea
; - resizeall() si on redimensionne la taille de la fenêtre, je modifie l'intérieur du scroll pour le canvas
; - ajout des mois à chaque nouvelle année
; [28/09/2015] (0.11) (2)
; ajout addnewdate()
; some minor changes
; [21/09/2015] (0.10) (1)
; - UI, window & canvas
; - we can add aproject name and add some date
; - the canvas draw the char bar.
; - Menu : add project > to add a new entry projects
; - Menu : add date > to add a new date entry to the project
;}
;{ TODO
; - pouvoir supprimer des données
; - pouvoir renommer un projet
; - pouvoir ajouter des prévisions (date ou durée)
; - ajouter les comparaisons prévisions/réel
; - pouvoir sélectionner une ligne et la modifier (ou la supprimer)
; OK :
; 0.14
; ok - pouvoir ajouter des dates pour les projets (et ajouter le projet s'il n'existe pas, ainsi que l'année)
; ok - File : new
; ok - File : exit
; ok - View : by project
; ok - View : by nbday
; ok - File : save
; ok - File : load
;}
;{ Enumeration, constantes
#SoftwareName = "Gantt Diagram"
#SoftwareVersion = "0.14"
Enumeration ; window
#Window_main
#Window_Options
#Window_AddProject
EndEnumeration
Enumeration ; gadget
#G_btnOK
#G_canvas
#G_scroll
; pour ajouter un projet et des données (date, etc..)
#G_ProjectName
#G_ProjectStartYear
#G_ProjectStartDay
#G_ProjectStartMonth
#G_ProjectEndDay
#G_ProjectEndMonth
#G_ProjectEndYear
#G_ProjectColor
EndEnumeration
Enumeration ; menu
#menu_Open
#menu_New
#menu_Save
#menu_Exit
#menu_AddProjets
#menu_AddDate
#menu_Deldata
#menu_ViewByYear
#menu_ViewByProject
#menu_ViewByNbDays
#menu_About
EndEnumeration
;}
;{ Structures
Structure sDate
X_start.i
X_end.i
X_day.i
X_Year.i
X_Month.i
StartDate.i
; pour sauvegarde // for saving
startyear.i
startmonth.i
startday.i
endyear.i
endmonth.i
endday.i
EndStructure
Structure sProject
Name$
Year.i
List NewDate.sDate()
Color.i
TotalNbDay.i
Type.a
EndStructure
Global NewList Project.sProject()
Structure sTempName
Name$
Pos.i
Year.i
TotalNbDay.i
Color.i
EndStructure
Global ViewTyp.a, CurrentYear.i, CurrentColor.i
If CreateImage(1,64,64)
EndIf
CurrentColor = -1
;}
;{ procedures
; diagram
Procedure AddNewDate(name$, color=-1)
ForEach project()
With Project()
If \Name$ = name$ And \type = 1
MessageRequester("Info", "Year still exist")
ProcedureReturn 0
EndIf
EndWith
Next
AddElement(Project())
With Project()
\Name$ = Name$
\year = Val(Name$)
\type = 1
If color = -1
\Color=RGBA(150,150,150,255)
Else
\Color = color
EndIf
EndWith
CurrentYear = Val(Name$)
SortStructuredList(Project(),#PB_Sort_Ascending,OffsetOf(sProject\year),TypeOf(sProject\year))
EndProcedure
Procedure AddNewProject(name$, color=-1)
AddElement(Project())
With Project()
\Name$ = Name$
\Year = CurrentYear
If color = -1
If CurrentColor = -1
b = 0
c = 255-b -80
\Color=RGBA(b+Random(c),b+Random(c),b+Random(c),255)
Else
\color = CurrentColor
EndIf
Else
\Color = color
EndIf
EndWith
EndProcedure
Procedure AddProjectData(name$,startyear,startmonth,startday,endyear=-1,endmonth=-1,endday=-1)
; d'abord, on vérifie si on a l'année
ForEach Project()
If Project()\Name$ = Str(startyear) And Project()\type = 1
trouveyear = 1
Break
EndIf
Next
; on n'a pas trouvé l'année, on l'ajoute car c'est une nouvelle année
If trouveyear = 0
; Debug "on n'a pas trouvé la date, on l'ajoute : "+Str(startyear)
; LastElement(project())
AddNewDate(Str(startyear))
EndIf
; puis, on vérifie si on a déjà le projet
ForEach Project()
; Debug Project()\Name$
If Project()\Name$ = name$ And project()\Type = 0 ; on l'a déjà
color = Project()\Color
trouveProjet = 1
; on vérifie si on a déjà des dates pour cette année-ci
If ListSize(Project()\NewDate())>0
If Project()\NewDate()\X_Year = startyear
trouveProjet = 2
Break
EndIf
Else
trouveprojet = 2
Break
EndIf
EndIf
Next
; on n'a pas trouvé le nom du projet, on l'ajoute
If trouveProjet <= 1
;Debug "on n'a pas trouvé le projet, on l'ajoute : "+Name$
; LastElement(project())
; AddNewProject(name$)
; Project()\Year = startyear
CurrentYear = startyear
AddNewProject(name$)
If trouveprojet = 1 ; on a trouvé la couleur
project()\Color = color
EndIf
EndIf
; puis, on ajoute cette date à ce nouvel élement
AddElement(Project()\NewDate())
; Project()\Year = startyear
With Project()\NewDate()
; for saving
\startday = startday
\startmonth = startmonth
\startyear = startyear
\endday = endday
\endmonth = endmonth
\endyear = endyear
; for graphics
year = Date(startyear,startmonth,startday,0,0,0)/(60*60*24)
\X_start = Date(startyear,startmonth,startday,0,0,0)/(60*60*24) - year
; on calcule le nombre de jours pour le projet
If endyear = -1 ; just on day
\X_end = 1
Else
\X_end = (Date(endyear,endmonth,endday,0,0,0)/(60*60*24) - year) + 1
EndIf
\X_day = startday
\X_Month = startmonth
\X_Year = startyear
Project()\TotalNbDay + \X_end
EndWith
SortStructuredList(Project(),#PB_Sort_Ascending,OffsetOf(sProject\year),TypeOf(sProject\year))
EndProcedure
Procedure AddProjectData_menu()
If OpenWindow(#Window_AddProject,0,0,500,300,"Add data project",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
xx= 10
yy = 10
w = 40
h = 20
TextGadget(#PB_Any,xx,yy,50,20,"Name")
StringGadget(#G_ProjectName,xx+60,yy,120,20,"")
ImageGadget(#G_ProjectColor,xx+200,yy,64,64,ImageID(1))
yy +25
FrameGadget(#PB_Any,xx,yy,150,100,"Start Date")
yy+15
StringGadget(#G_ProjectStartDay,xx,yy,w,h,"",#PB_String3D_Numeric)
StringGadget(#G_ProjectStartMonth,xx+w+5,yy,w,h,"",#PB_String3D_Numeric)
StringGadget(#G_ProjectStartYear,xx+w*2+10,yy,w,h,"",#PB_String3D_Numeric)
yy+90
FrameGadget(#PB_Any,xx,yy,150,100,"End Date")
yy+15
StringGadget(#G_ProjectEndDay ,xx,yy,w,h,"",#PB_String3D_Numeric)
StringGadget(#G_ProjectEndMonth,xx+w+5,yy,w,h,"",#PB_String3D_Numeric)
StringGadget(#G_ProjectEndYear,xx+w*2+10,yy,w,h,"",#PB_String3D_Numeric)
ButtonGadget(#G_BtnOK, WindowWidth(#Window_AddProject)-100, WindowHeight(#Window_AddProject)-30, 40,20,"OK")
EndIf
EndProcedure
; canvas
Procedure UpdateCanvas()
xx +15
yy = 0
hh = 20
If ViewTyp >= 1
;{ view by project
; on va copier la liste des projet pour travailler dessus
NewList Temp.sProject()
CopyList(Project(), Temp())
; on la trie en fonction de l'année de création du projet
SortStructuredList(Temp(), #PB_Sort_Ascending, OffsetOf(sProject\year),TypeOf(sProject\year))
; the graphics
If StartDrawing(CanvasOutput(#g_canvas))
; a white background
Box(0,0,OutputWidth(),OutputHeight(),RGBA(255,255,255,255))
; on place le nom du projet // name of the project
ForEach Project()
If xx < 15+TextWidth(Project()\Name$+ " ("+Str(Project()\TotalNbDay)+") ")
xx = 15+TextWidth(Project()\Name$+ " ("+Str(Project()\TotalNbDay)+") ")
EndIf
Next
; on crée une liste pour stocker les projets et quelques paramètres // we create a temp list to stock the name and some properties of the project
; car il arrive que certains projet s'étalent sur plusieurs années et on veut tout regrouper par projet et non par date
NewList lastname.sTempName()
i = 1
k = i
ForEach temp()
;{ on dessine les fond gris // gray BG
r= 180+Mod(ii,2)*50
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(0,yy+ii*hh,OutputWidth(),hh,RGBA(r,r,r,120))
ii+1
;}
Next
ForEach temp()
color = RGBA(0,0,0,255) ; text color
find = 0
k = i
TotalNbDay = 0
WDay = 0
DaySize = 3 ; size for one day
color1.i = temp()\Color
With temp()
If Val(\Name$) = 0
; on vérifie si on n'a pas déjà le nom
ForEach lastName()
If lastName()\Name$ = temp()\Name$
; Debug "projet déjà ajouté "
k = lastname()\Pos
year = lastname()\year
Color1 = lastname()\Color
find = 1
Break
EndIf
Next
If find = 0
k = i
TotalNbDay = 0
; color1 = temp()\Color
EndIf
ForEach \NewDate()
WDay + \NewDate()\X_end
Wday2 = temp()\TotalNbDay
;DrawingMode(#PB_2DDrawing_AlphaBlend)
;Box(xx+TotalNbDay*DaySize,k*hh,WDay*DaySize,hh,color1)
TotalNbDay + \NewDate()\X_end
LastYear = \Year
Next
; on affiche le texte pour chaque année où on a travaillé sur le projet // draw the year for each part of the project (each year)
; DrawingMode(#PB_2DDrawing_Transparent)
; DrawText(xx+TotalNbDay,k*hh, Str(LastYear),color)
; DrawText(xx,i*hh, Str(\Year),color)
; si on a pas déjà le nom, on l'ajoute dans la liste des noms
If find = 0
; Debug "pas trouvé, on ajoute : "+ \Name$
AddElement(lastname())
LastName()\Name$ = temp()\Name$
LastName()\year = temp()\Year
lastname()\TotalNbDay = temp()\TotalNbDay ; TotalNbDay
lastname()\color = temp()\color
; DrawText(10,i*hh, \Name$+" ("+Str(TotalNbDay)+") ",temp()\color)
; DrawText(10,i*hh, \Name$+" ("+Str(lastname()\TotalNbDay)+") ",temp()\color)
lastname()\Pos = i
i+1
Else
; Debug temp()\Name$ + Str(wday)+"/"+Str(wday2)
If lastname()\Name$ = temp()\Name$
lastname()\TotalNbDay + temp()\TotalNbDay
EndIf
EndIf
EndIf
EndWith
Next
If ViewTyp = 2
; on trie par nombre de jours par projets
SortStructuredList(lastname(), #PB_Sort_Descending, OffsetOf(sTempName\TotalNbDay),TypeOf(sTempName\TotalNbDay))
EndIf
i=1
ForEach lastname()
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(xx,i*hh,lastname()\TotalNbDay*DaySize,hh,lastname()\color)
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(10,i*hh, lastname()\Name$+" ("+Str(lastname()\TotalNbDay)+") ",lastname()\color)
Line(xx,yy+i*hh,OutputWidth(),1,RGBA(190,190,190,255))
i+1
Next
; the line of the diagram
Line(xx,yy,1,OutputHeight()-100,RGBA(0,0,0,255))
Line(xx,h1,OutputWidth(),1,RGBA(0,0,0,255)) ; line hor
StopDrawing()
EndIf
; free the temp list
FreeList(Temp())
FreeList(lastname())
;}
ElseIf viewTyp = 0
;{ view by year (default)
If StartDrawing(CanvasOutput(#g_canvas))
Box(0,0,OutputWidth(),OutputHeight(),RGBA(255,255,255,255))
; on place le texte
ForEach Project()
If xx < 10+TextWidth(Project()\Name$+ " ("+Str(Project()\TotalNbDay)+") ")
xx = 10+TextWidth(Project()\Name$+ " ("+Str(Project()\TotalNbDay)+") ")
EndIf
Next
h1 = OutputHeight()-100+10
Month$ = "Jan,Fev,Mars,Avril,Mai,Juin,Juil,Aout,Sept,Oct,Nov,Dec,"
W_month = (OutputWidth()-xx-10)/12
; For ii = 0 To 12 ; for the months
; DrawingMode(#PB_2DDrawing_Transparent)
; DrawText(10+xx+W_month*ii,10,StringField(Month$,ii+1,","),0)
; Next
ForEach Project()
x1 = 0
w1 = 0
;{ gray BG
r= 180+Mod(i,2)*50
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(10,yy+i*hh,W_month*12+xx,hh,RGBA(r,r,r,120))
;}
With project()
DrawingMode(#PB_2DDrawing_Transparent)
If \Type = 0
DrawText(10,yy+hh/6+hh*i,\Name$+ " ("+Str(\TotalNbDay)+")",\color)
ElseIf \type = 1 ; année
; DrawText(10,yy+hh/6+hh*i,\Name$,\color)
ElseIf \type = 2 ; séparation
EndIf
DrawingMode(#PB_2DDrawing_AlphaBlend)
If ListSize(\NewDate())=0 ; pas de date ajoutée, c'est donc une année
; Line(xx,yy+i*hh,W_month*12,1,RGBA(120,120,120,125)) ; line horizontal
If \type <> 0
Box(x1,yy+i*hh,W_month*12+xx-x1,hh,\color)
; Line(xx,yy+i*hh,W_month*12,1,RGBA(120,120,120,125)) ; line horizontal
If \type = 1
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(50,yy+hh/6+hh*i,\Name$,RGBA(50,50,50,255))
For j = 0 To 12; for the months
; DrawText(10+xx+W_month*j,h1,StringField(Month$,j+1,","),RGBA(50,50,50,255))
DrawText(10+xx+W_month*j,yy+hh/6+hh*i,StringField(Month$,j+1,","),RGBA(50,50,50,255))
Next j
DrawingMode(#PB_2DDrawing_AlphaBlend)
EndIf
EndIf
Else
ForEach \NewDate()
Select \NewDate()\X_Month
Case 1,3,5,7,8,10,12
day = 31
Case 2
day = 28
Default
day = 30
EndSelect
W_day.d = W_month/Day ; size of one day
;Debug W_day
DayFinalsize = \NewDate()\X_day*W_day -1 ; size of the total of the days
; Debug DayFinalsize
x1 = W_month * (\NewDate()\X_Month-1) + DayFinalsize ; position for this data
w = W_day*\NewDate()\X_end ; size of this data
; Debug "Taille du mois: "+Str(W_month)+" ("+Str(\NewDate()\X_Month)+") / Nb j: "+StrF(day,3)+" / jour: "+StrF(W_day,3)+" / total: "+Str(w)
; than we draw the char bar
Box(xx+x1,yy+i*hh,w,hh,\color)
; Line(xx,yy+i*hh,W_month*12,1,RGBA(120,120,120,125)) ; line horizontal
Next
EndIf
EndWith
i+1
Next
; the last line
; Line(xx,yy+i*hh,W_month*12,1,RGBA(120,120,120,125))
For i = 0 To 12 ; for the months
DrawingMode(#PB_2DDrawing_AlphaBlend)
Line(xx+W_month*i,10,1,OutputHeight()-100,RGBA(200,200,200,255))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(10+xx+W_month*i,h1,StringField(Month$,i+1,","),0)
Next
Line(xx,yy,1,OutputHeight()-100,RGBA(0,0,0,255))
Line(xx,h1,W_month*12,1,RGBA(0,0,0,255)) ; line hor
StopDrawing()
EndIf
;}
EndIf
EndProcedure
; Save, load
Procedure SaveDoc()
file$ = SaveFileRequester("save the document","","GTD|*.gtd",0)
If file$ <> ""
ext$ = GetExtensionPart(file$)
If ext$ <> "gtd"
file$ = RemoveString(file$,ext$)
file$ +".gtd"
EndIf
If CreateFile(1,file$)
WriteStringN(1, "Document|"+FormatDate("%dd/%mm/%yyyy", Date())+"|"+#SoftwareVersion+"|")
ForEach Project()
Thedata$ = ""
With project()
If ListSize(\NewDate())>0
ForEach \NewDate()
Thedata$ =""
Thedata$ + \NewDate()\startday +","
Thedata$ + \NewDate()\startmonth +","
Thedata$ + \NewDate()\startyear +","
Thedata$ + \NewDate()\endday +","
Thedata$ + \NewDate()\endmonth +","
Thedata$ + \NewDate()\endyear +",|"
txt$ = "Project|"+\Name$+"|"+\Year+"|"+\Color+"|"+\Type+"|"+\TotalNbDay+"|"+Thedata$
WriteStringN(1, txt$)
Next
Else
txt$ = "Project|"+\Name$+"|"+\Year+"|"+\Color+"|"+\Type+"|"+\TotalNbDay+"|-1|"
WriteStringN(1, txt$)
EndIf
EndWith
Next
CloseFile(1)
EndIf
EndIf
EndProcedure
Procedure OpenDoc()
file$ = OpenFileRequester("Open a document","","Gant diagram|*.gtd",0)
If file$ <> ""
If ReadFile(0,file$)
FreeList(Project())
Global NewList Project.sProject()
While Eof(0) = 0
line$ = ReadString(0)
index$ = StringField(line$,1,"|")
If index$ = "Document"
version.d = Val(StringField(line$,3,"|"))
If version < Val(#SoftwareVersion)
MessageRequester("Information","The document has been made with an old version of GantDiagram.")
EndIf
ElseIf index$ = "Project"
name$ = StringField(line$,2,"|")
year = Val(StringField(line$,3,"|"))
Color = Val(StringField(line$,4,"|"))
type = Val(StringField(line$,5,"|"))
TotalNbDay = Val(StringField(line$,6,"|"))
Thedata$ = StringField(line$,7,"|")
If type = 1 ; add a new year
AddNewDate(name$)
Else
u=1
startday = Val(StringField(thedata$,u,",")) : u+1
startmonth = Val(StringField(thedata$,u,",")) : u+1
startyear = Val(StringField(thedata$,u,",")) : u+1
endday = Val(StringField(thedata$,u,",")) : u+1
endmonth = Val(StringField(thedata$,u,",")) : u+1
endyear = Val(StringField(thedata$,u,",")) : u+1
If lastname$ <> name$
AddNewProject(name$, color)
lastname$ = name$
EndIf
AddProjectData(name$,startyear,startmonth,startday,endyear,endmonth,endday)
EndIf
EndIf
Wend
CloseFile(0)
EndIf
UpdateCanvas()
EndIf
EndProcedure
; UI
Procedure ResizeAll(xx)
w1 = WindowWidth(#Window_main)-xx*2
h1 = WindowHeight(#Window_main)-30
ResizeGadget(#G_scroll,#PB_Ignore,#PB_Ignore,w1,h1)
EndProcedure
;}
flag = #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget
w = 1200
h = 800
If OpenWindow(#Window_main,0,0,w,h, #SoftwareName + " " + #SoftwareVersion, Flag)
;{ menu
If CreateMenu(0, WindowID(0))
MenuTitle("File")
MenuItem(#menu_New, "New" +Chr(9)+"Ctrl+N")
MenuItem(#menu_Open, "Open" +Chr(9)+"Ctrl+O")
MenuItem(#menu_Save, "Save" +Chr(9)+"Ctrl+S")
MenuBar()
MenuItem(#menu_Exit, "Exit" +Chr(9)+"Esc")
MenuTitle("Edition")
MenuItem(#menu_AddProjets, "Add data (of a project)")
; MenuItem(#menu_AddDate, "Add Year")
; MenuBar()
MenuItem(#menu_Deldata, "Delete data of a project")
MenuTitle("View")
MenuItem(#menu_ViewByYear, "By year")
MenuItem(#menu_ViewByProject, "By project")
MenuItem(#menu_ViewByNbDays, "By nb of day")
MenuTitle("Help")
MenuItem(#menu_About, "About")
EndIf
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_S, #Menu_Save)
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_O, #menu_Open)
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_N, #menu_New)
AddKeyboardShortcut(0, #PB_Shortcut_Escape, #menu_Exit)
;}
;{ Gadget
XX = 0
yy = 5
w1 = WindowWidth(#Window_main)-xx-10
h1 = WindowHeight(#Window_main) -30
h2 = 3000
If ScrollAreaGadget(#G_scroll,xx,yy,w1,h1,w1,h2)
If CanvasGadget(#G_canvas,0,0,w1,h2)
EndIf
CloseGadgetList()
EndIf
;}
UpdateCanvas()
EndIf
Repeat
Repeat
EventID = WaitWindowEvent()
EventGadget = EventGadget()
EventMenu = EventMenu()
EventWindow = EventWindow()
Select EventID
Case #PB_Event_Menu
;{ menu
Select EventMenu
;{ File
Case #menu_Open
OpenDoc()
Case #menu_Save
SaveDoc()
Case #menu_New
FreeList(Project())
Global NewList Project.sProject()
UpdateCanvas()
Case #menu_Exit
quit = 1
;}
;{ Edition
Case #menu_Deldata
delete$ = InputRequester("Project to delete","Name of the project to delete","")
ForEach project()
If project()\Name$ = delete$
DeleteElement(project())
EndIf
Next
UpdateCanvas()
Case #menu_AddDate
Name$ = InputRequester("Add a new year", "Define the year","")
If name$ <> ""
AddNewDate(name$)
UpdateCanvas()
EndIf
Case #menu_AddProjets
AddProjectData_menu()
;}
;{ View
Case #menu_ViewByProject,#menu_ViewByYear,#menu_ViewByNbDays
ViewTyp = EventMenu -#menu_ViewByYear
UpdateCanvas()
;}
;{ Help
Case #menu_About
txt$ =#SoftwareName+" "+#SoftwareVersion+Chr(10)
txt$ +"Made by blendman, in purebasic (5.31)."+Chr(10)+"Date version : "+FormatDate("%dd/%mm/%yyyy", #PB_Compiler_Date)
MessageRequester("Info", txt$)
;}
EndSelect
;}
Case #PB_Event_SizeWindow
ResizeAll(xx)
Case #PB_Event_Gadget
;{ gadget
Select EventGadget
Case #G_ProjectColor
Color = ColorRequester(CurrentColor)
Currentcolor =RGBA(Red(color),Green(color),Blue(color),255)
If StartDrawing(ImageOutput(1))
Box(0,0,64,64,CurrentColor)
StopDrawing()
EndIf
SetGadgetState(#G_ProjectColor,ImageID(1))
Case #G_BtnOK
Name$ = GetGadgetText(#G_ProjectName)
startyear = Val(GetGadgetText(#G_ProjectStartYear))
startmonth = Val(GetGadgetText(#G_ProjectStartMonth))
startday = Val(GetGadgetText(#G_ProjectStartDay))
Endday = Val(GetGadgetText(#G_ProjectEndDay))
Endmonth = Val(GetGadgetText(#G_ProjectEndMonth))
EndYear = Val(GetGadgetText(#G_ProjectEndYear))
AddProjectData(name$,startyear,startmonth,startday,EndYear,Endmonth,Endday)
UpdateCanvas()
CloseWindow(#Window_AddProject)
EndSelect
;}
Case #PB_Event_CloseWindow
If EventWindow = #Window_main
quit = 1
Else
CloseWindow(EventWindow)
EndIf
EndSelect
Until event = 0 Or quit = 1
Until Quit = 1
Si vous trouvez un bug n'hésitez pas à me le dire.