expertcad/SRC/SCSNormBase/U_BaseOptions.pas
2025-05-12 10:21:16 +03:00

1390 lines
51 KiB
ObjectPascal
Raw Permalink Blame History

unit U_BaseOptions;
interface
uses
Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RzButton, ExtCtrls, RzPanel, StdCtrls, Mask, RzEdit, RzTabs,
RzRadChk, RzCmboBx,
U_BaseCommon, U_BaseConstants, U_Common, siComp, siLngLnk, ComCtrls, RzSpnEdt,
Buttons, RzLabel{Tolik -- 02/03/2017 }, iniFiles, RzRadGrp,
USCS_Main;
type
TF_BaseOptions = class(TForm)
gbOkCancel: TRzGroupBox;
RzBitBtn1: TRzBitBtn;
RzBitBtn2: TRzBitBtn;
lng_Forms: TsiLangLinked;
pnMain: TRzPanel;
pcMain: TRzPageControl;
tsPaths: TRzTabSheet;
RzGroupBox1: TRzGroupBox;
edNBPath: TRzEdit;
btChoiceNBPath: TRzButton;
RzGroupBox2: TRzGroupBox;
edPMPath: TRzEdit;
btChoicePMPath: TRzButton;
tsNormBase: TRzTabSheet;
RzGroupBox3: TRzGroupBox;
Label1: TLabel;
Label2: TLabel;
cbMainCurrency: TRzComboBox;
cbSecondCurrency: TRzComboBox;
btChoiceMainCurrency: TRzButton;
btChoiceSecondCurrency: TRzButton;
cbDisableEditUserBase: TRzCheckBox;
tvSettingTypes: TTreeView;
lbTitleNormBase: TLabel;
tsCommon: TRzTabSheet;
lbTitleCommon: TLabel;
tsReportDesigner: TRzTabSheet;
lbTitleProjMan: TLabel;
Label4: TLabel;
cbRepDesignLang: TRzComboBox;
RzGroupBox4: TRzGroupBox;
cbControlComplectByProducer: TRzCheckBox;
cbControlJoinByNetType: TRzCheckBox;
cbControlJoinByProperties: TRzCheckBox;
cbControlComplectByProperties: TRzCheckBox;
cbRemindToBackUpBase: TRzCheckBox;
pnRemindForBackUpBase: TRzPanel;
Label5: TLabel;
Label6: TLabel;
seRemindToBackUpBaseTime: TRzSpinEdit;
Label7: TLabel;
cbUOM: TRzComboBox;
tsColor: TRzTabSheet;
lbTitleColor: TLabel;
RzGroupBox5: TRzGroupBox;
tcColorObjects: TRzTabControl;
cbColorObjectStandart: TRzCheckBox;
pnColorObject: TRzPanel;
lbColorObjectBack: TLabel;
lbColorObjectFont: TLabel;
ceColorObjectBack: TRzColorEdit;
ceColorObjectFont: TRzColorEdit;
tsEnvironmentOptions: TRzTabSheet;
lbEnvironmentOptionsTitle: TLabel;
Label3: TLabel;
ceZeroPriceComponent: TRzColorEdit;
ScrollBox1: TScrollBox;
RzGroupBox6: TRzGroupBox;
Label8: TLabel;
btChoiceDirProjects: TSpeedButton;
Label9: TLabel;
btChioceDirCompons: TSpeedButton;
Label10: TLabel;
btChoiceDirFilters: TSpeedButton;
Label11: TLabel;
btChoiceedDirBackgLayers: TSpeedButton;
Label12: TLabel;
btChoiceDirArchPlans: TSpeedButton;
Label13: TLabel;
btChioceDirDXF: TSpeedButton;
Label14: TLabel;
btChoiceDirOtherSettings: TSpeedButton;
edDirProjects: TRzEdit;
edDirCompons: TRzEdit;
edDirFilters: TRzEdit;
edDirBackgLayers: TRzEdit;
edDirArchPlans: TRzEdit;
edDirDXF: TRzEdit;
edDirOtherSettings: TRzEdit;
Label15: TLabel;
btChoiceedDirPictures: TSpeedButton;
edDirPictures: TRzEdit;
Label16: TLabel;
btChoiceDirPageFrames: TSpeedButton;
edDirPageFrames: TRzEdit;
gbLiteVersion: TRzGroupBox;
cbLiteVersion: TRzCheckBox;
cbUseLiteFunctional: TRzCheckBox;
cbUseVerticalTraces: TRzCheckBox;
Label17: TLabel;
edDirTempFolder: TRzEdit;
btChoiceDirTempFolder: TSpeedButton;
cbAllowConvertInterfaces: TRzCheckBox;
RzGroupBox7: TRzGroupBox;
ckbCurrConvNB2PMTarget: TRzRadioButton;
ckbCurrConvNB2PMSource: TRzRadioButton;
cbSendInfo: TRzCheckBox;
tsImport: TRzTabSheet;
lbImport: TLabel;
RzLabel3: TRzLabel;
cbImportSplinesByControlPoints: TRzCheckBox;
RzLabel4: TRzLabel;
RzLabel1: TRzLabel;
RzLabel2: TRzLabel;
RzLabel5: TRzLabel;
RzLabel6: TRzLabel;
RzLabel7: TRzLabel;
RzLabel8: TRzLabel;
edMaxSplinePointsCount: TEdit;
edMaxSplinePartsCount: TEdit;
edMaxPolyLinePoinsCount: TEdit;
cbConnectTraceOnClickPoint: TRzCheckBox;
cbMoveRouteToPointObject: TRzCheckBox;
tsExport: TRzTabSheet;
lbExport: TLabel;
Label19: TLabel;
edLineTypeScale: TEdit;
cbDropObjbyOneClick: TRzCheckBox;
Label18: TLabel;
cbStoreLastPaths: TRzCheckBox;
cbScaleRasterImages: TRzCheckBox;
ts3D: TRzTabSheet;
lb3D: TLabel;
cbCorrect3DModelMaterial: TRzCheckBox;
tsElectrical: TRzTabSheet;
lbElectrical: TLabel;
cbTraceElectric: TRzCheckBox;
cbShowAutoCreatedGuides: TRzCheckBox;
cbAllowDropCableToRoute: TRzCheckBox;
cbAutoRouteCable: TRzCheckBox;
cbAutoAddNetworkEquipment: TRzCheckBox;
tsReserv: TRzTabSheet;
lbReserv: TLabel;
Label21: TLabel;
mdFtpConnect: TMemo;
procedure btChoiceMainCurrencyClick(Sender: TObject);
procedure btChoiceSecondCurrencyClick(Sender: TObject);
procedure cbMainCurrencyChange(Sender: TObject);
procedure cbSecondCurrencyChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure tvSettingTypesChange(Sender: TObject; Node: TTreeNode);
procedure cbRemindToBackUpBaseClick(Sender: TObject);
procedure gbOkCancelResize(Sender: TObject);
procedure tcColorObjectsChange(Sender: TObject);
procedure cbColorObjectStandartClick(Sender: TObject);
procedure ceColorObjectBackChange(Sender: TObject);
procedure ceColorObjectFontChange(Sender: TObject);
procedure btChoiceDirClick(Sender: TObject);
procedure cbLiteVersionClick(Sender: TObject);
procedure cbUseLiteFunctionalClick(Sender: TObject);
procedure edMaxSplinePointsCountKeyPress(Sender: TObject; var Key: Char);
procedure edMaxSplinePartsCountKeyPress(Sender: TObject; var Key: Char);
procedure edMaxPolyLinePoinsCountKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure cbConnectTraceOnClickPointClick(Sender: TObject);
procedure Label18Click(Sender: TObject);
private
FOldMCurrecy: TCurrency;
FOldSCurrecy: TCurrency;
//FOldDisableEditing: Boolean;
FMCurrecy: TCurrency;
FSCurrecy: TCurrency;
FActiveColorsInfo: PColorsInfo;
FEditColorObjects: TColorObjectsIni;
FEnvDirEdits: TList;
FEnvDirButtons: TList;
//FNewRatio : Double;
//FOldMRatio: Double;
//FNewMRatio: Double;
function AddElementTypeToTree(AText: String; AIndex: Integer; ATabSheet: TRzTabSheet; ATitleLabel: TLabel): TTreeNode;
procedure AddColorObjectToPageControl(ACaption: String; AColorsInfo: PColorsInfo);
procedure AddEnvDirControlsToList(AEdit: TRzEdit; AButton: TSpeedButton; ADirType: Integer);
function GetNodeBySettingTypeIndex(ASettingTypeIndex: Integer): TTreeNode;
function GetTabSheetBySettingTypeIndex(ASettingTypeIndex: Integer): TRzTabSheet;
procedure OpenCurrencyForm(AComboBoxChange, AComboBoxNotChange: TRzComboBox; var AChangeCurr,
AOtherCurr: TCurrency{; var AChangeFlag: Boolean});
procedure ChangeComboBox(AComboChange, AComboSecond: TRzComboBox; {AID_NotChangeCurrency: Integer;}
var AChangeCurr, AOtherCurr: TCurrency{; var AChangeFlag: Boolean});
function CheckSameCurrencies(AID_CurrChanged, AID_CurrNotChanged: Integer;
ANameChanged: String): Boolean;
procedure LoadEnvDirs;
Procedure LoadEnvDirsByDefault; // Tolik 01/08/2019-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
procedure SaveEnvDirs;
procedure SetControlsByActiveColorsInfo;
procedure SetControlsByLite(AOnClickSender: TObject=nil);
procedure UpdateCurrency;
procedure UpdateDisablingEdit;
public
GForm: TForm;
function ChangeOptions(ASettingTypeIndex: Integer): Boolean;
procedure HideTabSheet(ATabSheet: TRzTabSheet);
constructor Create(AOwner: TComponent; AForm: TForm);
destructor Destroy; override;
end;
// Tolik --
var
PSplinePointCount: Integer = 500;
PPolyLinePointCount: Integer = 500;
PSplinePartsCount: Integer = 6;
PImportSplineByControlPoints: Boolean = False;
PLineTypeScale: Double = 400;
//
//var
// F_BaseOptions: TF_BaseOptions;
implementation
Uses U_BaseSettings, Unit_DM_scs, DB, U_CaseForm, U_MAIN, U_SCSComponent;
{$R *.dfm}
{ TF_BaseOptions }
procedure TF_BaseOptions.ChangeComboBox(AComboChange, AComboSecond: TRzComboBox;
{AIDSecondCombo: Integer;} var AChangeCurr, AOtherCurr: TCurrency{;
var AChangeFlag: Boolean});
var
//ID_ChangeCurr: Integer;
NewID: Integer;
IDSecondCombo: Integer;
NameChangeCurr: String;
begin
NewID := GetIDFromComboBoxRz(AComboChange);
IDSecondCombo := GetIDFromComboBoxRz(AComboSecond);
if NewID = IDSecondCombo then
begin
SelectItemByIDinComboRz(AComboSecond, AChangeCurr.ID);
AOtherCurr := GetCurrencyByID(AChangeCurr.ID, TF_Main(GForm).DM.Query_Select);
end;
AChangeCurr := GetCurrencyByID(NewID, TF_Main(GForm).DM.Query_Select);
//04.03.2011 //if Not GCanChangeCombo then
// // Exit;
//
// ID_ChangeCurr := GetIDFromComboBoxRz(AComboChange);
// NameChangeCurr := AComboChange.Text;
// if Not CheckSameCurrencies(ID_ChangeCurr, AIDSecondCombo, NameChangeCurr) then
// begin
// NewID := GetIDFromComboBoxRz(AComboChange);
// //DataSetLocateByID(F_NormBase.DM.DataSet_CURRENCY, NewId);
// //AChangeCurr := GetCurrencyFromDataSet(F_NormBase.DM.DataSet_CURRENCY);
//
// AChangeCurr := GetCurrencyByID(NewID, TF_Main(GForm).DM.Query_Select);
// end
// else
// SelectItemByIDinComboRz(AComboChange, AChangeCurr.ID);
// {begin
// CCount := AComboChange.Items.Count;
// for i := 0 to CCount - 1 do
// if (AComboChange.Properties.Items.Objects[i] as TIDGuidObject).ID = AChangeCurr.ID then
// begin
// AComboChange.ItemIndex := i;
// break;
// end;
// end; }
end;
function TF_BaseOptions.CheckSameCurrencies(AID_CurrChanged,
AID_CurrNotChanged: Integer; ANameChanged: String): Boolean;
begin
Result := false;
if AID_CurrChanged = AID_CurrNotChanged then
begin
Result := true;
MessageModal(cBaseOptions_Msg1_1+' "' +
ANameChanged + '" '+cBaseOptions_Msg1_2, cBaseOptions_Msg1_3,
MB_OK or MB_ICONINFORMATION);
end;
end;
constructor TF_BaseOptions.Create(AOwner: TComponent; AForm: TForm);
begin
GForm := AForm;
inherited Create(AOwner);
end;
destructor TF_BaseOptions.Destroy;
begin
ClearComboBoxRz(cbRepDesignLang);
ClearComboBoxRz(cbUOM);
FreeAndNil(FEnvDirEdits);
FreeAndNil(FEnvDirButtons);
inherited;
end;
function TF_BaseOptions.AddElementTypeToTree(AText: String; AIndex: Integer; ATabSheet: TRzTabSheet; ATitleLabel: TLabel): TTreeNode;
var
Node: TTreeNode;
begin
Node := tvSettingTypes.Items.Add(nil, AText);
Node.Data := ATabSheet;
ATitleLabel.Caption := AText;
end;
procedure TF_BaseOptions.AddColorObjectToPageControl(ACaption: String; AColorsInfo: PColorsInfo);
var
TabCollectionItem: TRzTabCollectionItem;
begin
TabCollectionItem := tcColorObjects.Tabs.Add;
TabCollectionItem.Caption := ACaption;
TabCollectionItem.Tag := Integer(AColorsInfo);
end;
procedure TF_BaseOptions.AddEnvDirControlsToList(AEdit: TRzEdit; AButton: TSpeedButton; ADirType: Integer);
begin
AEdit.Tag := ADirType;
AEdit.ShowHint := true;
AButton.Tag := ADirType;
AButton.Hint := cBaseOptions_Msg5;
AButton.ShowHint := true;
FEnvDirEdits.Add(AEdit);
FEnvDirButtons.Add(AButton);
end;
procedure TF_BaseOptions.HideTabSheet(ATabSheet: TRzTabSheet);
var
Node: TTreeNode;
i: Integer;
begin
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> ATabSheet
i := 0;
while i <= tvSettingTypes.Items.Count - 1 do
begin
Node := tvSettingTypes.Items[i];
if Node.Data = ATabSheet then
Node.Delete
else
Inc(i);
end;
ATabSheet.TabVisible := false;
//*** <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>-<2D><>, <20><><EFBFBD>-<2D>
if pcMain.ActivePage = ATabSheet then
tvSettingTypesChange(tvSettingTypes, tvSettingTypes.Selected);
end;
function TF_BaseOptions.GetNodeBySettingTypeIndex(ASettingTypeIndex: Integer): TTreeNode;
var
TabSheet: TRzTabSheet;
i: Integer;
Node: TTreeNode;
begin
Result := nil;
TabSheet := GetTabSheetBySettingTypeIndex(ASettingTypeIndex);
if TabSheet <> nil then
for i := 0 to tvSettingTypes.Items.Count - 1 do
begin
Node := tvSettingTypes.Items[i];
if Node.Data = TabSheet then
begin
Result := Node;
Break; //// BREAK ////
end;
end;
end;
function TF_BaseOptions.GetTabSheetBySettingTypeIndex(ASettingTypeIndex: Integer): TRzTabSheet;
begin
Result := nil;
case ASettingTypeIndex of
stiCommon:
Result := tsCommon;
stiNormBase:
Result := tsNormBase;
stiReportDesigner:
Result := tsReportDesigner;
// Tolik 03/10/2019 --
stiImport:
Result := tsImport;
stiExport:
Result := tsExport;
sti3D:
Result := ts3D;
stiElectrical:
Result := tsElectrical; // Tolik 03/02/2021 --
//
end;
end;
procedure TF_BaseOptions.OpenCurrencyForm(AComboBoxChange,
AComboBoxNotChange: TRzComboBox; var AChangeCurr,
AOtherCurr: TCurrency{; var AChangeFlag: Boolean});
var ID_Curr : Integer;
IDNew: Integer;
Accept: Boolean;
OnChangeCombo1: TNotifyEvent;
OnChangeCombo2: TNotifyEvent;
begin
Accept := false;
OnChangeCombo1 := AComboBoxChange.OnChange;
OnChangeCombo2 := AComboBoxNotChange.OnChange;
try
with F_NormBase do
begin
//SearchRecord(DM.DataSet_Currency, 'ID', AChangeCurr.ID);
//DataSetLocateByID(DM.DataSet_Currency, AChangeCurr.ID);
//ID_Curr := DM.DataSet_Currency.FN('ID').AsInteger;
ID_Curr := GetIDFromComboBoxRz(AComboBoxChange);
F_CaseForm.GIDNotDel := AOtherCurr.ID;
F_CaseForm.GIDToLocate := AChangeCurr.ID;
//F_CaseForm.GViewKind := vkCurrency;
//GCanChangeCombo := false;
//if F_NormBase.F_CaseForm.ShowModal = mrOK then
if F_NormBase.F_CaseForm.Execute(vkCurrency, fmEdit) then
begin
IDNew := F_NormBase.DM.DataSet_CURRENCY.FN('ID').AsInteger;
if IDNew = AOtherCurr.ID then
AOtherCurr := AChangeCurr;
AChangeCurr := GetCurrencyFromDataSet(F_NormBase.DM.DataSet_CURRENCY); //F_NormBase.DM.GetCurrency;
FillComboBoxRz(AComboBoxChange, F_NormBase, false, tnCurrency, fnID, fnName, '', AChangeCurr.ID);
Accept := true;
//04.03.2011 if Not CheckSameCurrencies(IDNew, AOtherCurr.ID,
// F_NormBase.DM.DataSet_CURRENCY.FN('Name').AsString) then
//begin
// AChangeCurr := GetCurrencyFromDataSet(F_NormBase.DM.DataSet_CURRENCY); //F_NormBase.DM.GetCurrency;
// FillComboBoxRz(AComboBoxChange, F_NormBase, false, tnCurrency, fnID, fnName, '', AChangeCurr.ID);
// //AChangeFlag := true;
// Accept := true;
//end;
end;
FillComboBoxRz(AComboBoxNotChange, F_NormBase, false, tnCurrency, fnID, fnName, '', AOtherCurr.ID);
if Accept = false then
FillComboBoxRz(AComboBoxChange, F_NormBase, false, tnCurrency, fnID, fnName, '', ID_Curr);
//GCanChangeCombo := true;
end;
finally
AComboBoxChange.OnChange := OnChangeCombo1;
AComboBoxNotChange.OnChange := OnChangeCombo2;
end;
end;
procedure TF_BaseOptions.btChoiceMainCurrencyClick(Sender: TObject);
begin
OpenCurrencyForm(cbMainCurrency, cbSecondCurrency, FMCurrecy, FSCurrecy{, FChangeMCurrency});
end;
procedure TF_BaseOptions.btChoiceSecondCurrencyClick(Sender: TObject);
begin
OpenCurrencyForm(cbSecondCurrency, cbMainCurrency, FSCurrecy, FMCurrecy{, FChangeSCurrency});
end;
function TF_BaseOptions.ChangeOptions(ASettingTypeIndex: Integer): Boolean;
var
OnChangeCombo1: TNotifyEvent;
OnChangeCombo2: TNotifyEvent;
OldRepDesignLangFile: String;
NodeSetting: TTreeNode;
// Tolik -- 02/03/2017 --
Ini: TIniFile;
UserLineTypeScale: double; // Tolik 10/07/2019 --
//
begin
Result := false;
try
with TF_Main(GForm) do
begin
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FOldMCurrecy := TF_Main(GForm).DM.GetCurrencyByType(ctMain);
FOldSCurrecy := TF_Main(GForm).DM.GetCurrencyByType(ctSecond);
FMCurrecy := FOldMCurrecy;
FSCurrecy := FOldSCurrecy;
OnChangeCombo1 := cbMainCurrency.OnChange;
OnChangeCombo2 := cbSecondCurrency.OnChange;
try
FillComboBoxRz(cbMainCurrency, F_NormBase, false, tnCurrency, fnID, fnName, '', FMCurrecy.ID);
FillComboBoxRz(cbSecondCurrency, F_NormBase, false, tnCurrency, fnID, fnName, '', FSCurrecy.ID);
finally
cbMainCurrency.OnChange := OnChangeCombo1;
cbSecondCurrency.OnChange := OnChangeCombo2;
end;
// <20><> <20><><EFBFBD>
SelectItemByIDinComboRz(cbUOM, GNBSettings.UOM);
ceZeroPriceComponent.SelectedColor := GSCSIni.NB.ColorZeroPriceComponent;
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
cbDisableEditUserBase.Checked := GSCSIni.NB.DisableEdit;
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cbControlJoinByNetType.Checked := GSCSIni.NB.ControlJoinByNetType;
cbControlComplectByProducer.Checked := GSCSIni.NB.ComplectControlByProducer;
cbControlJoinByProperties.Checked := GSCSIni.NB.ControlJoinByProperties;
cbControlComplectByProperties.Checked := GSCSIni.NB.ControlComplectByProperties;
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OldRepDesignLangFile := GSCSIni.PM.RepDesignLanguageFile;
if GSCSIni.PM.RepDesignLanguageFile <> '' then
SelectItemByGUIDinComboRz(cbRepDesignLang, GSCSIni.PM.RepDesignLanguageFile)
else
SelectItemByGUIDinComboRz(cbRepDesignLang, fnRepDesignLangRus);
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
cbRemindToBackUpBase.Checked := GSCSIni.NB.RemindToBackUpBase;
seRemindToBackUpBaseTime.Value := GSCSIni.NB.RemindToBackUpBaseTime;
cbRemindToBackUpBaseClick(cbRemindToBackUpBase);
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cbLiteVersion.Checked := GLiteVersion;
cbUseLiteFunctional.Checked := GUseLiteFunctional;
cbAllowConvertInterfaces.Checked := GAllowConvertInterfToUniversal;
SetControlsByLite;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cbUseVerticalTraces.Checked := GUseVerticalTraces;
cbDropObjbyOneClick.Checked := GDropObjByOneClick; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> 1 <20><><EFBFBD><EFBFBD>
cbShowAutoCreatedGuides.Checked := GShowAutoCreatedGuides; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cbStoreLastPaths.Checked := GStoreLastPaths; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
cbScaleRasterImages.Checked := GAutoScaleRasterImages; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (Tolik 09/08/2019 -- )
cbSendInfo.Checked := GSendInfo;
cbAllowDropCableToRoute.Checked := GAllowDropCableToRoute; //Tolik 28/05/2021 -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cbAutoRouteCable.Checked := GAutoRouteCableAfterTraceCreation; // Tolik 09/08/2021 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
cbAutoAddNetworkEquipment.Checked := GAutoAddNetworkEquipment; // Tolik 26/03/2024
//23.08.2012
if GSCSIni.NB.CurrencyConvertionNB2PM = cckByTarget then
ckbCurrConvNB2PMTarget.Checked := true
else
if GSCSIni.NB.CurrencyConvertionNB2PM = cckBySource then
ckbCurrConvNB2PMSource.Checked := true;
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
NodeSetting := GetNodeBySettingTypeIndex(ASettingTypeIndex);
if NodeSetting <> nil then
tvSettingTypes.Selected := NodeSetting;
FEditColorObjects := GSCSIni.Colors;
tcColorObjectsChange(tcColorObjects);
LoadEnvDirs;
// Tolik 02/03/2017 -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DWG/DXF
// Tolik -- 02/03/2017 --
Ini := nil;
try
// ProgIni := TInifile.Create(fnSCSIniFile);
Ini := TInifile.Create(GetIniPath);
except
on E: Exception do
begin
// AddExceptionToLog('F_BaseOption.Create', 'IniFile open error! ', E.Message);
Ini := nil;
end;
end;
// Tolik 10/07/2019 --
//if (Ini <> nil) and Ini.SectionExists('ImportDxf') then
if (Ini <> nil) then
begin
//
if Ini.SectionExists('ImportDxf') then
begin
edMaxSplinePointsCount.Text := Ini.ReadString('ImportDxf', 'SplinePointCount', '500');
edMaxSplinePartsCount.Text := Ini.ReadString('ImportDxf', 'SplinePartsCount', '6');
edMaxPolyLinePoinsCount.Text := Ini.ReadString('ImportDxf', 'PolyLinePointCount', '500');
cbImportSplinesByControlPoints.checked := Ini.ReadBool('ImportDxf', 'ImportSplineByControlPoints', false);
//Ini.Free;
end
else
begin
edMaxSplinePointsCount.Text := '450';
edMaxSplinePartsCount.Text := '6';
edMaxPolyLinePoinsCount.Text := '500';
cbImportSplinesByControlPoints.checked := false;
end;
if Ini.SectionExists('ExportDxf') then
begin
edLineTypeScale.Text := Ini.ReadString('ExportDxf', 'LineTypeScale', '400');
end;
// Tolik 03/03/2021 --
cbTraceElectric.Checked := GCallElectricAutoTraceMaster;
if Ini.SectionExists('Electrical') then
begin
//cbTraceElectric.Checked := Ini.ReadBool('Electrical', 'TraceElectrical', false);
cbTraceElectric.Checked := Ini.ReadBool('Electrical', 'TraceElectrical', true);
end;
//
//Tolik 02/01/2025 -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mdFtpConnect.Text := GFtpConnectStr;
if Ini.SectionExists('ReservFtp') then
begin
//cbTraceElectric.Checked := Ini.ReadBool('Electrical', 'TraceElectrical', false);
mdFtpConnect.Text := Ini.ReadString('ReservFtp', 'ConnectString', '');
end
else
mdFtpConnect.Text := '';
//
end;
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if StrToInt(edMaxSplinePointsCount.Text) < 1 then
edMaxSplinePointsCount.Text := '50';
if StrToInt(edMaxSplinePartsCount.Text) < 1 then
edMaxSplinePartsCount.Text := '6';
if strtoint(edMaxPolyLinePoinsCount.Text) < 1 then
edMaxPolyLinePoinsCount.Text := '50';
//
//Tolik -- 04/05/2017 --
if ini <> nil then
begin
cbConnectTraceOnClickPoint.Checked := Ini.ReadBool('General', 'ConnectTraceOnClickPoint', false);
cbMoveRouteToPointObject.Checked := Ini.ReadBool('General', 'MoveRouteToPointObject', false);
//cbMoveRouteToPointObject.Enabled := cbConnectTraceOnClickPoint.Checked;
ini.free;
end
else
begin
cbConnectTraceOnClickPoint.Checked := False;
cbMoveRouteToPointObject.Checked := False;
//cbMoveRouteToPointObject.Enabled := False;
end;
//
if Self.ShowModal = mrOk then
begin
Result := true;
Screen.Cursor := crHourGlass;
BeginProgress;
try
//*** NormBase
if GSCSIni.NB.DisableEdit <> cbDisableEditUserBase.Checked then
TF_Main(GForm).EnableDisableEdit(Not cbDisableEditUserBase.Checked and CheckWriteNBByUser);
if GSCSIni.NB.ColorZeroPriceComponent <> ceZeroPriceComponent.SelectedColor then
TF_Main(GForm).DefineNodesFontColorByZeroPriceComponents(ceZeroPriceComponent.SelectedColor);
GSCSIni.NB.ColorZeroPriceComponent := ceZeroPriceComponent.SelectedColor;
GSCSIni.NB.DisableEdit := cbDisableEditUserBase.Checked;
GSCSIni.NB.ControlJoinByNetType := cbControlJoinByNetType.Checked;
GSCSIni.NB.ComplectControlByProducer := cbControlComplectByProducer.Checked;
GSCSIni.NB.ControlJoinByProperties := cbControlJoinByProperties.Checked;
GSCSIni.NB.ControlComplectByProperties := cbControlComplectByProperties.Checked;
GSCSIni.NB.RemindToBackUpBase := cbRemindToBackUpBase.Checked;
GSCSIni.NB.RemindToBackUpBaseTime := Trunc(seRemindToBackUpBaseTime.Value);
//23.08.2012
if ckbCurrConvNB2PMTarget.Checked then
GSCSIni.NB.CurrencyConvertionNB2PM := cckByTarget
else if ckbCurrConvNB2PMSource.Checked then
GSCSIni.NB.CurrencyConvertionNB2PM := cckBySource;
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TF_Main(GForm).SetControlsByUseLiteFunctional(cbLiteVersion.Checked, cbUseLiteFunctional.Checked, true);
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtLiteVersion, cbLiteVersion.Checked);
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtUseLiteFunctional, cbUseLiteFunctional.Checked);
GAllowConvertInterfToUniversal := cbAllowConvertInterfaces.Checked;
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtAllowConvertInterfToUniversal, GAllowConvertInterfToUniversal);
{$IF NOT Defined(TELECOM)}
//31.03.2011 // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//31.03.2011 TF_Main(GForm).SetControlsByUseLiteFunctional(cbLiteVersion.Checked, cbUseLiteFunctional.Checked, true);
//31.03.2011 WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtLiteVersion, cbLiteVersion.Checked);
//31.03.2011 WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtUseLiteFunctional, cbUseLiteFunctional.Checked);
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtUseVerticalTraces, cbUseVerticalTraces.Checked);
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtDropObjByOneClick, cbDropObjbyOneClick.Checked);
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtShowAutoCreatedGuides, cbShowAutoCreatedGuides.Checked);//Tolik 26/03/2021 --
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtStoreLastPaths, cbStoreLastPaths.Checked);
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtAutoScaleRasterImages, cbScaleRasterImages.Checked); // Tolik 09/08/2019 -*-
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtAllowDropCableToRoute, cbAllowDropCableToRoute.Checked); // Tolik 09/08/2019 -*-
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtAutoRouteCableAfterTraceCreation, cbAutoRouteCable.Checked); // Tolik 09/08/2019 -*-
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtAutoAddNetworkEquipment, cbAutoAddNetworkEquipment.Checked); // Tolik 26/03/2024 -*-
GUseVerticalTraces := cbUseVerticalTraces.Checked;
{$IFEND}
GAutoRouteCableAfterTraceCreation := cbAutoRouteCable.Checked; // Tolik 09/08/2021 --
GAutoAddNetworkEquipment := cbAutoAddNetworkEquipment.Checked; // Tolik 26/03/2024 --
GDropObjByOneClick := cbDropObjbyOneClick.Checked; // Tolik -- 01/08/2019 --
GShowAutoCreatedGuides := cbShowAutoCreatedGuides.Checked; // Tolik 26/03/2021 --
GStoreLastPaths := cbStoreLastPaths.Checked; // Tolik -- 01/08/2019
GAutoScaleRasterImages := cbScaleRasterImages.Checked;
GAllowDropCableToRoute := cbAllowDropCableToRoute.Checked; // Tolik 28/05/2021 --
// Tolik - -03/05/2017 --
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, 'ConnectTraceOnClickPoint', cbConnectTraceOnClickPoint.Checked);
GConnectTraceOnClickPoint := cbConnectTraceOnClickPoint.Checked;
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, 'MoveRouteToPointObject', cbMoveRouteToPointObject.Checked);
//GMoveRouteToPointObject := (cbMoveRouteToPointObject.Enabled and cbMoveRouteToPointObject.Checked);
GMoveRouteToPointObject := cbMoveRouteToPointObject.Checked;
//
WriteSetting(fnSCSIniFile, dtBoolean, scGeneral, idtSendInfo, cbSendInfo.Checked);
GSendInfo := cbSendInfo.Checked;
UpdateCurrency;
UpdateDisablingEdit;
//WriteOptionsToINI;
if GetIDFromComboBoxRz(cbUOM) <> GNBSettings.UOM then
begin
GNBSettings.UOM := GetIDFromComboBoxRz(cbUOM);
UpdateTableFieldAllRec(TF_Main(GForm).DM.Query_Operat, tnSettings, fnUOM, GNBSettings.UOM);
TF_Main(GForm).FUOM := GNBSettings.UOM;
TF_Main(GForm).SetUOMToControls;
end;
//*** ProjMan
GSCSIni.PM.RepDesignLanguageFile := GetGUIDFromComboBoxRz(cbRepDesignLang);
if GSCSIni.PM.RepDesignLanguageFile <> OldRepDesignLangFile then
if Assigned(TF_Main(GForm).FProjectMan.F_ResourceReport) then
TF_Main(GForm).FProjectMan.F_ResourceReport.DefineRepDesignLanguage;
GSCSIni.Colors := FEditColorObjects;
// Tolik 02/03/2017 --
Ini := TIniFile.Create(GetIniPath);
if strtoint(edMaxSplinePointsCount.Text) > 1 then // <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ini.WriteInteger('ImportDxf','SplinePointCount' , strtoint(edMaxSplinePointsCount.Text))
else
ini.WriteInteger('ImportDxf','SplinePointCount' , 50);
if strtoint(edMaxSplinePartsCount.Text) > 0 then
ini.WriteInteger('ImportDxf','SplinePartsCount' , strtoint(edMaxSplinePartsCount.Text))
else
ini.WriteInteger('ImportDxf','SplinePartsCount' , 6);
if strtoint(edMaxPolyLinePoinsCount.Text) > 1 then
ini.WriteInteger('ImportDxf','PolyLinePointCount' , strtoint(edMaxPolyLinePoinsCount.Text))
else
ini.WriteInteger('ImportDxf','PolyLinePointCount' , 50);
ini.WriteBool('ImportDxf','ImportSplineByControlPoints', cbImportSplinesByControlPoints.checked);
// Tolik 10/07/2019 -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> DXF/DWG
try
UserLineTypeScale := StrToFloat_My(edLineTypeScale.Text);
except
on E: Exception do UserLineTypeScale := 400;
end;
ini.WriteFloat('ExportDxf','LineTypeScale', UserLineTypeScale);
ini.WriteBool('3D', 'Correct3DModelMaterial', cbCorrect3DModelMaterial.Checked);
// Tolik -- 02/03/2021 --
ini.WriteBool('Electrical', 'TraceElectrical', cbTraceElectric.Checked);
GCallElectricAutoTraceMaster := cbTraceElectric.Checked;
//
//Tolik 02/01/2025 -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ini.WriteString('ReservFtp', 'ConnectString', mdFtpConnect.Text);
GFtpConnectStr := mdFtpConnect.Text;
FSCS_Main.mnuReserv.Enabled := GFtpConnectStr <> '';
//
Ini.Free;
//
FNormBase.WriteOptionsToINI;
FProjectMan.WriteOptionsToINI;
WriteColors(GSCSIni);
SaveEnvDirs;
finally
EndProgress;
Screen.Cursor := crDefault;
end;
end;
end;
except
on E: Exception do AddExceptionToLog('TF_BaseOptions.ChangeOptions: '+E.Message);
end;
end;
procedure TF_BaseOptions.Label18Click(Sender: TObject);
begin
LoadEnvDirsByDefault;
end;
// Tolik 01/08/2019 --
procedure TF_BaseOptions.LoadEnvDirsByDefault;
var
i: Integer;
DirEdit: TRzEdit;
begin
for i := 0 to FEnvDirEdits.Count - 1 do
begin
DirEdit := TRzEdit(FEnvDirEdits[i]);
DirEdit.Text := ExtractDirByCategoryTypeDefault(DirEdit.Tag);
DirEdit.Hint := DirEdit.Text;
end;
end;
//
procedure TF_BaseOptions.LoadEnvDirs;
var
i: Integer;
DirEdit: TRzEdit;
begin
for i := 0 to FEnvDirEdits.Count - 1 do
begin
DirEdit := TRzEdit(FEnvDirEdits[i]);
DirEdit.Text := ExtractDirByCategoryType(DirEdit.Tag);
DirEdit.Hint := DirEdit.Text;
end;
end;
procedure TF_BaseOptions.SaveEnvDirs;
var
i: Integer;
DirEdit: TRzEdit;
DefPath: String;
begin
for i := 0 to FEnvDirEdits.Count - 1 do
begin
DirEdit := TRzEdit(FEnvDirEdits[i]);
DefPath := ExtractDefDirByCategoryType(DirEdit.Tag);
if AnsiUpperCaseFileName(DefPath) = AnsiUpperCaseFileName(DirEdit.Text) then
WriteEnvironmentDir(DirEdit.Tag, '')
else
WriteEnvironmentDir(DirEdit.Tag, DirEdit.Text);
end;
end;
procedure TF_BaseOptions.SetControlsByActiveColorsInfo;
begin
lbColorObjectBack.Enabled := FActiveColorsInfo.Active;
ceColorObjectBack.Enabled := FActiveColorsInfo.Active;
lbColorObjectFont.Enabled := FActiveColorsInfo.Active;
ceColorObjectFont.Enabled := FActiveColorsInfo.Active;
pnColorObject.Enabled := FActiveColorsInfo.Active;
end;
procedure TF_BaseOptions.SetControlsByLite(AOnClickSender: TObject=nil);
begin
{IGOR} //D0000006315
(*
cbUseLiteFunctional.Enabled := Not cbLiteVersion.Checked;
cbAllowConvertInterfaces.Enabled := Not cbLiteVersion.Checked and cbUseLiteFunctional.Checked;
if cbLiteVersion.Checked then
begin
cbUseLiteFunctional.Checked := true;
cbAllowConvertInterfaces.Checked := true;
end
else
if (AOnClickSender = cbLiteVersion) or (AOnClickSender = cbUseLiteFunctional) then
begin
if TRzCheckBox(AOnClickSender).Checked then
cbAllowConvertInterfaces.Checked := true;
end;
*)
end;
procedure TF_BaseOptions.UpdateCurrency;
var //ID_Component: Integer;
//OldTick: Cardinal;
//CurrTick: Cardinal;
ChangedMCurrency: Boolean;
ChangedSCurrency: Boolean;
{
procedure RefreshPriceFields(AFormBase: TForm; ATableName: String; APriceFields: TStringList);
var IDList: TList;
i, j: Integer;
CurrID: Integer;
PriceValue: Double;
begin
try
try
with TF_Main(AFormBase).DM do
begin
IDList := TList.Create;
SetSQLToQuery(scsQSelect, ' select id from '+ATableName+' ');
IntFieldToList(IDList, scsQSelect, fnID);
for i := 0 to APriceFields.Count - 1 do
begin
scsQSelect.Close;
scsQSelect.SQL.Clear;
scsQSelect.SQL.Add(' select '+APriceFields.Strings[i]+' from '+ATableName+
' where id = :id ');
scsQOperat.Close;
scsQOperat.SQL.Clear;
scsQOperat.SQL.Add(' update '+ATableName+' set '+
APriceFields.Strings[i]+' = :PriceValue '+
' where id = :id ');
for j := 0 to IDList.Count - 1 do
begin
CurrID := Integer(IDList.Items[j]^);
scsQSelect.Close;
scsQSelect.SetParamAsInteger('id', CurrID);
scsQSelect.ExecQuery;
PriceValue := 0;
PriceValue := scsQSelect.GetFNAsFloat(APriceFields.Strings[i]);
if PriceValue > 0 then
begin
//PriceValue := PriceValue * (FirstCurr.Ratio / Curr1.Ratio);
//PriceValue := RoundIBD(PriceValue, 7);
PriceValue := GetPriceAfterChangeCurrency(PriceValue, FOldMCurrecy, FMCurrecy);
scsQOperat.Close;
scsQOperat.SetParamAsFloat('PriceValue', PriceValue);
scsQOperat.SetParamAsInteger('id', CurrID);
scsQOperat.ExecQuery;
end;
end;
end;
end;
except
on E: Exception do AddExceptionToLog('TF_ActiveCurrency.RefreshPriceFields: '+E.Message);
end;
finally
FreeList(IDList);
end;
end;
procedure RefreshPrices(AGDBMode: TDBKind);
var ComponForm: TF_Main;
//ID_Compon: Integer;
ComponPriceFields: TStringList;
NormsPriceFields: TStringList;
NormResoureRelPriceFields: TStringList;
ResourcesPriceFields: TStringList;
begin
try
try
ComponForm := nil;
case AGDBMode of
bkNormBase:
ComponForm := F_NormBase;
bkProjectManager:
ComponForm := F_ProjMan;
end;
with ComponForm do
begin
ComponPriceFields := TStringList.Create;
ComponPriceFields.Add(fnPriceSupply);
ComponPriceFields.Add(fnPrice);
ComponPriceFields.Add(fnPriceCalc);
RefreshPriceFields(TForm(ComponForm), 'component', ComponPriceFields);
NormsPriceFields := TStringList.Create;
NormsPriceFields.Add('Cost');
NormsPriceFields.Add('Total_Cost');
RefreshPriceFields(TForm(ComponForm), 'norms', NormsPriceFields);
NormResoureRelPriceFields := TStringList.Create;
NormResoureRelPriceFields.Add('Cost');
RefreshPriceFields(TForm(ComponForm), 'norm_resource_rel', NormResoureRelPriceFields);
ResourcesPriceFields := TStringList.Create;
ResourcesPriceFields.Add('Price');
ResourcesPriceFields.Add(fnAdditionalPrice);
RefreshPriceFields(TForm(ComponForm), 'resources', ResourcesPriceFields);
if ComponForm.GDBMode = bkNormBase then
begin
RefreshPriceFields(TForm(ComponForm), 'nb_norm_resource_rel', NormResoureRelPriceFields);
RefreshPriceFields(TForm(ComponForm), 'nb_resources', ResourcesPriceFields);
end;
end;
except
on E: Exception do AddExceptionToLog('RefreshPrices: '+E.Message);
end;
finally
FreeAndNil(ComponPriceFields);
FreeAndNil(NormsPriceFields);
FreeAndNil(NormResoureRelPriceFields);
FreeAndNil(ResourcesPriceFields);
end;
end;
}
procedure RefreshFromat(AGDBMode: TDBKind);
var ComponForm: TF_Main;
//ID_Compon: Integer;
begin
ComponForm := nil;
case AGDBMode of
bkNormBase:
ComponForm := F_NormBase;
bkProjectManager:
ComponForm := F_ProjMan;
end;
with ComponForm do
begin
//LoadCurrencyFormat;
SetCurrencyBriefToControls;
Tree_Catalog.OnChange(Tree_Catalog, Tree_Catalog.Selected);
//ShowPrice;
end;
end;
begin
ChangedMCurrency := false;
ChangedSCurrency := false;
if Not CmpRecords(Integer(@FOldMCurrecy), Integer(@FMCurrecy), SizeOf(FOldMCurrecy), SizeOf(FOldMCurrecy)) then
ChangedMCurrency := true;
if Not CmpRecords(Integer(@FOldSCurrecy), Integer(@FSCurrecy), SizeOf(FOldSCurrecy), SizeOf(FOldSCurrecy)) then
ChangedSCurrency := true;
with TF_Main(GForm).DM do
begin
//DataSet_CURRENCY.DisableControls;
try
//OldTick := GetTickCount;
if ChangedMCurrency or ChangedSCurrency then
begin
if ChangedMCurrency then
begin
ChengeCurrencyRatiosWithPrices(FOldMCurrecy, FMCurrecy, FSCurrecy, Query_Select, Query_Operat);
end
else
if ChangedSCurrency then
begin
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SetSQLToFIBQuery(TF_Main(GForm).DM.Query_Operat, GetSQLByParams(qtUpdate, tnCurrency,
fnMain+' = '''+IntTostr(ctSecond)+'''', nil, fnMain), false);
TF_Main(GForm).DM.Query_Operat.ParamByName(fnMain).AsInteger := ctSimple;
TF_Main(GForm).DM.Query_Operat.ExecQuery;
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SetSQLToFIBQuery(TF_Main(GForm).DM.Query_Operat, GetSQLByParams(qtUpdate, tnCurrency, fnID+' = :'+fnID, nil, fnMain), false);
TF_Main(GForm).DM.Query_Operat.ParamByName(fnID).AsInteger := FSCurrecy.ID;
TF_Main(GForm).DM.Query_Operat.ParamByName(fnMain).AsInteger := ctSecond;
TF_Main(GForm).DM.Query_Operat.ExecQuery;
end;
TF_Main(GForm).GSCSBase.NBSpravochnik.LoadCurrencies;
end;
TF_Main(GForm).GCurrencyM := FMCurrecy;
TF_Main(GForm).GCurrencyS := FSCurrecy;
RefreshFromat(bkNormBase);
//*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with F_ProjMan do
begin
if Assigned(GSCSBase.CurrProject) then
if GSCSBase.CurrProject.Active then
GSCSBase.CurrProject.UpdatePrices;
end;
//RefreshFromat(bkProjectManager);
//CurrTick := GetTickCount - OldTick;
//CurrTick := GetTickCount - OldTick;
finally
//DataSet_CURRENCY.EnableControls;
EndProgress;
Screen.Cursor := crDefault;
end;
end;
end;
procedure TF_BaseOptions.UpdateDisablingEdit;
begin
with TF_Main(GForm) do
EnableDisableEdit(Not cbDisableEditUserBase.Checked and CheckWriteNBByUser);
end;
procedure TF_BaseOptions.cbMainCurrencyChange(Sender: TObject);
begin
ChangeComboBox(cbMainCurrency, cbSecondCurrency, {GetIDFromComboBoxRz(cbSecondCurrency),} FMCurrecy, FSCurrecy);
end;
procedure TF_BaseOptions.cbSecondCurrencyChange(Sender: TObject);
begin
ChangeComboBox(cbSecondCurrency, cbMainCurrency, {GetIDFromComboBoxRz(cbMainCurrency),} FSCurrecy, FMCurrecy);
end;
procedure TF_BaseOptions.FormCreate(Sender: TObject);
// Tolik --
var ProgIni: TIniFile;
//
procedure AddUOMToCombo(AUOM: Integer);
begin
AddIDGUIDToComboRz(AUOM, '', GetNameUOM(AUOM, false), cbUOM);
end;
begin
//Tolik 01/11/2019 --
seRemindToBackUpBaseTime.Max := 0;
seRemindToBackUpBaseTime.Min := 0;
cbLiteVersion.Checked := False;
{IGOR} //D0000006315
cbLiteVersion.Enabled := False;
cbAllowConvertInterfaces.Enabled := False;
//*** <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
tvSettingTypes.Items.Clear;
AddElementTypeToTree(cBaseOptions_Msg2_1, stiCommon, tsCommon, lbTitleCommon);
AddElementTypeToTree(cBaseOptions_Msg2_2, stiNormBase, tsNormBase, lbTitleNormBase);
AddElementTypeToTree(cBaseOptions_Msg2_4, stiColor, tsColor, lbTitleColor);
AddElementTypeToTree(cBaseOptions_Msg2_3, stiReportDesigner, tsReportDesigner, lbTitleProjMan);
AddElementTypeToTree(cBaseOptions_Msg2_5, stiEnvironmentOptions, tsEnvironmentOptions, lbEnvironmentOptionsTitle);
// Tolik -- 02/03/2017 --
AddElementTypeToTree(cBaseOptions_Msg2_6, stiImport, tsImport, lbImport);
//
AddElementTypeToTree(cBaseOptions_Msg2_7, stiExport, tsExport, lbExport); // Tolik 11/07/2019
AddElementTypeToTree(cBaseOptions_Msg2_8, sti3D, ts3D, lb3D); // Tolik 11/07/2019
AddElementTypeToTree(cBaseOptions_Msg2_9, stiElectrical, tsElectrical, lbElectrical); // Tolik 02/03/2021 -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//
AddElementTypeToTree(cBaseOptions_Msg2_10, stiReserv, tsReserv, lbReserv); // Tolik 28/12/2024 -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
tvSettingTypes.Selected := tvSettingTypes.Items[1];
//*** <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
AddIDGUIDToComboRz(lniRus, fnRepDesignLangRus, cBaseOptions_Msg3_1, cbRepDesignLang);
AddIDGUIDToComboRz(lniUkr, fnRepDesignLangUkr, cBaseOptions_Msg3_2, cbRepDesignLang);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
AddUOMToCombo(umSantimetr);
AddUOMToCombo(umMetr);
AddUOMToCombo(umInch);
AddUOMToCombo(umFoot);
{$IF (Defined (TRIAL_SCS) or Defined (FINAL_SCS)) and Not Defined(BASEADM_SCS) and Not Defined(SCS_PANDUIT)}
cbUOM.ReadOnly := true;
{$IFEND}
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
tcColorObjects.RowOverlap := 1;
tcColorObjects.TabStyle := tsRoundCorners;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ZeroMemory(@FEditColorObjects, SizeOf(TColorObjectsIni));
tcColorObjects.Tabs.Clear;
AddColorObjectToPageControl(cBaseOptions_Msg4_1, @FEditColorObjects.Resource);
AddColorObjectToPageControl(cBaseOptions_Msg4_2, @FEditColorObjects.ResourceCompon);
{$IF Not Defined(NORMSCS_PE) and Not Defined(SCS_SPA)}
AddColorObjectToPageControl(cBaseOptions_Msg4_3, @FEditColorObjects.Norm);
{$IFEND}
AddColorObjectToPageControl(cNameTotalkolvo, @FEditColorObjects.TotalKolvo);
tcColorObjects.TabIndex := 0; //tcColorObjectsChange(tcColorObjects);
SetStyleToRZColorEdit(ceColorObjectBack);
SetStyleToRZColorEdit(ceColorObjectFont);
ceZeroPriceComponent.DefaultColorCaption := cColorEdit_DefaultColorCaption;
ceZeroPriceComponent.CustomColorCaption := cColorEdit_CustomColorCaption;
{$IF Defined(TELECOM)}
//gbLiteVersion.Visible := false;
cbUseVerticalTraces.Visible := false;
{$IFEND}
FEnvDirEdits := TList.Create;
FEnvDirButtons := TList.Create;
AddEnvDirControlsToList(edDirProjects, btChoiceDirProjects, dctProjs);
AddEnvDirControlsToList(edDirCompons, btChioceDirCompons, dctCompons);
AddEnvDirControlsToList(edDirOtherSettings, btChoiceDirOtherSettings, dctOtherSettings);
AddEnvDirControlsToList(edDirFilters, btChoiceDirFilters, dctFilters);
AddEnvDirControlsToList(edDirBackgLayers, btChoiceedDirBackgLayers, dctBackgLayers);
AddEnvDirControlsToList(edDirArchPlans, btChoiceDirArchPlans, dctArchPlans);
AddEnvDirControlsToList(edDirDXF, btChioceDirDXF, dctDXF);
AddEnvDirControlsToList(edDirPictures, btChoiceedDirPictures, dctPictures);
AddEnvDirControlsToList(edDirPageFrames, btChoiceDirPageFrames, dctStamps);
AddEnvDirControlsToList(edDirTempFolder, btChoiceDirTempFolder, dctTemp);
// Tolik -- 02/03/2017 --
ProgIni := nil;
try
// ProgIni := TInifile.Create(fnSCSIniFile);
ProgIni := TInifile.Create(GetIniPath);
except
on E: Exception do
begin
// AddExceptionToLog('F_BaseOption.Create', 'IniFile open error! ', E.Message);
ProgIni := nil;
end;
end;
// Tolik 02/03/2021 --
if (ProgIni <> nil) and ProgIni.SectionExists('Electrical') then
begin
//cbTraceElectric.Checked := ProgIni.ReadBool('Electrical', 'TraceElectrical', false);
cbTraceElectric.Checked := ProgIni.ReadBool('Electrical', 'TraceElectrical', true);
end;
//
//Tolik 02/01/2025 --
if (ProgIni <> nil) and ProgIni.SectionExists('ReservFtp') then
begin
mdFtpConnect.Text := ProgIni.ReadString('ReservFtp', 'ConnectString', '');
end;
//
if (ProgIni <> nil) and ProgIni.SectionExists('ImportDxf') then
begin
edMaxSplinePointsCount.Text := ProgIni.ReadString('ImportDxf', 'SplinePointCount', '500');
edMaxSplinePartsCount.Text := ProgIni.ReadString('ImportDxf', 'PolyLinePointCount', '500');
edMaxPolyLinePoinsCount.Text := ProgIni.ReadString('ImportDxf', 'SplinePartsCount', '6');
cbImportSplinesByControlPoints.checked := ProgIni.ReadBool('ImportDxf', 'ImportSplineByControlPoints', false);
//ProgIni.free;
end
else
begin
edMaxSplinePointsCount.Text := '450';
edMaxSplinePartsCount.Text := '6';
edMaxPolyLinePoinsCount.Text := '500';
cbImportSplinesByControlPoints.checked := false;
end;
// Tolik -- 03/05/2017 --
if (ProgIni <> nil) then
begin
cbConnectTraceOnClickPoint.Checked := ProgIni.ReadBool('General', 'ConnectTraceOnClickPoint', false);
cbMoveRouteToPointObject.Checked := ProgIni.ReadBool('General', 'MoveRouteToPointObject', false);
{if cbConnectTraceOnClickPoint.Checked then
cbMoveRouteToPointObject.Enabled := True
else
cbMoveRouteToPointObject.Enabled := False;}
end
else
begin
cbConnectTraceOnClickPoint.Checked := False;
cbMoveRouteToPointObject.Checked := False;
//cbMoveRouteToPointObject.Enabled := False;
end;
//
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if StrToInt(edMaxSplinePointsCount.Text) < 1 then
edMaxSplinePointsCount.Text := '50';
if StrToInt(edMaxSplinePartsCount.Text) < 1 then
edMaxSplinePartsCount.Text := '6';
if strtoint(edMaxPolyLinePoinsCount.Text) < 1 then
edMaxPolyLinePoinsCount.Text := '50';
//
// Tolik 10/07/2019 -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> DXF/DWG
if ((ProgIni <> nil) and ProgIni.SectionExists('ExportDxf')) then
begin
edLineTypeScale.Text := ProgIni.ReadString('ExportDxf', 'LineTypeScale', '400');
//ProgIni.free;
end
else
edLineTypeScale.Text := '400';
//
// Tolik 03/10/2019 -- 3D
if ((ProgIni <> nil) and ProgIni.SectionExists('3D')) then
begin
cbCorrect3DModelMaterial.Checked := ProgIni.ReadBool('3D', 'Correct3DModelMaterial', true);
ProgIni.free;
end
else
cbCorrect3DModelMaterial.Checked := true;
//
end;
procedure TF_BaseOptions.tvSettingTypesChange(Sender: TObject;
Node: TTreeNode);
var
TabSheet: TRzTabSheet;
begin
if Node <> nil then
begin
TabSheet := Node.Data;
if TabSheet <> nil then
pcMain.ActivePage := TabSheet;
end;
end;
procedure TF_BaseOptions.cbRemindToBackUpBaseClick(Sender: TObject);
begin
seRemindToBackUpBaseTime.Enabled := cbRemindToBackUpBase.Checked;
end;
procedure TF_BaseOptions.gbOkCancelResize(Sender: TObject);
begin
SetMiddleControlChilds(TControl(Sender), TControl(Self));
end;
procedure TF_BaseOptions.tcColorObjectsChange(Sender: TObject);
begin
FActiveColorsInfo := PColorsInfo(tcColorObjects.Tabs[tcColorObjects.TabIndex].Tag);
cbColorObjectStandart.OnClick := nil;
ceColorObjectBack.OnChange := nil;
ceColorObjectFont.OnChange := nil;
try
cbColorObjectStandart.Checked := Not FActiveColorsInfo.Active;
ceColorObjectBack.SelectedColor := FActiveColorsInfo.Back;
ceColorObjectFont.SelectedColor := FActiveColorsInfo.Font;
finally
cbColorObjectStandart.OnClick := cbColorObjectStandartClick;
ceColorObjectBack.OnChange := ceColorObjectBackChange;
ceColorObjectFont.OnChange := ceColorObjectFontChange;
end;
SetControlsByActiveColorsInfo;
end;
procedure TF_BaseOptions.cbColorObjectStandartClick(Sender: TObject);
begin
FActiveColorsInfo.Active := Not cbColorObjectStandart.Checked;
SetControlsByActiveColorsInfo;
end;
procedure TF_BaseOptions.ceColorObjectBackChange(Sender: TObject);
begin
FActiveColorsInfo.Back := ceColorObjectBack.SelectedColor;
end;
procedure TF_BaseOptions.ceColorObjectFontChange(Sender: TObject);
begin
FActiveColorsInfo.Font := ceColorObjectFont.SelectedColor;
end;
procedure TF_BaseOptions.btChoiceDirClick(Sender: TObject);
var
DirEdit: TRzEdit;
NewDirName: string;
begin
DirEdit := TRzEdit(GetControlFromListByTag(FEnvDirEdits, TControl(Sender).Tag));
if DirEdit <> nil then
begin
//NewDirName := TF_Main(GForm).BrowseNewDirName(cBaseOptions_Msg5,
// DirEdit.Text,
// '');
NewDirName := BrowseDialog(cBaseOptions_Msg5, DirEdit.Text);
if NewDirName <> '' then
begin
DirEdit.Text := NewDirName;
DirEdit.Hint := NewDirName;
end;
end;
end;
procedure TF_BaseOptions.cbLiteVersionClick(Sender: TObject);
begin
SetControlsByLite(Sender);
end;
procedure TF_BaseOptions.cbUseLiteFunctionalClick(Sender: TObject);
begin
SetControlsByLite(Sender);
end;
procedure TF_BaseOptions.edMaxSplinePointsCountKeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9']) then Key := #0;
end;
procedure TF_BaseOptions.edMaxSplinePartsCountKeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9']) then Key := #0;
end;
procedure TF_BaseOptions.edMaxPolyLinePoinsCountKeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9']) then Key := #0;
end;
procedure TF_BaseOptions.FormShow(Sender: TObject);
begin
{ PSplinePointCount: Integer = ReadSetting(fnSCSIniFile, dtBoolean, scImportDXF, SplinePointCount, 500);
PPolyLinePointCount: Integer = ReadSetting(fnSCSIniFile, dtBoolean, scImportDXF, PolyLinePointCount, 500);
PSplinePartsCount: Integer = ReadSetting(fnSCSIniFile, dtBoolean, scImportDXF, SplinePartsCount, 6);
PImportSplineByControlPoints: := ReadSetting(fnSCSIniFile, dtBoolean, scImportDXF, ImportSplineByControlPoints, false);}
end;
procedure TF_BaseOptions.cbConnectTraceOnClickPointClick(Sender: TObject);
begin
if not cbConnectTraceOnClickPoint.Checked then
begin
//cbMoveRouteToPointObject.Enabled := False;
//GMoveRouteToPointObject := False;
end
else
begin
//cbMoveRouteToPointObject.Enabled := True;
//GMoveRouteToPointObject := cbMoveRouteToPointObject.Checked;
end;
end;
end.