unit Ud_proportion;

{Une unité destiné à positionner une image, ajuster sa position dans le Plan}
{Cette même unité permet la duplication cette image dans l'espace du Plan}
{Et d'ajuster sa position avec des valeurs statiques et un facteur de poportionnalité}
{Elle permet aussi de répeter cette image le long des axes horizontal ou vertical}
{Puis de s'espacer avec des goulotte de taille paramètrable dont l'ajustement est variable}
{Permet aussi d'ajouter des repère de guidages avant découpe sur le cadre externe}
{Elle est écrite, cette unité par Denis Bertin Stéphane le 27-28-29 avril 2014}

interface

uses windows,c_color,Whelp,WBase,col_plan,messages,dialbase;

type

  Tcolor_guides_button = class(c_color.Tcolor_degra_button)
  	function get_color:longint; override;
	  end;

  Tcolor_marque_button = class(c_color.Tcolor_degra_button)
  	function get_color:longint; override;
	  end;

  Tad_et_tod_position = class(Whelp.ThelpDialog)
    constructor Create(AParent:WBase.TWindow; une_col_plan:col_plan.Tcol_plan);
    procedure 	setupwindow; override;
    procedure 	WMCommand(var Msg: TMessage); override;
    procedure 	wmset_painture_control(var Msg: TMessage); override;
    private
      une_col_plan_passagere:col_plan.Tcol_plan;
      x,y,xx,yy:dialbase.TNumEdit_plus_moins;
      Checkbox_Effectuer_une_duplication:wbase.tcheckbox;
      nbx,nby,decx,decy:dialbase.TNumEdit_plus_moins;
      Checkbox_Creer_des_guides_aux_interstice:wbase.tcheckbox;
      Checkbox_Marque_de_decoupage:wbase.tcheckbox;
      Checkbox_centrer_la_selection:wbase.tcheckbox;
      Checkbox_Placer_les_marques_a_lexterieur:wbase.tcheckbox;
      Checkbox_Ajouter_des_cotations:wbase.tcheckbox;
      Checkbox_Ajouter_les_grandes_cotation:wbase.tcheckbox;
      color_of_the_guides:Tcolor_guides_button;
      color_of_the_marque:Tcolor_marque_button;
      end;

  Trec_position_de_l_image = record
    x:integer;
    y:integer;
    xx:integer;
    yy:integer;
    Checkbox_Effectuer_une_duplication:bool;
    nbx:integer;
    nby:integer;
    decx:integer;
    decy:integer;
    Checkbox_Creer_des_guides_aux_interstice:bool;
    Checkbox_Marque_de_decoupage:bool;
    Checkbox_centrer_la_selection:bool;
    Checkbox_Placer_les_marques_a_lexterieur:bool;
    Checkbox_Ajouter_des_cotations:bool;
    Checkbox_Ajouter_les_grandes_cotation:bool;
    color_guides_button,color_marque_button:tcolorref;
    end;

  var Rec_position_de_l_image : Ud_proportion.Trec_position_de_l_image;

implementation

uses g_base,u_object,wformebm,graphics,relation,wmain,uregedit,math;

const ks_position = 'Position';

  function Tcolor_guides_button.get_color:longint;
    begin
    result:=Rec_position_de_l_image.color_guides_button;
    end;

  function Tcolor_marque_button.get_color:longint;
    begin
    result:=Rec_position_de_l_image.color_marque_button;
    end;

  constructor Tad_et_tod_position.Create(AParent:WBase.TWindow; une_col_plan:col_plan.Tcol_plan);
    const dial_id_position_de_mon_image = 1874;
    begin
    inherited Create(AParent,dial_id_position_de_mon_image,0);
    self.TransferBuffer:=@rec_position_de_l_image;
    self.x:=dialbase.TNumEdit_plus_moins.Create(self,1000,4,0,10000,0);
    self.y:=dialbase.TNumEdit_plus_moins.Create(self,1001,4,0,10000,0);
    self.xx:=dialbase.TNumEdit_plus_moins.Create(self,1002,4,0,10000,0);
    self.yy:=dialbase.TNumEdit_plus_moins.Create(self,1003,4,0,10000,0);
    self.Checkbox_Effectuer_une_duplication:=wbase.tcheckbox.Create(self,1005,0);
    self.nbx:=dialbase.TNumEdit_plus_moins.Create(self,1006,3,0,999,0);
    self.nby:=dialbase.TNumEdit_plus_moins.Create(self,1007,3,0,999,0);
    self.decx:=dialbase.TNumEdit_plus_moins.Create(self,1008,3,0,999,0);
    self.decy:=dialbase.TNumEdit_plus_moins.Create(self,1009,3,0,999,0); {écrit par denis Bertin}
    self.Checkbox_Creer_des_guides_aux_interstice:=wbase.tcheckbox.Create(self,1010,0);
    self.Checkbox_Marque_de_decoupage:=wbase.tcheckbox.Create(self,1011,0);
    self.Checkbox_centrer_la_selection:=wbase.tcheckbox.Create(self,1014,0);
    self.Checkbox_Placer_les_marques_a_lexterieur:=wbase.tcheckbox.Create(self,1016,0);
    self.Checkbox_Ajouter_des_cotations:=wbase.tcheckbox.Create(self,1017,0);
    self.Checkbox_Ajouter_les_grandes_cotation:=wbase.tcheckbox.Create(self,1018,0);
    self.color_of_the_guides:=Tcolor_guides_button.Create(self,1012,0);
    self.color_of_the_marque:=Tcolor_marque_button.Create(self,1013,0);
    self.une_col_plan_passagere:=une_col_plan;
    end; {Tad_et_tod_position.Create}

  procedure Tad_et_tod_position.Setupwindow;
    begin
    inherited Setupwindow;
    {Pour relire les information de la base de registre}
    self.x.Set_num_value(uregedit.RegGetPrivateProfileInt(ks_position,'x',self.x.Get_num_value));
    self.y.Set_num_value(uregedit.RegGetPrivateProfileInt(ks_position,'y',self.y.Get_num_value));
    self.xx.Set_num_value(uregedit.RegGetPrivateProfileInt(ks_position,'xx',self.xx.Get_num_value));
    self.yy.Set_num_value(uregedit.RegGetPrivateProfileInt(ks_position,'yy',self.yy.Get_num_value));
    self.nbx.Set_num_value(uregedit.RegGetPrivateProfileInt(ks_position,'nbx',self.nbx.Get_num_value));
    self.nby.Set_num_value(uregedit.RegGetPrivateProfileInt(ks_position,'nby',self.nby.Get_num_value));
    self.decx.Set_num_value(uregedit.RegGetPrivateProfileInt(ks_position,'decx',self.decx.Get_num_value));
    self.decy.Set_num_value(uregedit.RegGetPrivateProfileInt(ks_position,'decy',self.decy.Get_num_value));
    Rec_position_de_l_image.color_guides_button:=uregedit.RegGetPrivateProfileInt(ks_position,'guide color',Rec_position_de_l_image.color_guides_button);
    Rec_position_de_l_image.color_marque_button:=uregedit.RegGetPrivateProfileInt(ks_position,'mark color',Rec_position_de_l_image.color_marque_button);
    {Pour actualiser les cases de compréhension}
    postmessage(self.hwindow,wm_command,0,0);
    end; {Tad_et_tod_position.Setupwindow}


  procedure Tad_et_tod_position.wmset_painture_control(var Msg: TMessage);
    begin
    with msg do
	  	begin
		  if wparam=self.color_of_the_guides.hwindow then
        Rec_position_de_l_image.color_guides_button:=lparam
      else if wparam=self.color_of_the_marque.hwindow then
        Rec_position_de_l_image.color_marque_button:=lparam;
      end;
    end;

  procedure Tad_et_tod_position.WMCommand(var Msg: TMessage);
    const id_Proportionnaliter = 1004;
    var i,j,k,l:integer;
        un_Calque_actif:col_plan.TCalque;
        un_index:u_object.tindex;
        une_forme,une_forme_de_reference:wformebm.Tforme_TBitMap;
        int_largeur:integer;
        int_hauteur:integer;
        proportion:real;
        un_bitmap:wformebm.Tforme_TBitMap;
        mon_bitmap:graphics.tbitmap;
        bool_la_premiere:boolean;
        un_guide:u_object.T_Guide_couleur;
        x,y:integer;
        count_before:integer;
        un_rectangle:trect;
        dx,dy:integer;
        bool_Placer_les_marques_a_lexterieur:bool;
    begin
    inherited WMCommand(Msg);
    case msg.wparam of
      id_Proportionnaliter:
        begin
        un_Calque_actif:=self.une_col_plan_passagere.Get_calque_actif;
        if un_Calque_actif<>nil then
          begin
          une_forme:=wformebm.Tforme_TBitMap(un_Calque_actif.last_selection);
          if une_forme<>nil then
            begin
            if une_forme.ClassType=wformebm.Tforme_TBitMap then
              begin
              int_largeur:=une_forme.la_largeur;
              int_hauteur:=une_forme.la_hauteur;
              proportion:=int_largeur/int_hauteur;
              self.yy.Set_num_value(round(self.xx.Get_num_value/proportion)); {Denis B le 21.4.2014}
              end;
            end;
          end;
        end;
      id_ok :
        begin
        uregedit.RegWritePrivateProfileInt(ks_position,'x',self.x.Get_num_value);
        uregedit.RegWritePrivateProfileInt(ks_position,'y',self.y.Get_num_value);
        uregedit.RegWritePrivateProfileInt(ks_position,'xx',self.xx.Get_num_value);
        uregedit.RegWritePrivateProfileInt(ks_position,'yy',self.yy.Get_num_value);
        uregedit.RegWritePrivateProfileInt(ks_position,'nbx',self.nbx.Get_num_value);
        uregedit.RegWritePrivateProfileInt(ks_position,'nby',self.nby.Get_num_value);
        uregedit.RegWritePrivateProfileInt(ks_position,'decx',self.decx.Get_num_value);
        uregedit.RegWritePrivateProfileInt(ks_position,'decy',self.decy.Get_num_value);
        uregedit.RegWritePrivateProfileInt(ks_position,'guide color',Rec_position_de_l_image.color_guides_button);
        uregedit.RegWritePrivateProfileInt(ks_position,'mark color',Rec_position_de_l_image.color_marque_button);
        un_Calque_actif:=self.une_col_plan_passagere.Get_calque_actif;
        une_forme:=nil;
        une_forme_de_reference:=nil;
        if un_Calque_actif<>nil then
          begin
          count_before:=un_Calque_actif.count;
          for i:=0 to pred(un_Calque_actif.col_select.count) do
            begin
            un_index:=u_object.tindex(un_Calque_actif.col_select.at(i));
            if un_index<>nil then
              begin
              if un_index.classtype=u_object.tindex then
                begin
                une_forme:=wformebm.Tforme_TBitMap(un_Calque_actif.formindex(un_index));
                if une_forme<>nil then
                  begin
                  une_forme_de_reference:=une_forme;
                  if une_forme.ClassType=wformebm.Tforme_TBitMap then
                    begin
                    une_forme.rect.Left:=relation._10mm_to_log_pouce(self.x.Get_num_value*10);
                    une_forme.rect.top:=relation._10mm_to_log_pouce(self.y.Get_num_value*10);
                    une_forme.rect.right:=relation._10mm_to_log_pouce(self.xx.Get_num_value*10);
                    une_forme.rect.bottom:=relation._10mm_to_log_pouce(self.yy.Get_num_value*10);
                    if self.Checkbox_Marque_de_decoupage.GetCheck=bf_checked then
                      begin
                      for j:=1 to self.nbx.Get_num_value+1 do
                        begin
                        for k:=1 to self.nby.Get_num_value+1 do
                          begin
                          bool_Placer_les_marques_a_lexterieur:=
                            (self.Checkbox_Placer_les_marques_a_lexterieur.GetCheck=bf_checked) and ((j=1) or (k=1) or (j=self.nbx.Get_num_value+1) or (k=self.nby.Get_num_value+1));
                          if (self.Checkbox_Placer_les_marques_a_lexterieur.GetCheck=bf_checked) and ((j=1) or (k=1) or (j=self.nbx.Get_num_value+1) or (k=self.nby.Get_num_value+1)) or
                            (not (self.Checkbox_Placer_les_marques_a_lexterieur.GetCheck=bf_checked)) then {denis B le 1.5.2014}
                              begin
                              x:=une_forme.rect.Left+
                                pred(j)*(une_forme.la_largeur+relation._10mm_to_log_pouce(self.decx.Get_num_value*10))-
                                  relation._10mm_to_log_pouce(self.decx.Get_num_value*10) div 2;
                              y:=une_forme.rect.top+
                                pred(k)*(une_forme.la_hauteur+relation._10mm_to_log_pouce(self.decy.Get_num_value*10))-
                                relation._10mm_to_log_pouce(self.decy.Get_num_value*10) div 2;
                              if not bool_Placer_les_marques_a_lexterieur or (j=1) or (k=self.nby.Get_num_value+1) or (j=self.nbx.Get_num_value+1) then
                                begin
                                un_Calque_actif.Ds_Start_path(x,y);
                                un_Calque_actif.Ds_Add_ligne(0,256);
                                un_Calque_actif.Ds_de_cette_couleur_contour(
                                  Rec_position_de_l_image.color_marque_button);
                                un_Calque_actif.ds_draw_path.epaisseur:=6; {twips}
                                un_Calque_actif.Ds_Add_ce_chemin;
                                end;
                              if not bool_Placer_les_marques_a_lexterieur or (j<>1) then
                                begin
                                un_Calque_actif.Ds_Start_path(x,y);
                                un_Calque_actif.Ds_Add_ligne(256,0);
                                un_Calque_actif.Ds_de_cette_couleur_contour(
                                  Rec_position_de_l_image.color_marque_button);
                                un_Calque_actif.ds_draw_path.epaisseur:=6; {twips}
                                un_Calque_actif.Ds_Add_ce_chemin;
                                end;
                              if not bool_Placer_les_marques_a_lexterieur or (j=1) or (k<>self.nby.Get_num_value+1) then
                                begin
                                un_Calque_actif.Ds_Start_path(x,y);
                                un_Calque_actif.Ds_Add_ligne(0,-256);
                                un_Calque_actif.Ds_de_cette_couleur_contour(
                                  Rec_position_de_l_image.color_marque_button);
                                un_Calque_actif.ds_draw_path.epaisseur:=6; {twips}
                                un_Calque_actif.Ds_Add_ce_chemin;
                                end;
                              if not bool_Placer_les_marques_a_lexterieur or (j<>self.nbx.Get_num_value+1) then
                                begin
                                un_Calque_actif.Ds_Start_path(x,y);
                                un_Calque_actif.Ds_Add_ligne(-256,0);
                                un_Calque_actif.Ds_de_cette_couleur_contour(
                                  Rec_position_de_l_image.color_marque_button);
                                un_Calque_actif.ds_draw_path.epaisseur:=6; {twips}
                                un_Calque_actif.Ds_Add_ce_chemin;
                                end;
                              end;
                            end;
                        end;
                      end; {denis Bertin le 29.4.2014}
                    if self.Checkbox_Effectuer_une_duplication.GetCheck=bf_checked then
                      begin
                      bool_la_premiere:=true;
                      for j:=1 to self.nbx.Get_num_value do
                        begin
                        for k:=1 to self.nby.Get_num_value do
                          begin
                          if not bool_la_premiere then
                            begin
                            mon_bitmap:=graphics.tbitmap.Create;
                            mon_bitmap.Assign(une_forme.BitMap);
                            un_bitmap:=wformebm.Tforme_TBitMap.Create(
                              une_forme.rect.Left+pred(j)*(une_forme.la_largeur+
                                relation._10mm_to_log_pouce(self.decx.Get_num_value*10)),
                              une_forme.rect.top+pred(k)*(une_forme.la_hauteur+
                                relation._10mm_to_log_pouce(self.decy.Get_num_value*10)),
                              une_forme.rect.Left+pred(j)*(une_forme.la_largeur+
                                relation._10mm_to_log_pouce(self.decx.Get_num_value*10))+une_forme.la_largeur,
                              une_forme.rect.top+pred(k)*(une_forme.la_hauteur+
                                relation._10mm_to_log_pouce(self.decy.Get_num_value*10))+une_forme.la_hauteur, {écrit par denis Bertin}
                              mon_bitmap,0,une_forme.text_du_bouton,une_forme.taille_text_du_bouton,
                              une_forme.font_text_du_bouton,une_forme.brush1.lbColor,une_forme.nom_de_l_image);
							              un_bitmap.rop2:=une_forme.rop2; {the raster opération}
							              un_bitmap.fond:=une_forme.fond;
                            un_bitmap.transparent:=une_forme.transparent;
                            un_Calque_actif.Add(un_bitmap);
                            end
                          else
                            bool_la_premiere:=False;
                          if self.Checkbox_Creer_des_guides_aux_interstice.GetCheck=bf_checked then
                            begin
                            if k=1 then
                              begin
                              un_guide:=u_object.T_Guide_couleur.Create(une_forme.rect.Left+
                                pred(j)*(une_forme.la_largeur+relation._10mm_to_log_pouce(self.decx.Get_num_value*10))-
                                  relation._10mm_to_log_pouce(self.decx.Get_num_value*10) div 2);
                              un_guide.color:=Rec_position_de_l_image.color_guides_button;
                              wmain.MainWindow.wmsg.colec_guide_verticale.Add(un_guide);
                              end;
                            if j=1 then
                              begin
                              un_guide:=u_object.T_Guide_couleur.Create(une_forme.rect.top+
                                pred(k)*(une_forme.la_hauteur+relation._10mm_to_log_pouce(self.decy.Get_num_value*10))-
                                 relation._10mm_to_log_pouce(self.decy.Get_num_value*10) div 2);
                              un_guide.color:=Rec_position_de_l_image.color_guides_button;
                              wmain.MainWindow.wmsg.colec_guide_horizontale.Add(un_guide);
                              end;
                            end;
                          end;
                        end;
                      if self.Checkbox_Creer_des_guides_aux_interstice.GetCheck=bf_checked then
                        begin
                        un_guide:=u_object.T_Guide_couleur.Create(une_forme.rect.Left+
                          pred(j)*(une_forme.la_largeur+relation._10mm_to_log_pouce(self.decx.Get_num_value*10))-
                            relation._10mm_to_log_pouce(self.decx.Get_num_value*10) div 2);
                        un_guide.color:=Rec_position_de_l_image.color_guides_button;
                        wmain.MainWindow.wmsg.colec_guide_verticale.Add(un_guide);
                        un_guide:=u_object.T_Guide_couleur.Create(une_forme.rect.top+
                          pred(k)*(une_forme.la_hauteur+relation._10mm_to_log_pouce(self.decy.Get_num_value*10))-
                            relation._10mm_to_log_pouce(self.decy.Get_num_value*10) div 2);
                        un_guide.color:=Rec_position_de_l_image.color_guides_button;
                        wmain.MainWindow.wmsg.colec_guide_horizontale.Add(un_guide);
                        end;
                      end; // écrit par denis Bertin le 27.4.2014
                    end;
                  end;
                end;
              end;
            end;
          if self.Checkbox_Ajouter_des_cotations.GetCheck=bf_checked then
            begin
            //Les petites cotations en haut
            for l:=1 to self.nbx.Get_num_value do
              begin
              un_Calque_actif.Ds_Start_path(
                une_forme_de_reference.left+pred(l)*une_forme_de_reference.la_largeur+
                  pred(l)*relation._10mm_to_log_pouce(self.decy.Get_num_value*10),
                -une_forme_de_reference.rect.top-2*relation._10mm_to_log_pouce(100));
              un_Calque_actif.Ds_Add_ligne(une_forme_de_reference.la_largeur,0);
              un_Calque_actif.ds_draw_path.cotation.debut:=1;
              un_Calque_actif.ds_draw_path.cotation.fin:=1;
              un_Calque_actif.ds_draw_path.cotation.bool_check_incurver:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_colore:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_ferme:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_cote:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_Taquet:=true;
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_inferieur:=relation._10mm_to_log_pouce(100);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_superieur:=relation._10mm_to_log_pouce(200);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_sup_double:=relation._10mm_to_log_pouce(200);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_inf_double:=relation._10mm_to_log_pouce(100);
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_tronquer:=1;
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_visible:=1;
              un_Calque_actif.ds_draw_path.cotation.cota_cote_position:=
                4*un_Calque_actif.ds_draw_path.cotation.cota_cote_position;
              un_Calque_actif.Ds_Add_ce_chemin;
              end;
            //Les petites cotations en bas
            for l:=1 to self.nbx.Get_num_value do
              begin
              un_Calque_actif.Ds_Start_path(
                une_forme_de_reference.left+pred(l)*une_forme_de_reference.la_largeur+
                  pred(l)*relation._10mm_to_log_pouce(self.decy.Get_num_value*10),
                relation._10mm_to_log_pouce(100)+une_forme_de_reference.rect.top+self.nby.Get_num_value*(une_forme.la_hauteur+
                relation._10mm_to_log_pouce(self.decy.Get_num_value*10)));
              un_Calque_actif.Ds_Add_ligne(une_forme_de_reference.la_largeur,0);
              un_Calque_actif.ds_draw_path.cotation.debut:=1;
              un_Calque_actif.ds_draw_path.cotation.fin:=1;
              un_Calque_actif.ds_draw_path.cotation.bool_check_incurver:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_colore:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_ferme:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_cote:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_Taquet:=true;
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_inferieur:=relation._10mm_to_log_pouce(100);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_superieur:=relation._10mm_to_log_pouce(200);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_sup_double:=relation._10mm_to_log_pouce(200);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_inf_double:=relation._10mm_to_log_pouce(100);
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_tronquer:=1;
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_visible:=1;
              un_Calque_actif.ds_draw_path.cotation.cota_cote_position:=
                4*un_Calque_actif.ds_draw_path.cotation.cota_cote_position;
              un_Calque_actif.Ds_Add_ce_chemin;
              end;
            //Les petites cotations à gauche
            for l:=1 to self.nby.Get_num_value do
              begin
              un_Calque_actif.Ds_Start_path(
                une_forme_de_reference.rect.left-2*relation._10mm_to_log_pouce(100),
                une_forme_de_reference.top+pred(l)*une_forme_de_reference.la_hauteur+
                  pred(l)*relation._10mm_to_log_pouce(self.decx.Get_num_value*10));
              un_Calque_actif.Ds_Add_ligne(0,une_forme_de_reference.la_hauteur);
              un_Calque_actif.ds_draw_path.cotation.debut:=1;
              un_Calque_actif.ds_draw_path.cotation.fin:=1;
              un_Calque_actif.ds_draw_path.cotation.bool_check_incurver:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_colore:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_ferme:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_cote:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_Taquet:=true;
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_inferieur:=relation._10mm_to_log_pouce(200);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_superieur:=relation._10mm_to_log_pouce(100);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_sup_double:=relation._10mm_to_log_pouce(100);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_inf_double:=relation._10mm_to_log_pouce(200);
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_tronquer:=1;
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_visible:=1;
              un_Calque_actif.ds_draw_path.cotation.cota_cote_position:=
                4*un_Calque_actif.ds_draw_path.cotation.cota_cote_position;
              un_Calque_actif.Ds_Add_ce_chemin;
              end;
            //Les petites cotations à droite
            for l:=1 to self.nby.Get_num_value do
              begin
              un_Calque_actif.Ds_Start_path(
                une_forme_de_reference.rect.left+self.nbx.Get_num_value*(une_forme.la_largeur+
                relation._10mm_to_log_pouce(self.decx.Get_num_value*10))+relation._10mm_to_log_pouce(100),
                une_forme_de_reference.top+pred(l)*une_forme_de_reference.la_hauteur+
                  pred(l)*relation._10mm_to_log_pouce(self.decx.Get_num_value*10));
              un_Calque_actif.Ds_Add_ligne(0,une_forme_de_reference.la_hauteur);
              un_Calque_actif.ds_draw_path.cotation.debut:=1;
              un_Calque_actif.ds_draw_path.cotation.fin:=1;
              un_Calque_actif.ds_draw_path.cotation.bool_check_incurver:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_colore:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_ferme:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_cote:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_Taquet:=true;
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_inferieur:=relation._10mm_to_log_pouce(200);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_superieur:=relation._10mm_to_log_pouce(100);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_sup_double:=relation._10mm_to_log_pouce(100);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_inf_double:=relation._10mm_to_log_pouce(200);
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_tronquer:=1;
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_visible:=1;
              un_Calque_actif.ds_draw_path.cotation.cota_cote_position:=
                4*un_Calque_actif.ds_draw_path.cotation.cota_cote_position;
              un_Calque_actif.Ds_Add_ce_chemin;
              end;
            if self.Checkbox_Ajouter_les_grandes_cotation.GetCheck=bf_checked then
              begin
              {La grande cotation du bas}
              un_Calque_actif.Ds_Start_path(
                une_forme_de_reference.left,
                une_forme_de_reference.top+une_forme_de_reference.rect.top+relation._10mm_to_log_pouce(100)+self.nby.Get_num_value*(une_forme.la_hauteur+
                  relation._10mm_to_log_pouce(self.decy.Get_num_value*10))+relation._10mm_to_log_pouce(100));
              un_Calque_actif.Ds_Add_ligne(self.nbx.Get_num_value*(une_forme_de_reference.la_largeur)+
                pred(self.nbx.Get_num_value)*relation._10mm_to_log_pouce(self.decy.Get_num_value*10),0);
              un_Calque_actif.Ds_de_cette_couleur_contour(g_base.rgb_rouge);
              un_Calque_actif.ds_draw_path.epaisseur:=18; {twips}
              un_Calque_actif.ds_draw_path.epaisseur_went:=18; {twips}
              un_Calque_actif.ds_draw_path.epaisseur_seconde:=32;
              un_Calque_actif.ds_draw_path.cotation.debut:=1;
              un_Calque_actif.ds_draw_path.cotation.fin:=1;
              un_Calque_actif.ds_draw_path.cotation.bool_check_incurver:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_colore:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_ferme:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_cote:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_Taquet:=true;
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_inferieur:=relation._10mm_to_log_pouce(100);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_superieur:=relation._10mm_to_log_pouce(200);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_sup_double:=relation._10mm_to_log_pouce(200);
              un_Calque_actif.ds_draw_path.cotation.cota_taquet_inf_double:=relation._10mm_to_log_pouce(100);
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_tronquer:=1;
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_visible:=1;
              un_Calque_actif.Ds_Add_ce_chemin;
              {La grande cotation de gauche}
              un_Calque_actif.Ds_Start_path(une_forme_de_reference.left+3*relation._10mm_to_log_pouce(100)+
                self.nbx.Get_num_value*(une_forme.la_largeur+
                relation._10mm_to_log_pouce(self.decx.Get_num_value*10)),une_forme_de_reference.top);
              un_Calque_actif.Ds_Add_ligne(0,self.nby.Get_num_value*(une_forme_de_reference.la_hauteur)+
                pred(self.nby.Get_num_value)*relation._10mm_to_log_pouce(self.decx.Get_num_value*10));
              un_Calque_actif.Ds_de_cette_couleur_contour(g_base.rgb_rouge);
              un_Calque_actif.ds_draw_path.epaisseur:=18; {twips}
              un_Calque_actif.ds_draw_path.epaisseur_went:=18; {twips}
              un_Calque_actif.ds_draw_path.epaisseur_seconde:=32;
              un_Calque_actif.ds_draw_path.cotation.debut:=1;
              un_Calque_actif.ds_draw_path.cotation.fin:=1;
              un_Calque_actif.ds_draw_path.cotation.bool_check_incurver:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_colore:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_ferme:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_cote:=true;
              un_Calque_actif.ds_draw_path.cotation.bool_check_Taquet:=true;
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_tronquer:=1;
              un_Calque_actif.ds_draw_path.cotation.rec_echelle.nb_decimal_visible:=1;
              un_Calque_actif.Ds_Add_ce_chemin;
              end;
            end;
          if self.Checkbox_centrer_la_selection.GetCheck=bf_checked then
            begin
            setrect(un_rectangle,maxint,maxint,-maxint,-maxint);
            for i:=count_before to pred(un_Calque_actif.count) do
              begin
              une_forme:=wformebm.Tforme_TBitMap(un_Calque_actif.at(i));
              if une_forme<>nil then
                begin
                un_rectangle.left:=math.min(un_rectangle.Left,une_forme.left);
                un_rectangle.top:=math.min(un_rectangle.top,une_forme.top);
                un_rectangle.right:=math.max(un_rectangle.right,une_forme.right);
                un_rectangle.bottom:=math.max(un_rectangle.bottom,une_forme.bottom);
                end;
              end;
            dx:=(u_object.point_taille_page.x-(un_rectangle.Right+un_rectangle.Left)) div 2;
            dy:=(u_object.point_taille_page.y-(un_rectangle.bottom+un_rectangle.top)) div 2;
            if une_forme_de_reference<>nil then
              une_forme_de_reference.deplace(dx,dy,0);
            for i:=count_before to pred(un_Calque_actif.count) do
              begin
              une_forme:=wformebm.Tforme_TBitMap(un_Calque_actif.at(i));
              if une_forme<>nil then
                une_forme.deplace(dx,dy,0);
              end;
            end;
          end;
        end;
      end; {La case de vierzon écrit par denis bertin le 19.4.2014}
    if self.Checkbox_Effectuer_une_duplication.GetCheck=bf_checked then
      begin
      enablewindow(self.nbx.hwindow,true);
      enablewindow(self.nby.hwindow,true);
      enablewindow(self.decx.hwindow,true);
      enablewindow(self.decy.hwindow,true);
      enablewindow(getitemhandle(2000),true);
      enablewindow(getitemhandle(2001),true);
      enablewindow(getitemhandle(2002),true);
      enablewindow(getitemhandle(2003),true);
      enablewindow(getitemhandle(3000),true);
      enablewindow(getitemhandle(3001),true);
      showwindow(self.nbx.un_plus_moins.hwindow,sw_show);
      showwindow(self.nby.un_plus_moins.hwindow,sw_show);
      showwindow(self.decx.un_plus_moins.hwindow,sw_show);
      showwindow(self.decy.un_plus_moins.hwindow,sw_show);
      enablewindow(self.Checkbox_Creer_des_guides_aux_interstice.hwindow,true);
      end
    else
      begin
      enablewindow(self.nbx.hwindow,false);
      enablewindow(self.nby.hwindow,false);
      enablewindow(self.decx.hwindow,false);
      enablewindow(self.decy.hwindow,false);
      enablewindow(getitemhandle(2000),false);
      enablewindow(getitemhandle(2001),false);
      enablewindow(getitemhandle(2002),false);
      enablewindow(getitemhandle(2003),false);
      enablewindow(getitemhandle(3000),false);
      enablewindow(getitemhandle(3001),false);
      showwindow(self.nbx.un_plus_moins.hwindow,sw_hide);
      showwindow(self.nby.un_plus_moins.hwindow,sw_hide);
      showwindow(self.decx.un_plus_moins.hwindow,sw_hide);
      showwindow(self.decy.un_plus_moins.hwindow,sw_hide);
      enablewindow(self.Checkbox_Creer_des_guides_aux_interstice.hwindow,false);
      end;
    if (self.Checkbox_Effectuer_une_duplication.GetCheck=bf_checked)
    and (self.Checkbox_Creer_des_guides_aux_interstice.GetCheck=bf_checked) then
      begin
      enablewindow(getitemhandle(4500),true);
      showwindow(self.color_of_the_guides.hwindow,sw_show);
      end
    else
      begin
      enablewindow(getitemhandle(4500),false);
      showwindow(self.color_of_the_guides.hwindow,sw_hide);
      end;
    if self.Checkbox_Marque_de_decoupage.GetCheck=bf_checked then
      begin
      showwindow(color_of_the_marque.hwindow,sw_show);
      enablewindow(getitemhandle(4501),true);
      end
    else
      begin
      showwindow(color_of_the_marque.hwindow,sw_hide);
      enablewindow(getitemhandle(4501),false);
      end;
    Enablewindow(self.Checkbox_Placer_les_marques_a_lexterieur.hwindow,
      self.Checkbox_Marque_de_decoupage.GetCheck=bf_checked);
    end; {Tad_et_tod_position.WMCommand}

begin
Rec_position_de_l_image.x:=0;
Rec_position_de_l_image.y:=0;
Rec_position_de_l_image.xx:=35; {in millimeter unit}
Rec_position_de_l_image.yy:=45; {in millimeter unit}
Rec_position_de_l_image.nbx:=1; {nombre de répétition hori}
Rec_position_de_l_image.nby:=1; {nombre de répétition verti}
Rec_position_de_l_image.decx:=0; {espace des goulottes hori}
Rec_position_de_l_image.decy:=0; {espace des goulottes verti}
Rec_position_de_l_image.Checkbox_Creer_des_guides_aux_interstice:=false;
Rec_position_de_l_image.Checkbox_Marque_de_decoupage:=false;
Rec_position_de_l_image.Checkbox_centrer_la_selection:=false;
Rec_position_de_l_image.Checkbox_Placer_les_marques_a_lexterieur:=True;
Rec_position_de_l_image.Checkbox_Ajouter_des_cotations:=True;
Rec_position_de_l_image.Checkbox_Ajouter_les_grandes_cotation:=false;
Rec_position_de_l_image.color_guides_button:=g_base.rgb_rouge;
Rec_position_de_l_image.color_marque_button:=g_base.rgb_noir;
end.

Une image réalisée par guillaume romain avec le logiciel denis-draw et le module chrominance.


Une image réalisée par denis Bertin avec ce module de positionnement d'image.



Une image réalisée par denis Bertin avec son logiciel denis-draw et la fonction de projection du relief.



© copyright BeeLog