mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 03:01:07 +08:00
Implement a more effective solution for hiding and unhiding columns in ListColumns.
Pros: - ShowDBProperties doesn't reset column layout - Sort direction is remembered automatically - Reading columnlist from registry is done once in a TMDIChild, not on each ShowDBProperties - Hiding/unhiding columns doesn't call ShowDBProperties - No more hassling with what is called a "default column" or not. popupDBGrid is usable like in Windows Explorer. - Column layout is stored global, not per session. Cons: - Column layout from old settings logic needed to be discarded Side effect: - Fixes a potential AV in FormatNumber(str) with empty strings. - Created an overloaded FormatByteNumber() which can take a string as input
This commit is contained in:
@ -81,7 +81,8 @@ type
|
||||
function GetFieldValue( Field: TField ): String;
|
||||
function LastPos( substr: WideString; str: WideString): Integer;
|
||||
function ConvertServerVersion( Version: Integer ): String;
|
||||
function FormatByteNumber( Bytes: Int64; Decimals: Byte = 1 ): String;
|
||||
function FormatByteNumber( Bytes: Int64; Decimals: Byte = 1 ): String; Overload;
|
||||
function FormatByteNumber( Bytes: String; Decimals: Byte = 1 ): String; Overload;
|
||||
function FormatTimeNumber( Seconds: Cardinal ): String;
|
||||
function TColorToHex( Color : TColor ): string;
|
||||
function GetVTCaptions( VT: TVirtualStringTree; OnlySelected: Boolean = False; Column: Integer = 0 ): TStringList;
|
||||
@ -1587,7 +1588,10 @@ end;
|
||||
}
|
||||
function FormatNumber( str: String ): String; Overload;
|
||||
begin
|
||||
result := FormatNumber( StrToFloat( str ) );
|
||||
if str <> '' then
|
||||
result := FormatNumber( StrToFloat( str ) )
|
||||
else
|
||||
result := FormatNumber( 0 );
|
||||
end;
|
||||
|
||||
|
||||
@ -1950,7 +1954,7 @@ end;
|
||||
@param Int64 Number of Bytes
|
||||
@param Byte Decimals to display when bytes is bigger than 1M
|
||||
}
|
||||
function FormatByteNumber( Bytes: Int64; Decimals: Byte = 1 ): String;
|
||||
function FormatByteNumber( Bytes: Int64; Decimals: Byte = 1 ): String; Overload;
|
||||
const
|
||||
KB = 1024;
|
||||
begin
|
||||
@ -1965,6 +1969,16 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
{**
|
||||
An overloaded function of the previous one which can
|
||||
take a string as input
|
||||
}
|
||||
function FormatByteNumber( Bytes: String; Decimals: Byte = 1 ): String; Overload;
|
||||
begin
|
||||
Result := FormatByteNumber( MakeInt(Bytes), Decimals );
|
||||
end;
|
||||
|
||||
|
||||
{**
|
||||
Format a number of seconds to a human readable time format
|
||||
@param Cardinal Number of seconds
|
||||
|
Reference in New Issue
Block a user