tvplanit: Less hints and warnings.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4940 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-07-12 09:26:14 +00:00
parent 4bd27ec6db
commit 6517dc0e2e
16 changed files with 100 additions and 75 deletions

View File

@ -34,7 +34,7 @@ interface
uses
{$IFDEF LCL}
LMessages, LCLProc, LCLType, LCLIntf,
LCLProc, LCLType, LCLIntf,
{$ELSE}
Windows, Messages,
{$ENDIF}
@ -71,10 +71,8 @@ type
Label3: TLabel;
Label1: TLabel;
procedure FormActivate(Sender: TObject);
procedure lblLinkMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure lblLinkMouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure lblLinkClick(Sender: TObject);
private
{ Private declarations }
@ -103,7 +101,7 @@ uses
{$IFNDEF LCL}
ShellAPI,
{$ENDIF}
VpConst, VpSR;
VpConst, VpMisc, VpSR;
const
TURBO_LINK_URL = 'http://sourceforge.net/projects/tpvplanit/';
@ -156,6 +154,7 @@ end;
procedure TfrmAbout.FormMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
Unused(Shift, X, Y);
lblTurboLink.Font.Style := [];
end;
@ -180,6 +179,7 @@ end;
procedure TfrmAbout.lblLinkMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
Unused(Shift, X, Y);
TLabel(Sender).Font.Style := [fsUnderline];
end;

View File

@ -358,12 +358,10 @@ implementation
{$R vpbase.res}
{$IFNDEF LCL}
uses
Math
{$IFNDEF LCL}
, CommCtrl
{$ENDIF}
;
CommCtrl;
{$ENDIF}
{ EAdStreamError }

View File

@ -65,7 +65,7 @@ implementation
uses
LazFileUtils,
VpConst, VpBaseDS, VpData;
VpConst, VpMisc, VpBaseDS, VpData;
const
TABLE_EXT = '.db';
@ -166,6 +166,7 @@ end;
function TVpBufDSDatastore.GetNextID(TableName: string): Integer;
begin
Unused(TableName);
if FUseAutoInc then
{ This is not needed in the BufDataset datastore as these tables use
autoincrement fields. }
@ -243,7 +244,6 @@ end;
procedure TVpBufDSDatastore.SetUseAutoInc(AValue: Boolean);
var
dir: String;
table: TBufDataset;
begin
if AValue = FUseAutoInc then
exit;

View File

@ -344,7 +344,7 @@ type
implementation
uses
VpData, VpCalendarPainter;
VpCalendarPainter;
const
calMargin = 4; {left, right, and top margin}
@ -862,8 +862,10 @@ end;
{=====}
procedure TVpCustomCalendar.CreateParams(var Params: TCreateParams);
{$IFNDEF LCL}
const
BorderStyles: array[TBorderStyle] of LongInt = (0, WS_BORDER);
{$ENDIF}
begin
inherited CreateParams(Params);
{$IFNDEF LCL}

View File

@ -39,9 +39,9 @@ uses
{$ELSE}
Windows,
{$ENDIF}
SysUtils, Classes,
SysUtils, Classes, Dialogs,
{$IFDEF VERSION6} Types, {$ENDIF}
VpBase, VpSR, VpConst, Dialogs;
VpSR;
type
TVpEventRec = packed record

View File

@ -220,13 +220,15 @@ begin
{get the date order from windows}
C[0] := '0'; {default}
//TODO:
{$IFNDEF LCL}
{$IFDEF DELPHI}
GetProfileString('intl', 'iDate', '0', C, 2);
{$ENDIF}
DateOrder := TVpDateOrder(Ord(C[0])-Ord('0'));
{load button glyph}
FButton.Glyph.Handle := LoadBaseBitmap('VPBTNCAL');
{$ELSE}
DateOrder := TVpDateOrder(Ord(C[0])-Ord('0'));
{load button glyph}
FButton.Glyph.LoadFromResourceName(HINSTANCE,'VPBTNCAL');
{$ENDIF}
{create color class}
FPopupCalColors := TVpCalColors.Create;

View File

@ -70,7 +70,7 @@ uses
{$ELSE}
Windows, Messages,
{$ENDIF}
Classes, Graphics, Controls, ComCtrls, ExtCtrls, StdCtrls,
Classes, Graphics, Controls, ExtCtrls, StdCtrls,
Buttons, VpBase, VpBaseDS, VpMisc, VpData, VpSR, VpConst,
VpCanvasUtils, Menus;
@ -122,9 +122,9 @@ type
procedure CreateParams(var Params: TCreateParams); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
{$IFNDEF LCL}
procedure WMKillFocus(var Msg : TWMKillFocus); message WM_KILLFOCUS;
procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS;
{$ELSE}
procedure WMKillFocus(var Msg : TLMKillFocus); message LM_KILLFOCUS;
procedure WMKillFocus(var Msg: TLMKillFocus); message LM_KILLFOCUS;
{$ENDIF}
public
constructor Create(AOwner: TComponent); override;
@ -546,6 +546,7 @@ procedure TVpDvInPlaceEdit.WMKillFocus(var Msg: TWMKillFocus);
procedure TVpDvInPlaceEdit.WMKillFocus(var Msg: TLMKillFocus);
{$ENDIF}
begin
Unused(Msg);
TVpDayView(Owner).EndEdit(self);
end;
{=====}
@ -1801,6 +1802,7 @@ procedure TVpDayView.WMSetFocus(var Msg: TWMSetFocus);
procedure TVpDayView.WMSetFocus(var Msg: TLMSetFocus);
{$ENDIF}
begin
Unused(Msg);
if ActiveRow = -1 then ActiveRow := TopLine;
end;
{=====}
@ -2264,6 +2266,8 @@ end;
{.$IFNDEF LCL}
procedure TVpDayView.VpDayViewInit(var Msg: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF});
begin
Unused(Msg);
if csLoading in ComponentState then begin
PostMessage(Handle, Vp_DayViewInit, 0, 0);
Exit;

View File

@ -58,9 +58,8 @@ type
{ property setters }
procedure SetReadOnly(const Value: boolean);
procedure SetFilterCriteria(aTable : TDataset; aUseDateTime : Boolean;
aResourceID : Integer; aStartDateTime : TDateTime;
aEndDateTime : TDateTime); virtual;
procedure SetFilterCriteria(aTable: TDataset; aUseDateTime: Boolean;
aResourceID: Integer; aStartDateTime, aEndDateTime: TDateTime); virtual;
protected {properties that may be surfaced later}
property ReadOnly : boolean
@ -1943,9 +1942,8 @@ begin
end;
{=====}
procedure TVpCustomDBDataStore.SetFilterCriteria(aTable : TDataset;
aUseDateTime : Boolean; aResourceID : Integer; aStartDateTime : TDateTime;
aEndDateTime : TDateTime);
procedure TVpCustomDBDataStore.SetFilterCriteria(aTable: TDataset;
aUseDateTime: Boolean; aResourceID: Integer; aStartDateTime, aEndDateTime: TDateTime);
begin
// error here: "... raised an exception class 'EDatabaseError' with message:
// Index based on unknown field '>='.".

View File

@ -302,7 +302,6 @@ const
var
w: Integer;
cnv: TControlCanvas;
d: Integer;
shape: TVpShapeType;
begin
w := MaxValue([GetLabelWidth(lblPenColor), GetLabelWidth(lblPenStyle),
@ -389,8 +388,6 @@ begin
end;
procedure TfrmEditShape.SetData(AShape: TVpPrintShape);
var
StyleStr : string;
begin
FShapeButtons[AShape.Shape].Down := true;
@ -417,6 +414,8 @@ var
R: TRect;
bs: TBrushStyle;
begin
Unused(Control, State);
Item := cbBrushStyle.Items[Index];
x := Rect.Left + HeightOf(Rect);
with cbBrushStyle.Canvas do
@ -483,6 +482,8 @@ var
TxtRect : TRect;
x, y: Integer;
begin
Unused(Control, State);
Item := cbPenStyle.Items[Index];
x := Rect.Left + HeightOf(Rect) * 2;
y := Rect.Top + HeightOf(Rect) div 2;

View File

@ -25,7 +25,7 @@ type
procedure StrToContact(AString: String; AContact: TVpContact);
procedure StrToEvent(AString: String; AEvent: TVpEvent);
procedure StrToEventTimes(AString: String; var AStartTime, AEndTime: TDateTime);
procedure StrToEventTimes(AString: String; out AStartTime, AEndTime: TDateTime);
procedure StrToResource(AString: String; AResource: TVpResource);
procedure StrToTask(AString: String; ATask: TVpTask);
@ -168,6 +168,7 @@ end;
function TVpIniDatastore.GetNextID(TableName: string): Integer;
begin
Unused(TableName);
repeat
Result := Random(High(Integer));
until UniqueID(Result) and (Result <> -1);
@ -449,7 +450,7 @@ begin
end;
procedure TVpIniDatastore.StrToEventTimes(AString: String;
var AStartTime, AEndTime: TDateTime);
out AStartTime, AEndTime: TDateTime);
var
L: TStrings;
begin

View File

@ -75,17 +75,22 @@ function AssembleName(Contact: TVpContact): string;
procedure ParseName(Contact: TVpContact; const Value: string);
{ parses the name into it's elements and updates the contact }
procedure ParseCSZ(Str: string; var City, State, Zip: string);
{ parses the string and returns the city, state and zip parameters }
{ parses the string and returns the city, state and zip parameters }
{$IFDEF DELPHI}
function LoadBaseBitmap(lpBitmapName : PAnsiChar) : HBITMAP;
{-load and return the handle to bitmap resource}
function LoadBaseCursor(lpCursorName : PAnsiChar) : HCURSOR;
{-load and return the handle to cursor resource}
{-load and return the handle to cursor resource}
{$ENDIF}
function HeightOf(const R : TRect) : Integer;
{- return the height of the TRect}
function WidthOf(const R : TRect) : Integer;
{- return the width of the TRect}
function RightOf(AControl: TControl): Integer;
{- returns the right edge of a control }
function GetDisplayString(Canvas : TCanvas; const S : string;
MinChars, MaxWidth : Integer) : string;
{-given a string, a minimum number of chars to display, and a max width, }
@ -131,6 +136,9 @@ function GetRealFontHeight(AFont: TFont): Integer;
function DecodeLineEndings(const AText: String): String;
function EncodeLineEndings(const AText: String): String;
procedure Unused(const A1); overload;
procedure Unused(const A1, A2); overload;
procedure Unused(const A1, A2, A3); overload;
implementation
@ -227,6 +235,7 @@ begin
end;
{=====}
{$IFDEF DELPHI}
function LoadBaseBitmap(lpBitmapName : PAnsiChar) : HBITMAP;
begin
{$IFDEF FPC}
@ -241,6 +250,7 @@ function LoadBaseCursor(lpCursorName : PAnsiChar) : HCURSOR;
begin
//TODO: Result := LoadCursor(FindClassHInstance(TVpCustomControl), lpCursorName);
end;
{$ENDIF}
function WidthOf(const R : TRect) : Integer;
begin
@ -623,4 +633,18 @@ begin
Result := StringReplace(AText, LineEnding, '\n', [rfReplaceAll]);
end;
{$PUSH}{$HINTS OFF}
procedure Unused(const A1);
begin
end;
procedure Unused(const A1, A2);
begin
end;
procedure Unused(const A1, A2, A3);
begin
end;
{$POP}
end.

View File

@ -38,7 +38,7 @@ uses
{$ELSE}
Windows, Messages,
{$ENDIF}
Classes, Graphics, Controls, ComCtrls, ExtCtrls, StdCtrls,
Classes, Graphics, Controls, ComCtrls, ExtCtrls,
VpBase, VpBaseDS, VpMisc, VpData, VpSR, VpConst, VpCanvasUtils, Menus;
type
@ -181,8 +181,8 @@ type
message CM_WANTSPECIALKEY;
{$ELSE}
procedure WMSize(var Msg: TLMSize); message LM_SIZE;
procedure WMSetFocus(var Msg : TLMSetFocus); message LM_SETFOCUS;
procedure WMRButtonDown(var Msg : TLMRButtonDown); message LM_RBUTTONDOWN;
procedure WMSetFocus(var Msg: TLMSetFocus); message LM_SETFOCUS;
procedure WMRButtonDown(var Msg: TLMRButtonDown); message LM_RBUTTONDOWN;
{$ENDIF}
procedure PopupToday (Sender : TObject);
procedure PopupNextMonth (Sender : TObject);
@ -268,7 +268,7 @@ type
implementation
uses
SysUtils, Math, LazUTF8, Forms, Dialogs, VpEvntEditDlg, VpMonthViewPainter;
SysUtils, LazUTF8, Forms, Dialogs, VpMonthViewPainter;
(*****************************************************************************)
{ TVpContactHeadAttr }
@ -746,11 +746,12 @@ end;
{=====}
{$IFNDEF LCL}
procedure TVpMonthView.WMSetFocus(var Msg : TWMSetFocus);
procedure TVpMonthView.WMSetFocus(var Msg: TWMSetFocus);
{$ELSE}
procedure TVpMonthView.WMSetFocus(var Msg : TLMSetFocus);
procedure TVpMonthView.WMSetFocus(var Msg: TLMSetFocus);
{$ENDIF}
begin
Unused(Msg);
// if active event is nil then set active event to the first diaplsyed one.
end;
{=====}

View File

@ -63,7 +63,7 @@ implementation
uses
LazFileUtils,
VpConst;
VpConst, VpMisc;
{ TVpZeosDatastore }
@ -279,6 +279,7 @@ end;
function TVpSqlite3DataStore.GetNextID(TableName: string): integer;
begin
Unused(TableName);
{ This is not needed in the SQLITE3 datastore as these tables use
autoincrement fields. }
Result := -1;

View File

@ -264,7 +264,7 @@ type
implementation
uses
SysUtils, Math, LazUTF8, Forms, Dialogs, VpEvntEditDlg, VpWeekViewPainter;
SysUtils, LazUTF8, Forms, Dialogs, VpEvntEditDlg, VpWeekViewPainter;
(*****************************************************************************)
{ TVpTGInPlaceEdit }

View File

@ -39,7 +39,7 @@ type
procedure DrawDay(ADayIndex: Integer; var DayRect: TRect; var EAIndex: Integer);
procedure DrawDayHeader(ADayIndex: Integer; var TextRect: TRect);
procedure DrawDays;
procedure DrawEvent(AEvent: TVpEvent; DayRect, TextRect: TRect; ADayIndex: Integer);
procedure DrawEvent(AEvent: TVpEvent; TextRect: TRect; ADayIndex: Integer);
procedure DrawHeader;
procedure FixFontHeights;
procedure InitColors;
@ -226,8 +226,6 @@ begin
end;
procedure TVpWeekViewPainter.DrawBorders;
var
shadow, bright: TColor;
begin
if FWeekView.DrawingStyle = dsFlat then begin
{
@ -281,7 +279,6 @@ var
rowHeight: Integer;
headerHeight: Integer;
tmpRect: TRect;
event: TVpEvent;
begin
// Abbreviations
dayHeadHeight := TVpWeekviewOpener(FWeekView).wvDayHeadHeight;
@ -349,7 +346,7 @@ begin
end;
// Write the event text
DrawEvent(TVpEvent(EventList.List^[J]), DayRect, TextRect, ADayIndex);
DrawEvent(TVpEvent(EventList.List^[J]), TextRect, ADayIndex);
// Update the EventArray
with TVpWeekViewOpener(FWeekView).wvEventArray[EAIndex] do begin
@ -482,10 +479,9 @@ begin
TPSLineTo(RenderCanvas, Angle, RenderIn, realCenter, RealBottom - 1);
end;
procedure TVpWeekViewPainter.DrawEvent(AEvent: TVpEvent; DayRect, TextRect: TRect;
procedure TVpWeekViewPainter.DrawEvent(AEvent: TVpEvent; TextRect: TRect;
ADayIndex: Integer);
var
tmpRect: TRect;
dayStr: String;
todayStartTime: TDateTime;
todayEndTime: TDateTime;

View File

@ -13,7 +13,6 @@ uses
type
TVpXmlDatastore = class(TVpCustomDatastore)
private
FDoc: TXmlDocument;
FFilename: String;
FParentNode: String;
FXmlSettings: TFormatSettings;
@ -30,13 +29,13 @@ type
function FindStoreNode(ADoc: TDOMDocument): TDOMNode;
procedure ReadContact(ANode: TDOMNode; AContacts: TVpContacts);
procedure ReadContacts(ADoc: TDOMDocument; ANode: TDOMNode; AContacts: TVpContacts);
procedure ReadContacts(ANode: TDOMNode; AContacts: TVpContacts);
procedure ReadEvent(ANode: TDOMNode; ASchedule: TVpSchedule);
procedure ReadEvents(ADoc: TDOMDocument; ANode: TDOMNode; ASchedule: TVpSchedule);
procedure ReadResource(ADoc: TDOMDocument; ANode: TDOMNode);
procedure ReadResources(ADoc: TDOMDocument; ANode: TDOMNode);
procedure ReadEvents(ANode: TDOMNode; ASchedule: TVpSchedule);
procedure ReadResource(ANode: TDOMNode);
procedure ReadResources(ANode: TDOMNode);
procedure ReadTask(ANode: TDOMNode; ATasks: TVpTasks);
procedure ReadTasks(ADoc: TDOMDocument; ANode: TDOMNode; ATasks: TVpTasks);
procedure ReadTasks(ANode: TDOMNode; ATasks: TVpTasks);
procedure WriteContact(ADoc: TDOMDocument; AContactNode: TDOMNode; AContact: TVpContact);
procedure WriteContacts(ADoc: TDOMDocument; AParentNode: TDOMNode; AResource: TVpResource);
@ -74,7 +73,7 @@ type
implementation
uses
typinfo, StrUtils, Strings,
typinfo,
VpConst, VpMisc, VpSR;
const
@ -235,7 +234,7 @@ var
i, j: Integer;
node, prevnode: TDOMNode;
rootnode: TDOMNode;
nodename: String;
{%H-}nodename: String;
begin
L := TStringList.Create;
try
@ -368,6 +367,7 @@ end;
function TVpXmlDatastore.GetNextID(TableName: string): Integer;
begin
Unused(TableName);
repeat
Result := Random(High(Integer));
until UniqueID(Result) and (Result <> -1);
@ -517,7 +517,7 @@ end;
procedure TVpXmlDatastore.ReadFromXml;
var
doc: TXMLDocument;
node, child, storeNode: TDOMNode;
node, storeNode: TDOMNode;
nodename: String;
begin
if FFileName = '' then
@ -538,7 +538,7 @@ begin
while node <> nil do begin
nodeName := node.NodeName;
if nodeName = 'Resources' then
ReadResources(doc, node);
ReadResources(node);
node := node.NextSibling;
end;
finally
@ -639,8 +639,7 @@ begin
end;
end;
procedure TVpXmlDatastore.ReadContacts(ADoc: TDOMDocument; ANode: TDOMNode;
AContacts: TVpContacts);
procedure TVpXmlDatastore.ReadContacts(ANode: TDOMNode; AContacts: TVpContacts);
var
node: TDOMNode;
nodeName: String;
@ -737,8 +736,7 @@ begin
end;
end;
procedure TVpXmlDatastore.ReadEvents(ADoc: TDOMDocument; ANode: TDOMNode;
ASchedule: TVpSchedule);
procedure TVpXmlDatastore.ReadEvents(ANode: TDOMNode; ASchedule: TVpSchedule);
var
node: TDOMNode;
nodeName: String;
@ -755,7 +753,7 @@ end;
// <Resource ResourceID="1178568021" ResourceActive="true">
// <Description>some test</Description>
// </Resource>
procedure TVpXmlDatastore.ReadResource(ADoc: TDOMDocument; ANode: TDOMNode);
procedure TVpXmlDatastore.ReadResource(ANode: TDOMNode);
var
node: TDOMNode;
nodeName: String;
@ -780,11 +778,11 @@ begin
else if nodeName = 'Notes' then
res.Notes := GetNodeValue(node)
else if nodeName = 'Contacts' then
ReadContacts(ADoc, node, res.Contacts)
ReadContacts(node, res.Contacts)
else if nodeName = 'Events' then
ReadEvents(ADoc, node, res.Schedule)
ReadEvents(node, res.Schedule)
else if nodeName = 'Tasks' then
ReadTasks(ADoc, node, res.Tasks)
ReadTasks(node, res.Tasks)
else if nodeName = 'UserField0' then
res.UserField0 := GetNodeValue(node)
else if nodeName = 'UserField1' then
@ -809,7 +807,7 @@ begin
end;
end;
procedure TVpXmlDatastore.ReadResources(ADoc: TDOMDocument; ANode: TDOMNode);
procedure TVpXmlDatastore.ReadResources(ANode: TDOMNode);
var
node: TDOMNode;
nodeName: String;
@ -818,7 +816,7 @@ begin
while node <> nil do begin
nodeName := node.NodeName;
if nodeName = 'Resource' then
ReadResource(ADoc, node);
ReadResource(node);
node := node.NextSibling;
end;
end;
@ -876,8 +874,7 @@ begin
end;
end;
procedure TVpXmlDatastore.ReadTasks(ADoc: TDOMDocument; ANode: TDOMNode;
ATasks: TVpTasks);
procedure TVpXmlDatastore.ReadTasks(ANode: TDOMNode; ATasks: TVpTasks);
var
node: TDOMNode;
nodeName: String;
@ -1280,7 +1277,7 @@ procedure TVpXmlDatastore.WriteEvents(ADoc: TDOMDocument; AParentNode: TDOMNode;
AResource: TVpResource);
var
i: Integer;
node, evNode, child, txt: TDOMNode;
node, evNode: TDOMNode;
ev: TVpEvent;
begin
node := ADoc.CreateElement('Events');
@ -1511,7 +1508,7 @@ procedure TVpXmlDatastore.WriteTasks(ADoc: TDOMDocument; AParentNode: TDOMNode;
AResource: TVpResource);
var
i: Integer;
node, tnode, child, txt: TDOMNode;
node, tnode: TDOMNode;
t: TVpTask;
begin
node := ADoc.CreateElement('Tasks');