File: text.pas

package info (click to toggle)
mricron 0.20140804.1~dfsg.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,480 kB
  • ctags: 8,011
  • sloc: pascal: 114,853; sh: 49; makefile: 32
file content (91 lines) | stat: -rwxr-xr-x 2,263 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
unit text;
{$H+}

interface

uses
{$IFDEF FPC}LResources,{$ENDIF}
{$IFNDEF Unix} Windows,{$ENDIF}
  SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus, StdCtrls,Define_Types;

type

  { TTextForm }

  TTextForm = class(TForm)
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    Save1: TMenuItem;
    Closewindow1: TMenuItem;
    Copy1: TMenuItem;
    Copy2: TMenuItem;
    MemoT: TMemo;
    procedure Closewindow1Click(Sender: TObject);
    procedure Copy2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Save1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  TextForm: TTextForm;

implementation

 uses nifti_img_view;
{$IFNDEF FPC}
{$R *.DFM}
{$ENDIF}

procedure TTextForm.Closewindow1Click(Sender: TObject);
begin
	TextForm.Close;
end;

procedure TTextForm.Copy2Click(Sender: TObject);
begin
        {$IFDEF zxDarwin}
        Showmessage('Copy not yet supported with OSX: use File/Save');
        exit;
        {$ENDIF}
	MemoT.SelectAll;
	MemoT.CopyToClipboard;
end;

procedure TTextForm.FormCreate(Sender: TObject);
begin
                {$IFDEF Darwin}
        {$IFNDEF LCLgtk} //only for Carbon compile
        Copy2.ShortCut := ShortCut(Word('C'), [ssMeta]);
         Save1.ShortCut := ShortCut(Word('S'), [ssMeta]);
         Closewindow1.ShortCut := ShortCut(Word('W'), [ssMeta]);
         {$ENDIF}
        {$ENDIF}
end;

procedure TTextForm.Save1Click(Sender: TObject);
begin
     ImgForm.SaveDialog1.Filename := parsefilename(gMRIcroOverlay[kBGOverlayNum].HdrFilename);
     if kTextSep = chr(9) then
	  ImgForm.SaveDialog1.Filter := 'Tab Separated (*.tab)|*.tab|Comma Separated (*.csv)|*.csv|Text (*.txt)|*.txt'
     else
	  ImgForm.SaveDialog1.Filter := 'Comma Separated (*.csv)|*.csv|Tab Separated (*.tab)|*.tab|Text (*.txt)|*.txt';
     if kTextSep = chr(9) then
          ImgForm.SaveDialog1.DefaultExt := '.tab'
     else
         ImgForm.SaveDialog1.DefaultExt := '.csv';
     if not ImgForm.SaveDialog1.Execute then exit;
     MemoT.Lines.SaveToFile(ImgForm.SaveDialog1.Filename);
end;

{$IFDEF FPC}
initialization
  {$I Text.lrs}
{$ENDIF}


end.