Affiche une sous chaine de cette couleur si cette sous...

Contenu du snippet

{Affiche une sous_chaine de cette couleur ici elle cette sous chaine est contenu dans cette phrase}
{Cette procedure permet la Colorisation Syntaxique du panneau des désignations et des périphérique - denis Bertin le 28.10.2019}
procedure text_out_find(Paintdc:hdc; x,y:integer; phrase,sous_chaine:pchar; color:tcolorref);
      var p:pchar;
          pc:wutil.pc1024;
          Size:tsize;
          alpha:tcolorref;
      begin
      if not afficher_la_colorisation_syntaxique then exit;
      strcopy(pc,phrase);
      p:=strpos(pc,sous_chaine);
      if p<>nil then
        begin
        p^:=#0;
        GetTextExtentPoint(Paintdc,pc,strlen(pc),Size);
        if color=g_base.RGB_Vert then
          if woutil.global_bool_noir_ou_blanc then
            alpha:=settextcolor(Paintdc,color)
          else
            alpha:=settextcolor(Paintdc,g_base.RGB_Vert_foncer)
        else
          alpha:=settextcolor(Paintdc,color);
        textout(Paintdc,x+Size.cx,y,sous_chaine,strlen(sous_chaine));
        settextcolor(Paintdc,alpha);
        end;
      end; {text_out_find}

procedure text_out_color_number(Paintdc:hdc; x,y:integer; ficelle:string; color:tcolorref);
  var i:integer; {l'itérateur de boucle, il varie de '0' à '9', avec ord qui renvoie son ordre AsCii}
      local_apc:pc10;
  begin
  if not afficher_la_colorisation_syntaxique then exit;
  for i:=ord('0') to ord('9') do
    begin
    local_apc[0]:=chr(i); local_apc[1]:=chr(0);
    text_out_find_next(Paintdc,x,y,pchar(ficelle),local_apc,color);
    end; {for i}
  text_out_find_next(Paintdc,x,y,pchar(ficelle),'.',color);
  text_out_find_next(Paintdc,x,y,pchar(ficelle),',',color);
  end; {text_out_color_number}

procedure text_out_find_next(Paintdc:hdc; x,y:integer; phrase,repeter:pchar; color:tcolorref);
  var i,n:integer;
      p,q:pchar;
      pc:wutil.pc1024;
      Size:tsize;
      alpha:tcolorref;
  begin
      if not afficher_la_colorisation_syntaxique then exit;
      n:=pred(strlen(phrase));
      for i:=n downto 0 do
        begin
        strcopy(pc,phrase);
        q:=@pc[i];
        p:=strpos(q,repeter);
        if p<>nil then
          begin
          p^:=#0;
          //Renvoie la couleur précédante
          alpha:=Settextcolor(Paintdc,color);
          GetTextExtentPoint(Paintdc,pc,strlen(pc),Size);
          //Cette couleur s'applque ici
          TextOut(Paintdc,x+Size.cx,y,repeter,strlen(repeter));
          SetTextColor(Paintdc,alpha);
          end;
        end;
  end; {text_out_find_next}

Compatibilité : 1.0

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.