mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Use helper methods where possible, and leave GUI stuff in form units.
This commit is contained in:
@ -290,6 +290,8 @@ const
|
|||||||
MSG_COPYMAXSIZE = 'Copying data is limited to %s but more data is available. '
|
MSG_COPYMAXSIZE = 'Copying data is limited to %s but more data is available. '
|
||||||
+ 'Only %s out of %s rows were copied.' + CRLF + CRLF
|
+ 'Only %s out of %s rows were copied.' + CRLF + CRLF
|
||||||
+ 'Increase the value in Tools > Preferences > Export if you need more.';
|
+ 'Increase the value in Tools > Preferences > Export if you need more.';
|
||||||
|
SContainsNulCharFile = 'This file contains NUL characters. They have been converted to ASCII spaces (SP).';
|
||||||
|
SContainsNulCharGrid = 'This cell contains NUL characters. They have been converted to ASCII spaces (SP). Press ESC to cancel editing.';
|
||||||
|
|
||||||
DBO_NAME = 'Name';
|
DBO_NAME = 'Name';
|
||||||
DBO_TYPE = 'Type';
|
DBO_TYPE = 'Type';
|
||||||
|
@ -6,7 +6,7 @@ interface
|
|||||||
|
|
||||||
uses Windows, Forms, Graphics, messages, VirtualTrees, texteditor, bineditor, ComCtrls, SysUtils, Classes,
|
uses Windows, Forms, Graphics, messages, VirtualTrees, texteditor, bineditor, ComCtrls, SysUtils, Classes,
|
||||||
mysql_structures, Main, helpers, TntStdCtrls, WideStrings, StdCtrls, ExtCtrls, TntCheckLst,
|
mysql_structures, Main, helpers, TntStdCtrls, WideStrings, StdCtrls, ExtCtrls, TntCheckLst,
|
||||||
Buttons, Controls, Types, PngSpeedButton;
|
Buttons, Controls, Types, PngSpeedButton, Dialogs;
|
||||||
|
|
||||||
type
|
type
|
||||||
TMemoEditorLink = class(TInterfacedObject, IVTEditLink)
|
TMemoEditorLink = class(TInterfacedObject, IVTEditLink)
|
||||||
@ -874,7 +874,10 @@ begin
|
|||||||
FColumn := Column;
|
FColumn := Column;
|
||||||
|
|
||||||
FTree.GetTextInfo(Node, Column, FEdit.Font, FTextBounds, NodeText);
|
FTree.GetTextInfo(Node, Column, FEdit.Font, FTextBounds, NodeText);
|
||||||
CheckAndWarnIfNulChar(NodeText);
|
if ScanNulChar(NodeText) then begin
|
||||||
|
MessageDlg(SContainsNulCharGrid, mtInformation, [mbOK], 0);
|
||||||
|
NodeText := RemoveNulChars(NodeText);
|
||||||
|
end;
|
||||||
FPanel.Parent := FTree;
|
FPanel.Parent := FTree;
|
||||||
FEdit.Font.Color := clWindowText;
|
FEdit.Font.Color := clWindowText;
|
||||||
FEdit.Text := NodeText;
|
FEdit.Text := NodeText;
|
||||||
|
@ -189,7 +189,6 @@ type
|
|||||||
function CompareNumbers(List: TStringList; Index1, Index2: Integer): Integer;
|
function CompareNumbers(List: TStringList; Index1, Index2: Integer): Integer;
|
||||||
function ListIndexByRegExpr(List: TWideStrings; Expression: WideString): Integer;
|
function ListIndexByRegExpr(List: TWideStrings; Expression: WideString): Integer;
|
||||||
procedure RestoreSyneditStyles(Highlighter: TSynCustomHighlighter);
|
procedure RestoreSyneditStyles(Highlighter: TSynCustomHighlighter);
|
||||||
procedure CheckAndWarnIfNulChar(var Text: WideString);
|
|
||||||
var
|
var
|
||||||
MYSQL_KEYWORDS : TStringList;
|
MYSQL_KEYWORDS : TStringList;
|
||||||
MainReg : TRegistry;
|
MainReg : TRegistry;
|
||||||
@ -2973,16 +2972,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure CheckAndWarnIfNulChar(var Text: WideString);
|
|
||||||
begin
|
|
||||||
// Used by grid cell editors which use some TCustomEdit descendent which all cut a text at a NUL char
|
|
||||||
if Pos(#0, Text) > 0 then begin
|
|
||||||
MessageDlg('Text contains at least one NUL (\0) char. To avoid cutting off the rest they were just removed.', mtWarning, [mbOK], 0);
|
|
||||||
Text := WideStringReplace(Text, #0, '', [rfReplaceAll]);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|
||||||
|
|
||||||
|
@ -5479,7 +5479,7 @@ begin
|
|||||||
|
|
||||||
if ScanNulChar(filecontent) then begin
|
if ScanNulChar(filecontent) then begin
|
||||||
filecontent := RemoveNulChars(filecontent);
|
filecontent := RemoveNulChars(filecontent);
|
||||||
MessageDlg('This file contains NUL characters. They have been converted to ASCII spaces (SP).', mtInformation, [mbOK], 0);
|
MessageDlg(SContainsNulCharFile, mtInformation, [mbOK], 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
SynMemoQuery.BeginUpdate;
|
SynMemoQuery.BeginUpdate;
|
||||||
|
@ -102,7 +102,10 @@ begin
|
|||||||
if LB <> '' then
|
if LB <> '' then
|
||||||
text := WideStringReplace(text, LB, CRLF, [rfReplaceAll]);
|
text := WideStringReplace(text, LB, CRLF, [rfReplaceAll]);
|
||||||
|
|
||||||
CheckAndWarnIfNulChar(text);
|
if ScanNulChar(text) then begin
|
||||||
|
MessageDlg(SContainsNulCharGrid, mtInformation, [mbOK], 0);
|
||||||
|
text := RemoveNulChars(text);
|
||||||
|
end;
|
||||||
|
|
||||||
// TODO: Find out why the Delphi IDE insists hinting that this
|
// TODO: Find out why the Delphi IDE insists hinting that this
|
||||||
// property is ANSI when it is in fact a WideString.
|
// property is ANSI when it is in fact a WideString.
|
||||||
|
Reference in New Issue
Block a user