tvplanit: New TVpControlLink property CityStateZip defining the country-dependant order and structure of the city-state-zip part of the address.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4866 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-29 13:22:33 +00:00
parent ae8fecb42d
commit 9be9d8a4b8
8 changed files with 84 additions and 12 deletions

View File

@ -25,9 +25,9 @@ object MainForm: TMainForm
Height = 532 Height = 532
Top = 48 Top = 48
Width = 780 Width = 780
ActivePage = TabEvents ActivePage = TabSettings
Align = alClient Align = alClient
TabIndex = 0 TabIndex = 4
TabOrder = 0 TabOrder = 0
object TabEvents: TTabSheet object TabEvents: TTabSheet
Caption = 'Events' Caption = 'Events'
@ -485,6 +485,30 @@ object MainForm: TMainForm
OnChange = Cb3DChange OnChange = Cb3DChange
TabOrder = 4 TabOrder = 4
end end
object LblAddressBuilder: TLabel
Left = 16
Height = 15
Top = 149
Width = 82
Caption = 'Address builder'
ParentColor = False
end
object CbAddressBuilder: TComboBox
Left = 112
Height = 23
Top = 144
Width = 172
ItemHeight = 15
Items.Strings = (
'(default)'
'@ZIP @CITY'
'@CITY, @STATE @ZIP'
'@CITY @ZIP'
)
OnChange = CbAddressBuilderChange
Style = csDropDownList
TabOrder = 5
end
end end
end end
object HeaderPanel: TPanel object HeaderPanel: TPanel
@ -626,7 +650,7 @@ object MainForm: TMainForm
end end
object VpControlLink1: TVpControlLink object VpControlLink1: TVpControlLink
DataStore = VpBufDSDataStore1 DataStore = VpBufDSDataStore1
LocalizationFile = '../../source\vplocalize.xml' LocalizationFile = '../../source/vplocalize.xml'
Printer.BottomMargin = 0 Printer.BottomMargin = 0
Printer.DayStart = h_08 Printer.DayStart = h_08
Printer.DayEnd = h_05 Printer.DayEnd = h_05

View File

@ -17,6 +17,7 @@ TMAINFORM.LBLTIMEFORMAT.CAPTION=Time format
TMAINFORM.LBLFIRSTDAYOFWEEK.CAPTION=First day of week TMAINFORM.LBLFIRSTDAYOFWEEK.CAPTION=First day of week
TMAINFORM.CBALLOWINPLACEEDITING.CAPTION=Allow inplace editing TMAINFORM.CBALLOWINPLACEEDITING.CAPTION=Allow inplace editing
TMAINFORM.CB3D.CAPTION=3d display mode TMAINFORM.CB3D.CAPTION=3d display mode
TMAINFORM.LBLADDRESSBUILDER.CAPTION=Address builder
TMAINFORM.TITLELBL.CAPTION=TitleLbl TMAINFORM.TITLELBL.CAPTION=TitleLbl
TMAINFORM.MENUITEM1.CAPTION=File TMAINFORM.MENUITEM1.CAPTION=File
TMAINFORM.MNUQUIT.CAPTION=Quit TMAINFORM.MNUQUIT.CAPTION=Quit

View File

@ -24,8 +24,10 @@ type
CbFirstDayOfWeek: TComboBox; CbFirstDayOfWeek: TComboBox;
CbAllowInplaceEditing: TCheckBox; CbAllowInplaceEditing: TCheckBox;
Cb3D: TCheckBox; Cb3D: TCheckBox;
CbAddressBuilder: TComboBox;
Img: TImage; Img: TImage;
ImageList1: TImageList; ImageList1: TImageList;
LblAddressBuilder: TLabel;
LblFirstDayOfWeek: TLabel; LblFirstDayOfWeek: TLabel;
LblTimeFormat: TLabel; LblTimeFormat: TLabel;
LblGranularity: TLabel; LblGranularity: TLabel;
@ -71,6 +73,7 @@ type
procedure BtnNewResClick(Sender: TObject); procedure BtnNewResClick(Sender: TObject);
procedure BtnEditResClick(Sender: TObject); procedure BtnEditResClick(Sender: TObject);
procedure Cb3DChange(Sender: TObject); procedure Cb3DChange(Sender: TObject);
procedure CbAddressBuilderChange(Sender: TObject);
procedure CbAllowInplaceEditingChange(Sender: TObject); procedure CbAllowInplaceEditingChange(Sender: TObject);
procedure CbFirstDayOfWeekChange(Sender: TObject); procedure CbFirstDayOfWeekChange(Sender: TObject);
procedure CbGranularityChange(Sender: TObject); procedure CbGranularityChange(Sender: TObject);
@ -252,6 +255,14 @@ begin
VpMonthView1.DrawingStyle := ds; VpMonthView1.DrawingStyle := ds;
end; end;
procedure TMainForm.CbAddressBuilderChange(Sender: TObject);
begin
if CbAddressBuilder.ItemIndex <= 0 then
VpControlLink1.CityStateZipFormat := ''
else
VpControlLink1.CityStateZipFormat := CbAddressBuilder.Items[CbAddressBuilder.ItemIndex];
end;
procedure TMainForm.CbAllowInplaceEditingChange(Sender: TObject); procedure TMainForm.CbAllowInplaceEditingChange(Sender: TObject);
begin begin
VpContactGrid1.AllowInplaceEditing := CbAllowInplaceEditing.Checked; VpContactGrid1.AllowInplaceEditing := CbAllowInplaceEditing.Checked;

View File

@ -157,6 +157,10 @@ msgstr "Editieren an Ort und Stelle erlauben"
msgid "30 Min" msgid "30 Min"
msgstr "30 Min" msgstr "30 Min"
#: tmainform.lbladdressbuilder.caption
msgid "Address builder"
msgstr ""
#: tmainform.lblfirstdayofweek.caption #: tmainform.lblfirstdayofweek.caption
msgid "First day of week" msgid "First day of week"
msgstr "Die Woche beginnt am" msgstr "Die Woche beginnt am"

View File

@ -146,6 +146,10 @@ msgstr ""
msgid "30 Min" msgid "30 Min"
msgstr "" msgstr ""
#: tmainform.lbladdressbuilder.caption
msgid "Address builder"
msgstr ""
#: tmainform.lblfirstdayofweek.caption #: tmainform.lblfirstdayofweek.caption
msgid "First day of week" msgid "First day of week"
msgstr "" msgstr ""

View File

@ -358,11 +358,13 @@ type
FLocalization : TVpLocalization; FLocalization : TVpLocalization;
FLocalizationFile : string; FLocalizationFile : string;
FDefaultCountry : string; FDefaultCountry : string;
FCityStateZipFormat: String;
protected{private} protected{private}
DependentList: TList; DependentList: TList;
procedure Attach (Sender : TComponent); procedure Attach (Sender : TComponent);
procedure Detach (Sender : TComponent); procedure Detach (Sender : TComponent);
procedure ReleaseDependents; procedure ReleaseDependents;
procedure SetCityStateZipFormat(const Value: String);
procedure SetDataStore (const Value : TVpCustomDataStore); procedure SetDataStore (const Value : TVpCustomDataStore);
procedure SetDefaultCountry (const v : string); procedure SetDefaultCountry (const v : string);
procedure SetLocalizationFile (const v : string); procedure SetLocalizationFile (const v : string);
@ -378,6 +380,8 @@ type
procedure TriggerOnPageStart (Sender: TObject; PageNum: Integer; ADate: TDateTime); procedure TriggerOnPageStart (Sender: TObject; PageNum: Integer; ADate: TDateTime);
property Localization : TVpLocalization read FLocalization write FLocalization; property Localization : TVpLocalization read FLocalization write FLocalization;
published published
property CityStateZipFormat: String read FCityStateZipFormat write SetCityStateZipFormat;
// Use symbols @CITY, @STATE, @ZIP to define the order of these strings
property DataStore: TVpCustomDataStore read FDataStore write SetDataStore; property DataStore: TVpCustomDataStore read FDataStore write SetDataStore;
property DefaultCountry : string read FDefaultCountry write SetDefaultCountry; property DefaultCountry : string read FDefaultCountry write SetDefaultCountry;
property LocalizationFile : string read FLocalizationFile write SetLocalizationFile; property LocalizationFile : string read FLocalizationFile write SetLocalizationFile;
@ -1336,6 +1340,12 @@ begin
end; end;
{=====} {=====}
procedure TVpControlLink.SetCityStateZipFormat(const Value: String);
begin
if FCityStateZipFormat <> Value then
FCityStateZipFormat := Value
end;
procedure TVpControlLink.SetDataStore(const Value: TVpCustomDataStore); procedure TVpControlLink.SetDataStore(const Value: TVpCustomDataStore);
begin begin
if FDataStore <> Value then if FDataStore <> Value then

View File

@ -216,6 +216,7 @@ type
procedure LoadLanguage; procedure LoadLanguage;
procedure LinkHandler(Sender: TComponent; procedure LinkHandler(Sender: TComponent;
NotificationType: TVpNotificationType; const Value: Variant); override; NotificationType: TVpNotificationType; const Value: Variant); override;
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);
@ -518,6 +519,13 @@ begin
end; end;
{=====} {=====}
function TVpContactGrid.GetCityStateZipFormat: String;
begin
if ControlLink <> nil then
Result := ControlLink.CityStateZipFormat else
Result := '';
end;
function TVpContactGrid.GetControlType : TVpItemType; function TVpContactGrid.GetControlType : TVpItemType;
begin begin
Result := itContacts; Result := itContacts;

View File

@ -46,6 +46,7 @@ type
implementation implementation
uses uses
StrUtils,
VpCanvasUtils, VpMisc, VpSR; VpCanvasUtils, VpMisc, VpSR;
type type
@ -415,15 +416,24 @@ begin
DrawContactLine(TmpBmp, TmpCon.Address, '', WholeRect, AddrRect); DrawContactLine(TmpBmp, TmpCon.Address, '', WholeRect, AddrRect);
{ do City, State, Zip } { do City, State, Zip }
Str := TmpCon.City; str := FContactGrid.GetCityStateZipFormat;
if Str <> '' then if str = '' then
Str := Str + ', ' + TmpCon.State begin
else str := TmpCon.City;
Str := TmpCon.State; if (str <> '') and (TmpCon.State <> '') then
if Str <> '' then Str := Str + ', ' + TmpCon.State;
Str := Str + ' ' + TmpCon.Zip if (str <> '') and (TmpCon.Zip <> '') then
else Str := Str + ' ' + TmpCon.Zip;
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 }