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','StdCtrls',[TEdit,TLabel,TMemo,TCheckBox,
TListBox,TRadioButton,TComboBox,TScrollBar,TGroupBox,TToggleBox]);
RegisterComponents('Standard', 'ExtCtrls',[TPanel]);
RegisterComponents('Standard', 'ExtCtrls',[TRadioGroup,TPanel]);
RegisterComponents('Additional','Buttons',[TBitBtn,TSpeedButton]);
RegisterComponents('Additional','ExtCtrls',[TNoteBook,TPaintBox,
TBevel,TRadioGroup,TImage]);
TBevel,TImage]);
RegisterComponents('Additional','ComCtrls',[TStatusBar,TListView,TTreeView,
TProgressBar,TToolBar,TTrackbar,TScrollBox]);
RegisterComponents('Additional','ImgList',[TImageList]);

View File

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

View File

@ -95,29 +95,30 @@ type
property Items[Index: Integer]: TStatusPanel read GetItem write SetItem; default;
end;
TStatusBar = Class(TWinControl)
TStatusBar = class(TCustomPanel)
private
FCanvas : TCanvas;
FPanels : TStatusPanels;
FSimpleText : String;
FSimplePanel : Boolean;
//FContext : Integer;
//FMessage : Integer;
//FAlignmentWidget : TAlignment;
procedure SetPanels(Value: TStatusPanels);
procedure SetSimpleText(Value : String);
procedure SetSimplePanel(Value : Boolean);
Procedure WMPaint(var Msg: TLMPaint); message LM_PAINT;
Procedure DrawDivider(X : Integer);
Procedure DrawBevel(xLeft, PanelNum : Integer );
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
property Canvas : TCanvas read FCanvas;
published
property Align;
property Anchors;
property BorderWidth;
property Color;
property Constraints;
property Enabled;
property Font;
property Panels: TStatusPanels read FPanels write SetPanels;
property SimpleText: String read FSimpleText write SetSimpleText;
property SimplePanel: Boolean read FSimplePanel write SetSimplePanel default True;
property SimpleText: string read GetText write SetText;
property SimplePanel: boolean read FSimplePanel write SetSimplePanel default True;
property Visible;
end;
@ -1598,6 +1599,9 @@ end.
{ =============================================================================
$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
MG: TListView now works handleless and SetSelection implemented

View File

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

View File

@ -54,16 +54,9 @@ end;
------------------------------------------------------------------------------}
procedure TGraphicControl.WMPaint(var Message: TLMPaint);
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
begin
// Canvas.Lock;
Canvas.Lock;
try
Canvas.Handle := Message.DC;
try
@ -72,7 +65,7 @@ begin
Canvas.Handle := 0;
end;
finally
// Canvas.Unlock;
Canvas.Unlock;
end;
end;
end;
@ -92,6 +85,9 @@ end;
{ =============================================================================
$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
MG: fixed speedbutton in designmode

View File

@ -20,48 +20,25 @@
constructor TStatusBar.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
fCompStyle := csStatusBar;
ControlStyle := [csCaptureMouse, csClickEvents, csDoubleClicks, csOpaque];
// fCompStyle := csStatusBar;
ControlStyle:= [csCaptureMouse, csClickEvents, csDoubleClicks, csOpaque];
Color := clBtnFace;
Height := 19;
Setbounds(0,TWinControl(AOwner).Height-21,TWinControl(AOwner).Width,20);
Align := alBottom;
Alignment:= taLeftJustify;
BevelOuter:= bvLowered;
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);
FCanvas := TControlCanvas.Create;
TControlCanvas(FCanvas).Control := Self;
FSimplePanel := True;
FSimplePanel:= True;
// FSizeGrip := True;
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 }
{------------------------------------------------------------------------------}
@ -73,104 +50,30 @@ begin
end;
{------------------------------------------------------------------------------}
{ TStatusBar DrawBevel }
{ TStatusBar SetSimpleText }
{------------------------------------------------------------------------------}
Procedure TStatusBar.DrawBevel(xLeft, PanelNum : Integer );
var
Colora,Colorb:TColor;
I, PL, PW : Longint;
Begin
if PanelNum = Panels.Count-1 then begin
PL := Left;
If Panels.Count > 1 then
For I := 0 to Panels.Count-2 do
PL := PL + Panels[I].Width;
PW := ClientWidth - PL;
end
else
PW := Panels[PanelNum].Width;
procedure TStatusBar.SetSimpleText(Value : String);
begin
if FSimpleText <> value then
begin
Caption:= Value;
// Invalidate;
end;
end;
Canvas.Brush.Color := Color;
Canvas.FillRect(Rect(XLeft,Top,XLeft+PW,Top+Height));
if Panels[PanelNum].Bevel = pbRaised then
procedure TStatusBar.SetSimplePanel(Value : Boolean);
begin
if FSimplePanel <> Value then
begin
Colora:=clWhite;
Colorb:=clGray;
end;
if Panels[PanelNum].Bevel = pbLowered then
begin
Colora:=clGray;
Colorb:=clWhite;
FSimplePanel := Value;
Invalidate;
end;
end;
Canvas.Pen.Width:=1;
if (Panels[PanelNum].Bevel = pbRaised) or (Panels[PanelNum].Bevel = pbLowered) then
With Canvas Do
Begin
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.SetPanels(Value: TStatusPanels);
begin
FPanels.Assign(Value);
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