fixed register color prop edit

git-svn-id: trunk@4543 -
This commit is contained in:
mattias 2003-08-28 12:08:30 +00:00
parent 3a6dd972da
commit 8867c27b0f
8 changed files with 44 additions and 158 deletions

2
.gitattributes vendored
View File

@ -334,6 +334,8 @@ ide/codeexplorer.pas svneol=native#text/pascal
ide/codetemplatedialog.pp svneol=native#text/pascal
ide/codetoolsdefines.lrs svneol=native#text/pascal
ide/codetoolsdefines.pas svneol=native#text/pascal
ide/codetoolsdefpreview.lfm svneol=native#text/plain
ide/codetoolsdefpreview.lrs svneol=native#text/pascal
ide/codetoolsdefpreview.pas svneol=native#text/pascal
ide/codetoolsoptions.pas svneol=native#text/pascal
ide/compiler.pp svneol=native#text/pascal

View File

@ -836,7 +836,7 @@ initialization
// Normally it should use something like this;
// RegisterPropertyEditor(TypeInfo(TColor),nil,'',TColorPropertyEditor);
DummyClassForPropTypes:=TDummyClassForGraphPropTypes.Create;
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TColor'),
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TGraphicsColor'),
nil,'',TColorPropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TBrushStyle'),
nil,'',TBrushStylePropertyEditor);

View File

@ -148,7 +148,7 @@ type
InsertFilePathBitBtn: TBitBtn;
// preview
DefinePreview: TCodeToolsDefinesPreview;
//DefinePreview: TCodeToolsDefinesPreview;
// misc
procedure FormResize(Sender: TObject);
@ -581,13 +581,13 @@ end;
procedure TCodeToolsDefinesEditor.OpenPreviewMenuItemClick(Sender: TObject);
begin
if DefinePreview=nil then begin
DefinePreview:=TCodeToolsDefinesPreview.Create(Self);
DefinePreview.DefineTree:=DefineTree;
DefinePreview.Show;
end;
RefreshPreview;
BringWindowToTop(DefinePreview.Handle);
//if DefinePreview=nil then begin
// DefinePreview:=TCodeToolsDefinesPreview.Create(Self);
// DefinePreview.DefineTree:=DefineTree;
// DefinePreview.Show;
//end;
//RefreshPreview;
//BringWindowToTop(DefinePreview.Handle);
end;
procedure TCodeToolsDefinesEditor.InsertFPCProjectDefinesTemplateMenuItemClick(
@ -959,8 +959,8 @@ end;
procedure TCodeToolsDefinesEditor.RefreshPreview;
begin
if DefinePreview=nil then exit;
DefinePreview.ShowDefines;
//if DefinePreview=nil then exit;
//DefinePreview.ShowDefines;
end;
procedure TCodeToolsDefinesEditor.CreateComponents;

View File

@ -0,0 +1,11 @@
object Form2: TForm2
CAPTION = 'Form2'
CLIENTHEIGHT = 451
CLIENTWIDTH = 463
HORZSCROLLBAR.PAGE = 464
VERTSCROLLBAR.PAGE = 452
LEFT = 423
HEIGHT = 451
TOP = 228
WIDTH = 463
end

View File

@ -0,0 +1,7 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm2','FORMDATA',[
'TPF0'#6'TForm2'#5'Form2'#7'CAPTION'#6#5'Form2'#12'CLIENTHEIGHT'#3#195#1#11'C'
+'LIENTWIDTH'#3#207#1#18'HORZSCROLLBAR.PAGE'#3#208#1#18'VERTSCROLLBAR.PAGE'#3
+#196#1#4'LEFT'#3#167#1#6'HEIGHT'#3#195#1#3'TOP'#3#228#0#5'WIDTH'#3#207#1#0#0
]);

View File

@ -1,37 +1,3 @@
{ /***************************************************************************
codetoolsdefpreview.pas - Lazarus IDE unit
--------------------------------------------
***************************************************************************/
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Mattias Gaertner
Abstract:
- TCodeToolsDefinesPreview is a preview for the defines of a single
directory, used by TCodeToolsDefinesEditor.
Not complete.
}
unit CodeToolsDefPreview;
{$mode objfpc}{$H+}
@ -39,124 +5,21 @@ unit CodeToolsDefPreview;
interface
uses
Classes, SysUtils, LCLLinux, Forms, Controls, Buttons, StdCtrls, ComCtrls,
ExtCtrls, Menus, LResources, Graphics, Dialogs, ImgList, SynEdit,
LazarusIDEStrConsts, ExprEval, DefineTemplates;
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs;
type
TCodeToolsDefinesPreview = class(TForm)
DirectoryLabel: TLabel;
DirectoryEdit: TEdit;
DefListBox: TListBox;
// misc
procedure FormResize(Sender: TObject);
TForm2 = class(TForm)
private
FDefineTree: TDefineTree;
procedure CreateComponents;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure ShowDefines;
property DefineTree: TDefineTree read FDefineTree write FDefineTree;
end;
var
Form2: TForm2;
implementation
{ TCodeToolsDefinesPreview }
procedure TCodeToolsDefinesPreview.FormResize(Sender: TObject);
var MaxX, MaxY: integer;
begin
MaxX:=ClientWidth-2;
MaxY:=ClientHeight-2;
DirectoryLabel.SetBounds(5,3,150,DirectoryLabel.Height);
with DirectoryEdit do begin
Left:=0;
Top:=DirectoryLabel.Top+DirectoryLabel.Height+2;
Width:=MaxX;
end;
with DefListBox do begin
Left:=0;
Top:=DirectoryEdit.Top+DirectoryEdit.Height+3;
Width:=MaxX;
Height:=MaxY-Top;
end;
end;
procedure TCodeToolsDefinesPreview.CreateComponents;
begin
DirectoryLabel:=TLabel.Create(Self);
with DirectoryLabel do begin
Name:='DirectoryLabel';
Parent:=Self;
Visible:=true;
end;
DirectoryEdit:=TEdit.Create(Self);
with DirectoryEdit do begin
Name:='DirectoryEdit';
Parent:=Self;
Visible:=true;
end;
DefListBox:=TListBox.Create(Self);
with DefListBox do begin
Name:='DefListBox';
Parent:=Self;
Visible:=true;
end;
end;
constructor TCodeToolsDefinesPreview.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
if LazarusResources.Find(ClassName)=nil then begin
SetBounds((Screen.Width-400) div 2,(Screen.Height-400) div 2, 420, 420);
Caption:=lisCodeToolsDefsCodeToolsDefinesPreview;
OnResize:=@FormResize;
CreateComponents;
end;
Resize;
end;
destructor TCodeToolsDefinesPreview.Destroy;
begin
inherited Destroy;
end;
procedure TCodeToolsDefinesPreview.ShowDefines;
var
ExprEval: TExpressionEvaluator;
i: integer;
begin
DefListBox.Items.BeginUpdate;
if DefineTree<>nil then begin
DefineTree.ClearCache;
ExprEval:=DefineTree.GetDefinesForDirectory(DirectoryLabel.Text,false);
if ExprEval<>nil then begin
for i:=0 to ExprEval.Count-1 do begin
if i<DefListBox.Items.Count then
// replace old value
DefListBox.Items[i]:=ExprEval.Items(i)
else
// add value
DefListBox.Items.Add(ExprEval.Items(i));
end;
while DefListBox.Items.Count>ExprEval.Count do
// delete old value
DefListBox.Items.Delete(DefListBox.Items.Count-1);
end else
DefListBox.Items.Clear;
end;
DefListBox.Items.EndUpdate;
end;
initialization
{$I codetoolsdefpreview.lrs}
end.

View File

@ -481,7 +481,7 @@ type
TForm = class(TCustomForm)
private
FClientHandle: HWND;
FDummyPPI : longint;
FDummyPPI: longint;
public
property ClientHandle: HWND read FClientHandle;
published
@ -492,7 +492,7 @@ type
property Caption;
property ClientHeight;
property ClientWidth;
property Color;
property Color default clBtnFace;
property Constraints;
property Enabled;
property Font;

View File

@ -991,7 +991,7 @@ Begin
// FInCMParentBiDiModeChanged := False;
{apply a drawing surface}
FKeyPreview := False;
Color := clBtnface;
Color := clBtnFace;
// FPixelsPerInch := Screen.PixelsPerInch;
// FPrintScale := poProportional;
// FloatingDockSiteClass := TWinControlClass(ClassType);
@ -1426,6 +1426,9 @@ end;
{ =============================================================================
$Log$
Revision 1.111 2003/08/28 12:08:30 mattias
fixed register color prop edit
Revision 1.110 2003/08/27 09:20:44 mattias
added TFrame definition, no implementation