jvcllaz: Cleanup JvTimeline

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6239 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-03-12 10:47:48 +00:00
parent 6ee65d5dbb
commit 251ed51f04
5 changed files with 22 additions and 52 deletions

View File

@ -14,7 +14,6 @@ object TimelineMainForm: TTimelineMainForm
Font.Color = clWindowText
OnCreate = FormCreate
OnDestroy = FormDestroy
OnResize = FormResize
Position = poScreenCenter
LCLVersion = '1.9.0.0'
Scaled = False

View File

@ -138,7 +138,6 @@ type
procedure chkFlatClick(Sender: TObject);
procedure Exit1Click(Sender: TObject);
procedure chkHelpYearClick(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure ColorBtnClick(Sender: TObject);
procedure Disable1Click(Sender: TObject);
procedure TimeLine1ItemClick(Sender: TObject; Item: TJvTimeItem);
@ -585,15 +584,6 @@ begin
TimeLine1.HelperYears := chkHelpYear.Checked;
end;
procedure TTimelineMainForm.FormResize(Sender: TObject);
begin
{
TimeLine1.Height := Height div 2;
if Panel2.Height < 250 then
TimeLine1.Height := Height - 250;
}
end;
procedure TTimelineMainForm.ColorBtnClick(Sender: TObject);
begin
with TColorDialog.Create(nil) do

View File

@ -2073,6 +2073,10 @@ resourcestring
RsTipsCheckBoxText = '&Show Tips on Startup';
RsStoreShowOnStartUp = 'Show_On_Startup'; // (p3) Spaces in XML node names is not valid XML...
//=== JvTMTimeLine ===========================================================
resourcestring
RsInvalidImage = 'Invalid image';
//=== JvToolEdit.pas =========================================================
resourcestring
RsBrowseCaption = 'Browse';

View File

@ -30,17 +30,11 @@ unit JvTMTimeLine;
{$mode objfpc}{$H+}
//{$I jvcl.inc}
interface
uses
LCLIntf, LCLType, LMessages, Types,
SysUtils, Classes, Controls, Buttons, Graphics, ExtCtrls, Forms, ImgList,
{$IFDEF BCB}
JvTypes, // TDate / TTime macros
{$ENDIF BCB}
//JvExtComponent,
JvExControls;
type
@ -329,15 +323,13 @@ implementation
uses
LCLStrConsts, Themes,
JvConsts, JvJCLUtils, JvJVCLUtils; // JvThemes, JclSysUtils;
JvConsts, JvJCLUtils, JvJVCLUtils, JvResources;
{$R ..\..\resource\JvTMTimeLine.res}
const
cMagic = 'Jv.TMTIMELINE1';
resourcestring
SInvalidImage = 'Invalid image';
//=== { TJvTLSelFrame } ======================================================
@ -1223,7 +1215,7 @@ begin
ClearImages;
ClearObjects;
if not ReadMagic(Stream) then
raise EStreamError.CreateRes(@SInvalidImage);
raise EStreamError.CreateRes(@RsInvalidImage);
FDateImages.Text := ReadStr(Stream);
for I := 0 to FDateImages.Count - 1 do
FDateImages.Objects[I] := TObject(ReadInt(Stream));

View File

@ -41,7 +41,6 @@ Known Issues:
unit JvTimeLine;
{$mode objfpc}{$H+}
//{$I jvcl.inc}
interface
@ -276,7 +275,7 @@ type
procedure WMCancelMode(var Msg: TLMessage); message LM_CANCELMODE;
procedure CMEnter(var Msg: TLMessage); message CM_ENTER;
procedure CMExit(var Msg: TLMessage); message CM_EXIT;
// procedure CMDrag(var Msg: TCMDrag); message CM_DRAG; -- wp
// procedure CMDrag(var Msg: TLMessage); message CM_DRAG;
procedure DrawDays(ACanvas: TCanvas; Days, StartAt: Integer);
procedure DrawDayNumbers(ACanvas: TCanvas; Days, StartAt: Integer);
@ -489,12 +488,12 @@ type
implementation
uses
Math, Types, DateUtils, Themes, LazUTF8,
JvJCLUtils, JvJVCLUtils; //, {JvThemes,} JclSysUtils;
{$R ..\..\resource\JvTimeLine.res}
uses
Math, Types, DateUtils, Themes,
JvJCLUtils, JvJVCLUtils;
const
FDayLineLength = 4;
FDayTextTop = 5;
@ -540,17 +539,6 @@ var
begin
Result := IntersectRect(R, Rect1, Rect2);
end;
(*
function KeyboardStateToShiftState(const KeyboardState: TKeyboardState): TShiftState;
begin
Result := [];
if KeyboardState[VK_SHIFT] and $80 <> 0 then Include(Result, ssShift);
if KeyboardState[VK_CONTROL] and $80 <> 0 then Include(Result, ssCtrl);
if KeyboardState[VK_MENU] and $80 <> 0 then Include(Result, ssAlt);
if KeyboardState[VK_LBUTTON] and $80 <> 0 then Include(Result, ssLeft);
if KeyboardState[VK_RBUTTON] and $80 <> 0 then Include(Result, ssRight);
if KeyboardState[VK_MBUTTON] and $80 <> 0 then Include(Result, ssMiddle);
end; *)
//=== { TJvTimeItem } ========================================================
@ -589,7 +577,6 @@ end;
procedure TJvTimeItem.Remove;
begin
LCLIntf.InvalidateRect(FParent.FTimeLine.Handle, @FRect, True);
// Windows.InvalidateRect(FParent.FTimeLine.Handle, @FRect, True);
// (rom) suspicious
inherited Free;
end;
@ -1217,10 +1204,14 @@ end;
procedure TJvCustomTimeLine.SetBorderStyle(Value: TBorderStyle);
begin
inherited;
exit;
if FBorderStyle <> Value then
begin
FBorderStyle := Value;
Invalidate;
// Invalidate;
CreateWnd;
// RecreateWnd; -- wp: Invalidate instead of RecreateWnd
end;
end;
@ -1700,7 +1691,9 @@ begin
else
AName := FormatSettings.ShortMonthNames[Month];
{$IF FPC_FULLVERSION < 3000000 }
AName := SysToUTF8(AName);
{$IFDEF MSWINDOWS}
AName := AnsiToUTF8(AName);
{$ENDIF}
{$ENDIF}
with ACanvas do
@ -2375,13 +2368,8 @@ end;
procedure TJvCustomTimeLine.CNKeyDown(var Msg: TLMKeyDown);
var
// KeyState: TKeyboardState;
ShiftState: TShiftState;
begin
{
GetKeyboardState(KeyState);
ShiftState := KeyboardStateToShiftState(KeyState);
}
ShiftState := GetKeyShiftState;
Msg.Result := 0;
case Msg.CharCode of
@ -2415,9 +2403,9 @@ var
Details: TThemedElementDetails;
{$ENDIF JVCLThemesEnabled}
begin
(*
if csDestroying in ComponentState then
Exit;
(*
ACanvas := TCanvas.Create;
{ Get window DC that is clipped to the non-client area }
DC := GetWindowDC(Handle);
@ -2461,11 +2449,7 @@ begin
*)
end;
{$IFDEF FPC}
procedure TJvCustomTimeLine.WMNCCalcSize(var Msg: TLMNCCalcSize);
{$ELSE}
procedure TJvCustomTimeLine.WMNCCalcSize(var Msg: TWMNCCalcSize);
{$ENDIF}
begin
InflateRect(Msg.CalcSize_Params^.rgrc[0], -2, -2);
inherited;
@ -2495,7 +2479,7 @@ begin
inherited;
end;
{-- wp
{ -------- FIXME !!!
procedure TJvCustomTimeLine.CMDrag(var Msg: TCMDrag);
var
P: TPoint;
@ -2576,6 +2560,7 @@ begin
end;
end;
}
procedure TJvCustomTimeLine.SetAutoSize(Value: Boolean);
begin
if FAutoSize <> Value then