diff --git a/components/jvcllaz/examples/JvLED/JvLEDDemo.lpi b/components/jvcllaz/examples/JvLED/JvLEDDemo.lpi index e48cc0482..5080ac236 100644 --- a/components/jvcllaz/examples/JvLED/JvLEDDemo.lpi +++ b/components/jvcllaz/examples/JvLED/JvLEDDemo.lpi @@ -4,9 +4,6 @@ - - - @@ -16,7 +13,6 @@ <XPManifest> <DpiAware Value="True"/> </XPManifest> - <Icon Value="0"/> </General> <BuildModes Count="1"> <Item1 Name="Default" Default="True"/> @@ -55,9 +51,10 @@ <Version Value="11"/> <PathDelim Value="\"/> <Target> - <Filename Value="JvLEDDemo"/> + <Filename Value="..\..\bin\JvLEDDemo"/> </Target> <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> </SearchPaths> <Linking> diff --git a/components/jvcllaz/examples/JvLED/JvLEDDemo.lpr b/components/jvcllaz/examples/JvLED/JvLEDDemo.lpr index 213d7b464..2b182fe76 100644 --- a/components/jvcllaz/examples/JvLED/JvLEDDemo.lpr +++ b/components/jvcllaz/examples/JvLED/JvLEDDemo.lpr @@ -7,6 +7,7 @@ uses {$R *.res} begin + Application.Scaled:=True; Application.Initialize; Application.CreateForm(TLEDDemoMain, LEDDemoMain); Application.Run; diff --git a/components/jvcllaz/packages/JvMMLazD.lpk b/components/jvcllaz/packages/JvMMLazD.lpk index 4c28634f1..b6e4cb608 100644 --- a/components/jvcllaz/packages/JvMMLazD.lpk +++ b/components/jvcllaz/packages/JvMMLazD.lpk @@ -9,8 +9,9 @@ <Version Value="11"/> <PathDelim Value="\"/> <SearchPaths> + <IncludeFiles Value="..\resource"/> <OtherUnitFiles Value="..\design\JvMM"/> - <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\design\JvMM"/> + <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)\design\JvMM"/> </SearchPaths> </CompilerOptions> <Version Major="1" Release="4"/> diff --git a/components/jvcllaz/packages/JvMMLazR.lpk b/components/jvcllaz/packages/JvMMLazR.lpk index 727c55302..c46d72286 100644 --- a/components/jvcllaz/packages/JvMMLazR.lpk +++ b/components/jvcllaz/packages/JvMMLazR.lpk @@ -8,8 +8,9 @@ <Version Value="11"/> <PathDelim Value="\"/> <SearchPaths> + <IncludeFiles Value="..\resource"/> <OtherUnitFiles Value="..\run\JvMM"/> - <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\run\JvMM"/> + <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)\run\JvMM"/> </SearchPaths> </CompilerOptions> <Description Value="JVCL Multimedia Components (Runtime)."/> diff --git a/components/jvcllaz/packages/jvhmilazd.lpk b/components/jvcllaz/packages/jvhmilazd.lpk index 07599b8f5..806cc48b9 100644 --- a/components/jvcllaz/packages/jvhmilazd.lpk +++ b/components/jvcllaz/packages/jvhmilazd.lpk @@ -9,8 +9,9 @@ <Version Value="11"/> <PathDelim Value="\"/> <SearchPaths> + <IncludeFiles Value="..\resource"/> <OtherUnitFiles Value="..\design\JvHMI"/> - <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\design\JvHMI"/> + <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)\design\JvHMI"/> </SearchPaths> </CompilerOptions> <Description Value="JVCL Human-Machine-Interface (HMI) Components (design-time) containing these components diff --git a/components/jvcllaz/packages/jvhmilazr.lpk b/components/jvcllaz/packages/jvhmilazr.lpk index d751830ca..a9ca6b1be 100644 --- a/components/jvcllaz/packages/jvhmilazr.lpk +++ b/components/jvcllaz/packages/jvhmilazr.lpk @@ -8,8 +8,9 @@ <Version Value="11"/> <PathDelim Value="\"/> <SearchPaths> + <IncludeFiles Value="..\resource"/> <OtherUnitFiles Value="..\run\JvHMI"/> - <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\run\JvHMI"/> + <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)\run\JvHMI"/> </SearchPaths> </CompilerOptions> <Description Value="JVCL Human-Machine-Interface (HMI) Components (run-time) containing these components diff --git a/components/jvcllaz/run/JvCore/JvThemes.pas b/components/jvcllaz/run/JvCore/JvThemes.pas index 2fee6a2f5..a15465a10 100644 --- a/components/jvcllaz/run/JvCore/JvThemes.pas +++ b/components/jvcllaz/run/JvCore/JvThemes.pas @@ -33,7 +33,9 @@ unit JvThemes; interface uses - Types, SysUtils, Classes, Contnrs, + LCLType, LCLIntf, LMessages, + //Types, + SysUtils, Classes, Contnrs, {$IFDEF JVCLThemesEnabled} Themes, {$ENDIF JVCLThemesEnabled} @@ -80,8 +82,8 @@ type out Size: TSize): Boolean; overload; function GetElementSize(DC: HDC; Details: TThemedElementDetails; const Rect: TRect; ElementSize: TElementSize; out Size: TSize): Boolean; overload; + ********************) function IsSystemStyle: Boolean; - ********************) function Enabled: Boolean; function Available: Boolean; (******************** @@ -119,7 +121,6 @@ procedure IncludeThemeStyle(Control: TControl; Style: TJvThemeStyle); procedure ExcludeThemeStyle(Control: TControl; Style: TJvThemeStyle); function GetThemeStyle(Control: TControl): TJvThemeStyle; -(***************************** NOT CONVERTED *** { DrawThemedBackground fills R with Canvas.Brush.Color/Color. If the control uses csParentBackground and the color is that of it's parent the Rect is not filled because then it is done by the JvThemes/VCL7. } @@ -130,9 +131,10 @@ procedure DrawThemedBackground(Control: TControl; Canvas: TCanvas; procedure DrawThemedBackground(Control: TControl; DC: HDC; const R: TRect; Brush: HBRUSH; NeedsParentBackground: Boolean = True); overload; +(***************************** NOT CONVERTED *** { DrawThemesFrameControl draws a themed frame control when theming is enabled. } function DrawThemedFrameControl(DC: HDC; const Rect: TRect; uType, uState: UINT): BOOL; - +*) { PerformEraseBackground sends a WM_ERASEBKGND message to the Control's parent. } procedure PerformEraseBackground(Control: TControl; DC: HDC; Offset: TPoint); overload; @@ -141,6 +143,7 @@ procedure PerformEraseBackground(Control: TControl; DC: HDC); overload; procedure PerformEraseBackground(Control: TControl; DC: HDC; const R: TRect); overload; +(***************************** NOT CONVERTED *** { DrawThemedButtonFace draws a themed button when theming is enabled. } function DrawThemedButtonFace(Control: TControl; Canvas: TCanvas; const Client: TRect; BevelWidth: Integer; Style: TButtonStyle; IsRounded, IsDown, @@ -179,7 +182,6 @@ uses JclSysInfo; *) -(************************ NOT CONVERTED *** type TWinControlThemeInfo = class(TWinControl) public @@ -260,6 +262,7 @@ begin FillRect(DC, R, Brush); end; +(************************ NOT CONVERTED *** function DrawThemedFrameControl(DC: HDC; const Rect: TRect; uType, uState: UINT): BOOL; {$IFDEF JVCLThemesEnabled} const @@ -483,6 +486,7 @@ begin if not Result then Result := DrawFrameControl(DC, Rect, uType, uState); end; +*) function IsInvalidRect(const R: TRect): Boolean; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} begin @@ -552,7 +556,7 @@ begin OldBkMode := GetBkMode(DC); end; {$ENDIF COMPILER16_UP} - Control.Parent.Perform(WM_ERASEBKGND, DC, DC); // force redraw + Control.Parent.Perform(LM_ERASEBKGND, DC, DC); // force redraw {$IFDEF COMPILER16_UP} if StyleServices.Enabled and not StyleServices.IsSystemStyle then begin @@ -591,6 +595,7 @@ begin PerformEraseBackground(Control, DC, Point(Control.Left, Control.Top), R); end; +(***************************** NOT CONVERTED *** function DrawThemedButtonFace(Control: TControl; Canvas: TCanvas; const Client: TRect; BevelWidth: Integer; Style: TButtonStyle; IsRounded, IsDown, IsFocused, IsHot: Boolean): TRect; @@ -841,12 +846,12 @@ function TThemeServicesEx.GetSystemColor(Color: TColor): TColor; begin Result := Color; end; +**********************) function TThemeServicesEx.IsSystemStyle: Boolean; begin Result := True; end; -**********************) function TThemeServicesEx.Enabled: Boolean; begin diff --git a/components/jvcllaz/run/JvHMI/jvdialbutton.pas b/components/jvcllaz/run/JvHMI/jvdialbutton.pas index 55c007687..134b56913 100644 --- a/components/jvcllaz/run/JvHMI/jvdialbutton.pas +++ b/components/jvcllaz/run/JvHMI/jvdialbutton.pas @@ -310,8 +310,8 @@ begin FTickStyle := tsAuto; FBitmapInvalid := True; FPointerRect.Left := -1; // Only on start up - Width := 51; - Height := 51; + Width := 120; + Height := 120; FRepeatDelay := 400; FRepeatRate := 100; SetTicks(FTickStyle); @@ -925,6 +925,7 @@ var OldOrg: TPoint; lCanvas: TCanvas; I: Integer; + lColor: TColor; begin Size := 2 * FRadius + 1; ButtonRect := Bounds(0, 0, Size, Size); @@ -942,9 +943,13 @@ begin lCanvas.Pen.Style := psClear; Highlight := ColorToRGB(clBtnHighlight); - Face := ColorToRGB(Color); + if Color = clDefault then + lColor := clGray + else + lColor := Color; + Face := ColorToRGB(lColor); // darking the color by halving each color part value - Shadow := (ColorToRGB(Color) and $00FEFEFE) shr 1; + Shadow := (ColorToRGB(lColor) and $00FEFEFE) shr 1; for I := 0 to Size do begin @@ -962,8 +967,8 @@ begin // Draw top of disk. lCanvas.Pen.Style := psSolid; - lCanvas.Pen.Color := Color; - lCanvas.Brush.Color := Color; + lCanvas.Pen.Color := lColor; + lCanvas.Brush.Color := lColor; Edge := FButtonEdge * FRadius div 100 + 1; lCanvas.Ellipse(0 + Edge, 0 + Edge, 0 + Size - Edge, 0 + Size - Edge); diff --git a/components/jvcllaz/run/JvMM/jvbmpanimator.pas b/components/jvcllaz/run/JvMM/jvbmpanimator.pas new file mode 100644 index 000000000..1fa2f9623 --- /dev/null +++ b/components/jvcllaz/run/JvMM/jvbmpanimator.pas @@ -0,0 +1,395 @@ +{----------------------------------------------------------------------------- +The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/MPL-1.1.html + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for +the specific language governing rights and limitations under the License. + +The Original Code is: JvBmpAnim.PAS, released on 2002-05-26. + +The Initial Developer of the Original Code is Peter Thörnqvist [peter3 at sourceforge dot net] +Portions created by Peter Thörnqvist are Copyright (C) 2002 Peter Thörnqvist. +All Rights Reserved. + +Contributor(s): + +You may retrieve the latest version of this file at the Project JEDI's JVCL home page, +located at http://jvcl.delphi-jedi.org + +Description: + A bitmap animator: animates an imagelist consisting of multiple likesized bitmaps + like the explorer logo in Internet Explorer or Netscape Navigator. + +Known Issues: +-----------------------------------------------------------------------------} +// $Id$ + +unit JvBmpAnimator; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + Graphics, Controls, ExtCtrls, ImgList, JvComponent; + +type + TJvAnimateDirection = (tdForward, tdBack, tdFwdBack, tdBackFwd); + + TJvCustomBmpAnimator = class(TJvGraphicControl) + private + FImageList: TCustomImageList; + FTimer: TTimer; + FIndex: Integer; + FActive: Boolean; + FWidth: Integer; + FHeight: Integer; + FNumGlyphs: Integer; + FSpeed: Integer; + FTransparent: Boolean; + FAutoSize: Boolean; + FStart: Integer; + FStop: Integer; + FPosition: Integer; + FDirection: TJvAnimateDirection; + FGoingUp: Boolean; + FCenter: Boolean; + FImageChangeLink: TChangeLink; + procedure SetCenter(Value: Boolean); + procedure SetDirection(Value: TJvAnimateDirection); + procedure SetPosition(Value: Integer); + procedure SetStart(Value: Integer); + procedure SetStop(Value: Integer); + procedure SetTransparent(Value: Boolean); + procedure SetImage(Value: TCustomImageList); + procedure SetActive(Value: Boolean); + procedure SetNumGlyphs(Value: Integer); + procedure SetSpeed(Value: Integer); + procedure TimerEvent(Sender: TObject); + procedure DoChange(Sender: TObject); + protected + procedure Paint; override; + procedure SetAutoSize(Value: Boolean); override; + property AutoSize: Boolean read FAutoSize write SetAutoSize default False; + procedure Notification(AComponent: TComponent; AOperation: TOperation); override; + property Centered: Boolean read FCenter write SetCenter; + property Color default clBtnFace; + property Direction: TJvAnimateDirection read FDirection write SetDirection; + property Active: Boolean read FActive write SetActive default False; + property Images: TCustomImageList read FImageList write SetImage; + property NumFrames: Integer read FNumGlyphs write SetNumGlyphs default 0; + property Position: Integer read FPosition write SetPosition default 0; + property Speed: Integer read FSpeed write SetSpeed default 100; + property Min: Integer read FStart write SetStart default 0; + property Max: Integer read FStop write SetStop default 0; + property Transparent: Boolean read FTransparent write SetTransparent default False; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + end; + + TJvBmpAnimator = class(TJvCustomBmpAnimator) + published + property Active; + property Align; + property AutoSize; + property Centered; + property Color; + property Direction; + property Height; + property Images; + property Left; + property Name; + property NumFrames; + property Position; + property Speed; + property Min; + property Max; + property Tag; + property Top; + property Transparent; + property Width; + property OnClick; + property OnMouseDown; + property OnMouseMove; + property OnMouseUp; + property OnDragDrop; + property OnEndDrag; + property OnStartDrag; + property OnDragOver; + end; + + +implementation + +uses + JvJVCLUtils; + +constructor TJvCustomBmpAnimator.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FImageChangeLink := TChangeLink.Create; + FImageChangeLink.OnChange := @DoChange; + FWidth := 60; + FHeight := 60; + Width := FWidth; + Height := FHeight; + FTransparent := False; + FAutoSize := False; + FSpeed := 15; + FNumGlyphs := 0; + FIndex := 0; + FStart := 0; + FStop := 0; + FPosition := 0; + FActive := False; + Color := clBtnFace; + FTimer := TTimer.Create(nil); + FTimer.OnTimer := @TimerEvent; + FTimer.Enabled := FActive; + FTimer.Interval := 100; + FDirection := tdForward; + FGoingUp := True; +end; + +destructor TJvCustomBmpAnimator.Destroy; +begin + FImageChangeLink.Free; + FTimer.Enabled := False; + FTimer.Free; + inherited Destroy; +end; + +procedure TJvCustomBmpAnimator.DoChange(Sender: TObject); +begin + Invalidate; +end; + +procedure TJvCustomBmpAnimator.TimerEvent(Sender: TObject); +begin + if not Assigned(FImageList) then + Exit; + + if not Active then + FIndex := FPosition + else + case FDirection of + tdForward: + begin + Inc(FIndex); + if (FIndex > FNumGlyphs) or (FIndex > FStop) then + FIndex := FStart; + end; + tdBack: + begin + Dec(FIndex); + if (FIndex < 0) or (FIndex < FStart) then + FIndex := FStop; + end; + tdFwdBack, tdBackFwd: + begin + if FGoingUp then + begin + if (FIndex >= FStop) then + begin + FGoingUp := False; + Dec(FIndex); + end + else + Inc(FIndex); + end + else + begin + if FIndex <= FStart then + begin + FGoingUp := True; + Inc(FIndex); + end + else + Dec(FIndex); + end; + end; + end; + Refresh; +end; + +procedure TJvCustomBmpAnimator.SetStart(Value: Integer); +begin + if FStart <> Value then + begin + FStart := Value; + if FStart > FStop then + FStart := FStop; + if FStart >= FNumGlyphs then + FStart := FNumGlyphs - 1; + if FStart < 0 then + FStart := 0; + end; +end; + +procedure TJvCustomBmpAnimator.SetStop(Value: Integer); +begin + if FStop <> Value then + begin + FStop := Value; + if FStop < FStart then + FStop := FStart; + if FStop >= FNumGlyphs then + FStop := FNumGlyphs - 1; + if FStop < 0 then + FStop := 0; + end; +end; + +procedure TJvCustomBmpAnimator.SetAutoSize(Value: Boolean); +begin + if FAutoSize <> Value then + begin + FAutoSize := Value; + if FAutoSize and Assigned(FImageList) then + begin + Width := FImageList.Width; + Height := FImageList.Height; + end; + end; +end; + +procedure TJvCustomBmpAnimator.SetTransparent(Value: Boolean); +begin + if FTransparent <> Value then + begin + FTransparent := Value; + Repaint; + end; +end; + +procedure TJvCustomBmpAnimator.Notification(AComponent: TComponent; AOperation: TOperation); +begin + inherited Notification(AComponent, AOperation); + if (AOperation = opRemove) and (AComponent = FImageList) then + SetImage(nil); +end; + +procedure TJvCustomBmpAnimator.SetImage(Value: TCustomImageList); +begin + if FImageList <> nil then + SetNumGlyphs(0); + + ReplaceImageListReference(Self, Value, FImageList, FImageChangeLink); + if FImageList <> nil then + SetNumGlyphs(FImageList.Count) + else + Active := False; + Repaint; +end; + +procedure TJvCustomBmpAnimator.SetActive(Value: Boolean); +begin +{ if not Assigned(FImageList) then + Value := False;} + if FActive <> Value then + begin + FActive := Value; + FTimer.Enabled := FActive; + FIndex := FStart; + end; + Repaint; +end; + +procedure TJvCustomBmpAnimator.SetNumGlyphs(Value: Integer); +begin + if FNumGlyphs <> Value then + begin + FNumGlyphs := Value; + SetStop(FNumGlyphs - 1); + end; +end; + +procedure TJvCustomBmpAnimator.SetSpeed(Value: Integer); +begin + if FSpeed <> Value then + begin + FSpeed := Value; + FTimer.Interval := 1000 div FSpeed; + end; +end; + +procedure TJvCustomBmpAnimator.SetCenter(Value: Boolean); +begin + if FCenter <> Value then + begin + FCenter := Value; + Invalidate; + end; +end; + +procedure TJvCustomBmpAnimator.SetDirection(Value: TJvAnimateDirection); +begin + if FDirection <> Value then + begin + FDirection := Value; + case FDirection of + tdForward, tdFwdBack: + begin + FGoingUp := True; + FIndex := FStart; + end; + tdBack, tdBackFwd: + begin + FGoingUp := False; + FIndex := FStop; + end; + end; + end; +end; + +procedure TJvCustomBmpAnimator.SetPosition(Value: Integer); +begin + FPosition := Value; + if FPosition > FNumGlyphs - 1 then + FPosition := FNumGlyphs - 1; + Invalidate; +end; + +procedure TJvCustomBmpAnimator.Paint; +var + dX, dY: Integer; +begin + if Assigned(FImageList) then + begin + if FCenter then + begin + dX := (Width - FImageList.Width) div 2; + dY := (Height - FImageList.Height) div 2; + end + else + begin + dX := 0; + dY := 0; + end; + if not FTransparent then + begin + Canvas.Brush.Color := Color; + Canvas.FillRect(ClientRect); + end + else + Canvas.Brush.Style := bsClear; + FImageList.Draw(Canvas, dX, dY, FIndex); + + if not Active then + FIndex := FPosition; + FImageList.Draw(Canvas, dX, dY, FIndex) + end; + if csDesigning in ComponentState then + with Canvas do + begin + Brush.Color := clBlack; + FrameRect( GetClientRect); + end; +end; + +end.