added idewindowintf.pas - interface for storing IDE dialogs sizes

git-svn-id: trunk@7460 -
This commit is contained in:
mattias 2005-07-31 10:21:18 +00:00
parent 01daa56c38
commit 12ce6432d7
34 changed files with 439 additions and 293 deletions

1
.gitattributes vendored
View File

@ -959,6 +959,7 @@ ideintf/helpfpdoc.pas svneol=native#text/pascal
ideintf/helphtml.pas svneol=native#text/pascal ideintf/helphtml.pas svneol=native#text/pascal
ideintf/helpintf.pas svneol=native#text/pascal ideintf/helpintf.pas svneol=native#text/pascal
ideintf/idecommands.pas svneol=native#text/pascal ideintf/idecommands.pas svneol=native#text/pascal
ideintf/idewindowintf.pas svneol=native#text/plain
ideintf/imagelisteditor.pp svneol=native#text/pascal ideintf/imagelisteditor.pp svneol=native#text/pascal
ideintf/lazideintf.pas svneol=native#text/pascal ideintf/lazideintf.pas svneol=native#text/pascal
ideintf/listviewpropedit.pp svneol=native#text/pascal ideintf/listviewpropedit.pp svneol=native#text/pascal

View File

@ -36,8 +36,8 @@ interface
uses uses
Classes, SysUtils, Math, LCLProc, LResources, Forms, Controls, Buttons, Classes, SysUtils, Math, LCLProc, LResources, Forms, Controls, Buttons,
ComCtrls, StdCtrls, ExtCtrls, Menus, Dialogs, Graphics, FileUtil, ComCtrls, StdCtrls, ExtCtrls, Menus, Dialogs, Graphics, FileUtil, AVL_Tree,
{$IFNDEF VER1_0}AVL_Tree{$ELSE}OldAvLTree{$ENDIF}, IDEWindowIntf,
LazarusIDEStrConsts, IDEProcs, IDEOptionDefs, EnvironmentOpts, LazarusIDEStrConsts, IDEProcs, IDEOptionDefs, EnvironmentOpts,
Project, PackageDefs, PackageSystem, InputHistory; Project, PackageDefs, PackageSystem, InputHistory;

View File

@ -39,7 +39,7 @@ uses
SynHighlighterLFM, SynEdit, BasicCodeTools, CodeCache, CodeToolManager, SynHighlighterLFM, SynEdit, BasicCodeTools, CodeCache, CodeToolManager,
LFMTrees, LFMTrees,
// IDE // IDE
ComponentReg, PackageIntf, ComponentReg, PackageIntf, IDEWindowIntf,
LazarusIDEStrConsts, OutputFilter, IDEProcs, IDEOptionDefs, EditorOptions; LazarusIDEStrConsts, OutputFilter, IDEProcs, IDEOptionDefs, EditorOptions;
type type

View File

@ -35,6 +35,9 @@ uses
SynRegExpr, LazarusIDEStrConsts, LazConf, IDEProcs, TransferMacros; SynRegExpr, LazarusIDEStrConsts, LazConf, IDEProcs, TransferMacros;
type type
{ TCleanDirectoryDialog }
TCleanDirectoryDialog = class(TForm) TCleanDirectoryDialog = class(TForm)
KeepTextFilesCheckbox: TCHECKBOX; KeepTextFilesCheckbox: TCHECKBOX;
SubDirsCheckbox: TCHECKBOX; SubDirsCheckbox: TCHECKBOX;
@ -63,6 +66,8 @@ type
property Macros: TTransferMacroList read FMacros write SetMacros; property Macros: TTransferMacroList read FMacros write SetMacros;
end; end;
{ TShowDeletingFilesDialog }
TShowDeletingFilesDialog = class(TForm) TShowDeletingFilesDialog = class(TForm)
FilesListBox: TListBox; FilesListBox: TListBox;
OkButton: TBUTTON; OkButton: TBUTTON;

View File

@ -46,6 +46,7 @@ interface
uses uses
Classes, SysUtils, LCLIntf, Forms, Controls, Buttons, StdCtrls, ComCtrls, Classes, SysUtils, LCLIntf, Forms, Controls, Buttons, StdCtrls, ComCtrls,
LCLType, ExtCtrls, Menus, LResources, LCLProc, Graphics, Dialogs, SynEdit, LCLType, ExtCtrls, Menus, LResources, LCLProc, Graphics, Dialogs, SynEdit,
IDEWindowIntf,
LazarusIDEStrConsts, DefineTemplates, CodeToolManager, LazarusIDEStrConsts, DefineTemplates, CodeToolManager,
CodeToolsOptions, CodeToolsDefPreview, TransferMacros, InputFileDialog, CodeToolsOptions, CodeToolsDefPreview, TransferMacros, InputFileDialog,
IDEOptionDefs, LazConf, IDEProcs; IDEOptionDefs, LazConf, IDEProcs;

View File

@ -38,6 +38,7 @@ uses
Classes, SysUtils, LazConf, Laz_XMLCfg, Classes, SysUtils, LazConf, Laz_XMLCfg,
LResources, Forms, Controls, Buttons, LclProc, ExtCtrls, StdCtrls, ComCtrls, LResources, Forms, Controls, Buttons, LclProc, ExtCtrls, StdCtrls, ComCtrls,
Dialogs, CodeToolManager, DefineTemplates, SourceChanger, SynEdit, Dialogs, CodeToolManager, DefineTemplates, SourceChanger, SynEdit,
IDEWindowIntf,
IDEOptionDefs, EditDefineTree, LazarusIDEStrConsts, IDEProcs; IDEOptionDefs, EditDefineTree, LazarusIDEStrConsts, IDEProcs;
type type

View File

@ -38,7 +38,7 @@ interface
uses uses
Forms, Classes, LCLProc, SysUtils, ComCtrls, Buttons, StdCtrls, ExtCtrls, Forms, Classes, LCLProc, SysUtils, ComCtrls, Buttons, StdCtrls, ExtCtrls,
Graphics, LResources, FileUtil, Dialogs, Controls, GraphType, Graphics, LResources, FileUtil, Dialogs, Controls, GraphType,
ProjectIntf, ProjectIntf, IDEWindowIntf,
PathEditorDlg, LazarusIDEStrConsts, IDEOptionDefs, LazConf, IDEProcs, PathEditorDlg, LazarusIDEStrConsts, IDEOptionDefs, LazConf, IDEProcs,
CompilerOptions, ShowCompilerOpts, Project, PackageDefs; CompilerOptions, ShowCompilerOpts, Project, PackageDefs;

View File

@ -40,7 +40,7 @@ interface
uses uses
Classes, SysUtils, Math, Forms, Controls, Buttons, StdCtrls, Classes, SysUtils, Math, Forms, Controls, Buttons, StdCtrls,
SynEdit, LResources, LazarusIDEStrConsts, EditorOptions, IDEOptionDefs, SynEdit, LResources, LazarusIDEStrConsts, EditorOptions, IDEWindowIntf,
InputHistory, DiffPatch; InputHistory, DiffPatch;
type type

View File

@ -41,7 +41,7 @@ uses
SynHighlighterPas, SynHighlighterHTML, SynHighlighterCPP, SynHighlighterXML, SynHighlighterPas, SynHighlighterHTML, SynHighlighterCPP, SynHighlighterXML,
SynHighlighterLFM, SynHighlighterPerl, SynHighlighterJava, SynHighlighterLFM, SynHighlighterPerl, SynHighlighterJava,
SynHighlighterPython, SynHighlighterUNIXShellScript, SynHighlighterPython, SynHighlighterUNIXShellScript,
Laz_XMLCfg, Laz_XMLCfg, IDEWindowIntf,
IDECommands, CodeTemplateDialog, KeyMapping, InputHistory, IDEOptionDefs, IDECommands, CodeTemplateDialog, KeyMapping, InputHistory, IDEOptionDefs,
LazarusIDEStrConsts, KeymapSchemeDlg; LazarusIDEStrConsts, KeymapSchemeDlg;

View File

@ -37,7 +37,7 @@ uses
{$ENDIF} {$ENDIF}
Classes, SysUtils, FPCAdds, LCLProc, Forms, Controls, Buttons, GraphType, Classes, SysUtils, FPCAdds, LCLProc, Forms, Controls, Buttons, GraphType,
Graphics, ExtCtrls, StdCtrls, Spin, FileUtil, LResources, Dialogs, Graphics, ExtCtrls, StdCtrls, Spin, FileUtil, LResources, Dialogs,
Laz_XMLCfg, ObjectInspector, Laz_XMLCfg, ObjectInspector, IDEWindowIntf,
LazarusIDEStrConsts, LazConf, ExtToolDialog, IDEProcs, IDEOptionDefs, LazarusIDEStrConsts, LazConf, ExtToolDialog, IDEProcs, IDEOptionDefs,
InputHistory, EditorOptions, Translations; InputHistory, EditorOptions, Translations;
@ -790,8 +790,8 @@ begin
// windows // windows
InitLayoutList; InitLayoutList;
FIDEDialogLayoutList:=TIDEDialogLayoutList.Create; FIDEDialogLayoutList:=TIDEDialogLayoutList.Create;
if IDEOptionDefs.IDEDialogLayoutList=nil then if IDEWindowIntf.IDEDialogLayoutList=nil then
IDEOptionDefs.IDEDialogLayoutList:=FIDEDialogLayoutList; IDEWindowIntf.IDEDialogLayoutList:=FIDEDialogLayoutList;
FMinimizeAllOnMinimizeMain:=false; FMinimizeAllOnMinimizeMain:=false;
FHideIDEOnRun:=false; FHideIDEOnRun:=false;
@ -885,8 +885,8 @@ begin
FMakeFileHistory.Free; FMakeFileHistory.Free;
FDebuggerFileHistory.Free; FDebuggerFileHistory.Free;
FTestBuildDirHistory.Free; FTestBuildDirHistory.Free;
if IDEOptionDefs.IDEDialogLayoutList=FIDEDialogLayoutList then if IDEWindowIntf.IDEDialogLayoutList=FIDEDialogLayoutList then
IDEOptionDefs.IDEDialogLayoutList:=nil; IDEWindowIntf.IDEDialogLayoutList:=nil;
FIDEDialogLayoutList.Free; FIDEDialogLayoutList.Free;
fIDEWindowLayoutList.Free; fIDEWindowLayoutList.Free;
FConfigStore.Free; FConfigStore.Free;
@ -994,8 +994,8 @@ begin
// windows // windows
FIDEWindowLayoutList.LoadFromXMLConfig(XMLConfig, FIDEWindowLayoutList.LoadFromXMLConfig(XMLConfig,
Path+'Desktop/'); Path+'Desktop/');
FIDEDialogLayoutList.LoadFromXMLConfig(XMLConfig, FIDEDialogLayoutList.LoadFromConfig(FConfigStore,
Path+'Desktop/Dialogs'); Path+'Desktop/Dialogs/');
FMinimizeAllOnMinimizeMain:=XMLConfig.GetValue( FMinimizeAllOnMinimizeMain:=XMLConfig.GetValue(
Path+'Desktop/MinimizeAllOnMinimizeMain/Value',true); Path+'Desktop/MinimizeAllOnMinimizeMain/Value',true);
FHideIDEOnRun:=XMLConfig.GetValue( FHideIDEOnRun:=XMLConfig.GetValue(
@ -1229,7 +1229,7 @@ begin
// windows // windows
FIDEWindowLayoutList.SaveToXMLConfig(XMLConfig,Path+'Desktop/'); FIDEWindowLayoutList.SaveToXMLConfig(XMLConfig,Path+'Desktop/');
FIDEDialogLayoutList.SaveToXMLConfig(XMLConfig,Path+'Desktop/Dialogs'); FIDEDialogLayoutList.SaveToConfig(FConfigStore,Path+'Desktop/Dialogs/');
XMLConfig.SetDeleteValue(Path+'Desktop/MinimizeAllOnMinimizeMain/Value', XMLConfig.SetDeleteValue(Path+'Desktop/MinimizeAllOnMinimizeMain/Value',
FMinimizeAllOnMinimizeMain,true); FMinimizeAllOnMinimizeMain,true);
XMLConfig.SetDeleteValue(Path+'Desktop/HideIDEOnRun/Value',FHideIDEOnRun, XMLConfig.SetDeleteValue(Path+'Desktop/HideIDEOnRun/Value',FHideIDEOnRun,

View File

@ -32,9 +32,9 @@ interface
uses uses
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, StdCtrls, Buttons, ExtCtrls,
{$IFNDEF VER1_0}AVL_Tree{$ELSE}OldAvLTree{$ENDIF}, CodeAtom, CodeCache, AVL_Tree, CodeAtom, CodeCache,
CodeToolManager, CodeToolManager,
LazarusIDEStrConsts, IDEProcs, IDEOptionDefs, MiscOptions, DialogProcs, LazarusIDEStrConsts, IDEProcs, IDEWindowIntf, MiscOptions, DialogProcs,
InputHistory, SearchResultView; InputHistory, SearchResultView;
type type

View File

@ -36,7 +36,7 @@ uses
Classes, SysUtils, LCLProc, Forms, Controls, Buttons, StdCtrls, Dialogs, Classes, SysUtils, LCLProc, Forms, Controls, Buttons, StdCtrls, Dialogs,
CodeToolManager, CodeAtom, CodeCache, CustomCodeTool, CodeTree, CodeToolManager, CodeAtom, CodeCache, CustomCodeTool, CodeTree,
PascalParserTool, FindDeclarationTool, PascalParserTool, FindDeclarationTool,
PropEdits, HelpIntf, HelpHTML, HelpFPDoc, MacroIntf, PropEdits, HelpIntf, HelpHTML, HelpFPDoc, MacroIntf, IDEWindowIntf,
LazarusIDEStrConsts, TransferMacros, DialogProcs, IDEOptionDefs, LazarusIDEStrConsts, TransferMacros, DialogProcs, IDEOptionDefs,
EnvironmentOpts, AboutFrm, MsgView, Project, PackageDefs, MainBar, EnvironmentOpts, AboutFrm, MsgView, Project, PackageDefs, MainBar,
OutputFilter, HelpOptions, MainIntf, LazConf; OutputFilter, HelpOptions, MainIntf, LazConf;

View File

@ -37,8 +37,8 @@ interface
uses uses
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, StdCtrls, Buttons, ExtCtrls,
HelpIntf, Laz_XMLCfg, ObjectInspector, HelpIntf, IDEWindowIntf, Laz_XMLCfg,
ObjectInspector, LazConf, LazarusIDEStrConsts, IDEProcs, IDEOptionDefs; LazConf, LazarusIDEStrConsts, IDEProcs, IDEOptionDefs;
type type
{ THelpOptions } { THelpOptions }

View File

@ -329,54 +329,9 @@ function StrToIDEWindowDockMode(const s: string): TIDEWindowDockMode;
function StrToIDEWindowPlacement(const s: string): TIDEWindowPlacement; function StrToIDEWindowPlacement(const s: string): TIDEWindowPlacement;
function StrToIDEWindowState(const s: string): TIDEWindowState; function StrToIDEWindowState(const s: string): TIDEWindowState;
//----------------------------------------------------------------------------
// for modal forms (dialogs) in the IDE
type
TIDEDialogLayout = class
private
FHeight: integer;
FName: string;
FWidth: integer;
procedure SetHeight(const AValue: integer);
procedure SetName(const AValue: string);
procedure SetWidth(const AValue: integer);
public
function SizeValid: boolean;
property Width: integer read FWidth write SetWidth;
property Height: integer read FHeight write SetHeight;
property Name: string read FName write SetName;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
end;
TIDEDialogLayoutList = class
private
FItems: TList;
function GetItems(Index: integer): TIDEDialogLayout;
public
constructor Create;
destructor Destroy; override;
procedure ApplyLayout(ADialog: TControl;
DefaultWidth, DefaultHeight: integer);
procedure SaveLayout(ADialog: TControl);
procedure Clear;
function Count: integer;
function Find(const DialogName: string;
CreateIfNotExists: boolean): TIDEDialogLayout;
function Find(ADialog: TObject;
CreateIfNotExists: boolean): TIDEDialogLayout;
function IndexOf(const DialogName: string): integer;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
property Items[Index: integer]: TIDEDialogLayout read GetItems;
end;
function CreateNiceWindowPosition(Width, Height: integer): TRect; function CreateNiceWindowPosition(Width, Height: integer): TRect;
function NonModalIDEFormIDToEnum(const FormID: string): TNonModalIDEWindow; function NonModalIDEFormIDToEnum(const FormID: string): TNonModalIDEWindow;
var
IDEDialogLayoutList: TIDEDialogLayoutList;
function GetLazIDEConfigStorage(const Filename: string; LoadFromDisk: Boolean function GetLazIDEConfigStorage(const Filename: string; LoadFromDisk: Boolean
): TConfigStorage; ): TConfigStorage;
@ -1122,167 +1077,6 @@ begin
SaveTo(Layout); SaveTo(Layout);
end; end;
{ TIDEDialogLayout }
procedure TIDEDialogLayout.SetHeight(const AValue: integer);
begin
if FHeight=AValue then exit;
FHeight:=AValue;
end;
procedure TIDEDialogLayout.SetName(const AValue: string);
begin
if FName=AValue then exit;
FName:=AValue;
end;
procedure TIDEDialogLayout.SetWidth(const AValue: integer);
begin
if FWidth=AValue then exit;
FWidth:=AValue;
end;
function TIDEDialogLayout.SizeValid: boolean;
begin
Result:=(Width>0) and (Height>0);
end;
procedure TIDEDialogLayout.LoadFromXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
begin
FName:=XMLConfig.GetValue(Path+'/Name/Value','');
FWidth:=XMLConfig.GetValue(Path+'/Size/Width',0);
FHeight:=XMLConfig.GetValue(Path+'/Size/Height',0);
end;
procedure TIDEDialogLayout.SaveToXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
begin
XMLConfig.SetValue(Path+'/Name/Value',Name);
XMLConfig.SetValue(Path+'/Size/Width',Width);
XMLConfig.SetValue(Path+'/Size/Height',Height);
end;
{ TIDEDialogLayoutList }
function TIDEDialogLayoutList.GetItems(Index: integer): TIDEDialogLayout;
begin
Result:=TIDEDialogLayout(FItems[Index]);
end;
constructor TIDEDialogLayoutList.Create;
begin
inherited Create;
FItems:=TList.Create;
end;
destructor TIDEDialogLayoutList.Destroy;
begin
Clear;
FreeAndNil(FItems);
inherited Destroy;
end;
procedure TIDEDialogLayoutList.ApplyLayout(ADialog: TControl;
DefaultWidth, DefaultHeight: integer);
var
ALayout: TIDEDialogLayout;
NewWidth, NewHeight: integer;
begin
if ADialog=nil then exit;
ALayout:=Find(ADialog,true);
if ALayout.SizeValid then begin
NewWidth:=ALayout.Width;
NewHeight:=ALayout.Height;
end else begin
NewWidth:=DefaultWidth;
NewHeight:=DefaultHeight;
end;
ADialog.SetBounds(ADialog.Left,ADialog.Top,NewWidth,NewHeight);
end;
procedure TIDEDialogLayoutList.SaveLayout(ADialog: TControl);
var
ALayout: TIDEDialogLayout;
begin
if ADialog=nil then exit;
ALayout:=Find(ADialog,true);
ALayout.Width:=ADialog.Width;
ALayout.Height:=ADialog.Height;
end;
procedure TIDEDialogLayoutList.Clear;
var i: integer;
begin
for i:=0 to FItems.Count-1 do
Items[i].Free;
FItems.Clear;
end;
function TIDEDialogLayoutList.Count: integer;
begin
Result:=FItems.Count;
end;
function TIDEDialogLayoutList.Find(const DialogName: string;
CreateIfNotExists: boolean): TIDEDialogLayout;
var i: integer;
begin
i:=IndexOf(DialogName);
if (i<0) then begin
if CreateIfNotExists then begin
Result:=TIDEDialogLayout.Create;
FItems.Add(Result);
Result.Name:=DialogName;
end else begin
Result:=nil;
end;
end else begin
Result:=Items[i];
end;
end;
function TIDEDialogLayoutList.Find(ADialog: TObject; CreateIfNotExists: boolean
): TIDEDialogLayout;
begin
if ADialog<>nil then begin
Result:=Find(ADialog.ClassName,CreateIfNotExists);
end else begin
Result:=nil;
end;
end;
function TIDEDialogLayoutList.IndexOf(const DialogName: string): integer;
begin
Result:=Count-1;
while (Result>=0) and (AnsiCompareText(DialogName,Items[Result].Name)<>0) do
dec(Result);
end;
procedure TIDEDialogLayoutList.LoadFromXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
var
NewCount, i: integer;
NewDialogLayout: TIDEDialogLayout;
begin
Clear;
NewCount:=XMLConfig.GetValue(Path+'/Count',0);
for i:=0 to NewCount-1 do begin
NewDialogLayout:=TIDEDialogLayout.Create;
FItems.Add(NewDialogLayout);
NewDialogLayout.LoadFromXMLConfig(XMLConfig,Path+'/Dialog'+IntToStr(i+1));
end;
end;
procedure TIDEDialogLayoutList.SaveToXMLConfig(XMLConfig: TXMLConfig;
const Path: string);
var i: integer;
begin
XMLConfig.SetDeleteValue(Path+'/Count',Count,0);
for i:=0 to Count-1 do
Items[i].SaveToXMLConfig(XMLConfig,Path+'/Dialog'+IntToStr(i+1));
end;
{ TXMLOptionsStorage } { TXMLOptionsStorage }
function TXMLOptionsStorage.GetFullPathValue(const APath, ADefault: String function TXMLOptionsStorage.GetFullPathValue(const APath, ADefault: String
@ -1389,7 +1183,6 @@ begin
end; end;
initialization initialization
IDEDialogLayoutList:=nil;
DefaultConfigClass:=TXMLOptionsStorage; DefaultConfigClass:=TXMLOptionsStorage;
GetIDEConfigStorage:=@GetLazIDEConfigStorage; GetIDEConfigStorage:=@GetLazIDEConfigStorage;

View File

@ -41,7 +41,7 @@ interface
uses uses
Classes, SysUtils, LCLProc, Forms, Controls, Buttons, ComCtrls, StdCtrls, Classes, SysUtils, LCLProc, Forms, Controls, Buttons, ComCtrls, StdCtrls,
Dialogs, LResources, LazarusIDEStrConsts, IDEOptionDefs, CodeToolManager, Dialogs, LResources, LazarusIDEStrConsts, IDEWindowIntf, CodeToolManager,
CodeAtom, CodeToolsStructs, CodeCache, SynHighlighterPas, SynEdit, CodeAtom, CodeToolsStructs, CodeCache, SynHighlighterPas, SynEdit,
EditorOptions, InputHistory, MiscOptions; EditorOptions, InputHistory, MiscOptions;

View File

@ -42,7 +42,7 @@ interface
uses uses
Classes, SysUtils, LCLProc, Forms, Controls, StdCtrls, Buttons, ComCtrls, Classes, SysUtils, LCLProc, Forms, Controls, StdCtrls, Buttons, ComCtrls,
Dialogs, LResources, ProjectIntf, PackageIntf, NewItemIntf, Dialogs, LResources, ProjectIntf, PackageIntf, NewItemIntf,
IDEOptionDefs, LazarusIDEStrConsts; IDEWindowIntf, LazarusIDEStrConsts;
type type
{ TNewLazIDEItemCategory } { TNewLazIDEItemCategory }

View File

@ -38,7 +38,8 @@ interface
uses uses
Classes, LCLIntf, SysUtils, Forms, Controls, Graphics, StdCtrls, ExtCtrls, Classes, LCLIntf, SysUtils, Forms, Controls, Graphics, StdCtrls, ExtCtrls,
LResources, Buttons, Dialogs, CodeToolManager, LResources, Buttons, Dialogs, CodeToolManager,
LazarusIDEStrConsts, IDEOptionDefs, ProjectIntf, Project; ProjectIntf, IDEWindowIntf,
LazarusIDEStrConsts, IDEOptionDefs, Project;
type type
TProjectOptionsDialog = class(TForm) TProjectOptionsDialog = class(TForm)

View File

@ -38,7 +38,9 @@ interface
uses uses
Classes, SysUtils, Forms, Controls, Graphics, LResources, Buttons, StdCtrls, Classes, SysUtils, Forms, Controls, Graphics, LResources, Buttons, StdCtrls,
ProjectDefs, PackageDefs, PublishModule, IDEOptionDefs, InputHistory, Dialogs, Dialogs,
IDEWindowIntf,
ProjectDefs, PackageDefs, PublishModule, IDEOptionDefs, InputHistory,
LazarusIDEStrConsts; LazarusIDEStrConsts;
type type

View File

@ -42,7 +42,7 @@ interface
uses uses
Classes, SysUtils, LCLProc, Forms, Controls, SynEdit, Buttons, StdCtrls, Classes, SysUtils, LCLProc, Forms, Controls, SynEdit, Buttons, StdCtrls,
ExtCtrls, IDEOptionDefs, Dialogs, BasicCodeTools, ExtCtrls, IDEOptionDefs, Dialogs, BasicCodeTools,
{$IFNDEF VER1_0}AVL_Tree{$ELSE}OldAvLTree{$ENDIF}, TextTools, AVL_Tree, TextTools, IDEWindowIntf,
LazarusIDEStrConsts, EditorOptions, MiscOptions, SynEditHighlighter; LazarusIDEStrConsts, EditorOptions, MiscOptions, SynEditHighlighter;
type type

View File

@ -50,7 +50,7 @@ uses
SynEditTypes, SynEdit, SynRegExpr, SynEditHighlighter, SynEditAutoComplete, SynEditTypes, SynEdit, SynRegExpr, SynEditHighlighter, SynEditAutoComplete,
SynEditKeyCmds, SynCompletion, SynEditKeyCmds, SynCompletion,
// IDE interface // IDE interface
HelpIntf, SrcEditorIntf, MenuIntf, LazIDEIntf, HelpIntf, SrcEditorIntf, MenuIntf, LazIDEIntf, IDEWindowIntf,
// IDE units // IDE units
LazarusIDEStrConsts, LazConf, IDECommands, EditorOptions, KeyMapping, Project, LazarusIDEStrConsts, LazConf, IDECommands, EditorOptions, KeyMapping, Project,
WordCompletion, FindReplaceDialog, FindInFilesDlg, IDEProcs, IDEOptionDefs, WordCompletion, FindReplaceDialog, FindInFilesDlg, IDEProcs, IDEOptionDefs,

View File

@ -38,7 +38,7 @@ interface
uses uses
SysUtils, Classes, Controls, Forms, Dialogs, LResources, Buttons, StdCtrls, SysUtils, Classes, Controls, Forms, Dialogs, LResources, Buttons, StdCtrls,
LazarusIdeStrConsts, IDEOptionDefs; LazarusIdeStrConsts, IDEWindowIntf;
type type
TViewUnitsEntry = class TViewUnitsEntry = class

View File

@ -25,7 +25,7 @@ uses
ImageListEditor, ComponentTreeView, ActionsEditor, HelpIntf, TextTools, ImageListEditor, ComponentTreeView, ActionsEditor, HelpIntf, TextTools,
FormEditingIntf, SrcEditorIntf, ComponentReg, PackageIntf, HelpHTML, FormEditingIntf, SrcEditorIntf, ComponentReg, PackageIntf, HelpHTML,
FieldsEditor, ConfigStorage, HelpFPDoc, ProjectIntf, LazIDEIntf, NewItemIntf, FieldsEditor, ConfigStorage, HelpFPDoc, ProjectIntf, LazIDEIntf, NewItemIntf,
MacroIntf, MenuIntf, FrmSelectProps; MacroIntf, MenuIntf, FrmSelectProps, IDEWindowIntf;
implementation implementation

View File

@ -2,6 +2,7 @@ object SelectPropertiesForm: TSelectPropertiesForm
Caption = 'Select properties' Caption = 'Select properties'
ClientHeight = 462 ClientHeight = 462
ClientWidth = 485 ClientWidth = 485
OnClose = SelectPropertiesFormClose
OnCreate = SelectPropertiesFormCreate OnCreate = SelectPropertiesFormCreate
PixelsPerInch = 112 PixelsPerInch = 112
Position = poDesktopCenter Position = poDesktopCenter
@ -47,6 +48,8 @@ object SelectPropertiesForm: TSelectPropertiesForm
Align = alClient Align = alClient
BorderSpacing.OnChange = nil BorderSpacing.OnChange = nil
MultiSelect = True MultiSelect = True
OnClick = LBPropertiesClick
OnDblClick = LBPropertiesDblClick
Sorted = True Sorted = True
TabOrder = 0 TabOrder = 0
TopIndex = -1 TopIndex = -1

View File

@ -2,52 +2,53 @@
LazarusResources.Add('TSelectPropertiesForm','FORMDATA',[ LazarusResources.Add('TSelectPropertiesForm','FORMDATA',[
'TPF0'#21'TSelectPropertiesForm'#20'SelectPropertiesForm'#7'Caption'#6#17'Sel' 'TPF0'#21'TSelectPropertiesForm'#20'SelectPropertiesForm'#7'Caption'#6#17'Sel'
+'ect properties'#12'ClientHeight'#3#206#1#11'ClientWidth'#3#229#1#8'OnCreate' +'ect properties'#12'ClientHeight'#3#206#1#11'ClientWidth'#3#229#1#7'OnClose'
+#7#26'SelectPropertiesFormCreate'#13'PixelsPerInch'#2'p'#8'Position'#7#15'po' +#7#25'SelectPropertiesFormClose'#8'OnCreate'#7#26'SelectPropertiesFormCreate'
+'DesktopCenter'#18'HorzScrollBar.Page'#3#228#1#18'VertScrollBar.Page'#3#205#1 +#13'PixelsPerInch'#2'p'#8'Position'#7#15'poDesktopCenter'#18'HorzScrollBar.P'
+#4'Left'#3#155#1#6'Height'#3#206#1#3'Top'#3#175#0#5'Width'#3#229#1#0#6'TPane' +'age'#3#228#1#18'VertScrollBar.Page'#3#205#1#4'Left'#3#155#1#6'Height'#3#206
+'l'#4'PTop'#5'Align'#7#5'alTop'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3 +#1#3'Top'#3#175#0#5'Width'#3#229#1#0#6'TPanel'#4'PTop'#5'Align'#7#5'alTop'#10
+#248#0#11'ClientWidth'#3#229#1#11'FullRepaint'#8#8'TabOrder'#2#0#8'OnResize' +'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3#248#0#11'ClientWidth'#3#229#1#11
+#7#10'PTopResize'#6'Height'#3#248#0#5'Width'#3#229#1#0#6'TPanel'#11'PPropert' +'FullRepaint'#8#8'TabOrder'#2#0#8'OnResize'#7#10'PTopResize'#6'Height'#3#248
+'ies'#5'Align'#7#7'alRight'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3#248 +#0#5'Width'#3#229#1#0#6'TPanel'#11'PProperties'#5'Align'#7#7'alRight'#10'Bev'
+#0#11'ClientWidth'#3#221#0#11'FullRepaint'#8#8'TabOrder'#2#0#4'Left'#3#8#1#6 +'elOuter'#7#6'bvNone'#12'ClientHeight'#3#248#0#11'ClientWidth'#3#221#0#11'Fu'
+'Height'#3#248#0#5'Width'#3#221#0#0#6'TLabel'#11'LProperties'#5'Align'#7#5'a' +'llRepaint'#8#8'TabOrder'#2#0#4'Left'#3#8#1#6'Height'#3#248#0#5'Width'#3#221
+'lTop'#22'BorderSpacing.OnChange'#13#20'BorderSpacing.Around'#2#3#7'Caption' +#0#0#6'TLabel'#11'LProperties'#5'Align'#7#5'alTop'#22'BorderSpacing.OnChange'
+#6#11'&Properties'#5'Color'#7#6'clNone'#6'Layout'#7#8'tlCenter'#4'Left'#2#3#6 +#13#20'BorderSpacing.Around'#2#3#7'Caption'#6#11'&Properties'#5'Color'#7#6'c'
+'Height'#2#25#3'Top'#2#3#5'Width'#3#215#0#0#0#8'TListBox'#12'LBProperties'#5 +'lNone'#6'Layout'#7#8'tlCenter'#4'Left'#2#3#6'Height'#2#25#3'Top'#2#3#5'Widt'
+'Align'#7#8'alClient'#22'BorderSpacing.OnChange'#13#11'MultiSelect'#9#6'Sort' +'h'#3#215#0#0#0#8'TListBox'#12'LBProperties'#5'Align'#7#8'alClient'#22'Borde'
+'ed'#9#8'TabOrder'#2#0#8'TopIndex'#2#255#6'Height'#3#217#0#3'Top'#2#31#5'Wid' +'rSpacing.OnChange'#13#11'MultiSelect'#9#7'OnClick'#7#17'LBPropertiesClick'
+'th'#3#221#0#0#0#0#6'TPanel'#11'PComponents'#5'Align'#7#6'alLeft'#10'BevelOu' +#10'OnDblClick'#7#20'LBPropertiesDblClick'#6'Sorted'#9#8'TabOrder'#2#0#8'Top'
+'ter'#7#6'bvNone'#7'Caption'#6#11'PComponents'#12'ClientHeight'#3#248#0#11'C' +'Index'#2#255#6'Height'#3#217#0#3'Top'#2#31#5'Width'#3#221#0#0#0#0#6'TPanel'
+'lientWidth'#3#200#0#11'FullRepaint'#8#8'TabOrder'#2#1#6'Height'#3#248#0#5'W' +#11'PComponents'#5'Align'#7#6'alLeft'#10'BevelOuter'#7#6'bvNone'#7'Caption'#6
+'idth'#3#200#0#0#6'TLabel'#11'LComponents'#5'Align'#7#5'alTop'#7'Anchors'#11 +#11'PComponents'#12'ClientHeight'#3#248#0#11'ClientWidth'#3#200#0#11'FullRep'
+#5'akTop'#6'akLeft'#0#20'BorderSpacing.Around'#2#3#7'Caption'#6#11'Co&mponen' +'aint'#8#8'TabOrder'#2#1#6'Height'#3#248#0#5'Width'#3#200#0#0#6'TLabel'#11'L'
+'ts'#5'Color'#7#6'clNone'#6'Layout'#7#8'tlCenter'#4'Left'#2#3#6'Height'#2#23 +'Components'#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#0#20'Borde'
+#3'Top'#2#3#5'Width'#3#194#0#0#0#8'TListBox'#12'LBComponents'#5'Align'#7#8'a' +'rSpacing.Around'#2#3#7'Caption'#6#11'Co&mponents'#5'Color'#7#6'clNone'#6'La'
+'lClient'#17'OnSelectionChange'#7#27'LBComponentsSelectionChange'#6'Sorted'#9 +'yout'#7#8'tlCenter'#4'Left'#2#3#6'Height'#2#23#3'Top'#2#3#5'Width'#3#194#0#0
+#8'TabOrder'#2#0#8'TopIndex'#2#255#6'Height'#3#219#0#3'Top'#2#29#5'Width'#3 +#0#8'TListBox'#12'LBComponents'#5'Align'#7#8'alClient'#17'OnSelectionChange'
+#200#0#0#0#0#0#9'TSplitter'#9'VSplitter'#5'Align'#7#5'alTop'#7'Beveled'#9#6 +#7#27'LBComponentsSelectionChange'#6'Sorted'#9#8'TabOrder'#2#0#8'TopIndex'#2
+'Cursor'#7#8'crVSplit'#6'Height'#2#8#11'ParentColor'#9#5'Width'#3#229#1#6'Cu' +#255#6'Height'#3#219#0#3'Top'#2#29#5'Width'#3#200#0#0#0#0#0#9'TSplitter'#9'V'
+'rsor'#7#8'crVSplit'#6'Height'#2#8#3'Top'#3#248#0#5'Width'#3#229#1#0#0#6'TPa' +'Splitter'#5'Align'#7#5'alTop'#7'Beveled'#9#6'Cursor'#7#8'crVSplit'#6'Height'
+'nel'#7'PBottom'#5'Align'#7#8'alClient'#10'BevelOuter'#7#6'bvNone'#12'Client' +#2#8#11'ParentColor'#9#5'Width'#3#229#1#6'Cursor'#7#8'crVSplit'#6'Height'#2#8
+'Height'#3#206#0#11'ClientWidth'#3#229#1#21'Constraints.MinHeight'#3#190#0#11 +#3'Top'#3#248#0#5'Width'#3#229#1#0#0#6'TPanel'#7'PBottom'#5'Align'#7#8'alCli'
+'FullRepaint'#8#8'TabOrder'#2#1#6'Height'#3#206#0#3'Top'#3#0#1#5'Width'#3#229 +'ent'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3#206#0#11'ClientWidth'#3
+#1#0#6'TLabel'#11'LLBSelected'#20'BorderSpacing.Around'#2#3#7'Caption'#6#20 +#229#1#21'Constraints.MinHeight'#3#190#0#11'FullRepaint'#8#8'TabOrder'#2#1#6
+'&Selected Properties'#5'Color'#7#6'clNone'#4'Left'#2#10#6'Height'#2#17#3'To' +'Height'#3#206#0#3'Top'#3#0#1#5'Width'#3#229#1#0#6'TLabel'#11'LLBSelected'#20
+'p'#2#3#5'Width'#3#30#1#0#0#8'TListBox'#10'LBSelected'#7'Anchors'#11#5'akTop' +'BorderSpacing.Around'#2#3#7'Caption'#6#20'&Selected Properties'#5'Color'#7#6
+#6'akLeft'#7'akRight'#8'akBottom'#0#11'MultiSelect'#9#8'TabOrder'#2#0#8'TopI' +'clNone'#4'Left'#2#10#6'Height'#2#17#3'Top'#2#3#5'Width'#3#30#1#0#0#8'TListB'
+'ndex'#2#255#4'Left'#2#8#6'Height'#3#177#0#3'Top'#2#24#5'Width'#3'w'#1#0#0#7 +'ox'#10'LBSelected'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0
+'TButton'#4'BAdd'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#4'&Add'#7 +#11'MultiSelect'#9#8'TabOrder'#2#0#8'TopIndex'#2#255#4'Left'#2#8#6'Height'#3
+'OnClick'#7#9'BAddClick'#8'TabOrder'#2#1#4'Left'#3#143#1#6'Height'#2#25#3'To' +#177#0#3'Top'#2#24#5'Width'#3'w'#1#0#0#7'TButton'#4'BAdd'#7'Anchors'#11#5'ak'
+'p'#2#24#5'Width'#2'K'#0#0#7'TButton'#7'BDelete'#7'Anchors'#11#5'akTop'#7'ak' +'Top'#7'akRight'#0#7'Caption'#6#4'&Add'#7'OnClick'#7#9'BAddClick'#8'TabOrder'
+'Right'#0#7'Caption'#6#7'&Delete'#7'OnClick'#7#12'BDeleteClick'#8'TabOrder'#2 +#2#1#4'Left'#3#143#1#6'Height'#2#25#3'Top'#2#24#5'Width'#2'K'#0#0#7'TButton'
+#2#4'Left'#3#143#1#6'Height'#2#25#3'Top'#2'8'#5'Width'#2'K'#0#0#7'TButton'#6 +#7'BDelete'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#7'&Delete'#7'On'
+'BClear'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#6'C&lear'#7'OnClic' +'Click'#7#12'BDeleteClick'#8'TabOrder'#2#2#4'Left'#3#143#1#6'Height'#2#25#3
+'k'#7#11'BClearClick'#8'TabOrder'#2#3#4'Left'#3#143#1#6'Height'#2#25#3'Top'#2 +'Top'#2'8'#5'Width'#2'K'#0#0#7'TButton'#6'BClear'#7'Anchors'#11#5'akTop'#7'a'
+'X'#5'Width'#2'K'#0#0#7'TButton'#3'BOK'#7'Anchors'#11#7'akRight'#8'akBottom' +'kRight'#0#7'Caption'#6#6'C&lear'#7'OnClick'#7#11'BClearClick'#8'TabOrder'#2
+#0#7'Caption'#6#3'&OK'#7'Default'#9#11'ModalResult'#2#1#8'TabOrder'#2#4#4'Le' +#3#4'Left'#3#143#1#6'Height'#2#25#3'Top'#2'X'#5'Width'#2'K'#0#0#7'TButton'#3
+'ft'#3#143#1#6'Height'#2#25#3'Top'#3#169#0#5'Width'#2'K'#0#0#7'TButton'#7'BC' +'BOK'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#3'&OK'#7'Default'#9
+'ancel'#7'Anchors'#11#7'akRight'#8'akBottom'#0#6'Cancel'#9#7'Caption'#6#7'&C' +#11'ModalResult'#2#1#8'TabOrder'#2#4#4'Left'#3#143#1#6'Height'#2#25#3'Top'#3
+'ancel'#11'ModalResult'#2#2#8'TabOrder'#2#5#4'Left'#3#143#1#6'Height'#2#25#3 +#169#0#5'Width'#2'K'#0#0#7'TButton'#7'BCancel'#7'Anchors'#11#7'akRight'#8'ak'
+'Top'#3#137#0#5'Width'#2'K'#0#0#0#0 +'Bottom'#0#6'Cancel'#9#7'Caption'#6#7'&Cancel'#11'ModalResult'#2#2#8'TabOrde'
+'r'#2#5#4'Left'#3#143#1#6'Height'#2#25#3'Top'#3#137#0#5'Width'#2'K'#0#0#0#0
]); ]);

View File

@ -19,8 +19,8 @@ unit frmSelectProps;
interface interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
ObjInspStrConsts, Buttons, ExtCtrls; StdCtrls, ObjInspStrConsts, IDEWindowIntf, Buttons, ExtCtrls;
type type
@ -47,7 +47,11 @@ type
procedure BClearClick(Sender: TObject); procedure BClearClick(Sender: TObject);
procedure BDeleteClick(Sender: TObject); procedure BDeleteClick(Sender: TObject);
procedure LBComponentsSelectionChange(Sender: TObject; User: boolean); procedure LBComponentsSelectionChange(Sender: TObject; User: boolean);
procedure LBPropertiesClick(Sender: TObject);
procedure LBPropertiesDblClick(Sender: TObject);
procedure PTopResize(Sender: TObject); procedure PTopResize(Sender: TObject);
procedure SelectPropertiesFormClose(Sender: TObject;
var CloseAction: TCloseAction);
procedure SelectPropertiesFormCreate(Sender: TObject); procedure SelectPropertiesFormCreate(Sender: TObject);
private private
FSelectedComponent : TComponent; FSelectedComponent : TComponent;
@ -89,6 +93,7 @@ Var
C : TComponent; C : TComponent;
begin begin
//debugln('TSelectPropertiesForm.LBComponentsSelectionChange');
With Sender as TListBox do With Sender as TListBox do
if ItemIndex=-1 then if ItemIndex=-1 then
C:=Nil C:=Nil
@ -97,6 +102,27 @@ begin
ShowProperties(C); ShowProperties(C);
end; end;
procedure TSelectPropertiesForm.LBPropertiesClick(Sender: TObject);
//var
//I: Integer;
begin
//writeln('TSelectPropertiesForm.LBPropertiesClick START ');
//For I:=LBProperties.Items.Count-1 downto 0 do if LBProperties.Selected[i] then writeln(i);
//writeln('');
//writeln('TSelectPropertiesForm.LBPropertiesClick END ');
end;
procedure TSelectPropertiesForm.LBPropertiesDblClick(Sender: TObject);
//var
//I: Integer;
begin
//writeln('TSelectPropertiesForm.LBPropertiesDblClick START ');
//For I:=LBProperties.Items.Count-1 downto 0 do if LBProperties.Selected[i] then writeln(i);
//writeln('');
//writeln('TSelectPropertiesForm.LBPropertiesDblClick END ');
AddSelectedProperties;
end;
procedure TSelectPropertiesForm.PTopResize(Sender: TObject); procedure TSelectPropertiesForm.PTopResize(Sender: TObject);
Var Var
@ -108,6 +134,12 @@ begin
PComponents.Width:=W; PComponents.Width:=W;
end; end;
procedure TSelectPropertiesForm.SelectPropertiesFormClose(Sender: TObject;
var CloseAction: TCloseAction);
begin
IDEDialogLayoutList.SaveLayout(Self);
end;
procedure TSelectPropertiesForm.SelectPropertiesFormCreate(Sender: TObject); procedure TSelectPropertiesForm.SelectPropertiesFormCreate(Sender: TObject);
begin begin
BAdd.Caption:=ilesAdd; BAdd.Caption:=ilesAdd;
@ -117,6 +149,7 @@ begin
BCancel.Caption:=oiStdActDataSetCancel1Hint; BCancel.Caption:=oiStdActDataSetCancel1Hint;
LComponents.Caption:=oisComponents; LComponents.Caption:=oisComponents;
LProperties.Caption:=oisProperties; LProperties.Caption:=oisProperties;
IDEDialogLayoutList.ApplyLayout(Self,485,460);
end; end;
procedure TSelectPropertiesForm.BAddClick(Sender: TObject); procedure TSelectPropertiesForm.BAddClick(Sender: TObject);
@ -137,6 +170,7 @@ end;
function TSelectPropertiesForm.GetSelectedProps: String; function TSelectPropertiesForm.GetSelectedProps: String;
begin begin
//debugln('TSelectPropertiesForm.GetSelectedProps');
LBSelected.Items.Delimiter:=';'; LBSelected.Items.Delimiter:=';';
Result:=LBSelected.Items.DelimitedText; Result:=LBSelected.Items.DelimitedText;
end; end;
@ -148,6 +182,7 @@ Var
I : Integer; I : Integer;
begin begin
//debugln('TSelectPropertiesForm.SetSelectedProps');
L:=TStringList.Create; L:=TStringList.Create;
Try Try
L.Delimiter:=';'; L.Delimiter:=';';
@ -168,6 +203,7 @@ Var
I : Integer; I : Integer;
begin begin
//debugln('TSelectPropertiesForm.ShowComponents');
With LBComponents.Items do With LBComponents.Items do
try try
BeginUpdate; BeginUpdate;
@ -195,8 +231,9 @@ Var
I : Integer; I : Integer;
N,S : String; N,S : String;
P : PPropInfo; P : PPropInfo;
begin begin
//debugln('TSelectPropertiesForm.ShowProperties ',dbgsName(C));
With LBProperties do With LBProperties do
try try
Items.BeginUpdate; Items.BeginUpdate;
@ -231,14 +268,19 @@ Var
N : String; N : String;
begin begin
//write('TSelectPropertiesForm.AddSelectedProperties A ');
//For I:=LBProperties.Items.Count-1 downto 0 do if LBProperties.Selected[i] then write(i);
//writeln('');
If Assigned(FSelectedComponent) then If Assigned(FSelectedComponent) then
With LBProperties do With LBProperties do
try try
Items.BeginUpdate; Items.BeginUpdate;
LBSelected.Items.BeginUpdate; LBSelected.Items.BeginUpdate;
//writeln('TSelectPropertiesForm.AddSelectedProperties B');
For I:=Items.Count-1 downto 0 do For I:=Items.Count-1 downto 0 do
If Selected[i] then If Selected[i] then
begin begin
//writeln('TSelectPropertiesForm.AddSelectedProperties C ',i);
N:=Items[i]; N:=Items[i];
If (FSelectedComponent<>FPropComponent) then If (FSelectedComponent<>FPropComponent) then
N:=FSelectedComponent.Name+'.'+N; N:=FSelectedComponent.Name+'.'+N;
@ -257,6 +299,7 @@ Var
I : Integer; I : Integer;
begin begin
//debugln('TSelectPropertiesForm.DeleteSelectedProperties');
With LBSelected do With LBSelected do
try try
Items.BeginUpdate; Items.BeginUpdate;

283
ideintf/idewindowintf.pas Normal file
View File

@ -0,0 +1,283 @@
{
*****************************************************************************
* *
* See the file COPYING.modifiedLGPL, included in this distribution, *
* for details about the copyright. *
* *
* 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. *
* *
*****************************************************************************
Author: Mattias Gaertner
Abstract:
Provides general classes and methods to access and handle IDE dialogs and
windows.
}
unit IDEWindowIntf;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, ConfigStorage, Forms, Controls;
//----------------------------------------------------------------------------
// layout settings of modal forms (dialogs) in the IDE
type
TIDEDialogLayoutList = class;
{ TIDEDialogLayout }
TIDEDialogLayout = class
private
FHeight: integer;
FList: TIDEDialogLayoutList;
FModified: boolean;
FName: string;
FWidth: integer;
procedure SetHeight(const AValue: integer);
procedure SetList(const AValue: TIDEDialogLayoutList);
procedure SetModified(const AValue: boolean);
procedure SetWidth(const AValue: integer);
public
constructor Create(const TheName: string; TheList: TIDEDialogLayoutList);
function SizeValid: boolean;
property Width: integer read FWidth write SetWidth;
property Height: integer read FHeight write SetHeight;
property Name: string read FName;
procedure LoadFromConfig(Config: TConfigStorage; const Path: string);
procedure SaveToConfig(Config: TConfigStorage; const Path: string);
property List: TIDEDialogLayoutList read FList write SetList;
property Modified: boolean read FModified write SetModified;
end;
TIDEDialogLayoutClass = class of TIDEDialogLayout;
{ TIDEDialogLayoutList }
TIDEDialogLayoutList = class
private
FItemClass: TIDEDialogLayoutClass;
FItems: TList;
FModified: boolean;
function GetItems(Index: integer): TIDEDialogLayout;
protected
procedure SetModified(const AValue: boolean); virtual;
public
constructor Create;
destructor Destroy; override;
procedure ApplyLayout(ADialog: TControl;
DefaultWidth, DefaultHeight: integer);
procedure SaveLayout(ADialog: TControl);
procedure Clear;
function Count: integer;
function Find(const DialogName: string;
CreateIfNotExists: boolean): TIDEDialogLayout;
function Find(ADialog: TObject;
CreateIfNotExists: boolean): TIDEDialogLayout;
function IndexOf(const DialogName: string): integer;
procedure LoadFromConfig(Config: TConfigStorage; const Path: string);
procedure SaveToConfig(Config: TConfigStorage; const Path: string);
property Items[Index: integer]: TIDEDialogLayout read GetItems;
property Modified: boolean read FModified write SetModified;
property ItemClass: TIDEDialogLayoutClass read FItemClass write FItemClass;
end;
var
IDEDialogLayoutList: TIDEDialogLayoutList = nil;// set by the IDE
implementation
{ TIDEDialogLayout }
procedure TIDEDialogLayout.SetHeight(const AValue: integer);
begin
if FHeight=AValue then exit;
FHeight:=AValue;
Modified:=true;
end;
procedure TIDEDialogLayout.SetList(const AValue: TIDEDialogLayoutList);
begin
if FList=AValue then exit;
FList:=AValue;
if (List<>nil) and Modified then List.Modified:=true;
end;
procedure TIDEDialogLayout.SetModified(const AValue: boolean);
begin
FModified:=AValue;
if FModified and (FList<>nil) then FList.Modified:=true;
end;
procedure TIDEDialogLayout.SetWidth(const AValue: integer);
begin
if FWidth=AValue then exit;
FWidth:=AValue;
Modified:=true;
end;
constructor TIDEDialogLayout.Create(const TheName: string;
TheList: TIDEDialogLayoutList);
begin
FName:=TheName;
FList:=TheList;
end;
function TIDEDialogLayout.SizeValid: boolean;
begin
Result:=(Width>10) and (Height>10);
end;
procedure TIDEDialogLayout.LoadFromConfig(Config: TConfigStorage;
const Path: string);
begin
FName:=Config.GetValue(Path+'Name/Value','');
FWidth:=Config.GetValue(Path+'Size/Width',0);
FHeight:=Config.GetValue(Path+'Size/Height',0);
Modified:=false;
end;
procedure TIDEDialogLayout.SaveToConfig(Config: TConfigStorage;
const Path: string);
begin
Config.SetValue(Path+'Name/Value',Name);
Config.SetValue(Path+'Size/Width',Width);
Config.SetValue(Path+'Size/Height',Height);
Modified:=false;
end;
{ TIDEDialogLayoutList }
function TIDEDialogLayoutList.GetItems(Index: integer): TIDEDialogLayout;
begin
Result:=TIDEDialogLayout(FItems[Index]);
end;
procedure TIDEDialogLayoutList.SetModified(const AValue: boolean);
begin
if FModified=AValue then exit;
FModified:=AValue;
end;
constructor TIDEDialogLayoutList.Create;
begin
inherited Create;
FItems:=TList.Create;
FItemClass:=TIDEDialogLayout;
end;
destructor TIDEDialogLayoutList.Destroy;
begin
Clear;
FreeAndNil(FItems);
inherited Destroy;
end;
procedure TIDEDialogLayoutList.ApplyLayout(ADialog: TControl;
DefaultWidth, DefaultHeight: integer);
var
ALayout: TIDEDialogLayout;
NewWidth, NewHeight: integer;
begin
if (ADialog=nil) or (Self=nil) then exit;
ALayout:=Find(ADialog,true);
if ALayout.SizeValid then begin
NewWidth:=ALayout.Width;
NewHeight:=ALayout.Height;
end else begin
NewWidth:=DefaultWidth;
NewHeight:=DefaultHeight;
end;
ADialog.SetBounds(ADialog.Left,ADialog.Top,NewWidth,NewHeight);
end;
procedure TIDEDialogLayoutList.SaveLayout(ADialog: TControl);
var
ALayout: TIDEDialogLayout;
begin
if (ADialog=nil) or (Self=nil) then exit;
ALayout:=Find(ADialog,true);
ALayout.Width:=ADialog.Width;
ALayout.Height:=ADialog.Height;
end;
procedure TIDEDialogLayoutList.Clear;
var i: integer;
begin
for i:=0 to FItems.Count-1 do
Items[i].Free;
FItems.Clear;
end;
function TIDEDialogLayoutList.Count: integer;
begin
Result:=FItems.Count;
end;
function TIDEDialogLayoutList.Find(const DialogName: string;
CreateIfNotExists: boolean): TIDEDialogLayout;
var i: integer;
begin
i:=IndexOf(DialogName);
if (i<0) then begin
if CreateIfNotExists then begin
Result:=FItemClass.Create(DialogName,Self);
FItems.Add(Result);
end else begin
Result:=nil;
end;
end else begin
Result:=Items[i];
end;
end;
function TIDEDialogLayoutList.Find(ADialog: TObject; CreateIfNotExists: boolean
): TIDEDialogLayout;
begin
if ADialog<>nil then begin
Result:=Find(ADialog.ClassName,CreateIfNotExists);
end else begin
Result:=nil;
end;
end;
function TIDEDialogLayoutList.IndexOf(const DialogName: string): integer;
begin
Result:=Count-1;
while (Result>=0) and (CompareText(DialogName,Items[Result].Name)<>0) do
dec(Result);
end;
procedure TIDEDialogLayoutList.LoadFromConfig(Config: TConfigStorage;
const Path: string);
var
NewCount, i: integer;
NewDialogLayout: TIDEDialogLayout;
begin
Clear;
NewCount:=Config.GetValue(Path+'Count',0);
for i:=0 to NewCount-1 do begin
NewDialogLayout:=FItemClass.Create('',Self);
FItems.Add(NewDialogLayout);
NewDialogLayout.LoadFromConfig(Config,Path+'Dialog/'+IntToStr(i+1));
end;
Modified:=false;
end;
procedure TIDEDialogLayoutList.SaveToConfig(Config: TConfigStorage;
const Path: string);
var i: integer;
begin
Config.SetDeleteValue(Path+'Count',Count,0);
for i:=0 to Count-1 do
Items[i].SaveToConfig(Config,Path+'Dialog/'+IntToStr(i+1));
Modified:=false;
end;
end.

View File

@ -50,7 +50,7 @@ type
procedure DoResizeRecord(Index, OldSize, NewSize: integer); procedure DoResizeRecord(Index, OldSize, NewSize: integer);
protected protected
procedure ResizeRecord(var ARecord: Pointer; procedure ResizeRecord(var ARecord: Pointer;
Index, OldSize, NewSize: integer); virtual; Index, OldSize, NewSize: integer); virtual;
function GetObject(Index: Integer): TObject; override; function GetObject(Index: Integer): TObject; override;
procedure PutObject(Index: Integer; AnObject: TObject); override; procedure PutObject(Index: Integer; AnObject: TObject); override;
public public

View File

@ -316,6 +316,7 @@ begin
Result:= TWSCustomListBoxClass(WidgetSetClass).GetSelected(Self, Index) Result:= TWSCustomListBoxClass(WidgetSetClass).GetSelected(Self, Index)
else else
Result:= PCustomListBoxItemRecord(GetCachedData(Index))^.Selected; Result:= PCustomListBoxItemRecord(GetCachedData(Index))^.Selected;
//debugln('TCustomListBox.GetSelected A ',DbgSName(Self),' Index=',dbgs(Index),' Selected=',dbgs(Result));
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}

View File

@ -412,6 +412,8 @@ begin
end; end;
end; end;
end; end;
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
// debugln('TGtkWSCustomListBox.GetSelected ',DbgSName(ACustomListBox),' Index=',dbgs(AIndex),' Selected=',dbgs(Result));
end; end;
function TGtkWSCustomListBox.GetStrings(const ACustomListBox: TCustomListBox function TGtkWSCustomListBox.GetStrings(const ACustomListBox: TCustomListBox
@ -457,6 +459,8 @@ var
Widget: PGtkWidget;// pointer to gtk-widget (local use when neccessary) Widget: PGtkWidget;// pointer to gtk-widget (local use when neccessary)
Handle: HWND; Handle: HWND;
begin begin
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
// debugln('TGtkWSCustomListBox.SelectItem ',DbgSName(ACustomListBox),' Index=',dbgs(AIndex),' Selected=',dbgs(ASelected));
Handle := ACustomListBox.Handle; Handle := ACustomListBox.Handle;
case ACustomListBox.fCompStyle of case ACustomListBox.fCompStyle of
csListBox, csCheckListBox: csListBox, csCheckListBox:
@ -510,6 +514,8 @@ var
Handle: HWND; Handle: HWND;
Widget: PGtkWidget; Widget: PGtkWidget;
begin begin
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
// debugln('TGtkWSCustomListBox.SetItemIndex ',DbgSName(ACustomListBox),' Index=',dbgs(AIndex));
Handle := ACustomListBox.Handle; Handle := ACustomListBox.Handle;
if Handle<>0 then if Handle<>0 then
begin begin
@ -531,13 +537,17 @@ procedure TGtkWSCustomListBox.SetSelectionMode(
const ACustomListBox: TCustomListBox; const ACustomListBox: TCustomListBox;
const AExtendedSelect, AMultiSelect: boolean); const AExtendedSelect, AMultiSelect: boolean);
begin begin
TGtkWidgetSet(InterfaceObject).SetSelectionMode(ACustomListBox, //if CompareText(ACustomListBox.Name,'LBProperties')=0 then
// debugln('TGtkWSCustomListBox.SetSelectionMode ',DbgSName(ACustomListBox));
TGtkWidgetSet(InterfaceObject).SetSelectionMode(ACustomListBox,
PGtkWidget(ACustomListBox.Handle), AMultiSelect, AExtendedSelect); PGtkWidget(ACustomListBox.Handle), AMultiSelect, AExtendedSelect);
end; end;
procedure TGtkWSCustomListBox.SetSorted(const ACustomListBox: TCustomListBox; procedure TGtkWSCustomListBox.SetSorted(const ACustomListBox: TCustomListBox;
AList: TStrings; ASorted: boolean); AList: TStrings; ASorted: boolean);
begin begin
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
// debugln('TGtkWSCustomListBox.SetSorted ',DbgSName(ACustomListBox));
if AList is TGtkListStringList then if AList is TGtkListStringList then
TGtkListStringList(AList).Sorted := ASorted TGtkListStringList(AList).Sorted := ASorted
else if AList is TGtkCListStringList then else if AList is TGtkCListStringList then
@ -564,6 +574,8 @@ var
ListItemWidget: PGtkWidget; ListItemWidget: PGtkWidget;
i: Integer; i: Integer;
begin begin
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
// debugln('TGtkWSCustomListBox.SetTopIndex ',DbgSName(ACustomListBox));
AWidget:=PGtkWidget(ACustomListBox.Handle); AWidget:=PGtkWidget(ACustomListBox.Handle);
ListWidget:=PGtkList(GetWidgetInfo(AWidget, True)^.CoreWidget); ListWidget:=PGtkList(GetWidgetInfo(AWidget, True)^.CoreWidget);
ScrolledWindow:=PGtkScrolledWindow(AWidget); ScrolledWindow:=PGtkScrolledWindow(AWidget);
@ -582,7 +594,6 @@ begin
if AdjValue>MaxAdjValue then AdjValue:=MaxAdjValue; if AdjValue>MaxAdjValue then AdjValue:=MaxAdjValue;
gtk_adjustment_set_value(VertAdj,AdjValue); gtk_adjustment_set_value(VertAdj,AdjValue);
end; end;
{$EndIf} {$EndIf}
{ TGtkWSCustomComboBox } { TGtkWSCustomComboBox }

View File

@ -40,7 +40,7 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, Buttons, ExtCtrls, StdCtrls, Classes, SysUtils, LResources, Forms, Controls, Buttons, ExtCtrls, StdCtrls,
LazarusIDEStrConsts, Dialogs, AVL_Tree, FileUtil, IDEProcs, IDEOptionDefs, LazarusIDEStrConsts, Dialogs, AVL_Tree, FileUtil, IDEProcs, IDEWindowIntf,
ComponentReg, PackageDefs, PackageSystem; ComponentReg, PackageDefs, PackageSystem;
type type

View File

@ -40,7 +40,7 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, Buttons, StdCtrls, ExtCtrls, Classes, SysUtils, LResources, Forms, Controls, Buttons, StdCtrls, ExtCtrls,
Dialogs, FileUtil, ComCtrls, AVL_Tree, LCLProc, NewItemIntf, ProjectIntf, Dialogs, FileUtil, ComCtrls, AVL_Tree, LCLProc, NewItemIntf, ProjectIntf,
LazarusIDEStrConsts, IDEOptionDefs, InputHistory, CodeToolManager, IDEDefs, LazarusIDEStrConsts, IDEWindowIntf, InputHistory, CodeToolManager, IDEDefs,
IDEProcs, EnvironmentOpts, PackageSystem, PackageDefs, ComponentReg; IDEProcs, EnvironmentOpts, PackageSystem, PackageDefs, ComponentReg;
type type

View File

@ -41,7 +41,7 @@ interface
uses uses
Classes, SysUtils, Forms, Controls, Buttons, LResources, StdCtrls, ComCtrls, Classes, SysUtils, Forms, Controls, Buttons, LResources, StdCtrls, ComCtrls,
FileCtrl, Dialogs, FileCtrl, Dialogs,
IDEOptionDefs, LazarusIDEStrConsts, Project, PackageDefs, PackageSystem; IDEWindowIntf, LazarusIDEStrConsts, Project, PackageDefs, PackageSystem;
type type
TBrokenDependenciesDialog = class(TForm) TBrokenDependenciesDialog = class(TForm)

View File

@ -41,7 +41,7 @@ interface
uses uses
Classes, SysUtils, Forms, Controls, Buttons, ComCtrls, StdCtrls, Classes, SysUtils, Forms, Controls, Buttons, ComCtrls, StdCtrls,
FileCtrl, LResources, Dialogs, LCLProc, FileCtrl, LResources, Dialogs, LCLProc,
PackageDefs, LazarusIDEStrConsts, IDEOptionDefs, PackageSystem; PackageDefs, LazarusIDEStrConsts, IDEWindowIntf, PackageSystem;
type type
TOpenInstalledPackagesDlg = class(TCustomForm) TOpenInstalledPackagesDlg = class(TCustomForm)

View File

@ -39,7 +39,7 @@ interface
uses uses
Classes, SysUtils, FPCAdds, LCLProc, Forms, Controls, Buttons, LResources, Classes, SysUtils, FPCAdds, LCLProc, Forms, Controls, Buttons, LResources,
ExtCtrls, StdCtrls, Spin, Dialogs, PathEditorDlg, IDEProcs, IDEOptionDefs, ExtCtrls, StdCtrls, Spin, Dialogs, PathEditorDlg, IDEProcs, IDEWindowIntf,
LazarusIDEStrConsts, BrokenDependenciesDlg, PackageDefs, PackageSystem, LazarusIDEStrConsts, BrokenDependenciesDlg, PackageDefs, PackageSystem,
CompilerOptions; CompilerOptions;