unit U_ChooseListForTrunk;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxLookAndFeelPainters, StdCtrls, cxButtons, ComCtrls, ExtCtrls,
  RzPanel, cxControls, cxContainer, cxEdit, cxLabel, siComp, siLngLnk,
  cxTextEdit, cxMaskEdit, cxGraphics, cxLookAndFeels, Menus;

type
  TF_ChooseListForTrunk = class(TForm)
    RzPanel1: TRzPanel;
    lvCadLists: TListView;
    bOK: TcxButton;
    bCancel: TcxButton;
    cxLabel1: TcxLabel;
    lng_Forms: TsiLangLinked;
    cxLabel2: TcxLabel;
    edTrunkLength: TcxMaskEdit;
    Label12: TLabel;
    procedure lvCadListsSelectItem(Sender: TObject; Item: TListItem;
      Selected: Boolean);
    procedure lvCadListsChanging(Sender: TObject; Item: TListItem;
      Change: TItemChange; var AllowChange: Boolean);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  F_ChooseListForTrunk: TF_ChooseListForTrunk;

implementation
uses USCS_Main, U_CAD, U_Common, U_ESCadClasess, U_BaseCommon, U_Constants;


{$R *.dfm}

procedure TF_ChooseListForTrunk.lvCadListsSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
var
  FList: TF_CAD;
begin
end;

procedure TF_ChooseListForTrunk.lvCadListsChanging(Sender: TObject; Item: TListItem; Change: TItemChange; var AllowChange: Boolean);
var
  FList: TF_CAD; 
begin
  FList := TF_CAD(Item.Data);
  if Change <> ctText then
    if (FList.FListType <> lt_Normal) or (FList = GCadForm) then 
      AllowChange := false;
end;

procedure TF_ChooseListForTrunk.FormShow(Sender: TObject);
var
  Val: double;
begin
  try
    // система измерений
    if GCurrProjUnitOfMeasure = umSM then
      Label12.Caption := cMetric_sm;
    if GCurrProjUnitOfMeasure = umM then
      Label12.Caption := cMetric_m;
    if GCurrProjUnitOfMeasure = umIn then
      Label12.Caption := cWhitworth_in;
    if GCurrProjUnitOfMeasure = umFt then
      Label12.Caption := cWhitworth_ft;

    // EditMask
    edTrunkLength.Properties.EditMask := '\d?\d?\d?' + DecimalSeparator + '\d?\d?';
    Val := 0;
    Val := MetreToUOM(Val);
    edTrunkLength.Text := FormatFloat(ffMask, Val);;
  except
    on E: Exception do AddExceptionToLogEx('TF_ChooseListForTrunk.FormShow', E.Message);
  end;
end;

end.
