MG: added various history lists

git-svn-id: trunk@3446 -
This commit is contained in:
lazarus 2002-10-02 14:23:23 +00:00
parent 8fa3e9f367
commit 0b38b75404
8 changed files with 708 additions and 32 deletions

View File

@ -1932,9 +1932,10 @@ end;
constructor TCodeToolsDefinesEditor.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
Position:=poScreenCenter;
IDEDialogLayoutList.ApplyLayout(Self,500, 460);
if LazarusResources.Find(ClassName)=nil then begin
Position:=poScreenCenter;
IDEDialogLayoutList.ApplyLayout(Self,500, 460);
Caption:='CodeTools Defines Editor';
OnResize:=@FormResize;

View File

@ -36,6 +36,7 @@ uses
Classes, SysUtils, Laz_XMLCfg, Forms, Controls, StdCtrls, Buttons;
const
// form names for non modal IDE windows:
DefaultMainIDEName = 'MainIDE';
DefaultSourceNoteBookName = 'SourceNotebook';
DefaultMessagesViewName = 'MessagesView';

View File

@ -23,6 +23,10 @@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Mattias Gaertner
}
unit InputHistory;
@ -41,6 +45,41 @@ type
HistoryList: TStringList;
MaxHistory: integer;
end;
THistoryList = class(TStringList)
private
FMaxCount: integer;
FName: string;
procedure SetMaxCount(const AValue: integer);
procedure SetName(const AValue: string);
public
constructor Create;
destructor Destroy; override;
function Add(const Entry: string): integer; override;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
property Name: string read FName write SetName;
property MaxCount: integer read FMaxCount write SetMaxCount;
end;
THistoryLists = class
private
FItems: TList;
function GetItems(Index: integer): THistoryList;
function GetXMLListPath(const Path: string; i: integer): string;
public
constructor Create;
destructor Destroy; override;
procedure Clear;
function Count: integer;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
function IndexOfName(const Name: string): integer;
function GetList(const Name: string;
CreateIfNotExists: boolean): THistoryList;
procedure Add(const ListName, Entry: string);
property Items[Index: integer]: THistoryList read GetItems;
end;
TInputHistories = class
private
@ -54,7 +93,7 @@ type
// Unit dependencies
FUnitDependenciesHistory: TStringList;
FMaxUnitDependeciesHistory: integer;
FMaxUnitDependenciesHistory: integer;
// FPC unitlinks
FLastFPCUnitLinks: string;
@ -62,6 +101,9 @@ type
FLastFPCSearchPath: string;
FLastFPCAge: longint;
// various history lists
FHistoryLists: THistoryLists;
procedure SetFilename(const AValue: string);
procedure SetLastFPCPath(const AValue: string);
public
@ -97,8 +139,8 @@ type
// Unit dependencies
property UnitDependenciesHistory: TStringList read FUnitDependenciesHistory;
property MaxUnitDependeciesHistory: integer
read FMaxUnitDependeciesHistory write FMaxUnitDependeciesHistory;
property MaxUnitDependenciesHistory: integer
read FMaxUnitDependenciesHistory write FMaxUnitDependenciesHistory;
// FPC unitlinks
property LastFPCUnitLinks: string read FLastFPCUnitLinks;
@ -109,6 +151,9 @@ type
// filedialogs
property FileDialogSettings: TFileDialogSettings
read FFileDialogSettings write FFileDialogSettings;
// various history lists
property HistoryLists: THistoryLists read FHistoryLists;
end;
const
@ -145,18 +190,24 @@ begin
FReplaceHistory:=TStringList.Create;
FMaxFindHistory:=20;
// unit dependencies
FUnitDependenciesHistory:=TStringList.Create;
FMaxUnitDependeciesHistory:=20;
FMaxUnitDependenciesHistory:=20;
// file dialog
FFileDialogSettings.HistoryList:=TStringList.Create;
FFileDialogSettings.MaxHistory:=20;
// various history lists
FHistoryLists:=THistoryLists.Create;
FFilename:='';
Clear;
end;
destructor TInputHistories.Destroy;
begin
FHistoryLists.Free;
FFileDialogSettings.HistoryList.Free;
FUnitDependenciesHistory.Free;
FFindHistory.Free;
@ -166,6 +217,7 @@ end;
procedure TInputHistories.Clear;
begin
FHistoryLists.Clear;
FFindHistory.Clear;
FReplaceHistory.Clear;
with FFileDialogSettings do begin
@ -196,6 +248,7 @@ begin
MaxHistory:=XMLConfig.GetValue(Path+'FileDialog/MaxHistory',20);
LoadRecentList(XMLConfig,HistoryList,Path+'FileDialog/HistoryList/');
end;
FHistoryLists.LoadFromXMLConfig(XMLConfig,Path+'HistoryLists/');
end;
procedure TInputHistories.SaveToXMLConfig(XMLConfig: TXMLConfig;
@ -217,6 +270,7 @@ begin
XMLConfig.SetValue(Path+'FileDialog/MaxHistory',MaxHistory);
SaveRecentList(XMLConfig,HistoryList,Path+'FileDialog/HistoryList/');
end;
FHistoryLists.SaveToXMLConfig(XMLConfig,Path+'HistoryLists/');
end;
procedure TInputHistories.SetLazarusDefaultFilename;
@ -276,7 +330,7 @@ function TInputHistories.AddToUnitDependenciesHistory(
const ARootFilename: String): boolean;
begin
Result:=AddToRecentList(ARootFilename,FUnitDependenciesHistory,
FMaxUnitDependeciesHistory);
FMaxUnitDependenciesHistory);
end;
function TInputHistories.LastFPCUnitLinksValid: boolean;
@ -322,5 +376,148 @@ begin
FFileDialogSettings.MaxHistory);
end;
{ THistoryList }
procedure THistoryList.SetMaxCount(const AValue: integer);
begin
if FMaxCount=AValue then exit;
FMaxCount:=AValue;
end;
procedure THistoryList.SetName(const AValue: string);
begin
if FName=AValue then exit;
FName:=AValue;
end;
constructor THistoryList.Create;
begin
FMaxCount:=20;
end;
destructor THistoryList.Destroy;
begin
inherited Destroy;
end;
function THistoryList.Add(const Entry: string): integer;
begin
AddToRecentList(Entry,Self,MaxCount);
Result:=-1;
end;
procedure THistoryList.LoadFromXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
begin
if FName='' then
FName:=XMLConfig.GetValue(Path+'Name','');
FMaxCount:=XMLConfig.GetValue(Path+'MaxCount',MaxCount);
LoadRecentList(XMLConfig,Self,Path);
end;
procedure THistoryList.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string
);
begin
XMLConfig.SetValue(Path+'Name',Name);
XMLConfig.SetValue(Path+'MaxCount',MaxCount);
SaveRecentList(XMLConfig,Self,Path);
end;
{ THistoryLists }
function THistoryLists.GetItems(Index: integer): THistoryList;
begin
Result:=THistoryList(FItems[Index]);
end;
function THistoryLists.GetXMLListPath(const Path: string; i: integer): string;
begin
Result:=Path+'List'+IntToStr(i)+'/';
end;
constructor THistoryLists.Create;
begin
FItems:=TList.Create;
end;
destructor THistoryLists.Destroy;
begin
Clear;
FItems.Free;
inherited Destroy;
end;
procedure THistoryLists.Clear;
var i: integer;
begin
for i:=0 to Count-1 do
Items[i].Free;
FItems.Clear;
end;
function THistoryLists.Count: integer;
begin
Result:=FItems.Count;
end;
procedure THistoryLists.LoadFromXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
var
MergeCount, i: integer;
CurList: THistoryList;
ListName, ListPath: string;
begin
MergeCount:=XMLConfig.GetValue(Path+'Count',0);
for i:=0 to MergeCount-1 do begin
ListPath:=GetXMLListPath(Path,i);
ListName:=XMLConfig.GetValue(ListPath+'Name','');
if ListName='' then continue;
CurList:=GetList(ListName,true);
CurList.LoadFromXMLConfig(XMLConfig,ListPath);
end;
end;
procedure THistoryLists.SaveToXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
var
i, CurID: integer;
begin
XMLConfig.SetValue(Path+'Count',Count);
CurID:=0;
for i:=0 to Count-1 do begin
if Items[i].Count>0 then begin
Items[i].SaveToXMLConfig(XMLConfig,GetXMLListPath(Path,CurID));
inc(CurID);
end;
end;
end;
function THistoryLists.IndexOfName(const Name: string): integer;
begin
Result:=Count-1;
while (Result>=0) and (AnsiCompareText(Items[Result].Name,Name)<>0) do
dec(Result);
end;
function THistoryLists.GetList(const Name: string;
CreateIfNotExists: boolean): THistoryList;
var
i: integer;
begin
i:=IndexOfName(Name);
if i>=0 then
Result:=Items[i]
else begin
Result:=THistoryList.Create;
Result.Name:=Name;
FItems.Add(Result);
end;
end;
procedure THistoryLists.Add(const ListName, Entry: string);
begin
GetList(ListName,true).Add(Entry);
end;
end.

View File

@ -236,6 +236,63 @@ type
read fOnLoadSaveFilename write fOnLoadSaveFilename;
end;
//---------------------------------------------------------------------------
{ TPublishProjectOptions }
TPublishProjectOptions = class
private
FCommandAfter: string;
FDestinationDirectory: string;
FExcludeFileFilter: string;
FIncludeFileFilter: string;
FSaveClosedEditorFilesInfo: boolean;
FSaveEditorInfoOfNonProjectFiles: boolean;
FUseExcludeFileFilter: boolean;
FUseIncludeFileFilter: boolean;
procedure SetCommandAfter(const AValue: string);
procedure SetDestinationDirectory(const AValue: string);
procedure SetExcludeFileFilter(const AValue: string);
procedure SetIncludeFileFilter(const AValue: string);
procedure SetSaveClosedEditorFilesInfo(const AValue: boolean);
procedure SetSaveEditorInfoOfNonProjectFiles(const AValue: boolean);
procedure SetUseExcludeFileFilter(const AValue: boolean);
procedure SetUseIncludeFileFilter(const AValue: boolean);
public
constructor Create;
destructor Destroy;
procedure Clear;
procedure LoadDefaults;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const APath: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const APath: string);
// destination
property DestinationDirectory: string
read FDestinationDirectory write SetDestinationDirectory;
property CommandAfter: string read FCommandAfter write SetCommandAfter;
// file filter
property UseIncludeFileFilter: boolean
read FUseIncludeFileFilter write SetUseIncludeFileFilter;
property IncludeFileFilter: string
read FIncludeFileFilter write SetIncludeFileFilter;
property UseExcludeFileFilter: boolean
read FUseExcludeFileFilter write SetUseExcludeFileFilter;
property ExcludeFileFilter: string
read FExcludeFileFilter write SetExcludeFileFilter;
// project info
property SaveEditorInfoOfNonProjectFiles: boolean
read FSaveEditorInfoOfNonProjectFiles
write SetSaveEditorInfoOfNonProjectFiles;
property SaveClosedEditorFilesInfo: boolean
read FSaveClosedEditorFilesInfo
write SetSaveClosedEditorFilesInfo;
end;
//---------------------------------------------------------------------------
function ProjectWatchTypeNameToType(const s: string): TProjectWatchType;
@ -867,5 +924,124 @@ begin
end;
end;
{ TPublishProjectOptions }
procedure TPublishProjectOptions.SetCommandAfter(const AValue: string);
begin
if FCommandAfter=AValue then exit;
FCommandAfter:=AValue;
end;
procedure TPublishProjectOptions.SetDestinationDirectory(const AValue: string);
begin
if FDestinationDirectory=AValue then exit;
FDestinationDirectory:=AValue;
end;
procedure TPublishProjectOptions.SetExcludeFileFilter(const AValue: string);
begin
if FExcludeFileFilter=AValue then exit;
FExcludeFileFilter:=AValue;
end;
procedure TPublishProjectOptions.SetIncludeFileFilter(const AValue: string);
begin
if FIncludeFileFilter=AValue then exit;
FIncludeFileFilter:=AValue;
end;
procedure TPublishProjectOptions.SetSaveClosedEditorFilesInfo(
const AValue: boolean);
begin
if FSaveClosedEditorFilesInfo=AValue then exit;
FSaveClosedEditorFilesInfo:=AValue;
end;
procedure TPublishProjectOptions.SetSaveEditorInfoOfNonProjectFiles(
const AValue: boolean);
begin
if FSaveEditorInfoOfNonProjectFiles=AValue then exit;
FSaveEditorInfoOfNonProjectFiles:=AValue;
end;
procedure TPublishProjectOptions.SetUseExcludeFileFilter(const AValue: boolean
);
begin
if FUseExcludeFileFilter=AValue then exit;
FUseExcludeFileFilter:=AValue;
end;
procedure TPublishProjectOptions.SetUseIncludeFileFilter(const AValue: boolean
);
begin
if FUseIncludeFileFilter=AValue then exit;
FUseIncludeFileFilter:=AValue;
end;
constructor TPublishProjectOptions.Create;
begin
LoadDefaults;
end;
destructor TPublishProjectOptions.Destroy;
begin
Clear;
inherited Destroy;
end;
procedure TPublishProjectOptions.Clear;
begin
LoadDefaults;
end;
procedure TPublishProjectOptions.LoadDefaults;
begin
FDestinationDirectory:='$(TempDir)/publishedproject/';
FCommandAfter:='';
FUseIncludeFileFilter:=true;
FIncludeFileFilter:='*.{pas,pp,inc,lfm,lpr,lrs,lpi,lpk,fpc,sh,xml}';
FUseExcludeFileFilter:=false;
FExcludeFileFilter:='*.{bak,ppu,ppw,o,so};*~;backup';
FSaveClosedEditorFilesInfo:=false;
FSaveEditorInfoOfNonProjectFiles:=false;
end;
procedure TPublishProjectOptions.LoadFromXMLConfig(XMLConfig: TXMLConfig;
const APath: string);
begin
LoadDefaults;
FDestinationDirectory:=XMLConfig.GetValue(APath+'DestinationDirectory/Value',
DestinationDirectory);
FCommandAfter:=XMLConfig.GetValue(APath+'CommandAfter/Value',CommandAfter);
FUseIncludeFileFilter:=XMLConfig.GetValue(APath+'UseIncludeFileFilter/Value',
UseIncludeFileFilter);
FIncludeFileFilter:=XMLConfig.GetValue(APath+'IncludeFileFilter/Value',
IncludeFileFilter);
FUseExcludeFileFilter:=XMLConfig.GetValue(APath+'UseExcludeFileFilter/Value',
UseExcludeFileFilter);
FExcludeFileFilter:=XMLConfig.GetValue(APath+'ExcludeFileFilter/Value',
ExcludeFileFilter);
FSaveClosedEditorFilesInfo:=XMLConfig.GetValue(
APath+'SaveClosedEditorFilesInfo/Value',SaveClosedEditorFilesInfo);
FSaveEditorInfoOfNonProjectFiles:=XMLConfig.GetValue(
APath+'SaveEditorInfoOfNonProjectFiles/Value',
SaveEditorInfoOfNonProjectFiles);
end;
procedure TPublishProjectOptions.SaveToXMLConfig(XMLConfig: TXMLConfig;
const APath: string);
begin
XMLConfig.SetValue(APath+'DestinationDirectory/Value',DestinationDirectory);
XMLConfig.SetValue(APath+'CommandAfter/Value',CommandAfter);
XMLConfig.SetValue(APath+'UseIncludeFileFilter/Value',UseIncludeFileFilter);
XMLConfig.SetValue(APath+'IncludeFileFilter/Value',IncludeFileFilter);
XMLConfig.SetValue(APath+'UseExcludeFileFilter/Value',UseExcludeFileFilter);
XMLConfig.SetValue(APath+'ExcludeFileFilter/Value',ExcludeFileFilter);
XMLConfig.SetValue(APath+'SaveClosedEditorFilesInfo/Value',
SaveClosedEditorFilesInfo);
XMLConfig.SetValue(APath+'SaveEditorInfoOfNonProjectFiles/Value',
SaveEditorInfoOfNonProjectFiles);
end;
end.

View File

@ -1,41 +1,42 @@
object PublishProjectDialog: TPublishProjectDialog
CAPTION = 'Publish Project Dialog'
CAPTION = 'Publish Project'
COLOR = -2147483633
CLIENTHEIGHT = 345
CLIENTWIDTH = 483
CLIENTHEIGHT = 377
CLIENTWIDTH = 470
POSITION = poscreencenter
ONRESIZE = PublishProjectDialogRESIZE
LEFT = 343
HEIGHT = 345
HEIGHT = 377
TOP = 289
WIDTH = 483
object Button1: TBUTTON
WIDTH = 470
object OkButton: TBUTTON
ANCHORS = [aktop, akleft]
MODALRESULT = 1
CAPTION = 'Ok'
TABSTOP = True
LEFT = 56
LEFT = 80
HEIGHT = 25
TOP = 264
TOP = 336
WIDTH = 75
end
object Button2: TBUTTON
object CancelButton: TBUTTON
ANCHORS = [aktop, akleft]
MODALRESULT = 2
CAPTION = 'Cancel'
TABSTOP = True
TABORDER = 1
LEFT = 226
LEFT = 377
HEIGHT = 25
TOP = 264
TOP = 336
WIDTH = 75
end
object DestDirGroupBox: TGROUPBOX
ANCHORS = [aktop, akleft]
CAPTION = 'Destination directory'
LEFT = 8
HEIGHT = 53
HEIGHT = 91
TOP = 8
WIDTH = 420
WIDTH = 450
object DestDirComboBox: TCOMBOBOX
ANCHORS = [aktop, akleft]
PARENTCTL3D = False
@ -44,7 +45,7 @@ object PublishProjectDialog: TPublishProjectDialog
LEFT = 6
HEIGHT = 25
TOP = 1
WIDTH = 294
WIDTH = 350
end
object BrowseDestDirBitBtn: TBITBTN
GLYPH.Data = {
@ -56,10 +57,124 @@ object PublishProjectDialog: TPublishProjectDialog
CAPTION = 'Browse'
TABSTOP = True
TABORDER = 1
LEFT = 336
LEFT = 366
HEIGHT = 25
TOP = 1
WIDTH = 72
end
object CommandAfterCombobox: TCOMBOBOX
ANCHORS = [aktop, akleft]
PARENTCTL3D = False
TABORDER = 2
TABSTOP = True
TEXT = 'CommandAfterCombobox'
LEFT = 6
HEIGHT = 25
TOP = 39
WIDTH = 430
end
end
object FilesGroupbox: TGROUPBOX
ANCHORS = [aktop, akleft]
CAPTION = 'Files'
LEFT = 8
HEIGHT = 139
TOP = 104
WIDTH = 450
object UseIncludeFilterCheckbox: TCHECKBOX
AUTOSIZE = True
ALLOWGRAYED = True
ANCHORS = [aktop, akleft]
CAPTION = 'Use include filter'
DRAGCURSOR = 0
TABSTOP = True
TABSTOP = True
LEFT = 4
HEIGHT = 20
WIDTH = 171
end
object IncludeFileFilterCombobox: TCOMBOBOX
ANCHORS = [aktop, akleft]
PARENTCTL3D = False
TABORDER = 1
TABSTOP = True
TEXT = 'IncludeFileFilterCombobox'
LEFT = 4
HEIGHT = 25
TOP = 24
WIDTH = 432
end
object UseExcludeFilterCheckbox: TCHECKBOX
AUTOSIZE = True
ALLOWGRAYED = True
ANCHORS = [aktop, akleft]
CAPTION = 'Use exclude filter'
DRAGCURSOR = 0
TABORDER = 2
TABSTOP = True
TABORDER = 2
TABSTOP = True
LEFT = 4
HEIGHT = 20
TOP = 64
WIDTH = 175
end
object ExcludeFileFilterCombobox: TCOMBOBOX
ANCHORS = [aktop, akleft]
PARENTCTL3D = False
TABORDER = 3
TABSTOP = True
TEXT = 'ExcludeFileFilterCombobox'
LEFT = 4
HEIGHT = 25
TOP = 88
WIDTH = 432
end
end
object ProjectInfoGroupbox: TGROUPBOX
ANCHORS = [aktop, akleft]
CAPTION = 'Project Information'
LEFT = 8
HEIGHT = 69
TOP = 248
WIDTH = 450
object SaveClosedEditorFilesInfoCheckbox: TCHECKBOX
AUTOSIZE = True
ALLOWGRAYED = True
ANCHORS = [aktop, akleft]
CAPTION = 'Save editor info of closed files'
DRAGCURSOR = 0
TABSTOP = True
TABSTOP = True
LEFT = 4
HEIGHT = 20
TOP = 1
WIDTH = 432
end
object SaveEditorInfoOfNonProjectFilesCheckbox: TCHECKBOX
AUTOSIZE = True
ALLOWGRAYED = True
ANCHORS = [aktop, akleft]
CAPTION = 'Save editor info of non project files'
DRAGCURSOR = 0
TABORDER = 1
TABSTOP = True
TABORDER = 1
TABSTOP = True
LEFT = 4
HEIGHT = 20
TOP = 26
WIDTH = 432
end
end
object SaveSettingsButton: TBUTTON
ANCHORS = [aktop, akleft]
CAPTION = 'Save settings'
TABSTOP = True
TABORDER = 5
LEFT = 206
HEIGHT = 25
TOP = 336
WIDTH = 120
end
end

View File

@ -1,20 +1,77 @@
unit PublishProjectDlg;
{ /***************************************************************************
publishprojectdlg.pp - Lazarus IDE unit
-----------------------------------------
***************************************************************************/
***************************************************************************
* *
* This source 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 code 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. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Mattias Gaertner
Abstract:
- TPublishProjectDialog
}
unit PublishProjectDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, LResources, Buttons, StdCtrls;
Classes, SysUtils, Forms, Controls, Graphics, LResources, Buttons, StdCtrls,
ProjectDefs, IDEOptionDefs, IDEProcs, InputHistory;
type
{ TPublishProjectDialog }
TPublishProjectDialog = class(TForm)
BrowseDestDirBitBtn: TBITBTN;
Button1: TBUTTON;
Button2: TBUTTON;
DestDirComboBox: TCOMBOBOX;
DestDirGroupBox: TGROUPBOX;
DestDirComboBox: TCOMBOBOX;
BrowseDestDirBitBtn: TBITBTN;
CommandAfterCombobox: TCOMBOBOX;
FilesGroupbox: TGROUPBOX;
UseIncludeFilterCheckbox: TCHECKBOX;
IncludeFileFilterCombobox: TCOMBOBOX;
UseExcludeFilterCheckbox: TCHECKBOX;
ExcludeFileFilterCombobox: TCOMBOBOX;
ProjectInfoGroupbox: TGROUPBOX;
SaveEditorInfoOfNonProjectFilesCheckbox: TCHECKBOX;
SaveClosedEditorFilesInfoCheckbox: TCHECKBOX;
OkButton: TBUTTON;
SaveSettingsButton: TBUTTON;
CancelButton: TBUTTON;
procedure PublishProjectDialogResize(Sender: TObject);
private
procedure SetComboBox(AComboBox: TComboBox; const NewText: string;
MaxItemCount: integer);
procedure LoadHistoryLists;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure LoadFromOptions(SrcOpts: TPublishProjectOptions);
procedure SaveToOptions(DestOpts: TPublishProjectOptions);
end;
var
@ -22,5 +79,78 @@ var
implementation
{ TPublishProjectDialog }
procedure TPublishProjectDialog.PublishProjectDialogResize(Sender: TObject);
begin
end;
procedure TPublishProjectDialog.SetComboBox(AComboBox: TComboBox;
const NewText: string; MaxItemCount: integer);
begin
AComboBox.AddHistoryItem(NewText,MaxItemCount,true,false);
end;
procedure TPublishProjectDialog.LoadHistoryLists;
begin
end;
constructor TPublishProjectDialog.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
Position:=poScreenCenter;
IDEDialogLayoutList.ApplyLayout(Self,500,460);
end;
destructor TPublishProjectDialog.Destroy;
begin
inherited Destroy;
end;
procedure TPublishProjectDialog.LoadFromOptions(SrcOpts: TPublishProjectOptions
);
begin
// destination
SetComboBox(DestDirComboBox,SrcOpts.DestinationDirectory,20);
SetComboBox(CommandAfterCombobox,SrcOpts.CommandAfter,20);
// file filter
UseIncludeFilterCheckbox.Checked:=SrcOpts.UseIncludeFileFilter;
SetComboBox(IncludeFileFilterCombobox,SrcOpts.IncludeFileFilter,20);
UseExcludeFilterCheckbox.Checked:=SrcOpts.UseExcludeFileFilter;
SetComboBox(ExcludeFileFilterCombobox,SrcOpts.ExcludeFileFilter,20);
// project info
SaveEditorInfoOfNonProjectFilesCheckbox.Checked:=
SrcOpts.SaveEditorInfoOfNonProjectFiles;
SaveClosedEditorFilesInfoCheckbox.Checked:=
SrcOpts.SaveClosedEditorFilesInfo;
end;
procedure TPublishProjectDialog.SaveToOptions(DestOpts: TPublishProjectOptions
);
begin
// destination
DestOpts.DestinationDirectory:=DestDirComboBox.Text;
DestOpts.CommandAfter:=CommandAfterCombobox.Text;
// file filter
DestOpts.UseIncludeFileFilter:=UseIncludeFilterCheckbox.Checked;
DestOpts.IncludeFileFilter:=IncludeFileFilterCombobox.Text;
DestOpts.UseExcludeFileFilter:=UseExcludeFilterCheckbox.Checked;
DestOpts.ExcludeFileFilter:=ExcludeFileFilterCombobox.Text;
// project info
DestOpts.SaveEditorInfoOfNonProjectFiles:=
SaveEditorInfoOfNonProjectFilesCheckbox.Checked;
DestOpts.SaveClosedEditorFilesInfo:=
SaveClosedEditorFilesInfoCheckbox.Checked;
end;
initialization
{$I publishprojectdlg.lrs}
end.

View File

@ -464,13 +464,59 @@ begin
end;
{------------------------------------------------------------------------------
procedure TCustomComboBox.AddItem(const Item: String; AObject: TObject);
procedure TCustomComboBox.AddItem(const Item: String; AnObject: TObject);
Adds an Item with an associated object to Items
------------------------------------------------------------------------------}
procedure TCustomComboBox.AddItem(const Item: String; AObject: TObject);
procedure TCustomComboBox.AddItem(const Item: String; AnObject: TObject);
begin
Items.AddObject(Item,AObject);
Items.AddObject(Item,AnObject);
end;
{------------------------------------------------------------------------------
procedure TCustomComboBox.AddHistoryItem(const Item: string;
MaxHistoryCount: integer; SetAsText, CaseSensitive: boolean);
Adds an Item as first item. Removes the Item from old positions and removes
last item if history is full.
------------------------------------------------------------------------------}
procedure TCustomComboBox.AddHistoryItem(const Item: string;
MaxHistoryCount: integer; SetAsText, CaseSensitive: boolean);
begin
AddHistoryItem(Item,nil,MaxHistoryCount,SetAsText,CaseSensitive);
end;
{------------------------------------------------------------------------------
procedure TCustomComboBox.AddHistoryItem(const Item: string;
AnObject: TObject; MaxHistoryCount: integer;
SetAsText, CaseSensitive: boolean);
Adds an Item as first item. Removes the Item from old positions and removes
last item if history is full.
------------------------------------------------------------------------------}
procedure TCustomComboBox.AddHistoryItem(const Item: string; AnObject: TObject;
MaxHistoryCount: integer; SetAsText, CaseSensitive: boolean);
var i: integer;
begin
// insert as first
if (Items.Count=0)
or (CaseSensitive and (AnsiCompareText(Items[0],Item)<>0))
or (not CaseSensitive and (Items[0]<>Item)) then
begin
Items.InsertObject(0,Item,AnObject);
end;
// delete old
for i:=Items.Count-1 downto 1 do begin
if (CaseSensitive and (AnsiCompareText(Items[i],Item)=0))
or (not CaseSensitive and (Items[i]=Item)) then
Items.Delete(i);
end;
// delete overflow items
while Items.Count>MaxHistoryCount do
Items.Delete(Items.Count-1);
// set as text
if SetAsText then
Text:=Item;
end;
{------------------------------------------------------------------------------
@ -549,6 +595,9 @@ end;
{
$Log$
Revision 1.15 2002/10/02 14:23:23 lazarus
MG: added various history lists
Revision 1.14 2002/09/16 16:06:21 lazarus
MG: replaced halt with raiseexception

View File

@ -224,7 +224,11 @@ type
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
procedure AddItem(const Item: String; AObject: TObject); //override;
procedure AddItem(const Item: String; AnObject: TObject); //override;
procedure AddHistoryItem(const Item: string; MaxHistoryCount: integer;
SetAsText, CaseSensitive: boolean);
procedure AddHistoryItem(const Item: string; AnObject: TObject;
MaxHistoryCount: integer; SetAsText, CaseSensitive: boolean);
procedure Clear; //override;
procedure ClearSelection; //override;
procedure MeasureItem(Index: Integer; var TheHeight: Integer); virtual;
@ -1268,6 +1272,9 @@ end.
{ =============================================================================
$Log$
Revision 1.48 2002/10/02 14:23:22 lazarus
MG: added various history lists
Revision 1.47 2002/10/01 18:00:03 lazarus
AJ: Initial TUpDown, minor property additions to improve reading Delphi created forms.