mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 03:48:08 +02:00
added idewindowintf.pas - interface for storing IDE dialogs sizes
git-svn-id: trunk@7460 -
This commit is contained in:
parent
01daa56c38
commit
12ce6432d7
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -959,6 +959,7 @@ ideintf/helpfpdoc.pas svneol=native#text/pascal
|
||||
ideintf/helphtml.pas svneol=native#text/pascal
|
||||
ideintf/helpintf.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/lazideintf.pas svneol=native#text/pascal
|
||||
ideintf/listviewpropedit.pp svneol=native#text/pascal
|
||||
|
@ -36,8 +36,8 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Math, LCLProc, LResources, Forms, Controls, Buttons,
|
||||
ComCtrls, StdCtrls, ExtCtrls, Menus, Dialogs, Graphics, FileUtil,
|
||||
{$IFNDEF VER1_0}AVL_Tree{$ELSE}OldAvLTree{$ENDIF},
|
||||
ComCtrls, StdCtrls, ExtCtrls, Menus, Dialogs, Graphics, FileUtil, AVL_Tree,
|
||||
IDEWindowIntf,
|
||||
LazarusIDEStrConsts, IDEProcs, IDEOptionDefs, EnvironmentOpts,
|
||||
Project, PackageDefs, PackageSystem, InputHistory;
|
||||
|
||||
|
@ -39,7 +39,7 @@ uses
|
||||
SynHighlighterLFM, SynEdit, BasicCodeTools, CodeCache, CodeToolManager,
|
||||
LFMTrees,
|
||||
// IDE
|
||||
ComponentReg, PackageIntf,
|
||||
ComponentReg, PackageIntf, IDEWindowIntf,
|
||||
LazarusIDEStrConsts, OutputFilter, IDEProcs, IDEOptionDefs, EditorOptions;
|
||||
|
||||
type
|
||||
|
@ -35,6 +35,9 @@ uses
|
||||
SynRegExpr, LazarusIDEStrConsts, LazConf, IDEProcs, TransferMacros;
|
||||
|
||||
type
|
||||
|
||||
{ TCleanDirectoryDialog }
|
||||
|
||||
TCleanDirectoryDialog = class(TForm)
|
||||
KeepTextFilesCheckbox: TCHECKBOX;
|
||||
SubDirsCheckbox: TCHECKBOX;
|
||||
@ -63,6 +66,8 @@ type
|
||||
property Macros: TTransferMacroList read FMacros write SetMacros;
|
||||
end;
|
||||
|
||||
{ TShowDeletingFilesDialog }
|
||||
|
||||
TShowDeletingFilesDialog = class(TForm)
|
||||
FilesListBox: TListBox;
|
||||
OkButton: TBUTTON;
|
||||
|
@ -46,6 +46,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLIntf, Forms, Controls, Buttons, StdCtrls, ComCtrls,
|
||||
LCLType, ExtCtrls, Menus, LResources, LCLProc, Graphics, Dialogs, SynEdit,
|
||||
IDEWindowIntf,
|
||||
LazarusIDEStrConsts, DefineTemplates, CodeToolManager,
|
||||
CodeToolsOptions, CodeToolsDefPreview, TransferMacros, InputFileDialog,
|
||||
IDEOptionDefs, LazConf, IDEProcs;
|
||||
|
@ -38,6 +38,7 @@ uses
|
||||
Classes, SysUtils, LazConf, Laz_XMLCfg,
|
||||
LResources, Forms, Controls, Buttons, LclProc, ExtCtrls, StdCtrls, ComCtrls,
|
||||
Dialogs, CodeToolManager, DefineTemplates, SourceChanger, SynEdit,
|
||||
IDEWindowIntf,
|
||||
IDEOptionDefs, EditDefineTree, LazarusIDEStrConsts, IDEProcs;
|
||||
|
||||
type
|
||||
|
@ -38,7 +38,7 @@ interface
|
||||
uses
|
||||
Forms, Classes, LCLProc, SysUtils, ComCtrls, Buttons, StdCtrls, ExtCtrls,
|
||||
Graphics, LResources, FileUtil, Dialogs, Controls, GraphType,
|
||||
ProjectIntf,
|
||||
ProjectIntf, IDEWindowIntf,
|
||||
PathEditorDlg, LazarusIDEStrConsts, IDEOptionDefs, LazConf, IDEProcs,
|
||||
CompilerOptions, ShowCompilerOpts, Project, PackageDefs;
|
||||
|
||||
|
@ -40,7 +40,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Math, Forms, Controls, Buttons, StdCtrls,
|
||||
SynEdit, LResources, LazarusIDEStrConsts, EditorOptions, IDEOptionDefs,
|
||||
SynEdit, LResources, LazarusIDEStrConsts, EditorOptions, IDEWindowIntf,
|
||||
InputHistory, DiffPatch;
|
||||
|
||||
type
|
||||
|
@ -41,7 +41,7 @@ uses
|
||||
SynHighlighterPas, SynHighlighterHTML, SynHighlighterCPP, SynHighlighterXML,
|
||||
SynHighlighterLFM, SynHighlighterPerl, SynHighlighterJava,
|
||||
SynHighlighterPython, SynHighlighterUNIXShellScript,
|
||||
Laz_XMLCfg,
|
||||
Laz_XMLCfg, IDEWindowIntf,
|
||||
IDECommands, CodeTemplateDialog, KeyMapping, InputHistory, IDEOptionDefs,
|
||||
LazarusIDEStrConsts, KeymapSchemeDlg;
|
||||
|
||||
|
@ -37,7 +37,7 @@ uses
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, FPCAdds, LCLProc, Forms, Controls, Buttons, GraphType,
|
||||
Graphics, ExtCtrls, StdCtrls, Spin, FileUtil, LResources, Dialogs,
|
||||
Laz_XMLCfg, ObjectInspector,
|
||||
Laz_XMLCfg, ObjectInspector, IDEWindowIntf,
|
||||
LazarusIDEStrConsts, LazConf, ExtToolDialog, IDEProcs, IDEOptionDefs,
|
||||
InputHistory, EditorOptions, Translations;
|
||||
|
||||
@ -790,8 +790,8 @@ begin
|
||||
// windows
|
||||
InitLayoutList;
|
||||
FIDEDialogLayoutList:=TIDEDialogLayoutList.Create;
|
||||
if IDEOptionDefs.IDEDialogLayoutList=nil then
|
||||
IDEOptionDefs.IDEDialogLayoutList:=FIDEDialogLayoutList;
|
||||
if IDEWindowIntf.IDEDialogLayoutList=nil then
|
||||
IDEWindowIntf.IDEDialogLayoutList:=FIDEDialogLayoutList;
|
||||
FMinimizeAllOnMinimizeMain:=false;
|
||||
FHideIDEOnRun:=false;
|
||||
|
||||
@ -885,8 +885,8 @@ begin
|
||||
FMakeFileHistory.Free;
|
||||
FDebuggerFileHistory.Free;
|
||||
FTestBuildDirHistory.Free;
|
||||
if IDEOptionDefs.IDEDialogLayoutList=FIDEDialogLayoutList then
|
||||
IDEOptionDefs.IDEDialogLayoutList:=nil;
|
||||
if IDEWindowIntf.IDEDialogLayoutList=FIDEDialogLayoutList then
|
||||
IDEWindowIntf.IDEDialogLayoutList:=nil;
|
||||
FIDEDialogLayoutList.Free;
|
||||
fIDEWindowLayoutList.Free;
|
||||
FConfigStore.Free;
|
||||
@ -994,8 +994,8 @@ begin
|
||||
// windows
|
||||
FIDEWindowLayoutList.LoadFromXMLConfig(XMLConfig,
|
||||
Path+'Desktop/');
|
||||
FIDEDialogLayoutList.LoadFromXMLConfig(XMLConfig,
|
||||
Path+'Desktop/Dialogs');
|
||||
FIDEDialogLayoutList.LoadFromConfig(FConfigStore,
|
||||
Path+'Desktop/Dialogs/');
|
||||
FMinimizeAllOnMinimizeMain:=XMLConfig.GetValue(
|
||||
Path+'Desktop/MinimizeAllOnMinimizeMain/Value',true);
|
||||
FHideIDEOnRun:=XMLConfig.GetValue(
|
||||
@ -1229,7 +1229,7 @@ begin
|
||||
|
||||
// windows
|
||||
FIDEWindowLayoutList.SaveToXMLConfig(XMLConfig,Path+'Desktop/');
|
||||
FIDEDialogLayoutList.SaveToXMLConfig(XMLConfig,Path+'Desktop/Dialogs');
|
||||
FIDEDialogLayoutList.SaveToConfig(FConfigStore,Path+'Desktop/Dialogs/');
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/MinimizeAllOnMinimizeMain/Value',
|
||||
FMinimizeAllOnMinimizeMain,true);
|
||||
XMLConfig.SetDeleteValue(Path+'Desktop/HideIDEOnRun/Value',FHideIDEOnRun,
|
||||
|
@ -32,9 +32,9 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Buttons, ExtCtrls,
|
||||
{$IFNDEF VER1_0}AVL_Tree{$ELSE}OldAvLTree{$ENDIF}, CodeAtom, CodeCache,
|
||||
AVL_Tree, CodeAtom, CodeCache,
|
||||
CodeToolManager,
|
||||
LazarusIDEStrConsts, IDEProcs, IDEOptionDefs, MiscOptions, DialogProcs,
|
||||
LazarusIDEStrConsts, IDEProcs, IDEWindowIntf, MiscOptions, DialogProcs,
|
||||
InputHistory, SearchResultView;
|
||||
|
||||
type
|
||||
|
@ -36,7 +36,7 @@ uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, Buttons, StdCtrls, Dialogs,
|
||||
CodeToolManager, CodeAtom, CodeCache, CustomCodeTool, CodeTree,
|
||||
PascalParserTool, FindDeclarationTool,
|
||||
PropEdits, HelpIntf, HelpHTML, HelpFPDoc, MacroIntf,
|
||||
PropEdits, HelpIntf, HelpHTML, HelpFPDoc, MacroIntf, IDEWindowIntf,
|
||||
LazarusIDEStrConsts, TransferMacros, DialogProcs, IDEOptionDefs,
|
||||
EnvironmentOpts, AboutFrm, MsgView, Project, PackageDefs, MainBar,
|
||||
OutputFilter, HelpOptions, MainIntf, LazConf;
|
||||
|
@ -37,8 +37,8 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Buttons, ExtCtrls,
|
||||
HelpIntf, Laz_XMLCfg,
|
||||
ObjectInspector, LazConf, LazarusIDEStrConsts, IDEProcs, IDEOptionDefs;
|
||||
ObjectInspector, HelpIntf, IDEWindowIntf, Laz_XMLCfg,
|
||||
LazConf, LazarusIDEStrConsts, IDEProcs, IDEOptionDefs;
|
||||
|
||||
type
|
||||
{ THelpOptions }
|
||||
|
@ -329,54 +329,9 @@ function StrToIDEWindowDockMode(const s: string): TIDEWindowDockMode;
|
||||
function StrToIDEWindowPlacement(const s: string): TIDEWindowPlacement;
|
||||
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 NonModalIDEFormIDToEnum(const FormID: string): TNonModalIDEWindow;
|
||||
|
||||
var
|
||||
IDEDialogLayoutList: TIDEDialogLayoutList;
|
||||
|
||||
function GetLazIDEConfigStorage(const Filename: string; LoadFromDisk: Boolean
|
||||
): TConfigStorage;
|
||||
|
||||
@ -1122,167 +1077,6 @@ begin
|
||||
SaveTo(Layout);
|
||||
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 }
|
||||
|
||||
function TXMLOptionsStorage.GetFullPathValue(const APath, ADefault: String
|
||||
@ -1389,7 +1183,6 @@ begin
|
||||
end;
|
||||
|
||||
initialization
|
||||
IDEDialogLayoutList:=nil;
|
||||
DefaultConfigClass:=TXMLOptionsStorage;
|
||||
GetIDEConfigStorage:=@GetLazIDEConfigStorage;
|
||||
|
||||
|
@ -41,7 +41,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, Buttons, ComCtrls, StdCtrls,
|
||||
Dialogs, LResources, LazarusIDEStrConsts, IDEOptionDefs, CodeToolManager,
|
||||
Dialogs, LResources, LazarusIDEStrConsts, IDEWindowIntf, CodeToolManager,
|
||||
CodeAtom, CodeToolsStructs, CodeCache, SynHighlighterPas, SynEdit,
|
||||
EditorOptions, InputHistory, MiscOptions;
|
||||
|
||||
|
@ -42,7 +42,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, StdCtrls, Buttons, ComCtrls,
|
||||
Dialogs, LResources, ProjectIntf, PackageIntf, NewItemIntf,
|
||||
IDEOptionDefs, LazarusIDEStrConsts;
|
||||
IDEWindowIntf, LazarusIDEStrConsts;
|
||||
|
||||
type
|
||||
{ TNewLazIDEItemCategory }
|
||||
|
@ -38,7 +38,8 @@ interface
|
||||
uses
|
||||
Classes, LCLIntf, SysUtils, Forms, Controls, Graphics, StdCtrls, ExtCtrls,
|
||||
LResources, Buttons, Dialogs, CodeToolManager,
|
||||
LazarusIDEStrConsts, IDEOptionDefs, ProjectIntf, Project;
|
||||
ProjectIntf, IDEWindowIntf,
|
||||
LazarusIDEStrConsts, IDEOptionDefs, Project;
|
||||
|
||||
type
|
||||
TProjectOptionsDialog = class(TForm)
|
||||
|
@ -38,7 +38,9 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, LResources, Buttons, StdCtrls,
|
||||
ProjectDefs, PackageDefs, PublishModule, IDEOptionDefs, InputHistory, Dialogs,
|
||||
Dialogs,
|
||||
IDEWindowIntf,
|
||||
ProjectDefs, PackageDefs, PublishModule, IDEOptionDefs, InputHistory,
|
||||
LazarusIDEStrConsts;
|
||||
|
||||
type
|
||||
|
@ -42,7 +42,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, SynEdit, Buttons, StdCtrls,
|
||||
ExtCtrls, IDEOptionDefs, Dialogs, BasicCodeTools,
|
||||
{$IFNDEF VER1_0}AVL_Tree{$ELSE}OldAvLTree{$ENDIF}, TextTools,
|
||||
AVL_Tree, TextTools, IDEWindowIntf,
|
||||
LazarusIDEStrConsts, EditorOptions, MiscOptions, SynEditHighlighter;
|
||||
|
||||
type
|
||||
|
@ -50,7 +50,7 @@ uses
|
||||
SynEditTypes, SynEdit, SynRegExpr, SynEditHighlighter, SynEditAutoComplete,
|
||||
SynEditKeyCmds, SynCompletion,
|
||||
// IDE interface
|
||||
HelpIntf, SrcEditorIntf, MenuIntf, LazIDEIntf,
|
||||
HelpIntf, SrcEditorIntf, MenuIntf, LazIDEIntf, IDEWindowIntf,
|
||||
// IDE units
|
||||
LazarusIDEStrConsts, LazConf, IDECommands, EditorOptions, KeyMapping, Project,
|
||||
WordCompletion, FindReplaceDialog, FindInFilesDlg, IDEProcs, IDEOptionDefs,
|
||||
|
@ -38,7 +38,7 @@ interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, Controls, Forms, Dialogs, LResources, Buttons, StdCtrls,
|
||||
LazarusIdeStrConsts, IDEOptionDefs;
|
||||
LazarusIdeStrConsts, IDEWindowIntf;
|
||||
|
||||
type
|
||||
TViewUnitsEntry = class
|
||||
|
@ -25,7 +25,7 @@ uses
|
||||
ImageListEditor, ComponentTreeView, ActionsEditor, HelpIntf, TextTools,
|
||||
FormEditingIntf, SrcEditorIntf, ComponentReg, PackageIntf, HelpHTML,
|
||||
FieldsEditor, ConfigStorage, HelpFPDoc, ProjectIntf, LazIDEIntf, NewItemIntf,
|
||||
MacroIntf, MenuIntf, FrmSelectProps;
|
||||
MacroIntf, MenuIntf, FrmSelectProps, IDEWindowIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -2,6 +2,7 @@ object SelectPropertiesForm: TSelectPropertiesForm
|
||||
Caption = 'Select properties'
|
||||
ClientHeight = 462
|
||||
ClientWidth = 485
|
||||
OnClose = SelectPropertiesFormClose
|
||||
OnCreate = SelectPropertiesFormCreate
|
||||
PixelsPerInch = 112
|
||||
Position = poDesktopCenter
|
||||
@ -47,6 +48,8 @@ object SelectPropertiesForm: TSelectPropertiesForm
|
||||
Align = alClient
|
||||
BorderSpacing.OnChange = nil
|
||||
MultiSelect = True
|
||||
OnClick = LBPropertiesClick
|
||||
OnDblClick = LBPropertiesDblClick
|
||||
Sorted = True
|
||||
TabOrder = 0
|
||||
TopIndex = -1
|
||||
|
@ -2,52 +2,53 @@
|
||||
|
||||
LazarusResources.Add('TSelectPropertiesForm','FORMDATA',[
|
||||
'TPF0'#21'TSelectPropertiesForm'#20'SelectPropertiesForm'#7'Caption'#6#17'Sel'
|
||||
+'ect properties'#12'ClientHeight'#3#206#1#11'ClientWidth'#3#229#1#8'OnCreate'
|
||||
+#7#26'SelectPropertiesFormCreate'#13'PixelsPerInch'#2'p'#8'Position'#7#15'po'
|
||||
+'DesktopCenter'#18'HorzScrollBar.Page'#3#228#1#18'VertScrollBar.Page'#3#205#1
|
||||
+#4'Left'#3#155#1#6'Height'#3#206#1#3'Top'#3#175#0#5'Width'#3#229#1#0#6'TPane'
|
||||
+'l'#4'PTop'#5'Align'#7#5'alTop'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3
|
||||
+#248#0#11'ClientWidth'#3#229#1#11'FullRepaint'#8#8'TabOrder'#2#0#8'OnResize'
|
||||
+#7#10'PTopResize'#6'Height'#3#248#0#5'Width'#3#229#1#0#6'TPanel'#11'PPropert'
|
||||
+'ies'#5'Align'#7#7'alRight'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3#248
|
||||
+#0#11'ClientWidth'#3#221#0#11'FullRepaint'#8#8'TabOrder'#2#0#4'Left'#3#8#1#6
|
||||
+'Height'#3#248#0#5'Width'#3#221#0#0#6'TLabel'#11'LProperties'#5'Align'#7#5'a'
|
||||
+'lTop'#22'BorderSpacing.OnChange'#13#20'BorderSpacing.Around'#2#3#7'Caption'
|
||||
+#6#11'&Properties'#5'Color'#7#6'clNone'#6'Layout'#7#8'tlCenter'#4'Left'#2#3#6
|
||||
+'Height'#2#25#3'Top'#2#3#5'Width'#3#215#0#0#0#8'TListBox'#12'LBProperties'#5
|
||||
+'Align'#7#8'alClient'#22'BorderSpacing.OnChange'#13#11'MultiSelect'#9#6'Sort'
|
||||
+'ed'#9#8'TabOrder'#2#0#8'TopIndex'#2#255#6'Height'#3#217#0#3'Top'#2#31#5'Wid'
|
||||
+'th'#3#221#0#0#0#0#6'TPanel'#11'PComponents'#5'Align'#7#6'alLeft'#10'BevelOu'
|
||||
+'ter'#7#6'bvNone'#7'Caption'#6#11'PComponents'#12'ClientHeight'#3#248#0#11'C'
|
||||
+'lientWidth'#3#200#0#11'FullRepaint'#8#8'TabOrder'#2#1#6'Height'#3#248#0#5'W'
|
||||
+'idth'#3#200#0#0#6'TLabel'#11'LComponents'#5'Align'#7#5'alTop'#7'Anchors'#11
|
||||
+#5'akTop'#6'akLeft'#0#20'BorderSpacing.Around'#2#3#7'Caption'#6#11'Co&mponen'
|
||||
+'ts'#5'Color'#7#6'clNone'#6'Layout'#7#8'tlCenter'#4'Left'#2#3#6'Height'#2#23
|
||||
+#3'Top'#2#3#5'Width'#3#194#0#0#0#8'TListBox'#12'LBComponents'#5'Align'#7#8'a'
|
||||
+'lClient'#17'OnSelectionChange'#7#27'LBComponentsSelectionChange'#6'Sorted'#9
|
||||
+#8'TabOrder'#2#0#8'TopIndex'#2#255#6'Height'#3#219#0#3'Top'#2#29#5'Width'#3
|
||||
+#200#0#0#0#0#0#9'TSplitter'#9'VSplitter'#5'Align'#7#5'alTop'#7'Beveled'#9#6
|
||||
+'Cursor'#7#8'crVSplit'#6'Height'#2#8#11'ParentColor'#9#5'Width'#3#229#1#6'Cu'
|
||||
+'rsor'#7#8'crVSplit'#6'Height'#2#8#3'Top'#3#248#0#5'Width'#3#229#1#0#0#6'TPa'
|
||||
+'nel'#7'PBottom'#5'Align'#7#8'alClient'#10'BevelOuter'#7#6'bvNone'#12'Client'
|
||||
+'Height'#3#206#0#11'ClientWidth'#3#229#1#21'Constraints.MinHeight'#3#190#0#11
|
||||
+'FullRepaint'#8#8'TabOrder'#2#1#6'Height'#3#206#0#3'Top'#3#0#1#5'Width'#3#229
|
||||
+#1#0#6'TLabel'#11'LLBSelected'#20'BorderSpacing.Around'#2#3#7'Caption'#6#20
|
||||
+'&Selected Properties'#5'Color'#7#6'clNone'#4'Left'#2#10#6'Height'#2#17#3'To'
|
||||
+'p'#2#3#5'Width'#3#30#1#0#0#8'TListBox'#10'LBSelected'#7'Anchors'#11#5'akTop'
|
||||
+#6'akLeft'#7'akRight'#8'akBottom'#0#11'MultiSelect'#9#8'TabOrder'#2#0#8'TopI'
|
||||
+'ndex'#2#255#4'Left'#2#8#6'Height'#3#177#0#3'Top'#2#24#5'Width'#3'w'#1#0#0#7
|
||||
+'TButton'#4'BAdd'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#4'&Add'#7
|
||||
+'OnClick'#7#9'BAddClick'#8'TabOrder'#2#1#4'Left'#3#143#1#6'Height'#2#25#3'To'
|
||||
+'p'#2#24#5'Width'#2'K'#0#0#7'TButton'#7'BDelete'#7'Anchors'#11#5'akTop'#7'ak'
|
||||
+'Right'#0#7'Caption'#6#7'&Delete'#7'OnClick'#7#12'BDeleteClick'#8'TabOrder'#2
|
||||
+#2#4'Left'#3#143#1#6'Height'#2#25#3'Top'#2'8'#5'Width'#2'K'#0#0#7'TButton'#6
|
||||
+'BClear'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#6'C&lear'#7'OnClic'
|
||||
+'k'#7#11'BClearClick'#8'TabOrder'#2#3#4'Left'#3#143#1#6'Height'#2#25#3'Top'#2
|
||||
+'X'#5'Width'#2'K'#0#0#7'TButton'#3'BOK'#7'Anchors'#11#7'akRight'#8'akBottom'
|
||||
+#0#7'Caption'#6#3'&OK'#7'Default'#9#11'ModalResult'#2#1#8'TabOrder'#2#4#4'Le'
|
||||
+'ft'#3#143#1#6'Height'#2#25#3'Top'#3#169#0#5'Width'#2'K'#0#0#7'TButton'#7'BC'
|
||||
+'ancel'#7'Anchors'#11#7'akRight'#8'akBottom'#0#6'Cancel'#9#7'Caption'#6#7'&C'
|
||||
+'ancel'#11'ModalResult'#2#2#8'TabOrder'#2#5#4'Left'#3#143#1#6'Height'#2#25#3
|
||||
+'Top'#3#137#0#5'Width'#2'K'#0#0#0#0
|
||||
+'ect properties'#12'ClientHeight'#3#206#1#11'ClientWidth'#3#229#1#7'OnClose'
|
||||
+#7#25'SelectPropertiesFormClose'#8'OnCreate'#7#26'SelectPropertiesFormCreate'
|
||||
+#13'PixelsPerInch'#2'p'#8'Position'#7#15'poDesktopCenter'#18'HorzScrollBar.P'
|
||||
+'age'#3#228#1#18'VertScrollBar.Page'#3#205#1#4'Left'#3#155#1#6'Height'#3#206
|
||||
+#1#3'Top'#3#175#0#5'Width'#3#229#1#0#6'TPanel'#4'PTop'#5'Align'#7#5'alTop'#10
|
||||
+'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3#248#0#11'ClientWidth'#3#229#1#11
|
||||
+'FullRepaint'#8#8'TabOrder'#2#0#8'OnResize'#7#10'PTopResize'#6'Height'#3#248
|
||||
+#0#5'Width'#3#229#1#0#6'TPanel'#11'PProperties'#5'Align'#7#7'alRight'#10'Bev'
|
||||
+'elOuter'#7#6'bvNone'#12'ClientHeight'#3#248#0#11'ClientWidth'#3#221#0#11'Fu'
|
||||
+'llRepaint'#8#8'TabOrder'#2#0#4'Left'#3#8#1#6'Height'#3#248#0#5'Width'#3#221
|
||||
+#0#0#6'TLabel'#11'LProperties'#5'Align'#7#5'alTop'#22'BorderSpacing.OnChange'
|
||||
+#13#20'BorderSpacing.Around'#2#3#7'Caption'#6#11'&Properties'#5'Color'#7#6'c'
|
||||
+'lNone'#6'Layout'#7#8'tlCenter'#4'Left'#2#3#6'Height'#2#25#3'Top'#2#3#5'Widt'
|
||||
+'h'#3#215#0#0#0#8'TListBox'#12'LBProperties'#5'Align'#7#8'alClient'#22'Borde'
|
||||
+'rSpacing.OnChange'#13#11'MultiSelect'#9#7'OnClick'#7#17'LBPropertiesClick'
|
||||
+#10'OnDblClick'#7#20'LBPropertiesDblClick'#6'Sorted'#9#8'TabOrder'#2#0#8'Top'
|
||||
+'Index'#2#255#6'Height'#3#217#0#3'Top'#2#31#5'Width'#3#221#0#0#0#0#6'TPanel'
|
||||
+#11'PComponents'#5'Align'#7#6'alLeft'#10'BevelOuter'#7#6'bvNone'#7'Caption'#6
|
||||
+#11'PComponents'#12'ClientHeight'#3#248#0#11'ClientWidth'#3#200#0#11'FullRep'
|
||||
+'aint'#8#8'TabOrder'#2#1#6'Height'#3#248#0#5'Width'#3#200#0#0#6'TLabel'#11'L'
|
||||
+'Components'#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#0#20'Borde'
|
||||
+'rSpacing.Around'#2#3#7'Caption'#6#11'Co&mponents'#5'Color'#7#6'clNone'#6'La'
|
||||
+'yout'#7#8'tlCenter'#4'Left'#2#3#6'Height'#2#23#3'Top'#2#3#5'Width'#3#194#0#0
|
||||
+#0#8'TListBox'#12'LBComponents'#5'Align'#7#8'alClient'#17'OnSelectionChange'
|
||||
+#7#27'LBComponentsSelectionChange'#6'Sorted'#9#8'TabOrder'#2#0#8'TopIndex'#2
|
||||
+#255#6'Height'#3#219#0#3'Top'#2#29#5'Width'#3#200#0#0#0#0#0#9'TSplitter'#9'V'
|
||||
+'Splitter'#5'Align'#7#5'alTop'#7'Beveled'#9#6'Cursor'#7#8'crVSplit'#6'Height'
|
||||
+#2#8#11'ParentColor'#9#5'Width'#3#229#1#6'Cursor'#7#8'crVSplit'#6'Height'#2#8
|
||||
+#3'Top'#3#248#0#5'Width'#3#229#1#0#0#6'TPanel'#7'PBottom'#5'Align'#7#8'alCli'
|
||||
+'ent'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3#206#0#11'ClientWidth'#3
|
||||
+#229#1#21'Constraints.MinHeight'#3#190#0#11'FullRepaint'#8#8'TabOrder'#2#1#6
|
||||
+'Height'#3#206#0#3'Top'#3#0#1#5'Width'#3#229#1#0#6'TLabel'#11'LLBSelected'#20
|
||||
+'BorderSpacing.Around'#2#3#7'Caption'#6#20'&Selected Properties'#5'Color'#7#6
|
||||
+'clNone'#4'Left'#2#10#6'Height'#2#17#3'Top'#2#3#5'Width'#3#30#1#0#0#8'TListB'
|
||||
+'ox'#10'LBSelected'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0
|
||||
+#11'MultiSelect'#9#8'TabOrder'#2#0#8'TopIndex'#2#255#4'Left'#2#8#6'Height'#3
|
||||
+#177#0#3'Top'#2#24#5'Width'#3'w'#1#0#0#7'TButton'#4'BAdd'#7'Anchors'#11#5'ak'
|
||||
+'Top'#7'akRight'#0#7'Caption'#6#4'&Add'#7'OnClick'#7#9'BAddClick'#8'TabOrder'
|
||||
+#2#1#4'Left'#3#143#1#6'Height'#2#25#3'Top'#2#24#5'Width'#2'K'#0#0#7'TButton'
|
||||
+#7'BDelete'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#7'&Delete'#7'On'
|
||||
+'Click'#7#12'BDeleteClick'#8'TabOrder'#2#2#4'Left'#3#143#1#6'Height'#2#25#3
|
||||
+'Top'#2'8'#5'Width'#2'K'#0#0#7'TButton'#6'BClear'#7'Anchors'#11#5'akTop'#7'a'
|
||||
+'kRight'#0#7'Caption'#6#6'C&lear'#7'OnClick'#7#11'BClearClick'#8'TabOrder'#2
|
||||
+#3#4'Left'#3#143#1#6'Height'#2#25#3'Top'#2'X'#5'Width'#2'K'#0#0#7'TButton'#3
|
||||
+'BOK'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#3'&OK'#7'Default'#9
|
||||
+#11'ModalResult'#2#1#8'TabOrder'#2#4#4'Left'#3#143#1#6'Height'#2#25#3'Top'#3
|
||||
+#169#0#5'Width'#2'K'#0#0#7'TButton'#7'BCancel'#7'Anchors'#11#7'akRight'#8'ak'
|
||||
+'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
|
||||
]);
|
||||
|
@ -19,8 +19,8 @@ unit frmSelectProps;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
ObjInspStrConsts, Buttons, ExtCtrls;
|
||||
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, ObjInspStrConsts, IDEWindowIntf, Buttons, ExtCtrls;
|
||||
|
||||
type
|
||||
|
||||
@ -47,7 +47,11 @@ type
|
||||
procedure BClearClick(Sender: TObject);
|
||||
procedure BDeleteClick(Sender: TObject);
|
||||
procedure LBComponentsSelectionChange(Sender: TObject; User: boolean);
|
||||
procedure LBPropertiesClick(Sender: TObject);
|
||||
procedure LBPropertiesDblClick(Sender: TObject);
|
||||
procedure PTopResize(Sender: TObject);
|
||||
procedure SelectPropertiesFormClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
procedure SelectPropertiesFormCreate(Sender: TObject);
|
||||
private
|
||||
FSelectedComponent : TComponent;
|
||||
@ -89,6 +93,7 @@ Var
|
||||
C : TComponent;
|
||||
|
||||
begin
|
||||
//debugln('TSelectPropertiesForm.LBComponentsSelectionChange');
|
||||
With Sender as TListBox do
|
||||
if ItemIndex=-1 then
|
||||
C:=Nil
|
||||
@ -97,6 +102,27 @@ begin
|
||||
ShowProperties(C);
|
||||
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);
|
||||
|
||||
Var
|
||||
@ -108,6 +134,12 @@ begin
|
||||
PComponents.Width:=W;
|
||||
end;
|
||||
|
||||
procedure TSelectPropertiesForm.SelectPropertiesFormClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
begin
|
||||
IDEDialogLayoutList.SaveLayout(Self);
|
||||
end;
|
||||
|
||||
procedure TSelectPropertiesForm.SelectPropertiesFormCreate(Sender: TObject);
|
||||
begin
|
||||
BAdd.Caption:=ilesAdd;
|
||||
@ -117,6 +149,7 @@ begin
|
||||
BCancel.Caption:=oiStdActDataSetCancel1Hint;
|
||||
LComponents.Caption:=oisComponents;
|
||||
LProperties.Caption:=oisProperties;
|
||||
IDEDialogLayoutList.ApplyLayout(Self,485,460);
|
||||
end;
|
||||
|
||||
procedure TSelectPropertiesForm.BAddClick(Sender: TObject);
|
||||
@ -137,6 +170,7 @@ end;
|
||||
|
||||
function TSelectPropertiesForm.GetSelectedProps: String;
|
||||
begin
|
||||
//debugln('TSelectPropertiesForm.GetSelectedProps');
|
||||
LBSelected.Items.Delimiter:=';';
|
||||
Result:=LBSelected.Items.DelimitedText;
|
||||
end;
|
||||
@ -148,6 +182,7 @@ Var
|
||||
I : Integer;
|
||||
|
||||
begin
|
||||
//debugln('TSelectPropertiesForm.SetSelectedProps');
|
||||
L:=TStringList.Create;
|
||||
Try
|
||||
L.Delimiter:=';';
|
||||
@ -168,6 +203,7 @@ Var
|
||||
I : Integer;
|
||||
|
||||
begin
|
||||
//debugln('TSelectPropertiesForm.ShowComponents');
|
||||
With LBComponents.Items do
|
||||
try
|
||||
BeginUpdate;
|
||||
@ -195,8 +231,9 @@ Var
|
||||
I : Integer;
|
||||
N,S : String;
|
||||
P : PPropInfo;
|
||||
|
||||
|
||||
begin
|
||||
//debugln('TSelectPropertiesForm.ShowProperties ',dbgsName(C));
|
||||
With LBProperties do
|
||||
try
|
||||
Items.BeginUpdate;
|
||||
@ -231,14 +268,19 @@ Var
|
||||
N : String;
|
||||
|
||||
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
|
||||
With LBProperties do
|
||||
try
|
||||
Items.BeginUpdate;
|
||||
LBSelected.Items.BeginUpdate;
|
||||
//writeln('TSelectPropertiesForm.AddSelectedProperties B');
|
||||
For I:=Items.Count-1 downto 0 do
|
||||
If Selected[i] then
|
||||
begin
|
||||
//writeln('TSelectPropertiesForm.AddSelectedProperties C ',i);
|
||||
N:=Items[i];
|
||||
If (FSelectedComponent<>FPropComponent) then
|
||||
N:=FSelectedComponent.Name+'.'+N;
|
||||
@ -257,6 +299,7 @@ Var
|
||||
I : Integer;
|
||||
|
||||
begin
|
||||
//debugln('TSelectPropertiesForm.DeleteSelectedProperties');
|
||||
With LBSelected do
|
||||
try
|
||||
Items.BeginUpdate;
|
||||
|
283
ideintf/idewindowintf.pas
Normal file
283
ideintf/idewindowintf.pas
Normal 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.
|
||||
|
@ -50,7 +50,7 @@ type
|
||||
procedure DoResizeRecord(Index, OldSize, NewSize: integer);
|
||||
protected
|
||||
procedure ResizeRecord(var ARecord: Pointer;
|
||||
Index, OldSize, NewSize: integer); virtual;
|
||||
Index, OldSize, NewSize: integer); virtual;
|
||||
function GetObject(Index: Integer): TObject; override;
|
||||
procedure PutObject(Index: Integer; AnObject: TObject); override;
|
||||
public
|
||||
|
@ -316,6 +316,7 @@ begin
|
||||
Result:= TWSCustomListBoxClass(WidgetSetClass).GetSelected(Self, Index)
|
||||
else
|
||||
Result:= PCustomListBoxItemRecord(GetCachedData(Index))^.Selected;
|
||||
//debugln('TCustomListBox.GetSelected A ',DbgSName(Self),' Index=',dbgs(Index),' Selected=',dbgs(Result));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
|
@ -412,6 +412,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
|
||||
// debugln('TGtkWSCustomListBox.GetSelected ',DbgSName(ACustomListBox),' Index=',dbgs(AIndex),' Selected=',dbgs(Result));
|
||||
end;
|
||||
|
||||
function TGtkWSCustomListBox.GetStrings(const ACustomListBox: TCustomListBox
|
||||
@ -457,6 +459,8 @@ var
|
||||
Widget: PGtkWidget;// pointer to gtk-widget (local use when neccessary)
|
||||
Handle: HWND;
|
||||
begin
|
||||
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
|
||||
// debugln('TGtkWSCustomListBox.SelectItem ',DbgSName(ACustomListBox),' Index=',dbgs(AIndex),' Selected=',dbgs(ASelected));
|
||||
Handle := ACustomListBox.Handle;
|
||||
case ACustomListBox.fCompStyle of
|
||||
csListBox, csCheckListBox:
|
||||
@ -510,6 +514,8 @@ var
|
||||
Handle: HWND;
|
||||
Widget: PGtkWidget;
|
||||
begin
|
||||
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
|
||||
// debugln('TGtkWSCustomListBox.SetItemIndex ',DbgSName(ACustomListBox),' Index=',dbgs(AIndex));
|
||||
Handle := ACustomListBox.Handle;
|
||||
if Handle<>0 then
|
||||
begin
|
||||
@ -531,13 +537,17 @@ procedure TGtkWSCustomListBox.SetSelectionMode(
|
||||
const ACustomListBox: TCustomListBox;
|
||||
const AExtendedSelect, AMultiSelect: boolean);
|
||||
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);
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomListBox.SetSorted(const ACustomListBox: TCustomListBox;
|
||||
AList: TStrings; ASorted: boolean);
|
||||
begin
|
||||
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
|
||||
// debugln('TGtkWSCustomListBox.SetSorted ',DbgSName(ACustomListBox));
|
||||
if AList is TGtkListStringList then
|
||||
TGtkListStringList(AList).Sorted := ASorted
|
||||
else if AList is TGtkCListStringList then
|
||||
@ -564,6 +574,8 @@ var
|
||||
ListItemWidget: PGtkWidget;
|
||||
i: Integer;
|
||||
begin
|
||||
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
|
||||
// debugln('TGtkWSCustomListBox.SetTopIndex ',DbgSName(ACustomListBox));
|
||||
AWidget:=PGtkWidget(ACustomListBox.Handle);
|
||||
ListWidget:=PGtkList(GetWidgetInfo(AWidget, True)^.CoreWidget);
|
||||
ScrolledWindow:=PGtkScrolledWindow(AWidget);
|
||||
@ -582,7 +594,6 @@ begin
|
||||
if AdjValue>MaxAdjValue then AdjValue:=MaxAdjValue;
|
||||
gtk_adjustment_set_value(VertAdj,AdjValue);
|
||||
end;
|
||||
|
||||
{$EndIf}
|
||||
|
||||
{ TGtkWSCustomComboBox }
|
||||
|
@ -40,7 +40,7 @@ interface
|
||||
|
||||
uses
|
||||
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;
|
||||
|
||||
type
|
||||
|
@ -40,7 +40,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Buttons, StdCtrls, ExtCtrls,
|
||||
Dialogs, FileUtil, ComCtrls, AVL_Tree, LCLProc, NewItemIntf, ProjectIntf,
|
||||
LazarusIDEStrConsts, IDEOptionDefs, InputHistory, CodeToolManager, IDEDefs,
|
||||
LazarusIDEStrConsts, IDEWindowIntf, InputHistory, CodeToolManager, IDEDefs,
|
||||
IDEProcs, EnvironmentOpts, PackageSystem, PackageDefs, ComponentReg;
|
||||
|
||||
type
|
||||
|
@ -41,7 +41,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Buttons, LResources, StdCtrls, ComCtrls,
|
||||
FileCtrl, Dialogs,
|
||||
IDEOptionDefs, LazarusIDEStrConsts, Project, PackageDefs, PackageSystem;
|
||||
IDEWindowIntf, LazarusIDEStrConsts, Project, PackageDefs, PackageSystem;
|
||||
|
||||
type
|
||||
TBrokenDependenciesDialog = class(TForm)
|
||||
|
@ -41,7 +41,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Buttons, ComCtrls, StdCtrls,
|
||||
FileCtrl, LResources, Dialogs, LCLProc,
|
||||
PackageDefs, LazarusIDEStrConsts, IDEOptionDefs, PackageSystem;
|
||||
PackageDefs, LazarusIDEStrConsts, IDEWindowIntf, PackageSystem;
|
||||
|
||||
type
|
||||
TOpenInstalledPackagesDlg = class(TCustomForm)
|
||||
|
@ -39,7 +39,7 @@ interface
|
||||
|
||||
uses
|
||||
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,
|
||||
CompilerOptions;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user