tvplanit: Add hint support for contact grid.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5184 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-09-19 22:58:13 +00:00
parent afebf9b206
commit dcfee2e807
20 changed files with 455 additions and 102 deletions

View File

@ -14,9 +14,6 @@
<EnableI18N Value="True"/> <EnableI18N Value="True"/>
<OutDir Value="..\..\languages"/> <OutDir Value="..\..\languages"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>

View File

@ -57,7 +57,7 @@ object MainForm: TMainForm
Height = 528 Height = 528
Top = 48 Top = 48
Width = 834 Width = 834
PageIndex = 0 PageIndex = 4
Align = alClient Align = alClient
TabOrder = 1 TabOrder = 1
TabStop = True TabStop = True
@ -579,8 +579,8 @@ object MainForm: TMainForm
Left = 349 Left = 349
Height = 19 Height = 19
Top = 117 Top = 117
Width = 110 Width = 176
Caption = 'Show event hints' Caption = 'Show event and contact hints'
Checked = True Checked = True
OnChange = CbShowEventHintsChange OnChange = CbShowEventHintsChange
State = cbChecked State = cbChecked
@ -602,41 +602,41 @@ object MainForm: TMainForm
DrawingStyle = dsCoolTab DrawingStyle = dsCoolTab
FolderCollection = < FolderCollection = <
item item
Version = 'v1.04' Version = 'v1.05'
Caption = 'Planner' Caption = 'Planner'
Enabled = True Enabled = True
FolderType = ftDefault FolderType = ftDefault
ItemCollection = < ItemCollection = <
item item
Version = 'v1.04' Version = 'v1.05'
Caption = 'Events' Caption = 'Events'
IconIndex = 0 IconIndex = 0
Name = 'NIEvents' Name = 'NIEvents'
Tag = 0 Tag = 0
end end
item item
Version = 'v1.04' Version = 'v1.05'
Caption = 'Month view' Caption = 'Month view'
IconIndex = 5 IconIndex = 5
Name = 'NIEventsByMonth' Name = 'NIEventsByMonth'
Tag = 0 Tag = 0
end end
item item
Version = 'v1.04' Version = 'v1.05'
Caption = 'Week view' Caption = 'Week view'
IconIndex = 4 IconIndex = 4
Name = 'NIEventsByWeek' Name = 'NIEventsByWeek'
Tag = 0 Tag = 0
end end
item item
Version = 'v1.04' Version = 'v1.05'
Caption = 'Day view' Caption = 'Day view'
IconIndex = 3 IconIndex = 3
Name = 'NIEventsByDay' Name = 'NIEventsByDay'
Tag = 0 Tag = 0
end end
item item
Version = 'v1.04' Version = 'v1.05'
Caption = 'Tasks' Caption = 'Tasks'
Description = 'Show tasks' Description = 'Show tasks'
IconIndex = 1 IconIndex = 1
@ -644,7 +644,7 @@ object MainForm: TMainForm
Tag = 0 Tag = 0
end end
item item
Version = 'v1.04' Version = 'v1.05'
Caption = 'Contacts' Caption = 'Contacts'
Description = 'Show address book' Description = 'Show address book'
IconIndex = 2 IconIndex = 2
@ -656,20 +656,20 @@ object MainForm: TMainForm
Tag = 0 Tag = 0
end end
item item
Version = 'v1.04' Version = 'v1.05'
Caption = 'Maintenance' Caption = 'Maintenance'
Enabled = True Enabled = True
FolderType = ftDefault FolderType = ftDefault
ItemCollection = < ItemCollection = <
item item
Version = 'v1.04' Version = 'v1.05'
Caption = 'Resources' Caption = 'Resources'
IconIndex = 7 IconIndex = 7
Name = 'NIResources' Name = 'NIResources'
Tag = 0 Tag = 0
end end
item item
Version = 'v1.04' Version = 'v1.05'
Caption = 'Settings' Caption = 'Settings'
IconIndex = 8 IconIndex = 8
Name = 'NISettings' Name = 'NISettings'
@ -708,12 +708,12 @@ object MainForm: TMainForm
Printer.MarginUnits = imPercent Printer.MarginUnits = imPercent
Printer.PrintFormats = < Printer.PrintFormats = <
item item
Version = 'v1.04' Version = 'v1.05'
DayInc = 0 DayInc = 0
DayIncUnits = duDay DayIncUnits = duDay
Elements = < Elements = <
item item
Version = 'v1.04' Version = 'v1.05'
Caption.Caption = 'Current week' Caption.Caption = 'Current week'
Caption.Font.Style = [fsItalic] Caption.Font.Style = [fsItalic]
DayOffset = 0 DayOffset = 0
@ -728,12 +728,12 @@ object MainForm: TMainForm
FormatName = 'Events of current week (dayview)' FormatName = 'Events of current week (dayview)'
end end
item item
Version = 'v1.04' Version = 'v1.05'
DayInc = 0 DayInc = 0
DayIncUnits = duWeek DayIncUnits = duWeek
Elements = < Elements = <
item item
Version = 'v1.04' Version = 'v1.05'
DayOffset = 0 DayOffset = 0
DayOffsetUnits = duDay DayOffsetUnits = duDay
ElementName = 'WeekView' ElementName = 'WeekView'
@ -747,12 +747,12 @@ object MainForm: TMainForm
FormatName = 'Events of current week (Week view)' FormatName = 'Events of current week (Week view)'
end end
item item
Version = 'v1.04' Version = 'v1.05'
DayInc = 0 DayInc = 0
DayIncUnits = duDay DayIncUnits = duDay
Elements = < Elements = <
item item
Version = 'v1.04' Version = 'v1.05'
DayOffset = 0 DayOffset = 0
DayOffsetUnits = duWeek DayOffsetUnits = duWeek
ElementName = 'TaskList' ElementName = 'TaskList'
@ -766,12 +766,12 @@ object MainForm: TMainForm
FormatName = 'Tasks of current week' FormatName = 'Tasks of current week'
end end
item item
Version = 'v1.04' Version = 'v1.05'
DayInc = 0 DayInc = 0
DayIncUnits = duDay DayIncUnits = duDay
Elements = < Elements = <
item item
Version = 'v1.04' Version = 'v1.05'
DayOffset = 0 DayOffset = 0
DayOffsetUnits = duDay DayOffsetUnits = duDay
ElementName = 'TaskList' ElementName = 'TaskList'
@ -791,7 +791,7 @@ object MainForm: TMainForm
top = 200 top = 200
end end
object VpResourceEditDialog1: TVpResourceEditDialog object VpResourceEditDialog1: TVpResourceEditDialog
Version = 'v1.04' Version = 'v1.05'
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter
Placement.Top = 10 Placement.Top = 10
@ -2018,7 +2018,7 @@ object MainForm: TMainForm
top = 368 top = 368
end end
object VpPrintPreviewDialog1: TVpPrintPreviewDialog object VpPrintPreviewDialog1: TVpPrintPreviewDialog
Version = 'v1.04' Version = 'v1.05'
BottomMargin = 0 BottomMargin = 0
ControlLink = VpControlLink1 ControlLink = VpControlLink1
EndDate = 42561.5151169907 EndDate = 42561.5151169907
@ -2037,7 +2037,7 @@ object MainForm: TMainForm
top = 432 top = 432
end end
object VpPrintFormatEditDialog1: TVpPrintFormatEditDialog object VpPrintFormatEditDialog1: TVpPrintFormatEditDialog
Version = 'v1.04' Version = 'v1.05'
ControlLink = VpControlLink1 ControlLink = VpControlLink1
Options = [] Options = []
Placement.Position = mpCenter Placement.Position = mpCenter

View File

@ -404,13 +404,15 @@ end;
procedure TMainForm.CbShowEventHintsChange(Sender: TObject); procedure TMainForm.CbShowEventHintsChange(Sender: TObject);
begin begin
VpDayView1.HintMode := hmEventHint; VpDayView1.HintMode := hmPlannerHint;
VpWeekView1.HintMode := hmEventHint; VpWeekView1.HintMode := hmPlannerHint;
VpMonthView1.HintMode := hmEventHint; VpMonthView1.HintMode := hmPlannerHint;
VpContactGrid1.HintMode := hmPlannerHint;
VpDayView1.ShowHint := CbShowEventHints.Checked; VpDayView1.ShowHint := CbShowEventHints.Checked;
VpWeekView1.ShowHint := CbShowEventHints.Checked; VpWeekView1.ShowHint := CbShowEventHints.Checked;
VpMonthView1.ShowHint := CbShowEventHints.Checked; VpMonthView1.ShowHint := CbShowEventHints.Checked;
VpContactGrid1.ShowHint := CbShowEventHints.Checked;
end; end;
procedure TMainForm.CbTimeFormatChange(Sender: TObject); procedure TMainForm.CbTimeFormatChange(Sender: TObject);

View File

@ -211,8 +211,8 @@ msgid "30 Min"
msgstr "30 Min" msgstr "30 Min"
#: tmainform.cbshoweventhints.caption #: tmainform.cbshoweventhints.caption
msgid "Show event hints" msgid "Show event and contact hints"
msgstr "Ereignis-Hinweise anzeigen" msgstr "Ereignis- und Kontakt-Hinweise anzeigen"
#: tmainform.lbladdressbuilder.caption #: tmainform.lbladdressbuilder.caption
msgid "Address builder" msgid "Address builder"
@ -302,4 +302,3 @@ msgstr "Fertiggestellte Aufgaben ausblenden"
#: tmainform.titlelbl.caption #: tmainform.titlelbl.caption
msgid "TitleLbl" msgid "TitleLbl"
msgstr "" msgstr ""

View File

@ -205,7 +205,7 @@ msgid "30 Min"
msgstr "30 Min" msgstr "30 Min"
#: tmainform.cbshoweventhints.caption #: tmainform.cbshoweventhints.caption
msgid "Show event hints" msgid "Show event and contact hints"
msgstr "" msgstr ""
#: tmainform.lbladdressbuilder.caption #: tmainform.lbladdressbuilder.caption

View File

@ -200,7 +200,7 @@ msgid "30 Min"
msgstr "" msgstr ""
#: tmainform.cbshoweventhints.caption #: tmainform.cbshoweventhints.caption
msgid "Show event hints" msgid "Show event and contact hints"
msgstr "" msgstr ""
#: tmainform.lbladdressbuilder.caption #: tmainform.lbladdressbuilder.caption

View File

@ -214,7 +214,7 @@ msgid "30 Min"
msgstr "30 минут" msgstr "30 минут"
#: tmainform.cbshoweventhints.caption #: tmainform.cbshoweventhints.caption
msgid "Show event hints" msgid "Show event and contact hints"
msgstr "" msgstr ""
#: tmainform.lbladdressbuilder.caption #: tmainform.lbladdressbuilder.caption

View File

@ -43,6 +43,10 @@ msgstr "Adresse:"
msgid "Fri" msgid "Fri"
msgstr "Fre" msgstr "Fre"
#: vpsr.rsagelbl
msgid "Age:"
msgstr "Alter:"
#: vpsr.rsalarmset #: vpsr.rsalarmset
msgid "&Reminder" msgid "&Reminder"
msgstr "E&rinnerung" msgstr "E&rinnerung"
@ -59,6 +63,10 @@ msgstr "G&anztägiges Ereignis"
msgid "Mon" msgid "Mon"
msgstr "Mon" msgstr "Mon"
#: vpsr.rsanniversarylbl
msgid "Anniversary:"
msgstr "Jubiläum:"
#: vpsr.rsappointmentgroupbox #: vpsr.rsappointmentgroupbox
msgid "Appointment" msgid "Appointment"
msgstr "Termin" msgstr "Termin"
@ -917,7 +925,7 @@ msgstr "Position"
#: vpsr.rspositionlbl #: vpsr.rspositionlbl
msgid "Position:" msgid "Position:"
msgstr "Position" msgstr "Position:"
#: vpsr.rsprevday #: vpsr.rsprevday
msgctxt "vpsr.rsprevday" msgctxt "vpsr.rsprevday"
@ -1207,6 +1215,22 @@ msgstr "Fehler: Kann nicht öffnen"
msgid "Untitled" msgid "Untitled"
msgstr "Ohne Titel" msgstr "Ohne Titel"
#: vpsr.rsuppercasecontact
msgid "CONTACT"
msgstr "KONTAKT"
#: vpsr.rsuppercasecustom
msgid "CUSTOM"
msgstr "BENUTZER-DEFINIERT"
#: vpsr.rsuppercasehome
msgid "HOME"
msgstr "ZUHAUSE"
#: vpsr.rsuppercasework
msgid "WORK"
msgstr "ARBEIT"
#: vpsr.rsvisible #: vpsr.rsvisible
msgid "Visible" msgid "Visible"
msgstr "Sichtbar" msgstr "Sichtbar"

View File

@ -49,6 +49,10 @@ msgstr "Adresse:"
msgid "Fri" msgid "Fri"
msgstr "Ven" msgstr "Ven"
#: vpsr.rsagelbl
msgid "Age:"
msgstr ""
#: vpsr.rsalarmset #: vpsr.rsalarmset
msgid "&Reminder" msgid "&Reminder"
msgstr "&Rappel" msgstr "&Rappel"
@ -65,6 +69,10 @@ msgstr "&Événement d'une journée"
msgid "Mon" msgid "Mon"
msgstr "Lun" msgstr "Lun"
#: vpsr.rsanniversarylbl
msgid "Anniversary:"
msgstr ""
#: vpsr.rsappointmentgroupbox #: vpsr.rsappointmentgroupbox
msgid "Appointment" msgid "Appointment"
msgstr "Rendevous" msgstr "Rendevous"
@ -1213,6 +1221,22 @@ msgstr "Erreur: Incapable d'ouvrir"
msgid "Untitled" msgid "Untitled"
msgstr "Sans titre" msgstr "Sans titre"
#: vpsr.rsuppercasecontact
msgid "CONTACT"
msgstr ""
#: vpsr.rsuppercasecustom
msgid "CUSTOM"
msgstr ""
#: vpsr.rsuppercasehome
msgid "HOME"
msgstr ""
#: vpsr.rsuppercasework
msgid "WORK"
msgstr ""
#: vpsr.rsvisible #: vpsr.rsvisible
msgid "Visible" msgid "Visible"
msgstr "" msgstr ""
@ -1591,3 +1615,4 @@ msgstr "Spécificateur d'axe inconnu"
#: vpsr.sxmldecnotatbeg #: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element" msgid "The XML declaration must appear before the first element"
msgstr "La déclaration XML doit apparaître avant le premier élément" msgstr "La déclaration XML doit apparaître avant le premier élément"

View File

@ -43,6 +43,10 @@ msgstr "Adres:"
msgid "Fri" msgid "Fri"
msgstr "Vr" msgstr "Vr"
#: vpsr.rsagelbl
msgid "Age:"
msgstr ""
#: vpsr.rsalarmset #: vpsr.rsalarmset
msgid "&Reminder" msgid "&Reminder"
msgstr "He&rinnering" msgstr "He&rinnering"
@ -59,6 +63,10 @@ msgstr "Hele D&ag Gebeurtenis"
msgid "Mon" msgid "Mon"
msgstr "Ma" msgstr "Ma"
#: vpsr.rsanniversarylbl
msgid "Anniversary:"
msgstr ""
#: vpsr.rsappointmentgroupbox #: vpsr.rsappointmentgroupbox
msgid "Appointment" msgid "Appointment"
msgstr "Afspraak" msgstr "Afspraak"
@ -1207,6 +1215,22 @@ msgstr "Fout: Openen niet mogelijk "
msgid "Untitled" msgid "Untitled"
msgstr "Zonder titel" msgstr "Zonder titel"
#: vpsr.rsuppercasecontact
msgid "CONTACT"
msgstr ""
#: vpsr.rsuppercasecustom
msgid "CUSTOM"
msgstr ""
#: vpsr.rsuppercasehome
msgid "HOME"
msgstr ""
#: vpsr.rsuppercasework
msgid "WORK"
msgstr ""
#: vpsr.rsvisible #: vpsr.rsvisible
msgid "Visible" msgid "Visible"
msgstr "" msgstr ""
@ -1585,3 +1609,4 @@ msgstr "Onbekende as specificatie: %s"
#: vpsr.sxmldecnotatbeg #: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element" msgid "The XML declaration must appear before the first element"
msgstr "De XML declaratie moet voor het eerste element staan" msgstr "De XML declaratie moet voor het eerste element staan"

View File

@ -33,6 +33,10 @@ msgstr ""
msgid "Fri" msgid "Fri"
msgstr "" msgstr ""
#: vpsr.rsagelbl
msgid "Age:"
msgstr ""
#: vpsr.rsalarmset #: vpsr.rsalarmset
msgid "&Reminder" msgid "&Reminder"
msgstr "" msgstr ""
@ -49,6 +53,10 @@ msgstr ""
msgid "Mon" msgid "Mon"
msgstr "" msgstr ""
#: vpsr.rsanniversarylbl
msgid "Anniversary:"
msgstr ""
#: vpsr.rsappointmentgroupbox #: vpsr.rsappointmentgroupbox
msgid "Appointment" msgid "Appointment"
msgstr "" msgstr ""
@ -1197,6 +1205,22 @@ msgstr ""
msgid "Untitled" msgid "Untitled"
msgstr "" msgstr ""
#: vpsr.rsuppercasecontact
msgid "CONTACT"
msgstr ""
#: vpsr.rsuppercasecustom
msgid "CUSTOM"
msgstr ""
#: vpsr.rsuppercasehome
msgid "HOME"
msgstr ""
#: vpsr.rsuppercasework
msgid "WORK"
msgstr ""
#: vpsr.rsvisible #: vpsr.rsvisible
msgid "Visible" msgid "Visible"
msgstr "" msgstr ""

View File

@ -43,6 +43,10 @@ msgstr "Адрес:"
msgid "Fri" msgid "Fri"
msgstr "Пт." msgstr "Пт."
#: vpsr.rsagelbl
msgid "Age:"
msgstr ""
#: vpsr.rsalarmset #: vpsr.rsalarmset
msgid "&Reminder" msgid "&Reminder"
msgstr "Напоминание" msgstr "Напоминание"
@ -59,6 +63,10 @@ msgstr "Событие на весь день"
msgid "Mon" msgid "Mon"
msgstr "Пон." msgstr "Пон."
#: vpsr.rsanniversarylbl
msgid "Anniversary:"
msgstr ""
#: vpsr.rsappointmentgroupbox #: vpsr.rsappointmentgroupbox
msgid "Appointment" msgid "Appointment"
msgstr "Встреча" msgstr "Встреча"
@ -1207,6 +1215,22 @@ msgstr "Ошибка открытия"
msgid "Untitled" msgid "Untitled"
msgstr "Без имени" msgstr "Без имени"
#: vpsr.rsuppercasecontact
msgid "CONTACT"
msgstr ""
#: vpsr.rsuppercasecustom
msgid "CUSTOM"
msgstr ""
#: vpsr.rsuppercasehome
msgid "HOME"
msgstr ""
#: vpsr.rsuppercasework
msgid "WORK"
msgstr ""
#: vpsr.rsvisible #: vpsr.rsvisible
msgid "Visible" msgid "Visible"
msgstr "" msgstr ""
@ -1585,3 +1609,4 @@ msgstr ""
#: vpsr.sxmldecnotatbeg #: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element" msgid "The XML declaration must appear before the first element"
msgstr "" msgstr ""

View File

@ -71,7 +71,7 @@ type
TVpPlaySoundMode = (psmSync, psmAsync, psmStop); TVpPlaySoundMode = (psmSync, psmAsync, psmStop);
TVpHintMode = (hmEventHint, hmComponentHint); TVpHintMode = (hmPlannerHint, hmComponentHint);
{ XML definitions } { XML definitions }
DOMString = WideString; DOMString = WideString;

View File

@ -38,7 +38,7 @@ uses
{$ELSE} {$ELSE}
Windows, Messages, Windows, Messages,
{$ENDIF} {$ENDIF}
Classes, Graphics, Controls, ExtCtrls, StdCtrls, Classes, Graphics, Controls, ExtCtrls, StdCtrls, Forms,
VpBase, VpBaseDS, VpMisc, VpData, VpConst, VpSR, VpCanvasUtils, Menus; VpBase, VpBaseDS, VpMisc, VpData, VpConst, VpSR, VpCanvasUtils, Menus;
const const
@ -109,6 +109,8 @@ type
{ Contact Grid } { Contact Grid }
TVpContactGrid = class(TVpLinkableControl) TVpContactGrid = class(TVpLinkableControl)
private
FHintMode: TVpHintMode;
protected{ private } protected{ private }
FColumnWidth : Integer; FColumnWidth : Integer;
FColor : TColor; FColor : TColor;
@ -153,6 +155,8 @@ type
cgColCount : Integer; cgColCount : Integer;
cgVScrollDelta : Integer; cgVScrollDelta : Integer;
FOldCursor : TCursor; FOldCursor : TCursor;
FHintWindow: THintWindow;
FMouseContactIndex: Integer;
{ property methods } { property methods }
function GetBarWidth: Integer; function GetBarWidth: Integer;
@ -166,6 +170,7 @@ type
procedure SetPrintNumColumns (const v : Integer); procedure SetPrintNumColumns (const v : Integer);
procedure SetSortBy (const v : TVpContactSort); procedure SetSortBy (const v : TVpContactSort);
procedure SetDataStore (const Value : TVpCustomDataStore); override; procedure SetDataStore (const Value : TVpCustomDataStore); override;
{ internal methods } { internal methods }
procedure cgCalcRowHeight; procedure cgCalcRowHeight;
procedure cgEditInPlace(Sender: TObject); procedure cgEditInPlace(Sender: TObject);
@ -174,19 +179,22 @@ type
procedure Loaded; override; procedure Loaded; override;
procedure cgSpawnContactEditDialog(NewContact: Boolean); procedure cgSpawnContactEditDialog(NewContact: Boolean);
procedure cgSetActiveContactByCoord(Pnt: TPoint); procedure cgSetActiveContactByCoord(Pnt: TPoint);
function GetContactIndexByCoord(Pnt: TPoint): Integer;
procedure cgScrollHorizontal(Rows: Integer); procedure cgScrollHorizontal(Rows: Integer);
procedure CreateParams(var Params: TCreateParams); override; procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override; procedure CreateWnd; override;
procedure MouseEnter; override;
procedure MouseLeave; override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
X, Y: Integer); override; procedure PopupAddContact(Sender: TObject);
procedure PopupAddContact (Sender : TObject); procedure PopupDeleteContact(Sender: TObject);
procedure PopupDeleteContact (Sender : TObject); procedure PopupEditContact(Sender: TObject);
procedure PopupEditContact (Sender : TObject);
procedure EditContact; procedure EditContact;
procedure EndEdit(Sender: TObject); procedure EndEdit(Sender: TObject);
procedure InitializeDefaultPopup; procedure InitializeDefaultPopup;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
{ message handlers } { message handlers }
{$IFNDEF LCL} {$IFNDEF LCL}
procedure WMSize(var Msg: TWMSize); message WM_SIZE; procedure WMSize(var Msg: TWMSize); message WM_SIZE;
@ -210,6 +218,11 @@ type
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override; function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override; function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
{$ENDIF} {$ENDIF}
{ Hints }
procedure ShowHintWindow(APoint: TPoint; AContactIndex: Integer);
procedure HideHintWindow;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -217,9 +230,9 @@ type
procedure LinkHandler(Sender: TComponent; NotificationType: TVpNotificationType; procedure LinkHandler(Sender: TComponent; NotificationType: TVpNotificationType;
const Value: Variant); override; const Value: Variant); override;
function GetCityStateZipFormat: String; function GetCityStateZipFormat: String;
function GetControlType : TVpItemType; override; function GetControlType: TVpItemType; override;
procedure DeleteActiveContact(Verify: Boolean); procedure DeleteActiveContact(Verify: Boolean);
procedure PaintToCanvas (ACanvas: TCanvas; ARect: TRect; Angle: TVpRotationAngle); procedure PaintToCanvas(ACanvas: TCanvas; ARect: TRect; Angle: TVpRotationAngle);
procedure RenderToCanvas(RenderCanvas: TCanvas; RenderIn: TRect; procedure RenderToCanvas(RenderCanvas: TCanvas; RenderIn: TRect;
Angle: TVpRotationAngle; Scale: Extended; RenderDate: TDateTime; Angle: TVpRotationAngle; Scale: Extended; RenderDate: TDateTime;
StartLine, StopLine: Integer; UseGran: TVpGranularity; StartLine, StopLine: Integer; UseGran: TVpGranularity;
@ -240,24 +253,27 @@ type
read FAllowInPlaceEdit write FAllowInPlaceEdit; read FAllowInPlaceEdit write FAllowInPlaceEdit;
property BarWidth: Integer read GetBarWidth write SetBarWidth; property BarWidth: Integer read GetBarWidth write SetBarWidth;
property BarColor: TColor read FBarColor write SetBarColor; property BarColor: TColor read FBarColor write SetBarColor;
property Color: TColor read FColor write SetColor;
property ColumnWidth: Integer read FColumnWidth write SetColumnWidth; property ColumnWidth: Integer read FColumnWidth write SetColumnWidth;
property ContactHeadAttributes: TVpContactHeadAttr property ContactHeadAttributes: TVpContactHeadAttr
read FContactHeadAttr write FContactHeadAttr; read FContactHeadAttr write FContactHeadAttr;
property DrawingStyle: TVpDrawingStyle property DrawingStyle: TVpDrawingStyle
read FDrawingStyle write SetDrawingStyle; read FDrawingStyle write SetDrawingStyle;
property Color: TColor read FColor write SetColor; property HintMode: TVpHintMode
property PrintNumColumns : Integer read FHintMode write FHintMode default hmPlannerHint;
property PrintNumColumns: Integer
read FPrintNumColumns write SetPrintNumColumns default 3; read FPrintNumColumns write SetPrintNumColumns default 3;
property SortBy : TVpContactSort read FSortBy write SetSortBy property SortBy: TVpContactSort
default csLastFirst; read FSortBy write SetSortBy default csLastFirst;
{ events } { events }
property BeforeEdit: TVpEditContactEvent property BeforeEdit: TVpEditContactEvent
read FBeforeEdit write FBeforeEdit; read FBeforeEdit write FBeforeEdit;
property AfterEdit : TVpContactEvent property AfterEdit: TVpContactEvent
read FAfterEdit write FAfterEdit; read FAfterEdit write FAfterEdit;
property OnOwnerEditContact: TVpEditContactEvent property OnOwnerEditContact: TVpEditContactEvent
read FOwnerEditContact write FOwnerEditContact; read FOwnerEditContact write FOwnerEditContact;
property OnColWidthChange : TVpCGColWidthChangeEvent property OnColWidthChange: TVpCGColWidthChangeEvent
read FOnColWidthChange write FOnColWidthChange; read FOnColWidthChange write FOnColWidthChange;
property OnContactChange: TVpContactEvent property OnContactChange: TVpContactEvent
read FOnClickContact write FOnClickContact; read FOnClickContact write FOnClickContact;
@ -266,11 +282,13 @@ type
implementation implementation
uses uses
SysUtils, Forms, Dialogs, VpContactEditDlg, VpContactGridPainter; SysUtils, DateUtils, Dialogs,
VpContactEditDlg, VpContactGridPainter;
(*****************************************************************************) (*****************************************************************************)
{ TVpContactHeadAttr } { TVpContactHeadAttr }
(*****************************************************************************)
constructor TVpContactHeadAttr.Create(AOwner: TVpContactGrid); constructor TVpContactHeadAttr.Create(AOwner: TVpContactGrid);
begin begin
inherited Create; inherited Create;
@ -452,12 +470,13 @@ begin
end; end;
cgDragBarNumber := -1; cgDragBarNumber := -1;
FMouseContactIndex := -1;
{ size } { size }
Height := 299; Height := 299;
Width := 225; Width := 225;
FDefaultPopup := TPopupMenu.Create (Self); FDefaultPopup := TPopupMenu.Create(Self);
InitializeDefaultPopup; InitializeDefaultPopup;
cgHookUp; cgHookUp;
@ -764,16 +783,184 @@ begin
cgCalcRowHeight; cgCalcRowHeight;
SetHScrollPos; SetHScrollPos;
end; end;
{=====}
procedure TVpContactGrid.ShowHintWindow(APoint: TPoint; AContactIndex: Integer);
const
MaxWidth = 400;
var
txt, s: String;
i: Integer;
contact: TVpContact;
list: TStrings;
R: TRect;
begin
if FHintMode = hmPlannerHint then
begin
if (AContactIndex = -1) or ((Datastore = nil) or (Datastore.Resource = nil)) then
begin
HideHintWindow;
exit;
end;
list := TStringList.Create;
try
contact := TVpContact(cgContactArray[AContactIndex].Contact);
if (contact.LastName <> '') or (contact.FirstName <> '') then begin
s := AssembleName(contact);
if contact.Title <> '' then
s := s + ', ' + contact.Title;
list.Add(s);
list.Add('');
end;
if contact.Category > -1 then
list.Add(RSCategoryLbl + ' ' + CategoryLabel(TVpCategoryType(contact.Category)));
if contact.Birthdate > 0 then begin
list.Add(Format('%s %s', [RSBirthdateLbl, FormatDateTime('ddddd', contact.Birthdate)]));
list.Add(Format('%s %d', [RSAgeLbl, YearsBetween(date, contact.Birthdate)]));
end;
if list.Count > 0 then
list.Add('');
list.Add(Format('--- %s ---', [RSUppercaseWORK]));
if contact.Company <> '' then
list.Add(RSCompanyLbl + ' ' + contact.Company);
if contact.Department <> '' then
list.Add(RSDepartmentLbl + ' ' + contact.Department);
if contact.Job_Position <> '' then
list.Add(RSPositionLbl + ' ' + contact.Job_Position);
if contact.Anniversary > 0 then
list.Add(Format('%s %s', [RSAnniversaryLbl, FormatDateTime('ddddd', contact.Anniversary)]));
if (contact.Address1 <> '') or (contact.Zip1 <> '') or (contact.City1 <> '') then begin
list.Add(RSAddressLbl);
if contact.Address1 <> '' then
list.Add(' ' + contact.Address1);
s := AssembleCSZ(contact, 1, GetCityStateZipFormat);
if s <> '' then
list.Add(' ' + s);
end;
list.Add('');
list.Add(Format('--- %s ---', [RSUppercaseHOME]));
if (contact.Address2 <> '') or (contact.Zip2 <> '') or (contact.City2 <> '') then begin
list.Add(RSAddressLbl);
if contact.Address1 <> '' then
list.Add(' ' + contact.Address2);
s := AssembleCSZ(contact, 2, GetCityStateZipFormat);
if s <> '' then
list.Add(' ' + s);
end;
list.Add('');
list.Add(Format('--- %s ---', [RSUppercaseCONTACT]));
if (contact.Phone1 <> '') or (contact.Phone2 <> '') or (contact.Phone3 <> '') or
(contact.Phone4 <> '') or (contact.Phone5 <> '')
then begin
list.Add(RSPhoneFax + ':');
if contact.Phone1 <> '' then
list.Add(' ' + PhoneLabel(TVpPhoneType(contact.PhoneType1)) + ': ' + contact.Phone1);
if contact.Phone2 <> '' then
list.Add(' ' + PhoneLabel(TVpPhoneType(contact.PhoneType2)) + ': ' + contact.Phone2);
if contact.Phone3 <> '' then
list.Add(' ' + PhoneLabel(TVpPhoneType(contact.PhoneType3)) + ': ' + contact.Phone3);
if contact.Phone4 <> '' then
list.Add(' ' + PhoneLabel(TVpPhoneType(contact.PhoneType4)) + ': ' + contact.Phone4);
if contact.Phone5 <> '' then
list.Add(' ' + PhoneLabel(TVpPhoneType(contact.PhoneType5)) + ': ' + contact.Phone5);
end;
if (contact.EMail1 <> '') or (contact.EMail2 <> '') or (contact.EMail3 <> '')
then begin
list.Add(RSEmail + ':');
if contact.EMail1 <> '' then
list.Add(' ' + EMailLabel(TVpEMailType(contact.EMailType1)) + ': ' + contact.EMail1);
if contact.EMail2 <> '' then
list.Add(' ' + EMailLabel(TVpEMailType(contact.EMailType2)) + ': ' + contact.EMail2);
if contact.EMail3 <> '' then
list.Add(' ' + EMailLabel(TVpEMailType(contact.EMailType2)) + ': ' + contact.EMail3);
end;
if (contact.Website1 <> '') or (contact.Website2 <> '')
then begin
list.Add(RSWebSites + ':');
if contact.Website1 <> '' then
list.Add(' ' + WebsiteLabel(TVpWebsiteType(contact.WebsiteType1)) + ': ' + contact.Website1);
if contact.Website2 <> '' then
list.Add(' ' + WebsiteLabel(TVpWebsiteType(contact.WebsiteType2)) + ': ' + contact.Website2);
end;
if (contact.Custom1 <> '') or (contact.Custom2 <> '') or
(contact.Custom3 <> '') or (contact.Custom4 <> '') then
begin
list.Add('');
list.Add(Format('--- %s ---', [RSUppercaseCUSTOM]));
if contact.Custom1 <> '' then
list.Add(contact.Custom1);
if contact.Custom2 <> '' then
list.Add(contact.Custom2);
if contact.Custom3 <> '' then
list.Add(contact.Custom3);
if contact.Custom4 <> '' then
list.Add(contact.Custom4);
end;
txt := list.Text;
finally
list.Free;
end;
if (txt <> '') and not (csDesigning in ComponentState) then
begin
// Build and show the hint window
if FHintWindow = nil then
FHintWindow := THintWindow.Create(nil);
APoint := ClientToScreen(APoint);
R := FHintWindow.CalcHintRect(MaxWidth, txt, nil);
OffsetRect(R, APoint.X - WidthOf(R), APoint.Y);
FHintWindow.ActivateHint(R, txt);
end else
// Hide the hint window
HideHintWindow;
end
else
if FHintMode = hmComponentHint then
begin
Application.Hint := Hint;
Application.ActivateHint(ClientToScreen(APoint), true);
end;
end;
procedure TVpContactGrid.HideHintWindow;
begin
case FHintMode of
hmPlannerHint : FreeAndNil(FHintWindow);
hmComponentHint : Application.CancelHint;
end;
end;
procedure TVpContactGrid.MouseEnter;
begin
FMouseContactIndex := -1;
end;
procedure TVpContactGrid.MouseLeave;
begin
HideHintWindow;
end;
procedure TVpContactGrid.MouseMove(Shift: TShiftState; X, Y: Integer); procedure TVpContactGrid.MouseMove(Shift: TShiftState; X, Y: Integer);
var var
J, I: Integer; J, I, idx: Integer;
begin begin
if cgGridState = gsNormal then if cgGridState = gsNormal then begin
inherited MouseMove(Shift, X, Y) inherited MouseMove(Shift, X, Y);
if ShowHint then
begin
idx := GetContactIndexByCoord(Point(X, Y));
if FMouseContactIndex <> idx then begin
ShowHintWindow(Point(X, Y), idx);
FMouseContactIndex := idx;
end;
end;
end else
begin
else begin
{ Column sizing happens here...} { Column sizing happens here...}
{ if the in-place editor is active then kill it. } { if the in-place editor is active then kill it. }
if Assigned(cgInplaceEditor) and cgInPlaceEditor.Visible then if Assigned(cgInplaceEditor) and cgInPlaceEditor.Visible then
@ -1510,6 +1697,18 @@ begin
end; end;
{=====} {=====}
function TVpContactGrid.GetContactIndexByCoord(Pnt: TPoint): Integer;
var
i: Integer;
begin
Result := -1;
for i:=0 to High(cgContactArray) do
if PointInRect(Pnt, cgContactArray[i].WholeRect) then begin
Result := i;
exit;
end;
end;
procedure TVpContactGrid.cgSetActiveContactByCoord(Pnt: TPoint); procedure TVpContactGrid.cgSetActiveContactByCoord(Pnt: TPoint);
var var
I: integer; I: integer;

View File

@ -428,24 +428,7 @@ begin
DrawContactLine(TmpBmp, TmpCon.Address, '', WholeRect, AddrRect); DrawContactLine(TmpBmp, TmpCon.Address, '', WholeRect, AddrRect);
{ do City, State, Zip } { do City, State, Zip }
str := FContactGrid.GetCityStateZipFormat; Str := AssembleCSZ(TmpCon, 1, FContactGrid.GetCityStateZipFormat);
if str = '' then
begin
str := TmpCon.City;
if (str <> '') and (TmpCon.State <> '') then
Str := Str + ', ' + TmpCon.State;
if (str <> '') and (TmpCon.Zip <> '') then
Str := Str + ' ' + TmpCon.Zip;
end else
begin
Str := ReplaceStr(Str, '@CITY', TmpCon.City);
Str := ReplaceStr(Str, '@STATE', TmpCon.State);
Str := ReplaceStr(Str, '@ZIP', TmpCon.Zip);
while (Length(Str) > 0) and (Str[1] in [' ', ',', '.']) do
Delete(Str, 1, 1);
while (Length(Str) > 0) and (Str[Length(Str)] in [' ', ',', '.']) do
Delete(Str, Length(Str), 1);
end;
DrawContactLine(TmpBmp, Str, '', WholeRect, CSZRect); DrawContactLine(TmpBmp, Str, '', WholeRect, CSZRect);
{ do Phone1 } { do Phone1 }

View File

@ -476,7 +476,7 @@ type
property IncludeWeekends: Boolean read FIncludeWeekends write SetIncludeWeekends default True; property IncludeWeekends: Boolean read FIncludeWeekends write SetIncludeWeekends default True;
property NumDays: Integer read FNumDays write SetNumDays default 1; property NumDays: Integer read FNumDays write SetNumDays default 1;
property WrapStyle: TVpDVWrapStyle read FWrapStyle Write SetWrapStyle default wsIconFlow; property WrapStyle: TVpDVWrapStyle read FWrapStyle Write SetWrapStyle default wsIconFlow;
property HintMode: TVpHintMode read FHintMode write FHintMode default hmEventHint; property HintMode: TVpHintMode read FHintMode write FHintMode default hmPlannerHint;
{events} {events}
property AfterEdit: TVpAfterEditEvent read FAfterEdit write FAfterEdit; property AfterEdit: TVpAfterEditEvent read FAfterEdit write FAfterEdit;
property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit; property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit;
@ -1005,7 +1005,7 @@ var
txt: String; txt: String;
R, eventR: TRect; R, eventR: TRect;
begin begin
if FHintMode = hmEventHint then if FHintMode = hmPlannerHint then
begin begin
if (AEvent = nil) or if (AEvent = nil) or
((Datastore = nil) or (Datastore.Resource = nil)) then ((Datastore = nil) or (Datastore.Resource = nil)) then
@ -1043,7 +1043,7 @@ end;
procedure TVpDayView.HideHintWindow; procedure TVpDayView.HideHintWindow;
begin begin
case FHintMode of case FHintMode of
hmEventHint: hmPlannerHint:
FreeAndNil(FHintWindow); FreeAndNil(FHintWindow);
hmComponentHint: hmComponentHint:
Application.CancelHint; Application.CancelHint;

View File

@ -69,9 +69,12 @@ function GetStartOfWeek(Date: TDateTime; StartOn: TVpDayType): TDateTime;
procedure StripString(var Str: string); procedure StripString(var Str: string);
{ strips non-alphanumeric characters from the beginning and end of the string} { strips non-alphanumeric characters from the beginning and end of the string}
function AssembleName(Contact: TVpContact): string; function AssembleName(AContact: TVpContact): string;
{ returns an assembled name string } { returns an assembled name string }
function AssembleCSZ(AContact: TVpContact; AType: Integer; AFormat: String): String;
{ returns an assembled city-state-zip string }
procedure ParseName(Contact: TVpContact; const Value: string); procedure ParseName(Contact: TVpContact; const Value: string);
{ parses the name into it's elements and updates the contact } { parses the name into it's elements and updates the contact }
@ -177,7 +180,7 @@ implementation
uses uses
{$IFDEF LCL} {$IFDEF LCL}
DateUtils, DateUtils, StrUtils,
{$ENDIF} {$ENDIF}
VpException, VpSR, VpBaseDS; VpException, VpSR, VpBaseDS;
@ -192,23 +195,63 @@ begin
end; end;
{=====} {=====}
function AssembleName(Contact: TVpContact): string; function AssembleName(AContact: TVpContact): string;
begin begin
result := Contact.LastName; Result := AContact.LastName;
if Assigned (Contact.Owner) then begin if Assigned(AContact.Owner) then begin
if Contact.Owner.ContactSort = csFirstLast then begin if AContact.Owner.ContactSort = csFirstLast then begin
if Contact.FirstName <> '' then if AContact.FirstName <> '' then
result := Contact.FirstName + ' ' + Result; Result := AContact.FirstName + ' ' + Result;
end else begin end else begin
if Contact.FirstName <> '' then if AContact.FirstName <> '' then
result := result + ', ' + Contact.FirstName; Result := Result + ', ' + AContact.FirstName;
end; end;
end else begin end else begin
if Contact.FirstName <> '' then if AContact.FirstName <> '' then
result := result + ', ' + Contact.FirstName; Result := Result + ', ' + AContact.FirstName;
end; end;
end; end;
{=====}
function AssembleCSZ(AContact: TVpContact; AType: Integer; AFormat: String): String;
var
city: String;
state: String;
zip: String;
begin
case AType of
1: // work address
begin
city := AContact.City1;
state := AContact.State1;
zip := AContact.Zip1;
end;
2: // home address
begin
city := AContact.City2;
state := AContact.State2;
zip := AContact.Zip2;
end;
end;
if AFormat = '' then
begin
Result := city;
if (Result <> '') and (state <> '') then
Result := Result + ', ' + state;
if (Result <> '') and (zip <> '') then
Result := Result + ' ' + zip;
end else
begin
Result := AFormat;
Result := ReplaceStr(Result, '@CITY', city);
Result := ReplaceStr(Result, '@STATE', state);
Result := ReplaceStr(Result, '@ZIP', zip);
while (Length(Result) > 0) and (Result[1] in [' ', ',', '.']) do
Delete(Result, 1, 1);
while (Length(Result) > 0) and (Result[Length(Result)] in [' ', ',', '.']) do
Delete(Result, Length(Result), 1);
end;
end;
procedure ParseName(Contact: TVpContact; const Value: string); procedure ParseName(Contact: TVpContact; const Value: string);
var var

View File

@ -265,7 +265,7 @@ type
property EventDayStyle: TFontStyles read FEventDayStyle write SetEventDayStyle; property EventDayStyle: TFontStyles read FEventDayStyle write SetEventDayStyle;
property EventFont: TVpFont read FEventFont write SetEventFont; property EventFont: TVpFont read FEventFont write SetEventFont;
property HeadAttributes: TVpMvHeadAttr read FHeadAttr write FHeadAttr; property HeadAttributes: TVpMvHeadAttr read FHeadAttr write FHeadAttr;
property HintMode: TVpHintMode read FHintMode write FHintMode default hmEventHint; property HintMode: TVpHintMode read FHintMode write FHintMode default hmPlannerHint;
property LineColor: TColor read FLineColor write SetLineColor; property LineColor: TColor read FLineColor write SetLineColor;
property TimeFormat: TVpTimeFormat read FTimeFormat write SetTimeFormat; property TimeFormat: TVpTimeFormat read FTimeFormat write SetTimeFormat;
property TodayAttributes: TVpMvTodayAttr read FTodayAttr write FTodayAttr; property TodayAttributes: TVpMvTodayAttr read FTodayAttr write FTodayAttr;
@ -926,7 +926,7 @@ var
list: TList; list: TList;
R: TRect; R: TRect;
begin begin
if FHintMode = hmEventHint then if FHintMode = hmPlannerHint then
begin begin
if (ADate = 0) or ((Datastore = nil) or (Datastore.Resource = nil)) then if (ADate = 0) or ((Datastore = nil) or (Datastore.Resource = nil)) then
begin begin
@ -980,7 +980,7 @@ end;
procedure TVpMonthView.HideHintWindow; procedure TVpMonthView.HideHintWindow;
begin begin
case FHintMode of case FHintMode of
hmEventHint: FreeAndNil(FHintWindow); hmPlannerHint: FreeAndNil(FHintWindow);
hmComponentHint: Application.CancelHint; hmComponentHint: Application.CancelHint;
end; end;
end; end;

View File

@ -261,8 +261,15 @@ resourcestring
RSDepartmentLbl = 'Department:'; RSDepartmentLbl = 'Department:';
RSPositionLbl = 'Position:'; RSPositionLbl = 'Position:';
RSBirthDateLbl = 'Birth date:'; RSBirthDateLbl = 'Birth date:';
RSAgeLbl = 'Age:';
RSAnniversaryLbl = 'Anniversary:';
RSPhoneFax = 'Phone/fax'; RSPhoneFax = 'Phone/fax';
RSWebsites = 'Websites'; RSWebsites = 'Websites';
RSUppercaseContact = 'CONTACT';
RSUppercaseHOME = 'HOME';
RSUppercaseWORK = 'WORK';
RSUppercaseCUSTOM = 'CUSTOM';
RSMasterData = 'Master data'; RSMasterData = 'Master data';
RSAddresses = 'Addresses'; RSAddresses = 'Addresses';

View File

@ -273,7 +273,7 @@ type
property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle stored True; property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle stored True;
property EventFont: TVpFont read FEventFont write SetEventFont; property EventFont: TVpFont read FEventFont write SetEventFont;
property HeadAttributes: TVpWvHeadAttributes read FHeadAttr write FHeadAttr; property HeadAttributes: TVpWvHeadAttributes read FHeadAttr write FHeadAttr;
property HintMode: TVpHintMode read FHintMode write FHintMode default hmEventHint; property HintMode: TVpHintMode read FHintMode write FHintMode default hmPlannerHint;
property LineColor: TColor read FLineColor write SetLineColor; property LineColor: TColor read FLineColor write SetLineColor;
property TimeFormat: TVpTimeFormat read FTimeFormat write SetTimeFormat; property TimeFormat: TVpTimeFormat read FTimeFormat write SetTimeFormat;
property ShowEventTime: Boolean read FShowEventTime write SetShowEventTime; property ShowEventTime: Boolean read FShowEventTime write SetShowEventTime;
@ -1015,7 +1015,7 @@ var
txt: String; txt: String;
R, eventR: TRect; R, eventR: TRect;
begin begin
if FHintMode = hmEventHint then if FHintMode = hmPlannerHint then
begin begin
if (AEvent = nil) or if (AEvent = nil) or
((Datastore = nil) or (Datastore.Resource = nil)) then ((Datastore = nil) or (Datastore.Resource = nil)) then
@ -1053,7 +1053,7 @@ end;
procedure TVpWeekView.HideHintWindow; procedure TVpWeekView.HideHintWindow;
begin begin
case FHintMode of case FHintMode of
hmEventHint: hmPlannerHint:
FreeAndNil(FHintWindow); FreeAndNil(FHintWindow);
hmComponentHint: hmComponentHint:
Application.CancelHint; Application.CancelHint;