J'avais commencer le développement d'un éditeur html que je ne terminerais pas. Voici la source si ca peut aider quelqu'un.
Code : Tout sélectionner
;Required Image Decoders
UsePNGImageDecoder()
;- Global Variables and Constants
Global BubbleTipStyle.l:BubbleTipStyle=0
;- Window Constants
Enumeration 1
#Window_Form1
#Window_Form2
#Window_Form3
#Window_Editeur
#Window_FTP
#Window_Outils
#Window_CodeCouleur
EndEnumeration
#WindowIndex=#PB_Compiler_EnumerationValue
;- Gadget Constants
Enumeration 1
;Window_Form1
#MenuBar_Form1_Fichier
#MenuBar_Form1_Nouveau
#MenuBar_Form1_Ouvrir
#MenuBar_Form1_Enregistrer
#MenuBar_Form1_EnregistrerSous
#MenuBar_Form1_Quitter
#MenuBar_Form1_Edition
#MenuBar_Form1_Annuler
#MenuBar_Form1_Couper
#MenuBar_Form1_Copier
#MenuBar_Form1_Coller
#MenuBar_Form1_Outils
#MenuBar_Form1_Editeur
#MenuBar_Form1_Boiteoutils
#MenuBar_Form1_ClientFTP
#MenuBar_Form1_Position
#MenuBar_Form1_Apercu
#MenuBar_Form1_RubriqueAide
#MenuBar_Form1_Aide
#MenuBar_Form1_MAJ
#MenuBar_Form1_SiteWeb
#MenuBar_Form1_Apropos
;Window_Form2
#Gadget_Form2_Web4
#Gadget_Form2_Button5
;Window_Form3
#Gadget_Form3_Image7
#Gadget_Form3_Text8
#Gadget_Form3_Text9
#Gadget_Form3_Text10
#Gadget_Form3_Text11
#Gadget_Form3_Text12
#Gadget_Form3_HyperLink13
#Gadget_Form3_Button14
;Window_Editeur
#Gadget_Editeur_Editeur
#popup_0
#Menup1
#Menup2
#Menup3
#Menup4
;Window_FTP
#Gadget_FTP_Text19
#Gadget_FTP_Text20
#Gadget_FTP_StringAdresse
#Gadget_FTP_Text22
#Gadget_FTP_StringUtilisateur
#Gadget_FTP_StringPassword
#Gadget_FTP_Text26
#Gadget_FTP_Text19_27
#Gadget_FTP_Text28
#Gadget_FTP_StringFichierLocal
#Gadget_FTP_ButtonFTPParcourir
#Gadget_FTP_Text19_31
#Gadget_FTP_ProgressBar32
#Gadget_FTP_ButtonFTPEnvoyer
#Gadget_FTP_ButtonFTPFermer
;Window_Outils
#Gadget_Outils_BouttonTexteCentrer
#Gadget_Outils_ButtonOtilsFermer
#Gadget_Outils_ButtonTexteDroite
#Gadget_Outils_ButtonTexteMajuscule
#Gadget_Outils_ButtonTexteSouligner
#Gadget_Outils_BouttonTexteGauche
#Gadget_Outils_ButtonTexteH1
#Gadget_Outils_ButtonTexteH2
#Gadget_Outils_ButtonTexteH3
#Gadget_Outils_ButtonTexteH4
#Gadget_Outils_ButtonTexteH5
#Gadget_Outils_ButtonTexteH6
#Gadget_Outils_ButtonLienPage
#Gadget_Outils_ButtonLienImage
#Gadget_Outils_ButtonImage
#Gadget_Outils_ButtonSon
#Gadget_Outils_ButtonVideo
#Gadget_Outils_ButtonEmail
#Gadget_Outils_ButtonFormulaire
#Gadget_Outils_ButtonFrame
#Gadget_Outils_ButtonTexteItalique
;Window_CodeCouleur
#Gadget_CodeCouleur_ListIcon58
EndEnumeration
#GadgetIndex=#PB_Compiler_EnumerationValue
;- MenuBar Constants
Enumeration 1
#MenuBar_Form1
EndEnumeration
#MenuBarIndex=#PB_Compiler_EnumerationValue
;- StatusBar Constants
Enumeration 1
#StatusBar_Form1
EndEnumeration
#StatusBarIndex=#PB_Compiler_EnumerationValue
#StatusBar_Form1_Version =0
#StatusBar_Form1_Position =1
#StatusBar_Form1_Chargement =2
#StatusBar_Form1_Fichier =3
;- Image Constants
Enumeration 1
#Image_Form1
#MenuBarIcon_Form1_Nouveau
#MenuBarIcon_Form1_Ouvrir
#MenuBarIcon_Form1_Enregistrer
#MenuBarIcon_Form1_EnregistrerSous
#MenuBarIcon_Form1_Quitter
#MenuBarIcon_Form1_Annuler
#MenuBarIcon_Form1_Couper
#MenuBarIcon_Form1_Copier
#MenuBarIcon_Form1_Coller
#MenuBarIcon_Form1_Editeur
#MenuBarIcon_Form1_Boiteoutils
#MenuBarIcon_Form1_ClientFTP
#MenuBarIcon_Form1_Apercu
#MenuBarIcon_Form1_Aide
#MenuBarIcon_Form1_MAJ
#MenuBarIcon_Form1_SiteWeb
#MenuBarIcon_Form1_Apropos
#ProgressBar_0
#Image_Form3_Image7
#Web
#WebGadget_Couleur
#Image_Outils_BouttonTexteCentrer
#Image_Outils_ButtonTexteDroite
#Image_Outils_ButtonTexteMajuscule
#Image_Outils_ButtonTexteSouligner
#Image_Outils_BouttonTexteGauche
#Image_Outils_ButtonTexteH1
#Image_Outils_ButtonTexteH2
#Image_Outils_ButtonTexteH3
#Image_Outils_ButtonTexteH4
#Image_Outils_ButtonTexteH5
#Image_Outils_ButtonTexteH6
#Image_Outils_ButtonLienPage
#Image_Outils_ButtonLienImage
#Image_Outils_ButtonImage
#Image_Outils_ButtonSon
#Image_Outils_ButtonVideo
#Image_Outils_ButtonEmail
#Image_Outils_ButtonFormulaire
#Image_Outils_ButtonFrame
#Image_Outils_ButtonTexteItalique
EndEnumeration
#ImageIndex=#PB_Compiler_EnumerationValue
;- Load Images
CatchImage(#Image_Form1,?_OPT_Form1)
CatchImage(#MenuBarIcon_Form1_Nouveau,?_OPT_MBI_Nouveau)
CatchImage(#MenuBarIcon_Form1_Ouvrir,?_OPT_MBI_Ouvrir)
CatchImage(#MenuBarIcon_Form1_Enregistrer,?_OPT_MBI_Enregistrer)
CatchImage(#MenuBarIcon_Form1_EnregistrerSous,?_OPT_MBI_EnregistrerSous)
CatchImage(#MenuBarIcon_Form1_Quitter,?_OPT_MBI_Quitter)
CatchImage(#MenuBarIcon_Form1_Annuler,?_OPT_MBI_Annuler)
CatchImage(#MenuBarIcon_Form1_Couper,?_OPT_MBI_Couper)
CatchImage(#MenuBarIcon_Form1_Copier,?_OPT_MBI_Copier)
CatchImage(#MenuBarIcon_Form1_Coller,?_OPT_MBI_Coller)
CatchImage(#MenuBarIcon_Form1_Editeur,?_OPT_MBI_Editeur)
CatchImage(#MenuBarIcon_Form1_Boiteoutils,?_OPT_MBI_Boiteoutils)
CatchImage(#MenuBarIcon_Form1_ClientFTP,?_OPT_MBI_ClientFTP)
CatchImage(#MenuBarIcon_Form1_Apercu,?_OPT_MBI_Apercu)
CatchImage(#MenuBarIcon_Form1_Aide,?_OPT_MBI_Aide)
CatchImage(#MenuBarIcon_Form1_MAJ,?_OPT_MBI_MAJ)
CatchImage(#MenuBarIcon_Form1_SiteWeb,?_OPT_MBI_SiteWeb)
CatchImage(#MenuBarIcon_Form1_Apropos,?_OPT_MBI_Apropos)
CatchImage(#Image_Form3_Image7,?_OPT_Form1)
CatchImage(#Image_Outils_BouttonTexteCentrer,?_OPT_Outils_BouttonTexteCentrer)
CatchImage(#Image_Outils_ButtonTexteDroite,?_OPT_Outils_ButtonTexteDroite)
CatchImage(#Image_Outils_ButtonTexteMajuscule,?_OPT_Outils_ButtonTexteMajuscule)
CatchImage(#Image_Outils_ButtonTexteSouligner,?_OPT_Outils_ButtonTexteSouligner)
CatchImage(#Image_Outils_BouttonTexteGauche,?_OPT_Outils_BouttonTexteGauche)
CatchImage(#Image_Outils_ButtonTexteH1,?_OPT_Outils_ButtonTexteH1)
CatchImage(#Image_Outils_ButtonTexteH2,?_OPT_Outils_ButtonTexteH2)
CatchImage(#Image_Outils_ButtonTexteH3,?_OPT_Outils_ButtonTexteH3)
CatchImage(#Image_Outils_ButtonTexteH4,?_OPT_Outils_ButtonTexteH4)
CatchImage(#Image_Outils_ButtonTexteH5,?_OPT_Outils_ButtonTexteH5)
CatchImage(#Image_Outils_ButtonTexteH6,?_OPT_Outils_ButtonTexteH6)
CatchImage(#Image_Outils_ButtonLienPage,?_OPT_Outils_ButtonLienPage)
CatchImage(#Image_Outils_ButtonLienImage,?_OPT_Outils_ButtonLienImage)
CatchImage(#Image_Outils_ButtonImage,?_OPT_Outils_ButtonImage)
CatchImage(#Image_Outils_ButtonSon,?_OPT_Outils_ButtonSon)
CatchImage(#Image_Outils_ButtonVideo,?_OPT_Outils_ButtonVideo)
CatchImage(#Image_Outils_ButtonEmail,?_OPT_Outils_ButtonEmail)
CatchImage(#Image_Outils_ButtonFormulaire,?_OPT_Outils_ButtonFormulaire)
CatchImage(#Image_Outils_ButtonFrame,?_OPT_Outils_ButtonFrame)
CatchImage(#Image_Outils_ButtonTexteItalique,?_OPT_Outils_ButtonTexteItalique)
DataSection
_OPT_Form1:IncludeBinary "Images\Logo.bmp"
_OPT_MBI_Nouveau:IncludeBinary "Images\page.ico"
_OPT_MBI_Ouvrir:IncludeBinary "Images\folder_page.ico"
_OPT_MBI_Enregistrer:IncludeBinary "Images\disk.ico"
_OPT_MBI_EnregistrerSous:IncludeBinary "Images\disk_multiple.ico"
_OPT_MBI_Quitter:IncludeBinary "Images\door_in.ico"
_OPT_MBI_Annuler:IncludeBinary "Images\cancel.ico"
_OPT_MBI_Couper:IncludeBinary "Images\cut.ico"
_OPT_MBI_Copier:IncludeBinary "Images\page_copy.ico"
_OPT_MBI_Coller:IncludeBinary "Images\page_white_paste.ico"
_OPT_MBI_Editeur:IncludeBinary "Images\application_view_columns.ico"
_OPT_MBI_Boiteoutils:IncludeBinary "Images\bullet_wrench.ico"
_OPT_MBI_ClientFTP:IncludeBinary "Images\server_connect.ico"
_OPT_MBI_Apercu:IncludeBinary "Images\world.ico"
_OPT_MBI_Aide:IncludeBinary "Images\help.ico"
_OPT_MBI_MAJ:IncludeBinary "Images\server.ico"
_OPT_MBI_SiteWeb:IncludeBinary "Images\house.ico"
_OPT_MBI_Apropos:IncludeBinary "Images\information.ico"
_OPT_Outils_BouttonTexteCentrer:IncludeBinary "Images\text_align_center.png"
_OPT_Outils_ButtonTexteDroite:IncludeBinary "Images\text_align_right.png"
_OPT_Outils_ButtonTexteMajuscule:IncludeBinary "Images\text_bold.png"
_OPT_Outils_ButtonTexteSouligner:IncludeBinary "Images\text_underline.png"
_OPT_Outils_BouttonTexteGauche:IncludeBinary "Images\text_align_left.png"
_OPT_Outils_ButtonTexteH1:IncludeBinary "Images\text_heading_1.png"
_OPT_Outils_ButtonTexteH2:IncludeBinary "Images\text_heading_2.png"
_OPT_Outils_ButtonTexteH3:IncludeBinary "Images\text_heading_3.png"
_OPT_Outils_ButtonTexteH4:IncludeBinary "Images\text_heading_4.png"
_OPT_Outils_ButtonTexteH5:IncludeBinary "Images\text_heading_5.png"
_OPT_Outils_ButtonTexteH6:IncludeBinary "Images\text_heading_6.png"
_OPT_Outils_ButtonLienPage:IncludeBinary "Images\page_white_link.png"
_OPT_Outils_ButtonLienImage:IncludeBinary "Images\photo_link.png"
_OPT_Outils_ButtonImage:IncludeBinary "Images\photo.png"
_OPT_Outils_ButtonSon:IncludeBinary "Images\sound.png"
_OPT_Outils_ButtonVideo:IncludeBinary "Images\video.png"
_OPT_Outils_ButtonEmail:IncludeBinary "Images\email.png"
_OPT_Outils_ButtonFormulaire:IncludeBinary "Images\textfield.png"
_OPT_Outils_ButtonFrame:IncludeBinary "Images\frame.png"
_OPT_Outils_ButtonTexteItalique:IncludeBinary "Images\text_italic.png"
EndDataSection
;Procedure Ouverture d'un Fichier.
Procedure OFile(file.s)
HideGadget(#Gadget_Editeur_Editeur, 0)
d=ReadFile(1, file)
If d
While Eof(1)=0
Text$ = Text$+ReadString(1)+Chr(13)+ Chr(10)
Wend
CloseFile(1)
SetGadgetText(#Gadget_Editeur_Editeur, Text$)
SetGadgetColor(#Gadget_Editeur_Editeur, #PB_Gadget_BackColor, RGB($FF,$FF,$FF))
; ici ça colore pendant le chargement du fichier :D
If CreateGadgetList(StatusBarID(#StatusBar_Form1))
ProgressBarGadget(#ProgressBar_0, 252,6 , 90, 12, 0, CountGadgetItems(#Gadget_Editeur_Editeur)-1)
EndIf
HideGadget(#Gadget_Editeur_Editeur, 0)
For lili=0 To CountGadgetItems(#Gadget_Editeur_Editeur)-1
SetGadgetState(#ProgressBar_0, lili)
chaine$=""
chaine$=GetGadgetItemText(#Gadget_Editeur_Editeur, lili, 0) ; recupere chaque ligne de text
SetGadgetItemText(#Gadget_Editeur_Editeur, lili, chaine$, 0)
Next lili
HideGadget(#Gadget_Editeur_Editeur, 0)
HideGadget(#ProgressBar_0, 1)
Else
EndIf
EndProcedure
;Procedure Enregistrer un Fichier.
Procedure SFile(file.s)
If file
If FindString(file.s,".",1)
Else
file.s =file.s + ".html"
EndIf
If CreateFile(0, file.s )
file$ = GetGadgetText(#Gadget_Editeur_Editeur)
WriteData(0, @file$, Len(file$))
CloseFile(0)
Else
MessageRequester("Erreur","Ne peut créer le fichier "+file+"!")
EndIf
EndIf
EndProcedure
;Procedure Enregistrer un Fichier sous...
Procedure SFilehtml(file.s)
If file
If CreateFile(0, file)
file$ = GetGadgetText(#Gadget_Editeur_Editeur)
WriteData(0, @file$, Len(file$))
CloseFile(0)
Else
MessageRequester("Erreur","Ne peut créer le fichier "+file+"!")
EndIf
EndIf
EndProcedure
Procedure Position()
PosGEditeur = WindowX(#Window_Editeur)
PosHEditeur = WindowY(#Window_Editeur)
PosGOutils = WindowX(#Window_Outils)
PosHOutils = WindowY(#Window_Outils)
PosGCouleur = WindowX(#Window_CodeCouleur)
PosHCouleur = WindowY(#Window_CodeCouleur)
PosGFTP = WindowX(#Window_FTP)
PosHFTP = WindowY(#Window_FTP)
If CreatePreferences("Position.ini")
PreferenceGroup("POSITIONS")
WritePreferenceLong("PosGEditeur", PosGEditeur)
WritePreferenceLong("PosHEditeur", PosHEditeur)
WritePreferenceLong("PosGOutils", PosGOutils)
WritePreferenceLong("PosHOutils", PosHOutils)
WritePreferenceLong("PosGCouleur", PosGCouleur)
WritePreferenceLong("PosHCouleur", PosHCouleur)
WritePreferenceLong("PosGFTP", PosGFTP)
WritePreferenceLong("PosHFTP", PosHFTP)
ClosePreferences()
MessageRequester("Information.", "La position des fenêtres à bien été enregistrées.", #PB_MessageRequester_Ok)
EndIf
EndProcedure
Procedure ChargementPosition()
If OpenPreferences("Position.ini")
PreferenceGroup("POSITIONS")
PosGEditeur1$ = ReadPreferenceString("PosGEditeur","")
PosHEditeur1$ = ReadPreferenceString("PosHEditeur","")
PosGEditeur1L = Val(PosGEditeur1$)
PosHEditeur1L = Val(PosHEditeur1$)
ResizeWindow(#Window_Editeur, PosGEditeur1L, PosHEditeur1L, #PB_Ignore, #PB_Ignore)
PosGOutils1$ = ReadPreferenceString("PosGOutils","")
PosHOutils1$ = ReadPreferenceString("PosHOutils","")
PosGOutils1L = Val(PosGOutils1$)
PosHOutils1L = Val(PosHOutils1$)
ResizeWindow(#Window_Outils, PosGOutils1L, PosHOutils1L, #PB_Ignore, #PB_Ignore)
PosGCouleur1$ = ReadPreferenceString("PosGCouleur","")
PosHCouleur1$ = ReadPreferenceString("PosHCouleur","")
PosGCouleur1L = Val(PosGCouleur1$)
PosHCouleur1L = Val(PosHCouleur1$)
ResizeWindow(#Window_CodeCouleur, PosGCouleur1L, PosHCouleur1L, #PB_Ignore, #PB_Ignore)
PosGFTP1$ = ReadPreferenceString("PosGFTP","")
PosHFTP1$ = ReadPreferenceString("PosHFTP","")
PosGFTP1L = Val(PosGFTP1$)
PosHFTP1L = Val(PosHFTP1$)
ResizeWindow(#Window_FTP, PosGFTP1L , PosHFTP1L, #PB_Ignore, #PB_Ignore)
EndIf
EndProcedure
Procedure.l Window_Form1()
If OpenWindow(#Window_Form1,126,112,852,490,"SourceWebEditor.",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered|#PB_Window_Maximize|#PB_Window_Invisible)
Brush.LOGBRUSH\lbStyle=#BS_PATTERN
Brush\lbColor=#DIB_RGB_COLORS
Brush\lbHatch=ImageID(#Image_Form1)
SetClassLong_(WindowID(#Window_Form1),#GCL_HBRBACKGROUND,CreateBrushIndirect_(Brush))
CreateMenu(#MenuBar_Form1,WindowID(#Window_Form1))
MenuTitle("Fichier")
MenuItem(#MenuBar_Form1_Nouveau,"Nouveau")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Nouveau,"Nouveau",#MenuBarIcon_Form1_Nouveau)
MenuBar()
MenuItem(#MenuBar_Form1_Ouvrir,"Ouvrir")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Ouvrir,"Ouvrir",#MenuBarIcon_Form1_Ouvrir)
MenuBar()
MenuItem(#MenuBar_Form1_Enregistrer,"Enregistrer")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Enregistrer,"Enregistrer",#MenuBarIcon_Form1_Enregistrer)
MenuItem(#MenuBar_Form1_EnregistrerSous,"Enregistrer sous...")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_EnregistrerSous,"Enregistrer sous...",#MenuBarIcon_Form1_EnregistrerSous)
MenuBar()
MenuItem(#MenuBar_Form1_Quitter,"Quitter")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Quitter,"Quitter",#MenuBarIcon_Form1_Quitter)
MenuTitle("Edition")
MenuItem(#MenuBar_Form1_Annuler,"Annuler")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Annuler,"Annuler",#MenuBarIcon_Form1_Annuler)
MenuBar()
MenuItem(#MenuBar_Form1_Couper,"Couper")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Couper,"Couper",#MenuBarIcon_Form1_Couper)
MenuItem(#MenuBar_Form1_Copier,"Copier")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Copier,"Copier",#MenuBarIcon_Form1_Copier)
MenuBar()
MenuItem(#MenuBar_Form1_Coller,"Coller")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Coller,"Coller",#MenuBarIcon_Form1_Coller)
MenuTitle("Outils")
MenuItem(#MenuBar_Form1_Boiteoutils,"Boite d'outils")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Boiteoutils,"Boite d'outils",#MenuBarIcon_Form1_Boiteoutils)
MenuItem(#MenuBar_Form1_ClientFTP,"Client FTP")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_ClientFTP,"Client FTP",#MenuBarIcon_Form1_ClientFTP)
MenuBar()
MenuItem(#MenuBar_Form1_Position,"Enregistrer la position des fenêtres")
MenuBar()
MenuItem(#MenuBar_Form1_Apercu,"Aperçu dans navigateur")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Apercu,"Aperçu dans navigateur",#MenuBarIcon_Form1_Apercu)
MenuTitle("?")
MenuItem(#MenuBar_Form1_Aide,"Aide")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Aide,"Aide",#MenuBarIcon_Form1_Aide)
MenuBar()
MenuItem(#MenuBar_Form1_MAJ,"Mise à jour")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_MAJ,"Mise à jour",#MenuBarIcon_Form1_MAJ)
MenuBar()
MenuItem(#MenuBar_Form1_SiteWeb,"Site internet SourceWebEditor")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_SiteWeb,"Site internet SourceWebEditor",#MenuBarIcon_Form1_SiteWeb)
MenuBar()
MenuItem(#MenuBar_Form1_Apropos,"A propos de SourceWebEditor")
PVDynamic_AddMenuBarIcon(#Window_Form1,#MenuBar_Form1_Apropos,"A propos de SourceWebEditor",#MenuBarIcon_Form1_Apropos)
PVDynamic_DisplayMenuBarIcon()
If CreateGadgetList(WindowID(#Window_Form1))
CreateStatusBar(#StatusBar_Form1,WindowID(#Window_Form1))
AddStatusBarField(100)
StatusBarText(#StatusBar_Form1, 0, "Version 2.0.1", #PB_StatusBar_Center)
AddStatusBarField(150)
AddStatusBarField(100)
AddStatusBarField(1500)
StatusBarText(#StatusBar_Form1,3," Aucun Fichier HTML chargé:")
PVDynamic_AddLockWindow(#Window_Form1,#StatusBar_Form1,1,3)
HideWindow(#Window_Form1,0)
ProcedureReturn WindowID(#Window_Form1)
EndIf
EndIf
EndProcedure
Procedure.l Window_Form2()
If OpenWindow(#Window_Form2,435,269,400,300,"Mise à jour.",#PB_Window_ScreenCentered|#PB_Window_WindowCentered|#PB_Window_Invisible,WindowID(#Window_Form1))
If CreateGadgetList(WindowID(#Window_Form2))
WebGadget(#Gadget_Form2_Web4,5,5,390,265,"")
ButtonGadget(#Gadget_Form2_Button5,335,275,60,20,"Fermer")
HideWindow(#Window_Form2,0)
ProcedureReturn WindowID(#Window_Form2)
EndIf
EndIf
EndProcedure
Procedure.l Window_Form3()
If OpenWindow(#Window_Form3,403,229,425,199,"A propos de SourceWebEditor.",#PB_Window_ScreenCentered|#PB_Window_WindowCentered|#PB_Window_Invisible,WindowID(#Window_Form1))
If CreateGadgetList(WindowID(#Window_Form3))
ImageGadget(#Gadget_Form3_Image7,0,0,147,132,ImageID(#Image_Form3_Image7))
TextGadget(#Gadget_Form3_Text8,0,130,146,15,"Version 2.0.1",#PB_Text_Center)
TextGadget(#Gadget_Form3_Text9,145,0,280,55,"SourceWebEditor est un éditeur HTML gratuit, il ne peut être vendu ou utilisé à des fins commercial. Toute reproduction parcièlle ou complète de ce logiciel est strictement interdit.",#PB_Text_Center)
SetGadgetColor(#Gadget_Form3_Text9,#PB_Gadget_BackColor,8421376)
SetGadgetColor(#Gadget_Form3_Text9,#PB_Gadget_FrontColor,16777215)
TextGadget(#Gadget_Form3_Text10,145,55,280,45,"Tous les codes html ou site internet produits avec SourceWebEditor sont libre de droits, il peuvent être utiliser dans un but personnel ou commercial.",#PB_Text_Center)
SetGadgetColor(#Gadget_Form3_Text10,#PB_Gadget_BackColor,8421376)
SetGadgetColor(#Gadget_Form3_Text10,#PB_Gadget_FrontColor,16777215)
TextGadget(#Gadget_Form3_Text11,145,100,280,30,"(Voir la licence d'utilisation qui ce trouve dans le fichier d'aide.)",#PB_Text_Center)
SetGadgetColor(#Gadget_Form3_Text11,#PB_Gadget_BackColor,8421376)
SetGadgetColor(#Gadget_Form3_Text11,#PB_Gadget_FrontColor,16777215)
TextGadget(#Gadget_Form3_Text12,5,155,250,15,"(c) 2008 - InfoProject Software By MetalOS")
PVDynamic_AddColorGadget(#Gadget_Form3_Text12,16711680,-1)
HyperLinkGadget(#Gadget_Form3_HyperLink13,5,175,190,15,"http://infoprojectsoftware.free.fr",255)
SetGadgetFont(#Gadget_Form3_HyperLink13,LoadFont(#Gadget_Form3_HyperLink13,"Georgia",8,0))
ButtonGadget(#Gadget_Form3_Button14,355,175,60,20,"Ok")
HideWindow(#Window_Form3,0)
ProcedureReturn WindowID(#Window_Form3)
EndIf
EndIf
EndProcedure
Procedure.l Window_Editeur()
If OpenWindow(#Window_Editeur,91,131,658,477,"Editeur.",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_Invisible,WindowID(#Window_Form1))
If CreateGadgetList(WindowID(#Window_Editeur))
EditorGadget(#Gadget_Editeur_Editeur,0,0,658,477)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_SETBKGNDCOLOR,0,16777215)
;Editor_LN_Start(#Gadget_Editeur_Editeur)
If CreatePopupMenu(#popup_0)
MenuItem(#Menup1, "Annuler")
MenuBar()
MenuItem(#Menup2, "Couper")
MenuItem(#Menup3, "Copier")
MenuItem(#Menup4, "Coller")
EndIf
HideWindow(#Window_Editeur,0)
ProcedureReturn WindowID(#Window_Editeur)
EndIf
EndIf
EndProcedure
Procedure.l Window_FTP()
If OpenWindow(#Window_FTP,799,408,286,243,"Client FTP.",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_Invisible,WindowID(#Window_Form1))
If CreateGadgetList(WindowID(#Window_FTP))
TextGadget(#Gadget_FTP_Text19,3,161,119,17,"Statut de l'envoie :")
SetGadgetFont(#Gadget_FTP_Text19,LoadFont(#Gadget_FTP_Text19,"@Arial Unicode MS",8,256))
TextGadget(#Gadget_FTP_Text20,8,28,54,15,"Adresse :",#PB_Text_Center)
StringGadget(#Gadget_FTP_StringAdresse,92,27,188,19,"")
SetGadgetColor(#Gadget_FTP_StringAdresse,#PB_Gadget_BackColor,12320767)
TextGadget(#Gadget_FTP_Text22,9,52,57,16,"Utilisateur :",#PB_Text_Center)
StringGadget(#Gadget_FTP_StringUtilisateur,92,51,188,19,"")
SetGadgetColor(#Gadget_FTP_StringUtilisateur,#PB_Gadget_BackColor,12320767)
StringGadget(#Gadget_FTP_StringPassword,92,76,188,19,"",#PB_String_Password)
SetGadgetColor(#Gadget_FTP_StringPassword,#PB_Gadget_BackColor,12320767)
TextGadget(#Gadget_FTP_Text26,8,78,78,16,"Mot de passe :",#PB_Text_Center)
TextGadget(#Gadget_FTP_Text19_27,3,6,257,17,"Informations fournies par votre hébergeur :")
SetGadgetFont(#Gadget_FTP_Text19_27,LoadFont(#Gadget_FTP_Text19_27,"@Arial Unicode MS",8,256))
TextGadget(#Gadget_FTP_Text28,8,123,75,16,"Fichiers local :",#PB_Text_Center)
StringGadget(#Gadget_FTP_StringFichierLocal,91,122,187,18,"")
ButtonGadget(#Gadget_FTP_ButtonFTPParcourir,247,144,30,17,"...")
GadgetToolTip(#Gadget_FTP_ButtonFTPParcourir,"Parcourir.")
TextGadget(#Gadget_FTP_Text19_31,3,101,257,17,"Site web que vous désirez mettre en ligne :")
SetGadgetFont(#Gadget_FTP_Text19_31,LoadFont(#Gadget_FTP_Text19_31,"@Arial Unicode MS",8,256))
ProgressBarGadget(#Gadget_FTP_ProgressBar32,3,184,280,14,0,100)
ButtonGadget(#Gadget_FTP_ButtonFTPEnvoyer,155,215,60,20,"Envoyer")
ButtonGadget(#Gadget_FTP_ButtonFTPFermer,218,215,60,20,"Fermer")
HideWindow(#Window_FTP,0)
ProcedureReturn WindowID(#Window_FTP)
EndIf
EndIf
EndProcedure
Procedure.l Window_Outils()
If OpenWindow(#Window_Outils,914,169,171,104,"Outils",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_Invisible,WindowID(#Window_Form1))
If CreateGadgetList(WindowID(#Window_Outils))
ButtonImageGadget(#Gadget_Outils_BouttonTexteCentrer,28,0,28,25,ImageID(#Image_Outils_BouttonTexteCentrer))
GadgetToolTip(#Gadget_Outils_BouttonTexteCentrer,"Texte centré.")
ButtonGadget(#Gadget_Outils_ButtonOtilsFermer,65,79,98,19,"Fermer")
ButtonImageGadget(#Gadget_Outils_ButtonTexteDroite,56,0,28,25,ImageID(#Image_Outils_ButtonTexteDroite))
GadgetToolTip(#Gadget_Outils_ButtonTexteDroite,"Texte à droite.")
ButtonImageGadget(#Gadget_Outils_ButtonTexteMajuscule,84,0,28,25,ImageID(#Image_Outils_ButtonTexteMajuscule))
GadgetToolTip(#Gadget_Outils_ButtonTexteMajuscule,"Texte gras.")
ButtonImageGadget(#Gadget_Outils_ButtonTexteSouligner,140,0,28,25,ImageID(#Image_Outils_ButtonTexteSouligner))
GadgetToolTip(#Gadget_Outils_ButtonTexteSouligner,"Texte souligné.")
ButtonImageGadget(#Gadget_Outils_BouttonTexteGauche,0,0,28,25,ImageID(#Image_Outils_BouttonTexteGauche))
GadgetToolTip(#Gadget_Outils_BouttonTexteGauche,"Texte à gauche.")
ButtonImageGadget(#Gadget_Outils_ButtonTexteH1,0,26,28,25,ImageID(#Image_Outils_ButtonTexteH1))
GadgetToolTip(#Gadget_Outils_ButtonTexteH1,"H1")
ButtonImageGadget(#Gadget_Outils_ButtonTexteH2,28,26,28,25,ImageID(#Image_Outils_ButtonTexteH2))
GadgetToolTip(#Gadget_Outils_ButtonTexteH2,"H2")
ButtonImageGadget(#Gadget_Outils_ButtonTexteH3,56,26,28,25,ImageID(#Image_Outils_ButtonTexteH3))
GadgetToolTip(#Gadget_Outils_ButtonTexteH3,"H3")
ButtonImageGadget(#Gadget_Outils_ButtonTexteH4,84,26,28,25,ImageID(#Image_Outils_ButtonTexteH4))
GadgetToolTip(#Gadget_Outils_ButtonTexteH4,"H4")
ButtonImageGadget(#Gadget_Outils_ButtonTexteH5,112,26,28,25,ImageID(#Image_Outils_ButtonTexteH5))
GadgetToolTip(#Gadget_Outils_ButtonTexteH5,"H5")
ButtonImageGadget(#Gadget_Outils_ButtonTexteH6,141,26,28,25,ImageID(#Image_Outils_ButtonTexteH6))
GadgetToolTip(#Gadget_Outils_ButtonTexteH6,"H6")
ButtonImageGadget(#Gadget_Outils_ButtonLienPage,0,51,28,25,ImageID(#Image_Outils_ButtonLienPage))
GadgetToolTip(#Gadget_Outils_ButtonLienPage,"Lien vers une page.")
ButtonImageGadget(#Gadget_Outils_ButtonLienImage,28,51,28,25,ImageID(#Image_Outils_ButtonLienImage))
GadgetToolTip(#Gadget_Outils_ButtonLienImage,"Lien vers une image.")
ButtonImageGadget(#Gadget_Outils_ButtonImage,57,51,28,25,ImageID(#Image_Outils_ButtonImage))
GadgetToolTip(#Gadget_Outils_ButtonImage,"Image.")
ButtonImageGadget(#Gadget_Outils_ButtonSon,85,51,28,25,ImageID(#Image_Outils_ButtonSon))
GadgetToolTip(#Gadget_Outils_ButtonSon,"Son.")
ButtonImageGadget(#Gadget_Outils_ButtonVideo,113,51,28,25,ImageID(#Image_Outils_ButtonVideo))
GadgetToolTip(#Gadget_Outils_ButtonVideo,"Vidéo.")
ButtonImageGadget(#Gadget_Outils_ButtonEmail,141,51,28,25,ImageID(#Image_Outils_ButtonEmail))
GadgetToolTip(#Gadget_Outils_ButtonEmail,"Email.")
ButtonImageGadget(#Gadget_Outils_ButtonFormulaire,0,76,28,25,ImageID(#Image_Outils_ButtonFormulaire))
GadgetToolTip(#Gadget_Outils_ButtonFormulaire,"Formulaire.")
ButtonImageGadget(#Gadget_Outils_ButtonFrame,28,76,28,25,ImageID(#Image_Outils_ButtonFrame))
GadgetToolTip(#Gadget_Outils_ButtonFrame,"Tableau.")
ButtonImageGadget(#Gadget_Outils_ButtonTexteItalique,112,0,28,25,ImageID(#Image_Outils_ButtonTexteItalique))
GadgetToolTip(#Gadget_Outils_ButtonTexteItalique,"Texte italique.")
HideWindow(#Window_Outils,0)
ProcedureReturn WindowID(#Window_Outils)
EndIf
EndIf
EndProcedure
Procedure.l Window_CodeCouleur()
If OpenWindow(#Window_CodeCouleur,1094,226,260,300,"Codes Couleur.",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_Invisible,WindowID(#Window_Form1))
If CreateGadgetList(WindowID(#Window_CodeCouleur))
WebGadget(#WebGadget_Couleur,0,0,259,300,"E:\Logiciel InfoProject\SourceWebEditor\SourceWebEditor Version 2.0.1\Executable\Couleur\couleur.html")
HideWindow(#Window_CodeCouleur,0)
ProcedureReturn WindowID(#Window_CodeCouleur)
EndIf
EndIf
EndProcedure
;---------------Debut Procedure Position--------------------------------------
Procedure CursorX(Gadget)
; returns X-Pos of Cursor
REG = GadgetID(Gadget)
SendMessage_(REG,#EM_EXGETSEL,0,Range.CHARRANGE)
ProcedureReturn (Range\cpMax-(SendMessage_(REG,#EM_LINEINDEX,SendMessage_(REG,#EM_EXLINEFROMCHAR,0,Range\cpMin),0)))
EndProcedure
Procedure CursorY(Gadget)
; returns Y-Pos of Cursor
REG = GadgetID(Gadget)
SendMessage_(REG,#EM_EXGETSEL,0,Range.CHARRANGE)
ProcedureReturn SendMessage_(REG,#EM_EXLINEFROMCHAR,0,Range\cpMin)+1
EndProcedure
Procedure Locate(Gadget,x,y)
; Set cursor position
REG = GadgetID(Gadget)
CharIdx = SendMessage_(REG,#EM_LINEINDEX,y-1,0)
LLength = SendMessage_(REG,#EM_LINELENGTH,CharIdx,0)
If LLength >= x-1
CharIdx + x-1
EndIf
Range.CHARRANGE
Range\cpMin = CharIdx
Range\cpMax = CharIdx
SendMessage_(REG,#EM_EXSETSEL,0,Range)
EndProcedure
;*****************************************************************************
;******Procedure pour la coloration de la Syntaxe du code*******************************************************
Procedure EditorGadgetCursorX(Gadget)
; returns X-Pos of Cursor
REG = GadgetID(Gadget)
SendMessage_(REG,#EM_EXGETSEL,0,Range.CHARRANGE)
ProcedureReturn (Range\cpMax-(SendMessage_(REG,#EM_LINEINDEX,SendMessage_(REG,#EM_EXLINEFROMCHAR,0,Range\cpMin),0))+1)
EndProcedure
Procedure EditorGadgetCursorY(Gadget)
; returns Y-Pos of Cursor
REG = GadgetID(Gadget)
SendMessage_(REG,#EM_EXGETSEL,0,Range.CHARRANGE)
ProcedureReturn SendMessage_(REG,#EM_EXLINEFROMCHAR,0,Range\cpMin)+1
EndProcedure
Procedure EditorGadgetCursorPos(Gadget)
; returns relative Position of Cursor
SendMessage_(GadgetID(Gadget),#EM_EXGETSEL,0,Range.CHARRANGE)
ProcedureReturn Range\cpMax
EndProcedure
Procedure EditorGadgetLocate(Gadget,x,y,length)
; Set cursor position
REG = GadgetID(Gadget)
CharIdx = SendMessage_(REG,#EM_LINEINDEX,y-1,0)
LLength = SendMessage_(REG,#EM_LINELENGTH,CharIdx,0)
If LLength >= x-1
CharIdx + x-1
EndIf
Range.CHARRANGE
Range\cpMin = CharIdx
Range\cpMax = CharIdx+length
SendMessage_(REG,#EM_EXSETSEL,0,Range)
EndProcedure
Procedure EditorGadgetColor(Gadget, Color.l)
format.CHARFORMAT
format\cbSize = SizeOf(CHARFORMAT)
format\dwMask = #CFM_COLOR
format\crTextColor = Color
SendMessage_(GadgetID(Gadget), #EM_SETCHARFORMAT, #SCF_SELECTION, format)
EndProcedure
Procedure EditorGadgetFontSize(Gadget, Fontsize.l)
format.CHARFORMAT
format\cbSize = SizeOf(CHARFORMAT)
format\dwMask = #CFM_SIZE
format\yHeight = FontSize*20
SendMessage_(GadgetID(Gadget), #EM_SETCHARFORMAT, #SCF_SELECTION, format)
EndProcedure
Procedure EditorGadgetFont(Gadget, FontName.s)
format.CHARFORMAT
format\cbSize = SizeOf(CHARFORMAT)
format\dwMask = #CFM_FACE
PokeS(@format\szFaceName, FontName)
SendMessage_(GadgetID(Gadget), #EM_SETCHARFORMAT, #SCF_SELECTION, format)
EndProcedure
; #CFM_BOLD
; #CFM_ITALIC
; #CFM_UNDERLINE
; #CFM_STRIKEOUT
Procedure EditorGadgetFormat(Gadget, Flags)
format.CHARFORMAT
format\cbSize = SizeOf(CHARFORMAT)
format\dwMask = #CFM_ITALIC|#CFM_BOLD|#CFM_STRIKEOUT|#CFM_UNDERLINE
format\dwEffects = Flags
SendMessage_(GadgetID(Gadget), #EM_SETCHARFORMAT, #SCF_SELECTION, format)
EndProcedure
Procedure EditorGadgetBackColor(Gadget, Color.l)
Structure CHARFORMAT2_
cbSize.l
dwMask.l
dwEffects.l
yHeight.l
yOffset.l
crTextColor.l
bCharSet.b
bPitchAndFamily.b
szFaceName.b[#LF_FACESIZE]
_wPad2.w
wWeight.w
sSpacing.w
crBackColor.l
lcid.l
dwReserved.l
sStyle.w
wKerning.w
bUnderlineType.b
bAnimation.b
bRevAuthor.b
bReserved1.b
EndStructure
format.CHARFORMAT2_
format\cbSize = SizeOf(CHARFORMAT2_)
format\dwMask = $4000000 ; = #CFM_BACKCOLOR
format\crBackColor = Color
SendMessage_(GadgetID(Gadget), #EM_SETCHARFORMAT, #SCF_SELECTION, @format)
EndProcedure
Procedure.l GetFieldIndex(String.s, Position, Separator.s)
m = 1
For x=1 To Position
If Mid(String, x, Len(Separator)) = Separator
m + 1
EndIf
Next
ProcedureReturn m
EndProcedure
;-Visible Procs
ProcedureDLL ClearHighlightingAll(Gadget, Color, FontSize, FontName.s, FontFlags)
CurrentPosX = EditorGadgetCursorX(Gadget)
CurrentPosY = EditorGadgetCursorY(Gadget)
CurrentPos = EditorGadgetCursorPos(Gadget)
SendMessage_(GadgetID(Gadget), #EM_HIDESELECTION, 1, 0)
EditorGadgetLocate(Gadget,1,1,Len(GetGadgetText(Gadget)))
EditorGadgetColor(Gadget,Color)
EditorGadgetFontSize(Gadget, FontSize)
EditorGadgetFont(Gadget, FontName)
EditorGadgetFormat(Gadget, FontFlags)
EditorGadgetBackColor(Gadget, RGB(255, 255, 255))
EditorGadgetLocate(Gadget,CurrentPosX,CurrentPosY,0)
SendMessage_(GadgetID(Gadget), #EM_HIDESELECTION, 0, 0)
EndProcedure
ProcedureDLL ClearHighlightingLine(Gadget, Color, FontSize, FontName.s, FontFlags)
CPos.CHARRANGE
SendMessage_(GadgetID(Gadget), #EM_EXGETSEL,0,CPos)
i = SendMessage_(GadgetID(Gadget), #EM_EXLINEFROMCHAR, 0, CPos\cpMin)
SendMessage_(GadgetID(Gadget), #EM_HIDESELECTION, 1, 0)
EditorGadgetLocate(Gadget,1,i+1,Len(GetGadgetItemText(Gadget, i, 0)))
EditorGadgetColor(Gadget,Color)
EditorGadgetFontSize(Gadget, FontSize)
EditorGadgetFont(Gadget, FontName)
EditorGadgetFormat(Gadget, FontFlags)
EditorGadgetBackColor(Gadget, RGB(255, 255, 255))
SendMessage_(GadgetID(Gadget), #EM_EXSETSEL,0,CPos)
SendMessage_(GadgetID(Gadget), #EM_HIDESELECTION, 0, 0)
EndProcedure
ProcedureDLL SyntaxHighlightingAll(Gadget, Words.s, Separator.s, Color, BackgroundColor, FontSize, FontName.s, FontFlags)
CPos.CHARRANGE
SendMessage_(GadgetID(Gadget), #EM_EXGETSEL,0,CPos)
SendMessage_(GadgetID(Gadget), #EM_HIDESELECTION, 1, 0)
For k=1 To CountString(Words, Separator)+1
Word.s = StringField(Words, k, Separator)
For i=0 To CountGadgetItems(Gadget)
Pos = FindString(GetGadgetItemText(Gadget, i, 0), Word, 1)
While Pos <> 0
EditorGadgetLocate(Gadget,Pos,i+1,Len(Word))
EditorGadgetColor(Gadget,Color)
EditorGadgetFontSize(Gadget, FontSize)
EditorGadgetFont(Gadget, FontName)
EditorGadgetFormat(Gadget, FontFlags)
EditorGadgetBackColor(Gadget, BackgroundColor)
Pos = FindString(GetGadgetItemText(Gadget, i, 0), Word, Pos+1)
Wend
Next
Next
SendMessage_(GadgetID(Gadget), #EM_EXSETSEL,0,CPos)
SendMessage_(GadgetID(Gadget), #EM_HIDESELECTION, 0, 0)
EndProcedure
ProcedureDLL CorrectWordsLine(Gadget, Words.s, Separator.s)
CPos.CHARRANGE
SendMessage_(GadgetID(Gadget), #EM_EXGETSEL,0,CPos)
i = SendMessage_(GadgetID(Gadget), #EM_EXLINEFROMCHAR, 0, CPos\cpMin)
SendMessage_(GadgetID(Gadget), #EM_HIDESELECTION, 1, 0)
For k=1 To CountString(Words, Separator)+1
Word.s = StringField(Words, k, Separator)
SetGadgetItemText(Gadget, i, ReplaceString(GetGadgetItemText(Gadget, i, 0), Word, Word, 1), 0)
Next
SendMessage_(GadgetID(Gadget), #EM_EXSETSEL,0,CPos)
SendMessage_(GadgetID(Gadget), #EM_HIDESELECTION, 0, 0)
EndProcedure
ProcedureDLL CorrectWordsAll(Gadget, Words.s, Separator.s)
CPos.CHARRANGE
SendMessage_(GadgetID(Gadget), #EM_EXGETSEL,0,CPos)
i = SendMessage_(GadgetID(Gadget), #EM_EXLINEFROMCHAR, 0, CPos\cpMin)
SendMessage_(GadgetID(Gadget), #EM_HIDESELECTION, 1, 0)
For k=1 To CountString(Words, Separator)+1
Word.s = StringField(Words, k, Separator)
SetGadgetText(Gadget, ReplaceString(GetGadgetText(Gadget), Word, Word, 1))
Next
SendMessage_(GadgetID(Gadget), #EM_EXSETSEL,0,CPos)
SendMessage_(GadgetID(Gadget), #EM_HIDESELECTION, 0, 0)
EndProcedure
ProcedureDLL.s GetCurrentWritingWord(Gadget)
CPos.CHARRANGE
SendMessage_(GadgetID(Gadget), #EM_EXGETSEL,0,CPos)
i = SendMessage_(GadgetID(Gadget), #EM_EXLINEFROMCHAR, 0, CPos\cpMin)
GetCursorPos_(@Mouse.Point)
CurrentWord.s = StringField(GetGadgetItemText(Gadget, i, 0), GetFieldIndex(GetGadgetItemText(Gadget, i, 0), EditorGadgetCursorX(Gadget)-1, " "), " ")
ProcedureReturn CurrentWord
EndProcedure
;******Fin de la Procedure de la coloration de la Syntaxe du code***********************************************************
Procedure WindowCallback(WindowID,Message,wParam,lParam)
ReturnValue=#PB_ProcessPureBasicEvents
If Message=#WM_GETMINMAXINFO
ReturnValue=PVDynamic_LockWindow(WindowID,lParam)
EndIf
If Message=#WM_SIZE
ReturnValue=PVDynamic_Resize(WindowID)
EndIf
If Message=#WM_CTLCOLORSTATIC Or Message=#WM_CTLCOLOREDIT Or Message=#WM_CTLCOLORLISTBOX
ReturnValue=PVDynamic_ColorGadget(lParam,wParam)
EndIf
If Message=#WM_MEASUREITEM
ReturnValue=PVDynamic_MenuBarSize(WindowID,lParam)
EndIf
If Message=#WM_DRAWITEM
ReturnValue=PVDynamic_MenuBar(lParam,-1,-1)
EndIf
ProcedureReturn ReturnValue
EndProcedure
;- Main Loop
If Window_Form1()
SetWindowCallback(@WindowCallback())
Window_Outils()
Window_FTP()
Window_CodeCouleur()
Window_Editeur()
ChargementPosition()
quitForm1=0
Repeat
EventID =WaitWindowEvent()
MenuID =EventMenu()
GadgetID =EventGadget()
WindowID =EventWindow()
StatusBarText(#StatusBar_Form1,1," Ligne: "+Str(CursorY(#Gadget_Editeur_Editeur))+" Caractère: "+Str(CursorX(#Gadget_Editeur_Editeur)))
If EventID = #WM_RBUTTONDOWN
DisplayPopupMenu(#popup_0, WindowID(#Window_Editeur))
EndIf
Select EventID
Case #PB_Event_CloseWindow
If WindowID=#Window_Form1
quitForm1=1
EndIf
Case #PB_Event_Menu
Select MenuID
Case #MenuBar_Form1_Nouveau
file$ = ""
ClearGadgetItemList(#Gadget_Editeur_Editeur)
AddGadgetItem(#Gadget_Editeur_Editeur, 1, "<html>")
AddGadgetItem(#Gadget_Editeur_Editeur, 2, " <title>Taper ici le titre de votre site internet</title>")
AddGadgetItem(#Gadget_Editeur_Editeur, 3, " <head>")
AddGadgetItem(#Gadget_Editeur_Editeur, 4, "")
AddGadgetItem(#Gadget_Editeur_Editeur, 5, " </head>")
AddGadgetItem(#Gadget_Editeur_Editeur, 6, " <body>")
AddGadgetItem(#Gadget_Editeur_Editeur, 7, "")
AddGadgetItem(#Gadget_Editeur_Editeur, 8, "")
AddGadgetItem(#Gadget_Editeur_Editeur, 9, "")
AddGadgetItem(#Gadget_Editeur_Editeur, 10, "")
AddGadgetItem(#Gadget_Editeur_Editeur, 11, " </body>")
AddGadgetItem(#Gadget_Editeur_Editeur, 12, "</html>")
StatusBarText(#StatusBar_Form1, 3, "Nouveau fichier html")
Case #MenuBar_Form1_Ouvrir
file$ = OpenFileRequester("Ouvrir un fichier html","","Fichiers HTML|*.html;*.htm",1)
OFile(file$)
StatusBarText(#StatusBar_Form1,3," Fichier Ouvert: "+ file$)
Case #MenuBar_Form1_Enregistrer
If file$
SFilehtml(file$)
StatusBarText(#StatusBar_Form1,3," Fichier Enregistrer: "+ file$)
Else
file$ = SaveFileRequester("Enregistrer nouveau fichier...","","HTML|*.html;*.htm",1)
SFile(file$)
StatusBarText(#StatusBar_Form1,3," Fichier Enregistrer: "+ file$)
EndIf
Case #MenuBar_Form1_EnregistrerSous
file$ = SaveFileRequester("Enregistrer sous...","","HTML|*.html;*.htm",1)
SFile(file$)
StatusBarText(#StatusBar_Form1,3," Fichier Enregistrer: "+ file$)
Case #MenuBar_Form1_Quitter
ReponseQuitter = 6
Resultat = MessageRequester("Attention.", "Vérifiez de bien avoir enregistrer votre travail avant de quitter SourceWebEditor. En cas de doute, procédez à l'enregistrement de celui-ci.", #PB_MessageRequester_YesNo)
If ReponseQuitter = Resultat
End
Else
EndIf
Case #MenuBar_Form1_Annuler
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_UNDO,0,0)
Case #MenuBar_Form1_Couper
;Code Couper
Vide$ = ""
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_GETSEL,@StartSel,@EndSel)
Buffer$ = Space(EndSel-StartSel)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_GETSELTEXT,0,@Buffer$)
ClearClipboard()
SetClipboardText(Buffer$)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,#True,@Vide$)
;Fin de code Couper
Case #MenuBar_Form1_Copier
;Code Copier
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_GETSEL,@StartSel,@EndSel)
Buffer$ = Space(EndSel-StartSel)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_GETSELTEXT,0,@Buffer$)
ClearClipboard()
SetClipboardText(Buffer$)
;Fin de code Copier
Case #MenuBar_Form1_Coller
;Code coller
Buffer$ = GetClipboardText()
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,#True,@Buffer$)
;Fin de code Coller
Case #MenuBar_Form1_Boiteoutils
Window_Outils()
If OpenPreferences("Position.ini")
PreferenceGroup("POSITIONS")
PosGOutils1$ = ReadPreferenceString("PosGOutils","")
PosHOutils1$ = ReadPreferenceString("PosHOutils","")
PosGOutils1L = Val(PosGOutils1$)
PosHOutils1L = Val(PosHOutils1$)
ResizeWindow(#Window_Outils, PosGOutils1L, PosHOutils1L, #PB_Ignore, #PB_Ignore)
EndIf
Case #MenuBar_Form1_ClientFTP
Window_FTP()
If OpenPreferences("Position.ini")
PreferenceGroup("POSITIONS")
PosGFTP1$ = ReadPreferenceString("PosGFTP","")
PosHFTP1$ = ReadPreferenceString("PosHFTP","")
PosGFTP1L = Val(PosGFTP1$)
PosHFTP1L = Val(PosHFTP1$)
ResizeWindow(#Window_FTP, PosGFTP1L , PosHFTP1L, #PB_Ignore, #PB_Ignore)
EndIf
Case #MenuBar_Form1_Position
Position()
Case #MenuBar_Form1_Apercu
RunProgram(file$)
Case #MenuBar_Form1_Aide
Case #MenuBar_Form1_MAJ
Window_Form2()
Case #MenuBar_Form1_SiteWeb
RunProgram("http://infoprojectsoftware.free.fr")
Case #MenuBar_Form1_Apropos
Window_Form3()
Case #Menup1
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_UNDO,0,0)
Case #Menup2
;Code Couper
Vide$ = ""
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_GETSEL,@StartSel,@EndSel)
Buffer$ = Space(EndSel-StartSel)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_GETSELTEXT,0,@Buffer$)
ClearClipboard()
SetClipboardText(Buffer$)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,#True,@Vide$)
;Fin de code Couper
Case #Menup3
;Code Copier
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_GETSEL,@StartSel,@EndSel)
Buffer$ = Space(EndSel-StartSel)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_GETSELTEXT,0,@Buffer$)
ClearClipboard()
SetClipboardText(Buffer$)
;Fin de code Copier
Case #Menup4
;Code coller
Buffer$ = GetClipboardText()
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,#True,@Buffer$)
;Fin de code Coller
EndSelect
Case #PB_Event_Gadget
Select GadgetID
Case #Gadget_Outils_BouttonTexteGauche
Chaine.s="<div align=*left*>Taper votre texte ici </div>"
ReplaceString(Chaine,"*",Chr(34),2)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,1,@Chaine)
Case #Gadget_Outils_BouttonTexteCentrer
Chaine.s="<div align=*center*> Taper votre texte ici </div>"
ReplaceString(Chaine,"*",Chr(34),2)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,1,@Chaine)
Case #Gadget_Outils_ButtonTexteDroite
Chaine.s="<div align=*right*>Taper votre texte ici </div>"
ReplaceString(Chaine,"*",Chr(34),2)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,1,@Chaine)
Case #Gadget_Outils_ButtonTexteMajuscule
SetClipboardText("<b> Taper votre texte ici </b>")
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#WM_PASTE,0,0)
Case #Gadget_Outils_ButtonTexteItalique
SetClipboardText("<i> Taper votre texte ici </i>")
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#WM_PASTE,0,0)
Case #Gadget_Outils_ButtonTexteSouligner
SetClipboardText("<u> Taper votre code ici </u>")
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#WM_PASTE,0,0)
Case #Gadget_Outils_ButtonTexteH1
SetClipboardText("<H1>Taper votre texte ici</H1>")
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#WM_PASTE,0,0)
Case #Gadget_Outils_ButtonTexteH2
SetClipboardText("<H2>Taper votre texte ici</H2>")
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#WM_PASTE,0,0)
Case #Gadget_Outils_ButtonTexteH3
SetClipboardText("<H3>Taper votre texte ici</H3>")
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#WM_PASTE,0,0)
Case #Gadget_Outils_ButtonTexteH4
SetClipboardText("<H4>Taper votre texte ici</H4>")
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#WM_PASTE,0,0)
Case #Gadget_Outils_ButtonTexteH5
SetClipboardText("<H5>Taper votre texte ici</H5>")
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#WM_PASTE,0,0)
Case #Gadget_Outils_ButtonTexteH6
SetClipboardText("<H6>Taper votre texte ici</H6>")
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#WM_PASTE,0,0)
Case #Gadget_Outils_ButtonLienPage
Chaine.s="<a href=* Indiquez ici le chemin de la page *> Indiquez ici le nom de la page </a>"
ReplaceString(Chaine,"*",Chr(34),2)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,1,@Chaine)
Case #Gadget_Outils_ButtonLienImage
Chaine.s="<a href=* Indiquez ici l'adresse de la page web *><img border=*0* src=* Indiquez ici le chemin du fichier image *></a>"
ReplaceString(Chaine,"*",Chr(34),2)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,1,@Chaine)
Case #Gadget_Outils_ButtonImage
Chaine.s="<img border=*0* src=* Indiquez ici le chemin du fichier image *>"
ReplaceString(Chaine,"*",Chr(34),2)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,1,@Chaine)
Case #Gadget_Outils_ButtonEmail
Chaine.s="<a href=*mailto:Indiquez l'adresse Email ici*> Indiquez ici du texte <a/>"
ReplaceString(Chaine,"*",Chr(34),2)
SendMessage_(GadgetID(#Gadget_Editeur_Editeur),#EM_REPLACESEL,1,@Chaine)
Case #Gadget_FTP_ButtonFTPFermer
CloseWindow(#Window_FTP)
Case #Gadget_Outils_ButtonOtilsFermer
CloseWindow(#Window_Outils)
Case #Gadget_Form2_Button5
CloseWindow(#Window_Form2)
Case #Gadget_Form3_Button14
CloseWindow(#Window_Form3)
EndSelect
EndSelect
Until quitForm1
CloseWindow(#Window_Form1)
EndIf
End