replacedialogform.pas 2.55 KB
Newer Older
mse1's avatar
mse1 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
{ MSEide Copyright (c) 1999-2006 by Martin Schreiber
   
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
}
unit replacedialogform;

mse1's avatar
mse1 committed
19
{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
mse1's avatar
mse1 committed
20 21 22

interface
uses
mse1's avatar
mse1 committed
23
 mseguiglob,msegui,mseclasses,mseforms,msegraphedits,msedataedits,msesimplewidgets,
mse1's avatar
mse1 committed
24
 msestat,msestatfile,mseglob,
mse1's avatar
mse1 committed
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
 projectoptionsform;

type
 treplacedialogfo = class(tmseform)
   casesensitive: tbooleanedit;
   findtext: thistoryedit;
   replacetext: thistoryedit;
   selectedonly: tbooleanedit;
   statfile1: tstatfile;
   promptonreplace: tbooleanedit;
   tintegerbutton1: tbutton;
   tintegerbutton2: tbutton;
   tintegerbutton3: tbutton;
   wholeword: tbooleanedit;
  private
   procedure valuestoinfo(out info: replaceinfoty);
   procedure infotovalues(const info: replaceinfoty);
 end;
 
function replacedialogexecute(var info: replaceinfoty): modalresultty;

implementation
uses
 replacedialogform_mfm,msestrings;

function replacedialogexecute(var info: replaceinfoty): modalresultty;
var
 fo: treplacedialogfo;
begin
 fo:= treplacedialogfo.create(nil);
 try
  fo.infotovalues(info);
  result:= fo.show(true,nil);
  if result in [mr_ok,mr_all] then begin
   fo.valuestoinfo(info);
  end;
 finally
  fo.Free;
 end;
end;

{ treplacedialogfo }
 
procedure treplacedialogfo.valuestoinfo(out info: replaceinfoty);
begin
 with info.find do begin
  text:= findtext.value;
  history:= findtext.dropdown.valuelist.asarray;
  options:= encodesearchoptions(not casesensitive.value,wholeword.value);
  selectedonly:= self.selectedonly.value;
 end;
 info.prompt:= promptonreplace.value;
 info.replacetext:= replacetext.value;
end;

procedure treplacedialogfo.infotovalues(const info: replaceinfoty);
begin
 with info.find do begin
  findtext.value:= text;
  findtext.dropdown.valuelist.asarray:= history;
  casesensitive.value:= not (so_caseinsensitive in options);
  wholeword.value:= so_wholeword in options;
//  self.selectedonly.value:= selectedonly;
 end;
end;

end.