{*************************************************************************
                Copyright (c) PilotLogic Software House

  Package pl_ORCA
  This file is part of CodeTyphon Studio (https://www.pilotlogic.com/)

 ***** BEGIN LICENSE BLOCK *****
 * Version: LGPL-2.1 with link exception (Modified LGPL)
 *
 * The contents of this file are subject to the 
 * GNU LIBRARY GENERAL PUBLIC LICENSE Version 2.1 (the "License")
 * with the following modification:
 * 
 * As a special exception, the copyright holders of this library give you
 * permission to link this library with independent modules to produce an
 * executable, regardless of the license terms of these independent modules,
 * and to copy and distribute the resulting executable under terms of your choice,
 * provided that you also meet, for each linked independent module, the terms
 * and conditions of the license of that module. An independent module is a
 * module which is not derived from or based on this library. If you modify this
 * library, you may extend this exception to your version of the library, but
 * you are not obligated to do so. If you do not wish to do so, delete this
 * exception statement from your version.
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * ***** END LICENSE BLOCK *****
 
***************************************************************************}

Unit orca_editor_pathdata;

{$mode objfpc}{$H+}

Interface

Uses
   LCLProc, LCLIntf, LCLType, LMessages, LResources, LazUtf8,
   Math, typinfo, IntfGraphics,
   Classes, Variants, SysUtils, Contnrs, Forms, Controls, Dialogs, Graphics,
   StdCtrls, DB, DBCtrls, ExtCtrls, Menus, Clipbrd, ActnList, ImgList,
   orca_scene2d;

Type

   TD2PathDataDesigner = Class(TD2CustomPathDataDesigner)
      d2Scene1: TD2Scene;
      Root1: TD2Background;
      previewLayout: TD2Layout;
      Layout2: TD2Layout;
      cnMemo: TD2Memo;
      btnOk: TD2Button;
      btnCancel: TD2Button;
      cnTextMemo: TD2Label;
      cnTextPreview: TD2Label;
      previewPath: TD2Path;
      btnPaste: TD2Button;
      Procedure cnMemoChange(Sender: TObject);
      Procedure btnOkClick(Sender: TObject);
      Procedure btnCancelClick(Sender: TObject);
      Procedure btnPasteClick(Sender: TObject);
   Protected
      Function GetLines: TD2WideStrings; Override;
   End;

Function fnCreateAPathDataDesigner(Sender: TObject): TD2PathDataDesigner;

Var
   GvarD2PathDataDesigner: TD2PathDataDesigner;

Implementation

{$R *.lfm}
//===================================================================
Function fnCreateAPathDataDesigner(Sender: TObject): TD2PathDataDesigner;
Var
   xDlg: TD2PathDataDesigner;
Begin
   xDlg := TD2PathDataDesigner.Create(nil);
   Result := xDlg;
End;

//======================== TD2PathDataDesigner ==========================

Function TD2PathDataDesigner.GetLines: TD2WideStrings;
Begin
   Result := cnMemo.Lines;
End;

Procedure TD2PathDataDesigner.btnOkClick(Sender: TObject);
Begin
   ModalResult := mrOk;
End;

Procedure TD2PathDataDesigner.btnCancelClick(Sender: TObject);
Begin
   ModalResult := mrCancel;
End;

Procedure TD2PathDataDesigner.btnPasteClick(Sender: TObject);
Begin
   cnMemo.SelectAll;
   cnMemo.ClearSelection;
   cnMemo.PasteFromClipboard;
End;

Procedure TD2PathDataDesigner.cnMemoChange(Sender: TObject);
Begin
   If previewLayout.Visible Then
      previewPath.Data.Data := cnMemo.TextW;
End;

//===========================================

Initialization
   VarCreateAPathDataDesigner := TD2CreateAPathDataDesigner(@fnCreateAPathDataDesigner);
End.
