fpspreadsheet: Modify the define which deactivates multi-selection in the grid (old way not working for old Laz 1.3)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4020 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-03-13 14:33:55 +00:00
parent 380ac8247c
commit 6a56fc20c9
4 changed files with 16 additions and 91 deletions

View File

@ -36,4 +36,9 @@
FPS_LAZUTF8. Keep undefined for the current Lazarus version. }
{.$DEFINE FPS_LAZUTF8}
{ In order to allow selection of multiple ranges in the WorksheetGrid a
sufficiently new version of the basic TCustomGrid is required. The required
property "RangeSelect" was introduced in Lazarus 1.4. In order to compile
the package with older versions activate the define FPS_NO_GRID_MULTISELECT }
{.$DEFINE FPS_NO_GRID_MULTISELECT}

View File

@ -15,7 +15,6 @@ interface
uses
Classes, SysUtils;
{$IFDEF FPS_VARISBOOL}
{ Needed only if FPC version is < 2.6.4 }
function VarIsBool(const V: Variant): Boolean;
@ -1710,6 +1709,7 @@ end;
{$ENDIF}
{$IFDEF FPS_FORMATDATETIME}
{******************************************************************************}
{******************************************************************************}
@ -1717,13 +1717,13 @@ end;
{******************************************************************************}
{******************************************************************************}
{@@
{@@ ----------------------------------------------------------------------------
Applies a formatting string to a date/time value and converts the number
to a date/time string.
This functionality is available in the SysUtils unit. But it is duplicated
here to add a patch which is not available in stable fpc.
}
-------------------------------------------------------------------------------}
procedure DateTimeToString(out Result: string; const FormatStr: string; const DateTime: TDateTime;
const FormatSettings: TFormatSettings; Options : TFormatDateTimeOptions = []);
// Copied from "fpc/rtl/objpas/sysutils/datei.inc"
@ -1731,44 +1731,7 @@ var
ResultLen: integer;
ResultBuffer: array[0..255] of char;
ResultCurrent: pchar;
(* ---- not needed here ---
{$IFDEF MSWindows}
isEnable_E_Format : Boolean;
isEnable_G_Format : Boolean;
eastasiainited : boolean;
procedure InitEastAsia;
var ALCID : LCID;
PriLangID , SubLangID : Word;
begin
ALCID := GetThreadLocale;
PriLangID := ALCID and $3FF;
if (PriLangID>0) then
SubLangID := (ALCID and $FFFF) shr 10
else
begin
PriLangID := SysLocale.PriLangID;
SubLangID := SysLocale.SubLangID;
end;
isEnable_E_Format := (PriLangID = LANG_JAPANESE)
or
(PriLangID = LANG_KOREAN)
or
((PriLangID = LANG_CHINESE)
and
(SubLangID = SUBLANG_CHINESE_TRADITIONAL)
);
isEnable_G_Format := (PriLangID = LANG_JAPANESE)
or
((PriLangID = LANG_CHINESE)
and
(SubLangID = SUBLANG_CHINESE_TRADITIONAL)
);
eastasiainited :=true;
end;
{$ENDIF MSWindows}
*)
procedure StoreStr(Str: PChar; Len: Integer);
begin
if ResultLen + Len < SizeOf(ResultBuffer) then
@ -2000,38 +1963,6 @@ var
StoreString(' ');
StoreFormat(FormatSettings.LongTimeFormat, Nesting+1, True);
end;
(* ------------ not needed here...
{$IFDEF MSWindows}
'E':
begin
if not Eastasiainited then InitEastAsia;
if Not(isEnable_E_Format) then StoreStr(@FormatCurrent^, 1)
else
begin
while (P < FormatEnd) and (UpCase(P^) = Token) do
P := P + 1;
Count := P - FormatCurrent;
StoreString(ConvertEraYearString(Count,Year,Month,Day));
end;
prevlasttoken := lastformattoken;
lastformattoken:=token;
end;
'G':
begin
if not Eastasiainited then InitEastAsia;
if Not(isEnable_G_Format) then StoreStr(@FormatCurrent^, 1)
else
begin
while (P < FormatEnd) and (UpCase(P^) = Token) do
P := P + 1;
Count := P - FormatCurrent;
StoreString(ConvertEraString(Count,Year,Month,Day));
end;
prevlasttoken := lastformattoken;
lastformattoken:=token;
end;
{$ENDIF MSWindows}
*)
end;
prevlasttoken := lastformattoken;
lastformattoken := token;
@ -2043,11 +1974,7 @@ var
end;
end;
begin (*
{$ifdef MSWindows}
eastasiainited:=false;
{$endif MSWindows}
*)
begin
DecodeDateFully(DateTime, Year, Month, Day, DayOfWeek);
DecodeTime(DateTime, Hour, Minute, Second, MilliSecond);
ResultLen := 0;
@ -2100,6 +2027,5 @@ begin
end;
{$ENDIF}
end.

View File

@ -13,6 +13,7 @@ LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus
unit fpspreadsheetgrid;
{$mode objfpc}{$H+}
{$I fps.inc}
{ To do:
- When Lazarus 1.4 comes out remove the workaround for the RGB2HLS bug in
@ -28,13 +29,6 @@ uses
LCLVersion,
fpstypes, fpspreadsheet, fpspreadsheetctrls;
const
{$IF (lcl_fullversion >= 1030000)}
ENABLE_MULTI_SELECT = 1; // requires Laz 1.4+ or trunk after r46767
{$ELSE}
ENABLE_MULTI_SELECT = 0;
{$ENDIF}
type
{ TsCustomWorksheetGrid }
@ -356,7 +350,7 @@ type
read GetWordwraps write SetWordwraps;
// inherited
{$IF (ENABLE_MULTI_SELECT = 1)}
{$IFNDEF FPS_NO_GRID_MULTISELECT}
{@@ Allow multiple selections}
property RangeSelectMode default rsmMulti;
{$ENDIF}
@ -864,7 +858,7 @@ begin
FHyperlinkTimer.Interval := HYPERLINK_TIMER_INTERVAL;
FHyperlinkTimer.OnTimer := @HyperlinkTimerElapsed;
FOwnsWorkbook := true;
{$IF (ENABLE_MULTI_SELECT=1)}
{$IFNDEF FPS_NO_GRID_MULTISELECT}
RangeSelectMode := rsmMulti;
{$ENDIF}
end;
@ -3523,13 +3517,13 @@ end;
procedure TsCustomWorksheetGrid.MoveSelection;
var
sel: TsCellRangeArray;
{$IF (ENABLE_MULTI_SELECT=1)}
{$IFNDEF FPS_NO_GRID_MULTISELECT}
i: Integer;
{$ENDIF}
begin
if Worksheet <> nil then
begin
{$IF (ENABLE_MULTI_SELECT=1)}
{$IFNDEF FPS_NO_GRID_MULTISELECT}
if HasMultiSelection then
begin
SetLength(sel, SelectedRangeCount);

View File

@ -18,7 +18,7 @@
</Parsing>
<Other>
<CompilerMessages>
<IgnoredMessages idx5028="True" idx4055="True"/>
<IgnoredMessages idx5028="True" idx4055="True" idx2005="True"/>
</CompilerMessages>
<CustomOptions Value="$(IDEBuildOptions)"/>
</Other>
@ -151,7 +151,7 @@ This package is all you need if you don't want graphical components (like grids
</Item30>
<Item31>
<Filename Value="fpsreaderwriter.pas"/>
<UnitName Value="fpsreaderwriter"/>
<UnitName Value="fpsReaderWriter"/>
</Item31>
<Item32>
<Filename Value="fpsnumformat.pas"/>