Add SetThumbsDisplayStyle()
This commit is contained in:
@@ -433,6 +433,7 @@ DeclareModule Thumbs
|
|||||||
Declare FreeThumbsGadget(GadgetId.i) ; Frees all resources associated with the gadget. / Libère toutes les ressources associées au gadget.
|
Declare FreeThumbsGadget(GadgetId.i) ; Frees all resources associated with the gadget. / Libère toutes les ressources associées au gadget.
|
||||||
Declare ForceUpdate(GadgetId.i) ; Forces a complete refresh of the gadget. / Force un rafraîchissement complet du gadget.
|
Declare ForceUpdate(GadgetId.i) ; Forces a complete refresh of the gadget. / Force un rafraîchissement complet du gadget.
|
||||||
Declare SetThumbsSize(GadgetId.i, Size.l) ; Change Thumb size / Change la taille des vignettes
|
Declare SetThumbsSize(GadgetId.i, Size.l) ; Change Thumb size / Change la taille des vignettes
|
||||||
|
Declare SetThumbsDisplayStyle(GadgetId.i, Style.l) ; Change fill style image / change le style de rempissage de l'image
|
||||||
EndDeclareModule
|
EndDeclareModule
|
||||||
|
|
||||||
Module Thumbs
|
Module Thumbs
|
||||||
@@ -491,6 +492,7 @@ Module Thumbs
|
|||||||
DrawSemaphore.i ; Semaphore to signal the drawing thread to redraw the canvas. / Sémaphore pour signaler au thread de dessin de redessiner le canvas.
|
DrawSemaphore.i ; Semaphore to signal the drawing thread to redraw the canvas. / Sémaphore pour signaler au thread de dessin de redessiner le canvas.
|
||||||
Quit.b ; Flag to signal the background threads to terminate. / Indicateur pour signaler aux threads d'arrière-plan de se terminer.
|
Quit.b ; Flag to signal the background threads to terminate. / Indicateur pour signaler aux threads d'arrière-plan de se terminer.
|
||||||
ThreadDrawCanvasImage.i ; Thread handle for the canvas drawing thread. / Handle du thread pour le thread de dessin du canvas.
|
ThreadDrawCanvasImage.i ; Thread handle for the canvas drawing thread. / Handle du thread pour le thread de dessin du canvas.
|
||||||
|
DisplayStyle.l ; style (Fit, Fill, Stretch)
|
||||||
EndStructure
|
EndStructure
|
||||||
|
|
||||||
; Global structure for the Thumbs module. / Structure globale pour le module Thumbs.
|
; Global structure for the Thumbs module. / Structure globale pour le module Thumbs.
|
||||||
@@ -729,7 +731,7 @@ Module Thumbs
|
|||||||
FileName.s = GetFilePart(*Ptr\FilePath)
|
FileName.s = GetFilePart(*Ptr\FilePath)
|
||||||
|
|
||||||
Protected result.ImgTools::DefDisplayImage
|
Protected result.ImgTools::DefDisplayImage
|
||||||
ImgTools::ImageToContainer(@result, Image, *Gdt\_Size, *Gdt\_Size, ImgTools::#Image_Style_Fit)
|
ImgTools::ImageToContainer(@result, Image, *Gdt\_Size, *Gdt\_Size, *Gdt\DisplayStyle)
|
||||||
|
|
||||||
Protected _Border.l, _BorderX2.l
|
Protected _Border.l, _BorderX2.l
|
||||||
; Draw a green border if the item is selected. / Dessine une bordure verte si l'élément est sélectionné.
|
; Draw a green border if the item is selected. / Dessine une bordure verte si l'élément est sélectionné.
|
||||||
@@ -959,6 +961,7 @@ Module Thumbs
|
|||||||
*Gdt\GadgetId = GadgetId
|
*Gdt\GadgetId = GadgetId
|
||||||
*Gdt\Size = Size
|
*Gdt\Size = Size
|
||||||
*Gdt\LastIndexSelected = -1 ; Initialize with no selection. / Initialise sans sélection.
|
*Gdt\LastIndexSelected = -1 ; Initialize with no selection. / Initialise sans sélection.
|
||||||
|
*Gdt\DisplayStyle = ImgTools::#Image_Style_Fit ; default fit style
|
||||||
Debug *Gdt\Size
|
Debug *Gdt\Size
|
||||||
SetGadgetData(GadgetId, *Gdt)
|
SetGadgetData(GadgetId, *Gdt)
|
||||||
InitGadgetValue(GadgetId)
|
InitGadgetValue(GadgetId)
|
||||||
@@ -1046,7 +1049,18 @@ Module Thumbs
|
|||||||
EndIf
|
EndIf
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
; Procédure : SetThumbsDisplayStyle - Permet de changer le style d'affichage des vignettes.
|
||||||
|
Procedure SetThumbsDisplayStyle(GadgetId.i, Style.l)
|
||||||
|
Protected *Gdt.gdt
|
||||||
|
*Gdt = GetGadgetData(GadgetId)
|
||||||
|
If *Gdt
|
||||||
|
; Met à jour la variable de style dans la structure du gadget
|
||||||
|
*Gdt\DisplayStyle = Style
|
||||||
|
|
||||||
|
; Force le redessin du gadget pour que le changement soit visible immédiatement
|
||||||
|
SignalSemaphore(*Gdt\DrawSemaphore)
|
||||||
|
EndIf
|
||||||
|
EndProcedure
|
||||||
EndModule
|
EndModule
|
||||||
|
|
||||||
; =================================================
|
; =================================================
|
||||||
@@ -1065,6 +1079,10 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
#Gdt_ThumbA
|
#Gdt_ThumbA
|
||||||
#Gdt_ThumbB
|
#Gdt_ThumbB
|
||||||
#Gdt_ThumbSize
|
#Gdt_ThumbSize
|
||||||
|
#Gdt_FrameStyle ; <--- Ajoutez
|
||||||
|
#Gdt_OptionFit ; <--- Ajoutez
|
||||||
|
#Gdt_OptionFill ; <--- Ajoutez
|
||||||
|
#Gdt_OptionStretch ; <--- Ajoutez
|
||||||
EndEnumeration
|
EndEnumeration
|
||||||
|
|
||||||
Global NewList CurrentList.s() ; A global list to hold the file paths of the images to be displayed. / Une liste globale pour contenir les chemins des fichiers des images à afficher.
|
Global NewList CurrentList.s() ; A global list to hold the file paths of the images to be displayed. / Une liste globale pour contenir les chemins des fichiers des images à afficher.
|
||||||
@@ -1117,6 +1135,12 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
ButtonGadget(#Gdt_Folder, 10, 10, 120, 25, "Choose Folder")
|
ButtonGadget(#Gdt_Folder, 10, 10, 120, 25, "Choose Folder")
|
||||||
TrackBarGadget(#Gdt_ThumbSize, 140, 10, 200, 25, 64, 256) ; Min: 64px, Max: 256px
|
TrackBarGadget(#Gdt_ThumbSize, 140, 10, 200, 25, 64, 256) ; Min: 64px, Max: 256px
|
||||||
SetGadgetState(#Gdt_ThumbSize, 128) ; On règle la taille initiale à 128px
|
SetGadgetState(#Gdt_ThumbSize, 128) ; On règle la taille initiale à 128px
|
||||||
|
FrameGadget(#Gdt_FrameStyle, 350, 5, 280, 35, "Display Style")
|
||||||
|
OptionGadget(#Gdt_OptionFit, 360, 20, 80, 15, "Fit")
|
||||||
|
OptionGadget(#Gdt_OptionFill, 450, 20, 80, 15, "Fill")
|
||||||
|
OptionGadget(#Gdt_OptionStretch, 540, 20, 80, 15, "Stretch")
|
||||||
|
SetGadgetState(#Gdt_OptionFit, #True) ; On coche "Fit" par défaut
|
||||||
|
|
||||||
Cache::InitCache() ; Initialize the caching system. / Initialise le système de cache.
|
Cache::InitCache() ; Initialize the caching system. / Initialise le système de cache.
|
||||||
; Create the thumbnail gadget, passing our callback function. / Crée le gadget de vignettes, en passant notre fonction de callback.
|
; Create the thumbnail gadget, passing our callback function. / Crée le gadget de vignettes, en passant notre fonction de callback.
|
||||||
Thumbs::ThumbsGadget(#Gdt_ThumbA, 0, 50, WindowWidth(#Win_main), WindowHeight(#Win_main) - 50, 128, @CallBackLoadFromIndexB())
|
Thumbs::ThumbsGadget(#Gdt_ThumbA, 0, 50, WindowWidth(#Win_main), WindowHeight(#Win_main) - 50, 128, @CallBackLoadFromIndexB())
|
||||||
@@ -1158,6 +1182,15 @@ CompilerIf #PB_Compiler_IsMainFile
|
|||||||
Debug NewSize
|
Debug NewSize
|
||||||
;EndIf
|
;EndIf
|
||||||
|
|
||||||
|
Case #Gdt_OptionFit
|
||||||
|
Thumbs::SetThumbsDisplayStyle(#Gdt_ThumbA, ImgTools::#Image_Style_Fit)
|
||||||
|
|
||||||
|
Case #Gdt_OptionFill
|
||||||
|
Thumbs::SetThumbsDisplayStyle(#Gdt_ThumbA, ImgTools::#Image_Style_Fill)
|
||||||
|
|
||||||
|
Case #Gdt_OptionStretch
|
||||||
|
Thumbs::SetThumbsDisplayStyle(#Gdt_ThumbA, ImgTools::#Image_Style_Stretch)
|
||||||
|
|
||||||
EndSelect
|
EndSelect
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
@@ -1181,8 +1214,8 @@ CompilerEndIf
|
|||||||
; EnableXP
|
; EnableXP
|
||||||
; DPIAware
|
; DPIAware
|
||||||
; IDE Options = PureBasic 6.21 (Windows - x64)
|
; IDE Options = PureBasic 6.21 (Windows - x64)
|
||||||
; CursorPosition = 1158
|
; CursorPosition = 1192
|
||||||
; FirstLine = 1126
|
; FirstLine = 1149
|
||||||
; Folding = -------
|
; Folding = -------
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
||||||
|
Reference in New Issue
Block a user