Vers une programmation automatique des gadgets 2em édition
Publié : mar. 28/mai/2019 15:32
Bonjour a tous, et merci de vos encouragements.
Voici une seconde mouture, qui permet de visualiser l'emplacement du gadget sur votre fenêtre.
Ceci est certainement perfectible. Vos remarques seront appréciées.
Lisez bien l'aide.
Voici une seconde mouture, qui permet de visualiser l'emplacement du gadget sur votre fenêtre.
Ceci est certainement perfectible. Vos remarques seront appréciées.
Lisez bien l'aide.
Code : Tout sélectionner
;*****************************
;Autogad V2 MLD 28/05/2019
;¤¤¤¤¤¤ Numéros des éléments ¤¤¤¤¤¤¤¤¤¤¤¤¤
#FP = 1:#List1 = 2:#Eticlist1 = 3:#List2 = 4:#Eticlist2 = 5:#frame1 = 6:#Eticstyl = 7:#Eticstylcolor = 8
#coche1 = 10:#coche2 = 11:#coche3 = 12:#coche4 = 13:#coche5 = 14:#coche6 = 15:#coche7 = 16:#canvas = 17
#frame2 = 20:#txtTest = 21:#frame3 = 22:#eticft1 = 23:#eticft2 = 24:#stringNpol = 25:#stringIDF = 26:#txtresft = 27
#framegad1 = 30:#Listgad = 31:#txtgad1 = 32:#txtgad2 = 33:#txtgad3 = 34:#txtgad4 = 35
#stringIDG = 36:#stringnblt = 37:#stringnblg = 38:#trait_H = 39:#txtgad5 = 40:#txtgad6 = 41:#txtgad7 = 42:#txtgad8 = 43:
#stringLarg = 44:#stringhaut = 45:#stringX = 46:#stringY = 47:#trait_V = 48:#txtgad9 = 49
#cochegad1 = 50:#cochegad2 = 51:#cochegad3 = 52:#cochegad4 = 53:#cochegadUPG = 54:#cochegadOmbre = 55:
#trakbar = 56:#txtFT1 = 57:#txtFT2 = 58:#txtFT3 = 59:#txtFT4 = 60:#stringftX = 61:#stringftY = 62:#stringftL = 63:#stringftH = 64
#txtdxpg = 65:#txtdYpg = 66
#frameCodegad = 70:#Editor1 = 71:#frameCodePP = 72:#Editor2 = 73:#cochePP1 = 74:#cochePP2 = 75:#cochePP3 = 76:#cochePP4 = 77
#btPP = 80:#btaid = 81:#btstop = 82
;********** Place_gad *******
#fenpg = 101:#text = 102
Define CURSOR.q ; this is POINT structure by fact
Structure HOOKSTRUCT
vkCode.l
EndStructure
Global NewList NomFont.s()
Declare EnumFontFamExProc(*lpelfe.ENUMLOGFONTEX,*lpntme.NEWTEXTMETRICEX,FontType,lParam)
Declare LH(Ft$,tp,st1,st2,st3,st4,st5)
Declare SpecificGad(tw.D,th)
Declare style(Ft$,tp)
Global Dpencadr.b
Global Cgad$,CgadCLF$,CgadCLT$,CgadF$,copfont$
Global Dim L.s(17)
Global FontID1 = LoadFont(160,"Arial",13)
Global FontID2 = LoadFont(161,"Noto Serif Condensed",10,0|0|0|0|0)
Global FontID3 = LoadFont(162,"Noto Serif Condensed",10,256|0|0|0|0)
Macro EcriEtict(gad);couleur de fond fenêtre de travail
SetGadgetFont(gad,FontID3)
EndMacro
L.s(1) = "But du logiciel:" +#CRLF$
L.s(2) = "1° Insérer facilement des gadgets sur une fenêtre en cours de réalisation."+#CRLF$
L.s(3) = "2° Copier le code nécessaire aux gadgets dans votre logiciel en cours de développement, par l'intermédiaire du presse-papiers" +#CRLF$
L.s(4) = "Principe:"+#CRLF$
L.s(5) = "Une fenêtre quadrillée transparente vient se superposer a votre fenêtre en cours de développement, et projette l'ombre du futur gadget sur celle-ci a l'endroit souhaité."+#CRLF$
L.s(6) = "Les paramètres du futur gadget sont alors transmissiblent dans le presse-papiers pour une copie dans votre code."+#CRLF$
L.s(7) = "Utilisation:"+#CRLF$
L.s(8) = "1° Faite apparaitre la fenêtre en cours de développement."+#CRLF$
L.s(9) = "2° Utilisez AUTOGAD."+#CRLF$
L.s(10) = "3° indiquez dans AUTOGAD a la rubrique fenêtre en teste, les dimensions de votre fenêtre de manière que la fenêtre quadrillée se superpose exactement a celle-ci."+#CRLF$
L.s(10) = "4° Choisissez un gadget dans la liste. Si le gadget contient du texte, choisissez une police .Ce choix déterminera la largeur, et hauteur de certains gadgets. "+#CRLF$
L.s(11) = "De même si le gadget le permet choisissez les couleurs de fond et de texte." + #CRLF$
L.s(12) = "La taille du gadget étant définie, l'ombre de celui-ci apparait sur la fenêtre."+#CRLF$
L.s(13) = "Vous pouvez déplacer l'ombre a l'aide de la souris, et fixer les paramètres X,Y par un clic droit. Ou plus finement en utilisant"+#CRLF$
L.s(14) = "les touches de direction du clavier. Un appuis sur entrée validera la position X,Y."+#CRLF$
L.s(15) = "5° Faite un choix du code a insérer dans le presse-papiers en cliquant sur une des cases a cocher, et cliquez ensuite sur le bouton presse-papiers."+#CRLF$
L.s(16) = "Remarque:"+#CRLF$
L.s(17) = "La largeur et hauteur de n'importe quel gadget peut se définir manuellement en cochant la case L-H manuel"+#CRLF$
For X = 1 To 17
LT$ = LT$ + L.s(X)
Next
Procedure.l KeyboardHook(nCode, wParam, *p.HOOKSTRUCT)
If WindowMouseX(101)> 1 And WindowMouseX(101)< (WindowWidth(101,1))And WindowMouseY(101)=> 30 And WindowMouseY(101)< (WindowHeight(101,1) -30)
If wParam = #WM_KEYDOWN
Select *p\vkCode
Case 13
SetGadgetText(46,Str(WindowMouseX(101))):SetGadgetText(47,Str((WindowMouseY(101)-30))) ;inscrit coordonnées souris
style(Ft$,tp)
Case 37
GetCursorPos_(point.point)
SetCursorPos_(point\X - 1,point\Y)
Case 38
GetCursorPos_(point.point)
SetCursorPos_(point\X ,point\Y -1)
Case 39
GetCursorPos_(point.point)
SetCursorPos_(point\X + 1,point\Y)
Case 40
GetCursorPos_(point.point)
SetCursorPos_(point\X ,point\Y +1)
EndSelect
EndIf
EndIf
EndProcedure
Procedure GestionCaret(Gadget) ; Gestion du caret dans stringGadget
SendMessage_(GadgetID(Gadget), #EM_GETSEL, @Debut_Position, @Fin_position)
y = Debut_Position
Texte.s = GetGadgetText(Gadget)
x =Len(Texte)
Texte2.s = Left(Texte,y ) + Right(Texte,x-y)
SendMessage_(GadgetID(Gadget), #EM_SETSEL, x, x)
EndProcedure
Procedure MLD_ActCoche(Gad,Act) ;1 = actif 0 = non actif
haut.D = GadgetHeight(Gad): larg.D = haut.D
fontche = LoadFont(Gad,"Arial", haut * 0.75,256)
CreateImage(Gad,larg,haut)
hdc=StartDrawing(ImageOutput(Gad))
;Dessine l'image
DrawingMode(#PB_2DDrawing_Gradient)
BackColor($BEBEBE):FrontColor($FFFFFF)
LinearGradient(0,haut *1.5,0,0)
Box(0,0,larg,haut)
;Position du texte
DrawingMode(#PB_2DDrawing_Transparent)
DrawingFont(fontche)
txtcoche$ = Chr(10003)
hautxtC = TextHeight(txtcoche$):largtxtC = TextWidth(txtcoche$)
ctrtxtC = (larg - largtxtC)/2 ; centre le text en largeur
ctxtC = (haut - hautxtC)/2 ; centre le text en hauteur
If Act = 1
SetGadgetState(Gad,1):DrawText(ctrtxtC,ctxtC,txtcoche$,$32CD32)
Else
SetGadgetState(Gad,0)
EndIf
StopDrawing()
SetGadgetAttribute(Gad,#PB_Button_Image,ImageID(Gad))
EndProcedure
Procedure MLD_Coche(Gad,x.D,y.D,larg.D,haut.D,txt$,coultxt,Action) ;le num de gadget ne doit jamais être 0| Action 1 = ok 0 = no ok
ButtonImageGadget(Gad,x,y,haut,haut,0,#PB_Button_Toggle)
CouleurFond = GetSysColor_(#COLOR_3DFACE)
Font = LoadFont(0,"Arial", haut/2,256)
hautbt.D = GadgetHeight(Gad)
plG = x + hautbt.D + 12;20
txtgad = TextGadget(#PB_Any,plG,y,larg.D,haut.D,txt$,#SS_CENTERIMAGE)
SetGadgetColor(txtgad,#PB_Gadget_BackColor,CouleurFond)
SetGadgetColor(txtgad,#PB_Gadget_FrontColor,coultxt)
SetGadgetFont(txtgad,Font)
MLD_ActCoche(Gad,Action)
EndProcedure
Procedure cadrestring(Gad)
SetWindowLongPtr_(GadgetID(Gad),#GWL_EXSTYLE,GetWindowLongPtr_(GadgetID(Gad),#GWL_EXSTYLE)|#WS_EX_STATICEDGE &~ #WS_EX_CLIENTEDGE)
SetWindowPos_(GadgetID(Gad),0,0,0,0,0,#SWP_NOZORDER|#SWP_NOMOVE|#SWP_NOSIZE|#SWP_FRAMECHANGED|#SWP_DRAWFRAME)
EndProcedure
Procedure Gest_cmd()
DisableGadget(15,0):DisableGadget(16,0)
DisableGadget(35,1):DisableGadget(38,1)
DisableGadget(34,0):DisableGadget(37,0)
MLD_ActCoche(53,0)
SendMessage_(GadgetID(44),#EM_SETREADONLY,1,0):SendMessage_(GadgetID(45),#EM_SETREADONLY,1,0)
SetGadgetColor(44,#PB_Gadget_BackColor,$00FF7F):SetGadgetColor(45,#PB_Gadget_BackColor,$00FF7F)
Select Trim(GetGadgetText(31))
Case "Button","CheckBox","Option","ComboBox","Date","Frame","Shortcut"
DisableGadget(15,1):DisableGadget(16,1)
Case "Calendar"
DisableGadget(15,1):DisableGadget(34,1):DisableGadget(37,1)
Case "Editor","ListView","ListIcon","Tree"
DisableGadget(35,0):DisableGadget(38,0)
Case "ExplorerList","ExplorerTree","ProgressBar"
DisableGadget(34,1):DisableGadget(37,1)
MLD_ActCoche(53,1)
SendMessage_(GadgetID(44),#EM_SETREADONLY,0,0):SendMessage_(GadgetID(45),#EM_SETREADONLY,0,0)
SetGadgetColor(44,#PB_Gadget_BackColor,$00FFFF):SetGadgetColor(45,#PB_Gadget_BackColor,$00FFFF)
Case "Canvas","ButtonImage","ExplorerCombo","IPAddress","Image","OpenGL","Panel","ScrollArea","ScrollBar","TrackBar","Web"
DisableGadget(15,1):DisableGadget(16,1)
DisableGadget(34,1):DisableGadget(37,1)
MLD_ActCoche(53,1)
SendMessage_(GadgetID(44),#EM_SETREADONLY,0,0):SendMessage_(GadgetID(45),#EM_SETREADONLY,0,0)
SetGadgetColor(44,#PB_Gadget_BackColor,$00FFFF):SetGadgetColor(45,#PB_Gadget_BackColor,$00FFFF)
Case "Container"
DisableGadget(15,1)
DisableGadget(34,1):DisableGadget(37,1)
MLD_ActCoche(53,1)
SendMessage_(GadgetID(44),#EM_SETREADONLY,0,0):SendMessage_(GadgetID(45),#EM_SETREADONLY,0,0)
SetGadgetColor(44,#PB_Gadget_BackColor,$00FFFF):SetGadgetColor(45,#PB_Gadget_BackColor,$00FFFF)
EndSelect
EndProcedure
Procedure EnumFontFamExProc(*lpelfe.ENUMLOGFONTEX,*lpntme.NEWTEXTMETRICEX,FontType,lParam)
NomFont$ = PeekS(@*lpelfe\elfFullName)
Select FontType
Case #TRUETYPE_FONTTYPE
Type$ = "[TT] "
EndSelect
dp =0
ForEach NomFont()
If NomFont() = Type$ + NomFont$:dp=1:EndIf
Next
If dp =0
AddElement(NomFont())
NomFont() = Type$ + NomFont$ :Type$ = ""
EndIf
ProcedureReturn #True
EndProcedure
Procedure VisuEmumFont()
lf.LOGFONT
lf\lfCharset = #DEFAULT_CHARSET
hdc = GetDC_(WindowID(1))
EnumFontFamiliesEx_(hdc,lf,@EnumFontFamExProc(),0,0)
ReleaseDC_(WindowID(1),hdc)
SortList( NomFont.s(),#PB_Sort_Ascending)
ForEach NomFont()
AddGadgetItem(2,-1,NomFont())
Next
EndProcedure
Procedure colorgadfond()
If GetGadgetState(16) = 1
Couleur = ColorRequester()
If couleur > -1:SetGadgetColor(21,#PB_Gadget_BackColor,couleur):EndIf
Else
SetGadgetColor(21,#PB_Gadget_BackColor,#PB_Default)
EndIf
EndProcedure
Procedure colorgadtxt()
If GetGadgetState(15) = 1
Couleur = ColorRequester()
If couleur > -1:SetGadgetColor(21,#PB_Gadget_FrontColor,couleur):EndIf
Else
SetGadgetColor(21,#PB_Gadget_FrontColor,#PB_Default)
EndIf
EndProcedure
Procedure testPolice(Ft$,st1,St2,st3,st4,st5)
SetGadgetText(20,"Test police: taille 14:"+ Ft$)
FontID5 = LoadFont(170,Ft$,14,st1|St2|st3|st4|st5)
SetGadgetFont(21,FontID5)
EndProcedure
Procedure style(Ft$,tp)
If GetGadgetState(10) = 1
MLD_ActCoche(10,1):st1 = #PB_Font_Bold
Else
MLD_ActCoche(10,0):st1 = 0
EndIf
If GetGadgetState(11) = 1
MLD_ActCoche(11,1):st2 = #PB_Font_Italic
Else
MLD_ActCoche(11,0):st2 = 0
EndIf
If GetGadgetState(12) = 1
MLD_ActCoche(12,1):st3 = #PB_Font_Underline
Else
MLD_ActCoche(12,0):st3 = 0
EndIf
If GetGadgetState(13) = 1
MLD_ActCoche(13,1):st4 = #PB_Font_StrikeOut
Else
MLD_ActCoche(13,0):st4 = 0
EndIf
If GetGadgetState(14) = 1
MLD_ActCoche(14,1):st5 = #PB_Font_HighQuality
Else
MLD_ActCoche(14,0):st5 = 0
EndIf
testPolice(Ft$,st1,St2,st3,st4,st5)
LH(Ft$,tp,st1,st2,st3,st4,st5)
EndProcedure
Procedure LH(Ft$,tp,st1,st2,st3,st4,st5)
tw.D = 0:th = 0
FontID3 = LoadFont(102,Ft$,tp,st1|st2|st3|st4|st5)
For t= 50 To 51
If GetGadgetState(t) = 1:Break:EndIf
Next
Select t
Case 50
a$ ="ABwbikMplR"
Case 51
a$ ="ABWJLIPYFS"
EndSelect
StartDrawing(CanvasOutput(17))
DrawingFont(FontID3)
DrawText(17, 80,a$,$0, 0)
tw.D = (TextWidth(a$)/10)
th = TextHeight(a$)
StopDrawing()
If GetGadgetText(25) = "" And GetGadgetText(26) = ""
copfont$ = "FontID = LoadFont(#Police," + Chr(34) + Ft$+ Chr(34) + "," + Str(tp)+ "," + Str(st1) + "|" + Str(st2)+ "|" + Str(st3)+ "|" + Str(st4)+ "|" + Str(st5)+ ")"
EndIf
If GetGadgetText(25) <> "" And GetGadgetText(26) = ""
copfont$ = "FontID = LoadFont("+ GetGadgetText(25) + "," + Chr(34) + Ft$+ Chr(34) + "," + Str(tp)+ "," + Str(st1) + "|" + Str(st2)+ "|" + Str(st3)+ "|" + Str(st4)+ "|" + Str(st5)+ ")"
EndIf
If GetGadgetText(25) = "" And GetGadgetText(26) <> ""
copfont$ = GetGadgetText(26) + " = LoadFont(#Police," + Chr(34) + Ft$+ Chr(34) + "," + Str(tp)+ "," + Str(st1) + "|" + Str(st2)+ "|" + Str(st3)+ "|" + Str(st4)+ "|" + Str(st5)+ ")"
EndIf
If GetGadgetText(25) <> "" And GetGadgetText(26) <> ""
copfont$ = GetGadgetText(26) + " = LoadFont("+ GetGadgetText(25) + "," + Chr(34) + Ft$+ Chr(34) + "," + Str(tp)+ "," + Str(st1) + "|" + Str(st2)+ "|" + Str(st3)+ "|" + Str(st4)+ "|" + Str(st5)+ ")"
EndIf
SetGadgetText(27,copfont$)
SpecificGad(tw.D,th)
EndProcedure
Procedure gest_cochePP(IDcoche)
MLD_ActCoche(IDcoche,1)
For z = 74 To 77
If z <> IDcoche:MLD_ActCoche(z,0):EndIf
Next
EndProcedure
Procedure visuPP()
ClearGadgetItems(73)
SetGadgetColor(73,#PB_Gadget_FrontColor,$0)
If GetGadgetState(74) = 1 Or GetGadgetState(77) = 1
AddGadgetItem (73,-1,copfont$)
EndIf
If GetGadgetState(75) = 1 Or GetGadgetState(76) = 1 Or GetGadgetState(77) = 1
AddGadgetItem (73,-1,Cgad$)
If GetGadgetState(76) = 1 Or GetGadgetState(77) = 1 :AddGadgetItem (73,-1,CgadF$):EndIf
If GetGadgetState(16) = 1:AddGadgetItem (73,-1,CgadCLF$):EndIf
If GetGadgetState(15) = 1:AddGadgetItem (73,-1,CgadCLT$):EndIf
EndIf
EndProcedure
Procedure SpecificGad(tw.D,th)
Gad$ = GetGadgetText(31)
If GetGadgetState(53) <> 1 ;ne tient compte que des gadget dont la L-H est donné en automatique
cdW = 0:cdH = 0
If Dpencadr.b = 1:cdW = 14:cdH = 5:EndIf
nbl = Val(GetGadgetText(37));nombre de lettres
nblg = Val(GetGadgetText(38));nombre de lignes
If Gad$ = "Button"
Gadw = Round((tw.D*nbl + (2.6*nbl)),#PB_Round_Up)
Gadh = th + 6 + cdH
EndIf
If Gad$ = "Calendar"
Gadw = 230:Gadh = 180
EndIf
If Gad$ = "Editor" Or Gad$ = "Spin"
If GetGadgetState(51) = 1;majuscule
Gadw = Round((tw.D*nbl + (2.8*nbl)),#PB_Round_Up)+ 40 ;+ cdW;25 = larg srollbar
Gadh = (th * nblg)+ (th * 0.32);+ cdH
Else
Gadw = Round(tw.D*nbl,#PB_Round_Up)+ 40 + cdW;40 = larg srollbar
Gadh = (th * nblg)+ (th * 0.38) ;+ cdH
EndIf
EndIf
If Gad$ = "ListView" Or Gad$ = "ComboBox" Or Gad$ = "Date" Or Gad$ = "ListIcon" Or Gad$ = "Tree"
If GetGadgetState(51) = 1;majuscule
Gadw = Round((tw.D*nbl + (2.8*nbl)),#PB_Round_Up)+ 35 ;+ cdW;25 = larg srollbar
Gadh = (th * nblg)+ (th * 0.32);+ cdH
Else
Gadw = Round(tw.D*nbl,#PB_Round_Up)+ 35 ;+ cdW;25 = larg srollbar
Gadh = (th * nblg)+ (th * 0.32); cdH
EndIf
EndIf
If Gad$ = "String" Or Gad$ = "CheckBox" Or Gad$ = "Option" Or Gad$ = "HyperLink"
If GetGadgetState(51) = 1;majuscule
Gadw = Round((tw.D*nbl + (3.8*nbl)),#PB_Round_Up)+ cdW
Gadh = th + 2 + cdH
Else
Gadw = Round((tw.D*nbl + (1.7*nbl)),#PB_Round_Up)+ cdW
Gadh = th + 2
EndIf
EndIf
If Gad$ = "Text" Or Gad$ = "Frame" Or Gad$ = "Shortcut"
If GetGadgetState(51) = 1;majuscule
Gadw = Round((tw.D*nbl + (2.8*nbl)),#PB_Round_Up)+ cdW
Gadh = th + 2 + cdH
Else
Gadw = Round(tw.D*nbl,#PB_Round_Up)+ cdW
Gadh = th + 2 + cdH
EndIf
EndIf
SetGadgetText(44,Str(Gadw)):SetGadgetText(45,Str(Gadh))
Else
Gadw = Val(GetGadgetText(44)):Gadh = Val(GetGadgetText(45))
EndIf
;¤¤¤¤¤¤¤ construction gadget ¤¤¤¤¤¤¤¤¤¤
If GetGadgetText(36) = "";ID gad
Gid$ = "#Gadget"
Else
Gid$ = GetGadgetText(36)
EndIf
If GetGadgetText(26) = "";ID font
Fid$ = "FontID"
Else
Fid$ = GetGadgetText(26)
EndIf
ClearGadgetItems(71)
Select Gad$
Case "Editor","ListView","Canvas","Calendar","ComboBox","Container","Date","IPAddress","OpenGL","Panel","Tree"
Cgad$ = Gad$ + "Gadget(" + Gid$ + "," + GetGadgetText(46) + "," + GetGadgetText(47) + "," + Str(Gadw) + "," + Str(Gadh) + ")"
Case "Button","String","Text","CheckBox","Option","ExplorerCombo","ExplorerList","ExplorerTree","Frame"
Cgad$ = Gad$ + "Gadget("+ Gid$ +"," + GetGadgetText(46) + "," + GetGadgetText(47) + "," + Str(Gadw) + "," + Str(Gadh) + ",Texte$)"
Case "HyperLink"
Cgad$ = Gad$ + "Gadget("+ Gid$ +"," + GetGadgetText(46) + "," + GetGadgetText(47) + "," + Str(Gadw) + "," + Str(Gadh) + "," + "Texte$" + ",Couleur)"
Case "ButtonImage","Image"
Cgad$ = Gad$ + "Gadget("+ Gid$ +"," + GetGadgetText(46) + "," + GetGadgetText(47) + "," + Str(Gadw) + "," + Str(Gadh) + ",ImageID())"
Case "ProgressBar","Spin","TrackBar"
Cgad$ = Gad$ + "Gadget("+ Gid$ +"," + GetGadgetText(46) + "," + GetGadgetText(47) + "," + Str(Gadw) + "," + Str(Gadh)+ "," + "Minimum" + "," + "Maximum" + ")"
Case "ScrollArea"
Cgad$ = Gad$ + "Gadget("+ Gid$ +"," + GetGadgetText(46) + "," + GetGadgetText(47) + "," + Str(Gadw) + "," + Str(Gadh)+ "," + "LargeurZoneInterne" + "," + "HauteurZoneInterne"+ "," + "ValeurDeplacement" + ")"
Case "ScrollBar"
Cgad$ = Gad$ + "Gadget("+ Gid$ +"," + GetGadgetText(46) + "," + GetGadgetText(47) + "," + Str(Gadw) + "," + Str(Gadh)+ "," + "Minimum" + "," + "Maximum"+ "," + "LongueurPage" + ")"
Case "Shortcut"
Cgad$ = Gad$ + "Gadget("+ Gid$ +"," + GetGadgetText(46) + "," + GetGadgetText(47) + "," + Str(Gadw) + "," + Str(Gadh) + ",Raccourci)"
Case "ListIcon"
Largcol = Gadw - 22
Cgad$ = Gad$ + "Gadget("+ Gid$ +"," + GetGadgetText(46) + "," + GetGadgetText(47) + "," + Str(Gadw) + "," + Str(Gadh) + "," + "Texte$" + "," + Str(Largcol) + ")"
Case "Web"
Cgad$ = Gad$ + "Gadget("+ Gid$ +"," + GetGadgetText(46) + "," + GetGadgetText(47) + "," + Str(Gadw) + "," + Str(Gadh) + ",URL$)"
EndSelect
AddGadgetItem (71,-1,Cgad$)
Select Gad$
Case "ButtonImage", "Calendar"
Default
CgadF$ = "SetGadgetFont(" + Gid$ + "," + Fid$ +")"
AddGadgetItem (71,-1,CgadF$)
EndSelect
If GetGadgetState(16) = 1;coul fond
Coulf$ = Hex(GetGadgetColor(21,#PB_Gadget_BackColor))
CgadCLF$ = "SetGadgetColor(" + Gid$ + ",#PB_Gadget_BackColor,$" + Coulf$ + ")"
AddGadgetItem (71,-1,CgadCLF$)
EndIf
If GetGadgetState(15) = 1;coul text
CoulT$ = Hex(GetGadgetColor(21,#PB_Gadget_FrontColor))
CgadCLT$ = "SetGadgetColor(" + Gid$ + ",#PB_Gadget_FrontColor,$" + CoulT$ + ")"
AddGadgetItem (71,-1,CgadCLT$)
EndIf
visuPP()
EndProcedure
;¤¤¤¤¤¤¤¤ Place_gad ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
Procedure Rgl()
Protected i.i,x.i,w.i
UpdateWindow_(WindowID(101))
StartDrawing(WindowOutput(101))
DrawingFont(FontID(1))
For x=0 To WindowWidth(101) Step 20
Line(x,0,1,10,$0000FF);vingtaine haut
DrawText(x-2,12,Str(x),$0,$FFFFFF);chiffres du haut
Line(x,WindowHeight(101)-1,1,-10,$0000FF);vingtaine bas
DrawText(x-2,WindowHeight(101)-20,Str(x),$0,$FFFFFF) ;chiffres du bas
Next
For xx= 10 To WindowWidth(101) Step 20
If xx < = (WindowWidth(101)-40)
Line (xx+20,30,1,WindowHeight(101)-30,$FAE6E6);quadriage
EndIf
Line (xx,0,1,5,$CD0000);dizaine haut
Line(xx,WindowHeight(101)-1,1,-5,$CD0000);dizaine bas
Next
Line(20,30,WindowWidth(101)-40,1,$0000FF)
For y = 30 To (WindowHeight(101) -30)Step 20
Line(1,y,10,1,$0000FF);vingtaine gauche
DrawText(15,y-5,Str(y-30),$0,$FFFFFF);chiffres gauche
Line(WindowWidth(101)-1,y,-10,1,$0000FF);vingtaine droit
DrawText(WindowWidth(101)-20,y-5,Str(y-30),$0,$FFFFFF);chifres droit
Next
For yy = 40 To (WindowHeight(101) -30)Step 20
Line (6,yy,WindowWidth(101)-20,1,$FAE6E6);quadriage h
Line (1,yy,5,1,$CD0000);dizaine gauche
Line(WindowWidth(101)-1,yy,-5,1,$CD0000);dizaine droit
Next
StopDrawing()
UpdateWindow_(WindowID(101))
EndProcedure
Procedure dess (X,Y)
If X > 0 And Y > 0
If GetGadgetState(55) <> 0
HideGadget(102,0)
EndIf
ResizeGadget(102, X, Y,Val(GetGadgetText(44)),Val(GetGadgetText(45)))
Rgl()
Else
HideGadget(102,1)
Rgl()
EndIf
EndProcedure
Procedure PG()
Define hWPG = OpenWindow(101,650,200,700,400, "",#PB_Window_BorderLess|#WS_THICKFRAME)
StickyWindow(101,1)
HideWindow(101,0)
SetWindowColor(101,$FFFFFF)
SetWindowLong_(WindowID(101), #GWL_EXSTYLE, GetWindowLong_(WindowID(101), #GWL_EXSTYLE) | #WS_EX_LAYERED);transparence:
SetLayeredWindowAttributes_(WindowID(101), 0,140, #LWA_ALPHA)
LoadFont(1, "Noto Sans Condensed", 7,#PB_Font_HighQuality)
TextGadget(102,10,10,Val(GetGadgetText(44)),Val(GetGadgetText(45)),"")
SetGadgetColor(102,#PB_Gadget_BackColor,$D3D3D3)
Rgl()
EndProcedure
Procedure rzPG()
If Val(GetGadgetText(63)) >= 5 And Val(GetGadgetText(64)) >= 5
ResizeWindow(101,Val(GetGadgetText(61)),Val(GetGadgetText(62))-10,Val(GetGadgetText(63)),Val(GetGadgetText(64))+30)
EndIf
EndProcedure
Procedure PP()
ClearClipboard()
SetGadgetColor(73,#PB_Gadget_FrontColor,$FFFFFF)
If GetGadgetState(74) = 1:SetClipboardText(copfont$):ProcedureReturn:EndIf
If GetGadgetState(75) = 1
ppgad$ = Cgad$
EndIf
If GetGadgetState(76) = 1
ppgad$ = Cgad$ + Chr (13) + Chr (10) + CgadF$
EndIf
If GetGadgetState(77) = 1
ppgad$ = copfont$ + Chr (13) + Chr (10) + Cgad$ + Chr (13) + Chr (10) + CgadF$
EndIf
If GetGadgetState(15) = 1:ppgad$ = ppgad$ + Chr (13) + Chr (10) + CgadCLT$:EndIf
If GetGadgetState(16) = 1:ppgad$ = ppgad$ + Chr (13) + Chr (10) + CgadCLF$ :EndIf
SetClipboardText( ppgad$)
EndProcedure
Define hWndFP = OpenWindow(1,0,10,503,985,"Auto_Prog_Gad",#PB_Window_MinimizeGadget)
StickyWindow(1,1)
CanvasGadget(17,0,0,1000,500):HideGadget(17,1)
ListViewGadget(2,10,30,270,217)
cadrestring(2)
SetGadgetFont(2,FontID2)
SetGadgetColor(2,#PB_Gadget_BackColor,$B2DAD1)
SetGadgetColor(2,#PB_Gadget_FrontColor,$000080)
VisuEmumFont()
SetGadgetText(2,"[TT] Tahoma");sélectionne
ListViewGadget(4,305,30,70,217)
SetGadgetFont(4,FontID2)
SetGadgetColor(4,#PB_Gadget_BackColor,$B2DAD1)
SetGadgetColor(2,#PB_Gadget_FrontColor,$000080)
cadrestring(4)
For z = 6 To 70
AddGadgetItem(4,-1,Str(z))
Next
SetGadgetText(4,"14");sélectionne
FrameGadget(6,400,30,90,217,"",#PB_Frame_Single)
Tpol$ = "Choix polices" + Space(6)+ "Nb " + Str(CountGadgetItems(2))
TextGadget(3,13,10,160,17,Tpol$)
EcriEtict(3)
TextGadget(5,308,10,40,17,"Taille")
EcriEtict(5)
TextGadget(7,406,10,40,17,"Style")
EcriEtict(7)
TextGadget(8,403,165,90,17,"Couleurs ",#PB_Text_Center)
EcriEtict(8)
MLD_Coche(10,413,40,85,20,"G",$CD0000,0)
MLD_Coche(11,413,65,85,20,"I",$CD0000,0)
MLD_Coche(12,413,90,85,20,"S",$CD0000,0)
MLD_Coche(13,413,115,85,20,"B",$CD0000,0)
MLD_Coche(14,413,140,85,20,"H Q",$CD0000,0)
MLD_Coche(15,413,190,85,20,"Txt",$CD0000,0)
MLD_Coche(16,413,215,85,20,"Fd",$CD0000,0)
FrameGadget(20,10,255,485,80,"")
EcriEtict(20)
TextGadget(21,13,280,424,50,"AZuytmwxc1230TRF45 ЯЍ ΩΣ WX")
testPolice("Tahoma",st1,st2,st3,st4,st5)
FrameGadget(22,10,340,485,70,"Code fonte")
TextGadget(23,100,355,100,17,"Num de police")
TextGadget(24,270,355,80,17,"ID fonte")
StringGadget(25,205,353,55,20,"",#PB_String_Numeric|#ES_CENTER)
SendMessage_(GadgetID(25),#EM_LIMITTEXT,5,0)
cadrestring(25):SetGadgetColor(25,#PB_Gadget_BackColor,$00FFFF)
StringGadget(26,330,353,100,20,"",#ES_CENTER)
SendMessage_(GadgetID(26),#EM_LIMITTEXT,13,0)
cadrestring(26):SetGadgetColor(26,#PB_Gadget_BackColor,$00FFFF)
For x = 22 To 26
EcriEtict(x)
Next
TextGadget(27,13,380,480,22,"")
cadrestring(27):SetGadgetColor(27,#PB_Gadget_BackColor,$00FF7F)
SetGadgetFont(27,FontID2)
FrameGadget(30,10,420,485,270,"Paramètres Gadget")
EcriEtict(30)
ListViewGadget(31,15,460,105,95);list gadgets
SetGadgetFont(31,FontID2)
cadrestring(31):SetGadgetColor(31,#PB_Gadget_BackColor,$B2DAD1):SetGadgetColor(4,#PB_Gadget_BackColor,$B2DAD1)
AddGadgetItem (31,-1,"Button"):AddGadgetItem (31,-1,"ButtonImage"):AddGadgetItem (31,-1,"Calendar")
AddGadgetItem (31,-1,"Canvas"):AddGadgetItem (31,-1,"CheckBox"):AddGadgetItem (31,-1,"ComboBox"):AddGadgetItem (31,-1,"Container")
AddGadgetItem (31,-1,"Date"):AddGadgetItem (31,-1,"Editor"):AddGadgetItem (31,-1,"ExplorerCombo"): AddGadgetItem (31,-1,"ExplorerList")
AddGadgetItem (31,-1,"ExplorerTree"):AddGadgetItem (31,-1,"Frame"):AddGadgetItem (31,-1,"HyperLink"):AddGadgetItem (31,-1,"Image")
AddGadgetItem (31,-1,"IPAddress"):AddGadgetItem (31,-1,"ListIcon"):AddGadgetItem (31,-1,"ListView"):AddGadgetItem (31,-1,"OpenGL")
AddGadgetItem (31,-1,"Option"):AddGadgetItem (31,-1,"Panel"):AddGadgetItem (31,-1,"ProgressBar"):AddGadgetItem (31,-1,"ScrollArea")
AddGadgetItem (31,-1,"ScrollBar"):AddGadgetItem (31,-1,"Shortcut"):AddGadgetItem (31,-1,"Spin"):AddGadgetItem (31,-1,"String")
AddGadgetItem (31,-1,"Text"):AddGadgetItem (31,-1,"TrackBar"):AddGadgetItem (31,-1,"Tree"):AddGadgetItem (31,-1,"Web")
SetGadgetText(31,"Text");sélectionne
TextGadget(32,15,440,100,17,"Choix gadgets")
TextGadget(33,125,475,80,17,"ID Gadget")
TextGadget(34,125,505,80,17,"Nb lettre")
TextGadget(35,125,535,80,17,"Nb ligne")
DisableGadget(35,1)
StringGadget(36,200,473,130,20,"",#ES_CENTER);ID gad
SendMessage_(GadgetID(36),#EM_LIMITTEXT,16,0)
cadrestring(36):SetGadgetColor(36,#PB_Gadget_BackColor,$00FFFF)
StringGadget(37,200,503,130,20,"1",#PB_String_Numeric|#ES_CENTER);nb lettre
SendMessage_(GadgetID(37),#EM_LIMITTEXT,3,0)
cadrestring(37):SetGadgetColor(37,#PB_Gadget_BackColor,$00FFFF)
StringGadget(38,200,533,130,20,"1",#PB_String_Numeric|#ES_CENTER);nb lig
SendMessage_(GadgetID(38),#EM_LIMITTEXT,3,0)
cadrestring(38):SetGadgetColor(38,#PB_Gadget_BackColor,$00FFFF)
DisableGadget(38,1)
TextGadget(39,100,560,303,1,"");trait_H
SetGadgetColor(39,#PB_Gadget_BackColor,$A9A9A9)
TextGadget(40,15,570,80,17,"Largeur")
TextGadget(41,15,595,80,17,"Hauteur")
TextGadget(42,15,645,110,17,"Emplacement X:")
TextGadget(43,175,645,20,17,"Y:")
StringGadget(44,95,568,100,20,"",#PB_String_Numeric|#ES_CENTER|#PB_String_ReadOnly);larg
SendMessage_(GadgetID(44),#EM_LIMITTEXT,4,0)
cadrestring(44):SetGadgetColor(44,#PB_Gadget_BackColor,$00FF7F)
StringGadget(45,95,593,100,20,"",#PB_String_Numeric|#ES_CENTER|#PB_String_ReadOnly);haut
SendMessage_(GadgetID(45),#EM_LIMITTEXT,4,0)
cadrestring(45):SetGadgetColor(45,#PB_Gadget_BackColor,$00FF7F)
StringGadget(46,122,643,45,20,"0",#PB_String_Numeric|#ES_CENTER);X
SendMessage_(GadgetID(46),#EM_LIMITTEXT,4,0)
cadrestring(46):SetGadgetColor(46,#PB_Gadget_BackColor,$00FFFF)
StringGadget(47,195,643,45,20,"0",#PB_String_Numeric|#ES_CENTER);y
SendMessage_(GadgetID(47),#EM_LIMITTEXT,4,0)
cadrestring(47):SetGadgetColor(47,#PB_Gadget_BackColor,$00FFFF)
TextGadget(48,252,580,1,60,"");trait_V
SetGadgetColor(48,#PB_Gadget_BackColor,$A9A9A9)
TextGadget(49,323,625,90,17,"Transparence")
For zz = 32 To 49
EcriEtict(zz)
Next
MLD_Coche(50,345,473,85,20,"Maj/Minus",$0,1)
MLD_Coche(51,345,503,95,20,"Maj seulement",$0,0)
MLD_Coche(52,345,533,85,20,"Encadrement",$0,0)
MLD_Coche(53,15,620,90,20,"L - H manuel",$0,0)
MLD_Coche(54,263,570,150,20,"Utilise Place_Gadget ",$0,1)
MLD_Coche(55,263,600,150,20,"Ombre du Gadget ",$0,1)
TrackBarGadget(56,263,650,230,30,100,255)
SetGadgetState(56,140)
TextGadget(57,126,440,110,17,"Fenêtre en test X")
TextGadget(58,290,440,10,17,"Y")
TextGadget(59,360,440,10,17,"L")
TextGadget(60,430,440,10,17,"H")
StringGadget(61,240,438,40,20,"0",#PB_String_Numeric|#ES_CENTER);X
SendMessage_(GadgetID(61),#EM_LIMITTEXT,4,0)
cadrestring(61):SetGadgetColor(61,#PB_Gadget_BackColor,$00FFFF)
StringGadget(62,310,438,40,20,"0",#PB_String_Numeric|#ES_CENTER);Y
SendMessage_(GadgetID(62),#EM_LIMITTEXT,4,0)
cadrestring(62):SetGadgetColor(62,#PB_Gadget_BackColor,$00FFFF)
StringGadget(63,380,438,40,20,"0",#PB_String_Numeric|#ES_CENTER);L
SendMessage_(GadgetID(63),#EM_LIMITTEXT,4,0)
cadrestring(63):SetGadgetColor(63,#PB_Gadget_BackColor,$00FFFF)
StringGadget(64,450,438,40,20,"0",#PB_String_Numeric|#ES_CENTER);H
SendMessage_(GadgetID(64),#EM_LIMITTEXT,4,0)
cadrestring(64):SetGadgetColor(64,#PB_Gadget_BackColor,$00FFFF)
TextGadget(65,120,663,45,17,"0",#PB_Text_Center)
TextGadget(66,195,663,45,17,"0",#PB_Text_Center)
For ft = 57 To 66
EcriEtict(ft)
Next
FrameGadget(70,10,690,485,112,"Code Gadget")
EcriEtict(70)
EditorGadget (71,15,710,475,85,#PB_Editor_ReadOnly)
SetGadgetColor(71,#PB_Gadget_BackColor,$00FF7F):SetGadgetFont(71,FontID2)
FrameGadget(72,10,805,485,140,"Code pour le presse-papiers")
EcriEtict(72)
EditorGadget (73,15,825,475,85,#PB_Editor_ReadOnly)
SetGadgetColor(73,#PB_Gadget_BackColor,$BFDD35):SetGadgetFont(73,FontID2)
MLD_Coche(74,15,915,45,20,"Fonte",$CD0000,0)
MLD_Coche(75,100,915,50,20,"Gadget",$CD0000,1)
MLD_Coche(76,195,915,120,20,"Gadget + ref Fonte",$CD0000,0)
MLD_Coche(77,360,915,130,20,"Fonte + Gadget",$CD0000,0)
ButtonGadget(80,235,950,100,30,"Presse-papiers")
EcriEtict(80)
ButtonGadget(81,335,950,80,30,"Aide")
EcriEtict(81)
ButtonGadget(82,415,950,80,30,"Stop")
EcriEtict(82)
If Left(GetGadgetText(2),3) = "[TT"
Ft$ = Mid(GetGadgetText(2),7,Len(GetGadgetText(2)));Si TT enlève le type
Else
Ft$ = GetGadgetText(2)
EndIf
tp =Val(GetGadgetText(4))
style(Ft$,tp)
PG()
Repeat
GetCursorPos_(@CURSOR)
hWnd = WindowFromPoint_(CURSOR) ; get window handle under specified cursor pos (excluding hidden/disabled windows)
If hWnd = WindowID(1)
DestroyCursor_(cur0)
SetActiveWindow(1):dess(0,0)
EndIf
If hWnd = WindowID(101)
SetActiveWindow(101):cur0 = LoadCursor_(0, #IDC_CROSS):SetCursor_(cur0)
SetWindowsHookEx_(#WH_KEYBOARD_LL,@KeyboardHook(),GetModuleHandle_(0),0)
dess(WindowMouseX(101),WindowMouseY(101)):SetGadgetText(65,Str(WindowMouseX(101))):SetGadgetText(66,Str(WindowMouseY(101)-30))
EndIf
Event = WaitWindowEvent()
Select EventWindow()
Case 1 ;fenetre principale
If Event = #PB_Event_CloseWindow:DestroyCursor_(cur0): Break : EndIf
If GetWindowState(1) = #PB_Window_Minimize
HideWindow(101,1):dpw.b = 1
EndIf
If GetWindowState(1) = #PB_Window_Normal And dpw.b = 1
dpw.b = 0:HideWindow(101,0):Rgl()
EndIf
If Event = #PB_Event_Gadget
Select EventGadget()
Case 2;liste Police
If Left(GetGadgetText(2),3) = "[TT"
Ft$ = Mid(GetGadgetText(2),7,Len(GetGadgetText(2)));Si TT enlève le type
Else
Ft$ = GetGadgetText(2)
EndIf
style(Ft$,tp)
Case 4;liste taille
tp = Val(GetGadgetText(4))
style(Ft$,tp)
Case 10;coche gras
style(Ft$,tp)
Case 11;coche Italique
style(Ft$,tp)
Case 12;coche Souligné
style(Ft$,tp)
Case 13;coche Barré
style(Ft$,tp)
Case 14;coche Haute qualité
style(Ft$,tp)
Case 15;coul texte
If GetGadgetState(15) = 1
MLD_ActCoche(15,1):colorgadtxt()
Else
MLD_ActCoche(15,0):colorgadtxt()
EndIf
style(Ft$,tp)
Case 16;coul fond
If GetGadgetState(16) = 1
MLD_ActCoche(16,1):colorgadfond()
Else
MLD_ActCoche(16,0):colorgadfond()
EndIf
style(Ft$,tp)
Case 25;string num police
Select EventType()
Case #PB_EventType_Change
style(Ft$,tp)
EndSelect
Case 26;string IDfont
Select EventType()
Case #PB_EventType_Change
style(Ft$,tp)
EndSelect
Case 31;list gad
Gest_cmd()
style(Ft$,tp)
Case 36;ID gad
Select EventType()
Case #PB_EventType_Change
style(Ft$,tp)
EndSelect
Case 37;nb lettre
Select EventType()
Case #PB_EventType_Change
style(Ft$,tp):dess(X,Y)
EndSelect
Case 38 ;nb lig
Select EventType()
Case #PB_EventType_Change
style(Ft$,tp):dess(X,Y)
EndSelect
Case 44 ;Larg
Select EventType()
Case #PB_EventType_Change
SpecificGad(ValD(GetGadgetText(44)),Val(GetGadgetText(45)))
GestionCaret(44)
EndSelect
Case 45 ;Haut
Select EventType()
Case #PB_EventType_Change
SpecificGad(ValD(GetGadgetText(44)),Val(GetGadgetText(45)))
GestionCaret(45)
EndSelect
Case 46 ;X
Select EventType()
Case #PB_EventType_Change
style(Ft$,tp)
EndSelect
Case 47 ;Y
Select EventType()
Case #PB_EventType_Change
style(Ft$,tp)
EndSelect
Case 50;Coche Maj/minus
MLD_ActCoche(50,1)
rzPG()
MLD_ActCoche(51,0)
style(Ft$,tp)
Case 51;Coche Maj
MLD_ActCoche(51,1)
MLD_ActCoche(50,0)
style(Ft$,tp)
Case 52 ;coche encadrement
If GetGadgetState(52) = 1
MLD_ActCoche(52,1):Dpencadr.b =1
Else
MLD_ActCoche(52,0):Dpencadr.b = 0
EndIf
style(Ft$,tp)
Case 53
If GetGadgetState(53) = 1
MLD_ActCoche(53,1)
SendMessage_(GadgetID(44),#EM_SETREADONLY,0,0):SendMessage_(GadgetID(45),#EM_SETREADONLY,0,0)
SetGadgetColor(44,#PB_Gadget_BackColor,$00FFFF):SetGadgetColor(45,#PB_Gadget_BackColor,$00FFFF)
Else
MLD_ActCoche(53,0)
SendMessage_(GadgetID(44),#EM_SETREADONLY,1,0):SendMessage_(GadgetID(45),#EM_SETREADONLY,1,0)
SetGadgetColor(44,#PB_Gadget_BackColor,$00FF7F):SetGadgetColor(45,#PB_Gadget_BackColor,$00FF7F)
EndIf
Case 54;regle
If GetGadgetState(54) = 1
MLD_ActCoche(54,1)
HideWindow(101,0):SetActiveWindow(101):Rgl()
Else
HideWindow(101,1)
MLD_ActCoche(54,0)
EndIf
Case 55;ombre
If GetGadgetState(55) = 1
MLD_ActCoche(55 ,1)
Else
MLD_ActCoche(55 ,0)
EndIf
Case 56;trackbar
SetLayeredWindowAttributes_(WindowID(101), 0, GetGadgetState(56), #LWA_ALPHA)
Case 61 ;rzPG X
rzPG()
Case 62 ;rzPG Y
rzPG()
Case 63 ;rzPG L
rzPG()
Case 64 ;rzPG H
rzPG()
Case 74 ;PP_fonte
If GetGadgetState(74) = 1
gest_cochePP(74):visuPP()
EndIf
Case 75 ;PP_Gad
If GetGadgetState(75) = 1
gest_cochePP(75):visuPP()
EndIf
Case 76 ;PP_Gad +ref fonte
If GetGadgetState(76) = 1
gest_cochePP(76):visuPP()
EndIf
Case 77 ;PP_Gad + font
If GetGadgetState(77) = 1
gest_cochePP(77):visuPP()
EndIf
Case 80
PP()
Case 81;bt aide
MessageRequester("Logiciel AUTOGAD",LT$,#PB_MessageRequester_Ok | #PB_MessageRequester_Info)
Case 82;bt stop
Break
EndSelect
EndIf
Case 101;fenetre pg
If Event = #WM_RBUTTONDOWN
SetGadgetText(46,Str(WindowMouseX(101))):SetGadgetText(47,Str((WindowMouseY(101)-30))) ;inscrit coordonnées souris
style(Ft$,tp)
EndIf
If Event = #WM_LBUTTONDOWN
SendMessage_(WindowID(101), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
EndIf
If Event = #PB_Event_SizeWindow;#WM_SIZE
InvalidateRect_(WindowID(101), 0, 1)
Rgl()
EndIf
EndSelect
ForEver
End