Cleanups, extended TStatusBar, graphic control cleanups.

git-svn-id: trunk@3334 -
This commit is contained in:
lazarus 2002-09-13 11:49:47 +00:00
parent 6a4f25e1c6
commit e18c37b2a4
6 changed files with 88 additions and 179 deletions

View File

@ -319,10 +319,10 @@ begin
RegisterComponents('Standard','Buttons',[TButton]); RegisterComponents('Standard','Buttons',[TButton]);
RegisterComponents('Standard','StdCtrls',[TEdit,TLabel,TMemo,TCheckBox, RegisterComponents('Standard','StdCtrls',[TEdit,TLabel,TMemo,TCheckBox,
TListBox,TRadioButton,TComboBox,TScrollBar,TGroupBox,TToggleBox]); TListBox,TRadioButton,TComboBox,TScrollBar,TGroupBox,TToggleBox]);
RegisterComponents('Standard', 'ExtCtrls',[TPanel]); RegisterComponents('Standard', 'ExtCtrls',[TRadioGroup,TPanel]);
RegisterComponents('Additional','Buttons',[TBitBtn,TSpeedButton]); RegisterComponents('Additional','Buttons',[TBitBtn,TSpeedButton]);
RegisterComponents('Additional','ExtCtrls',[TNoteBook,TPaintBox, RegisterComponents('Additional','ExtCtrls',[TNoteBook,TPaintBox,
TBevel,TRadioGroup,TImage]); TBevel,TImage]);
RegisterComponents('Additional','ComCtrls',[TStatusBar,TListView,TTreeView, RegisterComponents('Additional','ComCtrls',[TStatusBar,TListView,TTreeView,
TProgressBar,TToolBar,TTrackbar,TScrollBox]); TProgressBar,TToolBar,TTrackbar,TScrollBox]);
RegisterComponents('Additional','ImgList',[TImageList]); RegisterComponents('Additional','ImgList',[TImageList]);

View File

@ -36,26 +36,29 @@ interface
uses uses
Classes, SysUtils; Classes, SysUtils;
ResourceString resourcestring
// command line help // command line help
lisCmdLineHlpHeader = 'lazarus [options] <project-filename>'#13#10 lisCmdLineHlpHeader = 'lazarus [options] <project-filename>' + LineEnding
+#13#10 + LineEnding
+'IDE Options:'#13#10 + 'IDE Options:' + LineEnding
+#13#10 + LineEnding
+'--help or -? this help message'#13#10 + '--help or -? this help message' + LineEnding
+#13#10; + LineEnding;
lisCmdLinePrimaryConfigPathDesc = lisCmdLinePrimaryConfigPathDesc =
'--primary-config-path <path>'#13#10 '--primary-config-path <path>' + LineEnding
+' primary config directory, where Lazarus'#13#10 +' primary config directory, where Lazarus' + LineEnding
+' stores its config files. Default is '#13#10 +' stores its config files. Default is ' + LineEnding
+' %s'#13#10 +' %s' + LineEnding
+#13#10; + LineEnding;
lisCmdLineSecondaryConfigPathDesc = lisCmdLineSecondaryConfigPathDesc =
'--secondary-config-path <path>'#13#10 '--secondary-config-path <path>' + LineEnding
+' secondary config directory, where Lazarus'#13#10 +' secondary config directory, where Lazarus' + LineEnding
+' searches for config template files.'#13#10 +' searches for config template files.' + LineEnding
+' Default is %s'#13#10 +' Default is %s' + LineEnding
+#13#10; + LineEnding;
lisCmdLineLCLInterfaceSpecificOptions = lisCmdLineLCLInterfaceSpecificOptions =
'LCL Interface specific options:'; 'LCL Interface specific options:';
@ -219,21 +222,21 @@ ResourceString
lisAboutLazarus = 'About Lazarus'; lisAboutLazarus = 'About Lazarus';
lisAboutLazarusMsg = lisAboutLazarusMsg =
'License: GPL/LGPL' 'License: GPL/LGPL'
+#13 + LineEnding
+'Lazarus are the class libraries for Free Pascal that emulate Delphi.'#13 +'Lazarus are the class libraries for Free Pascal that emulate Delphi.' + LineEnding
+'Free Pascal is a (L)GPL''ed compiler that runs on Linux,'#13 +'Free Pascal is a (L)GPL''ed compiler that runs on Linux,' + LineEnding
+'Win32, OS/2, 68K and more. Free Pascal is designed to be able to'#13 +'Win32, OS/2, 68K and more. Free Pascal is designed to be able to' + LineEnding
+'understand and compile Delphi syntax, which is of course OOP.'#13 +'understand and compile Delphi syntax, which is of course OOP.' + LineEnding
+'Lazarus is the missing part of the puzzle that will allow you to'#13 +'Lazarus is the missing part of the puzzle that will allow you to' + LineEnding
+'develop Delphi like programs in all of the above platforms.'#13 +'develop Delphi like programs in all of the above platforms.' + LineEnding
+'The IDE will eventually become a RAD tool like Delphi.'#13 +'The IDE will eventually become a RAD tool like Delphi.' + LineEnding
+#13 + LineEnding
+'As Lazarus is growing we need more developers.'#13 +'As Lazarus is growing we need more developers.' + LineEnding
+'For example: Write a nicer about dialog with a logo.'; +'For example: Write a nicer about dialog with a logo.';
lisUnitNameAlreadyExistsCap = 'Unitname already in project'; lisUnitNameAlreadyExistsCap = 'Unitname already in project';
lisUnitNameAlreadyExistsText = 'The unit "%s" already exists.'#13 lisUnitNameAlreadyExistsText = 'The unit "%s" already exists.' + LineEnding
+'Ignore will force the renaming,'#13 +'Ignore will force the renaming,' + LineEnding
+'Cancel will cancel the saving of this source and'#13 +'Cancel will cancel the saving of this source and' + LineEnding
+'Abort will abort the whole saving.'; +'Abort will abort the whole saving.';
lisInvalidPascalIdentifierCap = 'Invalid Pascal Identifier'; lisInvalidPascalIdentifierCap = 'Invalid Pascal Identifier';
lisInvalidPascalIdentifierText = lisInvalidPascalIdentifierText =
@ -268,6 +271,9 @@ ResourceString
+'along with this program; if not, write to the Free Software ' +'along with this program; if not, write to the Free Software '
+'Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. '; +'Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ';
// component editors commands
liscAdd = '&Add';
liscDelete = '&Delete';
implementation implementation

View File

@ -95,29 +95,30 @@ type
property Items[Index: Integer]: TStatusPanel read GetItem write SetItem; default; property Items[Index: Integer]: TStatusPanel read GetItem write SetItem; default;
end; end;
TStatusBar = Class(TWinControl) TStatusBar = class(TCustomPanel)
private private
FCanvas : TCanvas; FCanvas : TCanvas;
FPanels : TStatusPanels; FPanels : TStatusPanels;
FSimpleText : String; FSimpleText : String;
FSimplePanel : Boolean; FSimplePanel : Boolean;
//FContext : Integer;
//FMessage : Integer;
//FAlignmentWidget : TAlignment;
procedure SetPanels(Value: TStatusPanels); procedure SetPanels(Value: TStatusPanels);
procedure SetSimpleText(Value : String); procedure SetSimpleText(Value : String);
procedure SetSimplePanel(Value : Boolean); procedure SetSimplePanel(Value : Boolean);
Procedure WMPaint(var Msg: TLMPaint); message LM_PAINT;
Procedure DrawDivider(X : Integer);
Procedure DrawBevel(xLeft, PanelNum : Integer );
public public
constructor Create(AOwner : TComponent); override; constructor Create(AOwner : TComponent); override;
destructor Destroy; override; destructor Destroy; override;
property Canvas : TCanvas read FCanvas; property Canvas : TCanvas read FCanvas;
published published
property Align;
property Anchors;
property BorderWidth;
property Color;
property Constraints;
property Enabled;
property Font;
property Panels: TStatusPanels read FPanels write SetPanels; property Panels: TStatusPanels read FPanels write SetPanels;
property SimpleText: String read FSimpleText write SetSimpleText; property SimpleText: string read GetText write SetText;
property SimplePanel: Boolean read FSimplePanel write SetSimplePanel default True; property SimplePanel: boolean read FSimplePanel write SetSimplePanel default True;
property Visible; property Visible;
end; end;
@ -1598,6 +1599,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.44 2002/09/13 11:49:47 lazarus
Cleanups, extended TStatusBar, graphic control cleanups.
Revision 1.43 2002/09/10 10:00:27 lazarus Revision 1.43 2002/09/10 10:00:27 lazarus
MG: TListView now works handleless and SetSelection implemented MG: TListView now works handleless and SetSelection implemented

View File

@ -102,7 +102,7 @@ begin
if BevelInner <> bvNone then begin if BevelInner <> bvNone then begin
if BorderWidth > 0 then InflateRect(ARect, -BorderWidth, -BorderWidth); if BorderWidth > 0 then InflateRect(ARect, -BorderWidth, -BorderWidth);
Canvas.Frame3d(ARect, BorderWidth, BevelInner); Canvas.Frame3d(ARect, BevelWidth, BevelInner);
end; end;
if Caption <> '' then begin if Caption <> '' then begin

View File

@ -54,16 +54,9 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TGraphicControl.WMPaint(var Message: TLMPaint); procedure TGraphicControl.WMPaint(var Message: TLMPaint);
begin begin
// tspeedbutton is buggy: this is a workaround
if AnsiCompareText(Classname,'tspeedbutton')=0 then begin
Paint;
exit;
end;
// end of workaround
if Message.DC <> 0 then if Message.DC <> 0 then
begin begin
// Canvas.Lock; Canvas.Lock;
try try
Canvas.Handle := Message.DC; Canvas.Handle := Message.DC;
try try
@ -72,7 +65,7 @@ begin
Canvas.Handle := 0; Canvas.Handle := 0;
end; end;
finally finally
// Canvas.Unlock; Canvas.Unlock;
end; end;
end; end;
end; end;
@ -92,6 +85,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.5 2002/09/13 11:49:47 lazarus
Cleanups, extended TStatusBar, graphic control cleanups.
Revision 1.4 2002/08/26 17:28:21 lazarus Revision 1.4 2002/08/26 17:28:21 lazarus
MG: fixed speedbutton in designmode MG: fixed speedbutton in designmode

View File

@ -20,48 +20,25 @@
constructor TStatusBar.Create(AOwner: TComponent); constructor TStatusBar.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
fCompStyle := csStatusBar; // fCompStyle := csStatusBar;
ControlStyle := [csCaptureMouse, csClickEvents, csDoubleClicks, csOpaque]; ControlStyle:= [csCaptureMouse, csClickEvents, csDoubleClicks, csOpaque];
Color := clBtnFace; Color := clBtnFace;
Height := 19; Alignment:= taLeftJustify;
Setbounds(0,TWinControl(AOwner).Height-21,TWinControl(AOwner).Width,20); BevelOuter:= bvLowered;
Align := alBottom; BevelInner:= bvNone;
if Owner is TControl then
Setbounds(0, TControl(AOwner).Height - 21, TControl(AOwner).Width, 20)
else
Setbounds(0, 0, 20, 20);
Align:= alBottom;
FPanels := TStatusPanels.Create(Self); FPanels := TStatusPanels.Create(Self);
FCanvas := TControlCanvas.Create; FCanvas := TControlCanvas.Create;
TControlCanvas(FCanvas).Control := Self; TControlCanvas(FCanvas).Control := Self;
FSimplePanel := True; FSimplePanel:= True;
// FSizeGrip := True; // FSizeGrip := True;
end; end;
{------------------------------------------------------------------------------}
{ TStatusBar SetSimpleText }
{------------------------------------------------------------------------------}
procedure TStatusBar.SetSimpleText(Value : String);
begin
if FSimpleText <> value then
begin
FSimpleText := Value;
Invalidate;
end;
end;
Procedure TStatusBar.SetSimplePanel(Value : Boolean);
Begin
if FSimplePanel <> Value then
Begin
FSimplePanel := Value;
Invalidate;
end;
End;
procedure TStatusBar.SetPanels(Value: TStatusPanels);
begin
FPanels.Assign(Value);
end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
{ TStatusBar Destructor } { TStatusBar Destructor }
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
@ -73,104 +50,30 @@ begin
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
{ TStatusBar DrawBevel } { TStatusBar SetSimpleText }
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
Procedure TStatusBar.DrawBevel(xLeft, PanelNum : Integer ); procedure TStatusBar.SetSimpleText(Value : String);
var begin
Colora,Colorb:TColor; if FSimpleText <> value then
I, PL, PW : Longint; begin
Begin Caption:= Value;
if PanelNum = Panels.Count-1 then begin // Invalidate;
PL := Left; end;
If Panels.Count > 1 then end;
For I := 0 to Panels.Count-2 do
PL := PL + Panels[I].Width;
PW := ClientWidth - PL;
end
else
PW := Panels[PanelNum].Width;
Canvas.Brush.Color := Color; procedure TStatusBar.SetSimplePanel(Value : Boolean);
Canvas.FillRect(Rect(XLeft,Top,XLeft+PW,Top+Height)); begin
if FSimplePanel <> Value then
if Panels[PanelNum].Bevel = pbRaised then
begin begin
Colora:=clWhite; FSimplePanel := Value;
Colorb:=clGray; Invalidate;
end;
if Panels[PanelNum].Bevel = pbLowered then
begin
Colora:=clGray;
Colorb:=clWhite;
end; end;
end;
Canvas.Pen.Width:=1; procedure TStatusBar.SetPanels(Value: TStatusPanels);
if (Panels[PanelNum].Bevel = pbRaised) or (Panels[PanelNum].Bevel = pbLowered) then begin
With Canvas Do FPanels.Assign(Value);
Begin end;
Pen.Color:=Colora;
MoveTo(XLeft,Top+Height-1);
LineTo(XLeft,Top);
LineTo(XLeft+PW-1,Top);
Pen.Color:=Colorb;
LineTo(XLeft+PW-1,Top+Height-1);
LIneTo(XLeft,Top+Height-1);
End;
End;
Procedure TStatusBar.DrawDivider(X : Integer);
Begin
Canvas.Pen.Width:=1;
Canvas.Pen.Color := clBtnFace;
Canvas.Line(X,Top,X,Top+Height-1);
Canvas.Pen.Color := clBtnFace;
Canvas.Line(X+1,Top,X+1,Top+Height-1);
End;
Procedure TStatusBar.WMPaint(var Msg: TLMPaint);
var
I : Integer;
Style : TTextStyle;
R : TRect;
PW : Longint;
Begin
inherited;
Style := Canvas.TextStyle;
With Style do begin
Layout := tlCenter;
Alignment := taLeftJustify;
WordBreak := False;
SingleLine := True;
Clipping := True;
ShowPrefix := False;
Opaque := False;
end;
R := Rect(Left, Top, Left + ClientWidth, Top + ClientHeight);
if SimplePanel = False then
Begin
if Panels.Count = 0 then exit;
For I := 0 to Panels.Count-1 do
Begin
if I = Panels.Count-1 then
PW := ClientWidth-R.Left
else
PW := Panels[I].Width;
R.Right := R.Left + PW;
DrawBevel(R.Left,I);
InflateRect(R, -2, -1);
Style.Alignment := Panels[I].Alignment;
Canvas.TextRect(R, 0, 0, Panels[i].Text, Style);
InflateRect(R, 2, 1);
//draw divider
if I < Panels.Count-1 then
DrawDivider(R.Right);
R.Left := R.Right;
end;
end
else
Canvas.TextRect(R, 2, 0, SimpleText, Style);
End;
// included by comctrls.pp // included by comctrls.pp