Page 1 sur 1

Font Selector

Publié : jeu. 24/juil./2014 16:48
par falsam
Un outil qui insère une fonte dans votre éditeur sous la forme: LoadFont(#PB_Any, "Arial", 10, #PB_Font_Bold|#PB_Font_Italic)

Sauver le code ci-dessous et créer un exécutable (Exemple : Code Selector)

Code : Tout sélectionner

Define.s Message, FontName, FontStyle
Define.i FontSize, n

Result = FontRequester("Arial", 10, 0, RGB(0, 0, 0), #False)

If result  
  If SelectedFontStyle()  
    FontStyle=", "
    
    If SelectedFontStyle() & #PB_Font_Bold 
      FontStyle + "#PB_Font_Bold"
    EndIf
    
    If SelectedFontStyle() & #PB_Font_Italic
      FontStyle + "#PB_Font_Italic"
    EndIf
  
    If SelectedFontStyle() & #PB_Font_StrikeOut
      FontStyle + "#PB_Font_StrikeOut"
    EndIf
    
    If SelectedFontStyle() & #PB_Font_Underline
      FontStyle + "#PB_Font_Underline"
    EndIf 
  
    If SelectedFontStyle() & #PB_Font_HighQuality
      FontStyle + "#PB_Font_HighQuality"
    EndIf
    
    FontStyle = ReplaceString(FontStyle, "#PB", "|#PB",0, 4)
  EndIf
    
  Message = "LoadFont(#PB_Any, " + Chr(34)+SelectedFontName()+Chr(34) +", " + Str(SelectedFontSize()) + FontStyle +")" 
   
  SetClipboardText(Message)
  HandleIDESci=Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
  SendMessage_(HandleIDESci, #WM_PASTE,0,0) 
EndIf
Inscrivez ensuite cet exécutable dans les outils de votre éditeur de code (IDE). Ajouter une touche de raccourci (Exemple CTRL+ALT+F)

Image

Re: Font Selector

Publié : jeu. 24/juil./2014 16:58
par falsam
A mon avis les flags #PB_Font_StrikeOut, #PB_Font_Underline et #PB_Font_HighQuality ne seront jamais proposés :mrgreen: