/
YakuninAV
/
Convertors
Обзор
Документация
Войти
/
YakuninAV
/
Convertors
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
_Apps/EstCnvConfigForm.pas
117 строк
4 KB
YakuninAV
begin with gitflick
31 июл 2026, 15:21
31 июл 2026, 15:21
1dc0fc6
Код
Авторство
О чём код?
unit EstCnvConfigForm; {$I mormot.defines.inc} interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, System.ImageList, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ImgList, Vcl.ExtDlgs, Vcl.Buttons, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.ComCtrls,// Vcl.ExtDlgs, Vcl.Buttons, mormot.core.base, mormot.core.variants, mormot.core.os, mormot.core.unicode, mormot.core.text, mormot.core.data ; type TfrmConfig = class(TForm) pnlBottom: TPanel; pnlClient: TPanel; pgcApps: TPageControl; tsTS: TTabSheet; tsGGE: TTabSheet; eViewerPath: TButtonedEdit; eSchemaFile: TButtonedEdit; lbl1: TLabel; lbl2: TLabel; ImageList1: TImageList; eBooksFolder: TButtonedEdit; lbl3: TLabel; SrcFileDialog: TOpenTextFileDialog; btnOK: TBitBtn; procedure eSchemaFileRightButtonClick(Sender: TObject); procedure btnOKClick(Sender: TObject); private FConfig: PDocVariantData; procedure SetConfig(const Value: PDocVariantData); function GetConfig: PDocVariantData; { Private declarations } procedure ShowConfig; public { Public declarations } property Config: PDocVariantData read GetConfig write SetConfig; end; function ShowConfigForm(ConfigData: PDocVariantData): Boolean; implementation {$R *.dfm} function ShowConfigForm(ConfigData: PDocVariantData): Boolean; var frmConfig: TfrmConfig; t:TDocVariantData; begin frmConfig:= TfrmConfig.Create(nil); try t.InitCopy(Variant(ConfigData^), JSON_OPTIONS[False]); frmConfig.Config:=@t; Result:=(frmConfig.ShowModal=mrOk); if Result then begin ConfigData^.Clear; ConfigData^.InitCopy(Variant(t), JSON_OPTIONS[False]); end; finally frmConfig.Free; end; end; { TfrmConfig } procedure TfrmConfig.btnOKClick(Sender: TObject); begin if FConfig^.GetValueIndex('GGE')>=0 then FConfig^.S['GGE']:=eViewerPath.Text else FConfig^.AddValue('GGE',StringToUTF8(eViewerPath.Text)); if FConfig^.GetValueIndex('Books')>=0 then FConfig^.S['Books']:=eBooksFolder.Text else FConfig^.AddValue('Books',StringToUTF8(eBooksFolder.Text)); if FConfig^.GetValueIndex('Schema')>=0 then FConfig^.S['Schema']:=eSchemaFile.Text else FConfig^.AddValue('Schema',StringToUTF8(eSchemaFile.Text)); end; procedure TfrmConfig.eSchemaFileRightButtonClick(Sender: TObject); begin SrcFileDialog.Filter:='*.xsd'; SrcFileDialog.Title:='�������� ����, ���������� ����� ���-�����'; if SrcFileDialog.Execute() then begin eSchemaFile.Text:=SrcFileDialog.FileName; end; end; function TfrmConfig.GetConfig: PDocVariantData; begin if FConfig^.GetValueIndex('GGE')>=0 then FConfig^.S['GGE']:=eViewerPath.Text else FConfig^.AddValue('GGE',StringToUTF8(eViewerPath.Text)); if FConfig^.GetValueIndex('Books')>=0 then FConfig^.S['Books']:=eBooksFolder.Text else FConfig^.AddValue('Books',StringToUTF8(eBooksFolder.Text)); if FConfig^.GetValueIndex('Schema')>=0 then FConfig^.S['Schema']:=eSchemaFile.Text else FConfig^.AddValue('Schema',StringToUTF8(eSchemaFile.Text)); Result:=FConfig; end; procedure TfrmConfig.SetConfig(const Value: PDocVariantData); begin FConfig := Value; ShowConfig(); end; procedure TfrmConfig.ShowConfig; var r: RawUTF8; begin if FConfig^.GetAsRawUTF8('GGE',r) then eViewerPath.Text:=UTF8ToString(r) else eViewerPath.Text:=''; if FConfig^.GetAsRawUTF8('Books',r) then eBooksFolder.Text:=UTF8ToString(r) else eBooksFolder.Text:=''; if FConfig^.GetAsRawUTF8('Schema',r) then eSchemaFile.Text:=UTF8ToString(r) else eSchemaFile.Text:=''; end; end.