mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Implement auto-uppercase feature for reserved words, functions and data types in SQL editors. Closes #337.
This commit is contained in:
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: HeidiSQL\n"
|
"Project-Id-Version: HeidiSQL\n"
|
||||||
"POT-Creation-Date: 2012-11-05 21:40\n"
|
"POT-Creation-Date: 2012-11-05 21:40\n"
|
||||||
"PO-Revision-Date: 2018-04-19 07:33+0200\n"
|
"PO-Revision-Date: 2018-09-02 13:03+0200\n"
|
||||||
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
|
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
|
||||||
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
|
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@ -15,7 +15,7 @@ msgstr ""
|
|||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Language: en\n"
|
"Language: en\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
"X-Generator: Poedit 2.0.6\n"
|
"X-Generator: Poedit 2.1.1\n"
|
||||||
|
|
||||||
#. AboutBox..Caption
|
#. AboutBox..Caption
|
||||||
#: about.dfm:5
|
#: about.dfm:5
|
||||||
@ -2705,6 +2705,9 @@ msgstr "Maximum result sets:"
|
|||||||
msgid "Enable autocompletion"
|
msgid "Enable autocompletion"
|
||||||
msgstr "Enable autocompletion"
|
msgstr "Enable autocompletion"
|
||||||
|
|
||||||
|
msgid "Auto uppercase reserved words and functions"
|
||||||
|
msgstr "Auto uppercase reserved words and functions"
|
||||||
|
|
||||||
#. optionsform..pagecontrolMain..tabSQL..chkTabsToSpaces..Caption
|
#. optionsform..pagecontrolMain..tabSQL..chkTabsToSpaces..Caption
|
||||||
#: options.dfm:427
|
#: options.dfm:427
|
||||||
msgid "Tabs to spaces"
|
msgid "Tabs to spaces"
|
||||||
|
@ -168,7 +168,7 @@ type
|
|||||||
asConnectCount, asRefusedCount, asSessionCreated, asDoUsageStatistics,
|
asConnectCount, asRefusedCount, asSessionCreated, asDoUsageStatistics,
|
||||||
asLastUsageStatisticCall, asWheelZoom, asDisplayBars, asBarColor, asMySQLBinaries, asCustomSnippetsDirectory,
|
asLastUsageStatisticCall, asWheelZoom, asDisplayBars, asBarColor, asMySQLBinaries, asCustomSnippetsDirectory,
|
||||||
asPromptSaveFileOnTabClose, asWarnUnsafeUpdates, asQueryWarningsMessage,
|
asPromptSaveFileOnTabClose, asWarnUnsafeUpdates, asQueryWarningsMessage,
|
||||||
asCompletionProposal, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow,
|
asCompletionProposal, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow, asAutoUppercase,
|
||||||
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
|
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
|
||||||
asFindDialogReplaceHistory, asMaxQueryResults, asLogErrors,
|
asFindDialogReplaceHistory, asMaxQueryResults, asLogErrors,
|
||||||
asLogUserSQL, asLogSQL, asLogInfos, asLogDebug, asFieldColorNumeric,
|
asLogUserSQL, asLogSQL, asLogInfos, asLogDebug, asFieldColorNumeric,
|
||||||
@ -3522,6 +3522,7 @@ begin
|
|||||||
InitSetting(asCompletionProposal, 'CompletionProposal', 0, True);
|
InitSetting(asCompletionProposal, 'CompletionProposal', 0, True);
|
||||||
InitSetting(asCompletionProposalWidth, 'CompletionProposalWidth', 350);
|
InitSetting(asCompletionProposalWidth, 'CompletionProposalWidth', 350);
|
||||||
InitSetting(asCompletionProposalNbLinesInWindow,'CompletionProposalNbLinesInWindow', 12);
|
InitSetting(asCompletionProposalNbLinesInWindow,'CompletionProposalNbLinesInWindow', 12);
|
||||||
|
InitSetting(asAutoUppercase, 'AutoUppercase', 0, True);
|
||||||
InitSetting(asTabsToSpaces, 'TabsToSpaces', 0, False);
|
InitSetting(asTabsToSpaces, 'TabsToSpaces', 0, False);
|
||||||
InitSetting(asFilterPanel, 'FilterPanel', 0, False);
|
InitSetting(asFilterPanel, 'FilterPanel', 0, False);
|
||||||
InitSetting(asAllowMultipleInstances, 'AllowMultipleInstances', 0, True);
|
InitSetting(asAllowMultipleInstances, 'AllowMultipleInstances', 0, True);
|
||||||
|
@ -5879,9 +5879,32 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.SynMemoQueryStatusChange(Sender: TObject; Changes:
|
procedure TMainForm.SynMemoQueryStatusChange(Sender: TObject; Changes:
|
||||||
TSynStatusChanges);
|
TSynStatusChanges);
|
||||||
|
var
|
||||||
|
Editor: TSynMemo;
|
||||||
|
Token: String;
|
||||||
|
Attri: TSynHighlighterAttributes;
|
||||||
|
OldCaretPos: TBufferCoord;
|
||||||
|
TokenTypeInt, Start: Integer;
|
||||||
begin
|
begin
|
||||||
ValidateQueryControls(Sender);
|
ValidateQueryControls(Sender);
|
||||||
UpdateLineCharPanel;
|
UpdateLineCharPanel;
|
||||||
|
|
||||||
|
// Uppercase reserved words, functions and data types
|
||||||
|
if AppSettings.ReadBool(asAutoUppercase) then begin
|
||||||
|
Editor := Sender as TSynMemo;
|
||||||
|
Editor.GetHighlighterAttriAtRowColEx(Editor.PrevWordPos, Token, TokenTypeInt, Start, Attri);
|
||||||
|
if TtkTokenKind(TokenTypeInt) in [tkDatatype, tkFunction, tkKey] then begin
|
||||||
|
Editor.OnStatusChange := nil; // Don't call StatusChange recursively
|
||||||
|
OldCaretPos := Editor.CaretXY;
|
||||||
|
Editor.UndoList.BeginBlock;
|
||||||
|
Editor.SelStart := Editor.RowColToCharIndex(Editor.PrevWordPos);
|
||||||
|
Editor.SelEnd := Editor.SelStart + Length(Token);
|
||||||
|
Editor.SelText := UpperCase(Token);
|
||||||
|
Editor.CaretXY := OldCaretPos;
|
||||||
|
Editor.UndoList.EndBlock;
|
||||||
|
Editor.OnStatusChange := SynMemoQueryStatusChange;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -568,12 +568,12 @@ object optionsform: Toptionsform
|
|||||||
end
|
end
|
||||||
object chkCompletionProposal: TCheckBox
|
object chkCompletionProposal: TCheckBox
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 90
|
Top = 89
|
||||||
Width = 693
|
Width = 363
|
||||||
Height = 17
|
Height = 17
|
||||||
Anchors = [akLeft, akTop, akRight]
|
Anchors = [akLeft, akTop, akRight]
|
||||||
Caption = 'Enable autocompletion'
|
Caption = 'Enable autocompletion'
|
||||||
TabOrder = 5
|
TabOrder = 8
|
||||||
OnClick = Modified
|
OnClick = Modified
|
||||||
end
|
end
|
||||||
object chkTabsToSpaces: TCheckBox
|
object chkTabsToSpaces: TCheckBox
|
||||||
@ -583,7 +583,7 @@ object optionsform: Toptionsform
|
|||||||
Height = 17
|
Height = 17
|
||||||
Anchors = [akLeft, akTop, akRight]
|
Anchors = [akLeft, akTop, akRight]
|
||||||
Caption = 'Tabs to spaces'
|
Caption = 'Tabs to spaces'
|
||||||
TabOrder = 6
|
TabOrder = 5
|
||||||
OnClick = Modified
|
OnClick = Modified
|
||||||
end
|
end
|
||||||
object editSQLTabWidth: TEdit
|
object editSQLTabWidth: TEdit
|
||||||
@ -607,13 +607,13 @@ object optionsform: Toptionsform
|
|||||||
object chkAskFileSave: TCheckBox
|
object chkAskFileSave: TCheckBox
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 113
|
Top = 113
|
||||||
Width = 693
|
Width = 363
|
||||||
Height = 17
|
Height = 17
|
||||||
Anchors = [akLeft, akTop, akRight]
|
Anchors = [akLeft, akTop, akRight]
|
||||||
Caption = 'Prompt to save modified files on tab close'
|
Caption = 'Prompt to save modified files on tab close'
|
||||||
Checked = True
|
Checked = True
|
||||||
State = cbChecked
|
State = cbChecked
|
||||||
TabOrder = 7
|
TabOrder = 10
|
||||||
OnClick = Modified
|
OnClick = Modified
|
||||||
end
|
end
|
||||||
object editMaxQueryResults: TEdit
|
object editMaxQueryResults: TEdit
|
||||||
@ -621,7 +621,7 @@ object optionsform: Toptionsform
|
|||||||
Top = 61
|
Top = 61
|
||||||
Width = 41
|
Width = 41
|
||||||
Height = 21
|
Height = 21
|
||||||
TabOrder = 9
|
TabOrder = 6
|
||||||
Text = '1'
|
Text = '1'
|
||||||
OnChange = Modified
|
OnChange = Modified
|
||||||
end
|
end
|
||||||
@ -633,7 +633,7 @@ object optionsform: Toptionsform
|
|||||||
Associate = editMaxQueryResults
|
Associate = editMaxQueryResults
|
||||||
Min = 1
|
Min = 1
|
||||||
Position = 1
|
Position = 1
|
||||||
TabOrder = 10
|
TabOrder = 7
|
||||||
OnChanging = anyUpDownLimitChanging
|
OnChanging = anyUpDownLimitChanging
|
||||||
end
|
end
|
||||||
object comboSQLColElement: TComboBox
|
object comboSQLColElement: TComboBox
|
||||||
@ -643,7 +643,7 @@ object optionsform: Toptionsform
|
|||||||
Height = 21
|
Height = 21
|
||||||
Style = csDropDownList
|
Style = csDropDownList
|
||||||
Anchors = [akLeft, akTop, akRight]
|
Anchors = [akLeft, akTop, akRight]
|
||||||
TabOrder = 11
|
TabOrder = 12
|
||||||
OnChange = comboSQLColElementChange
|
OnChange = comboSQLColElementChange
|
||||||
end
|
end
|
||||||
object chkSQLBold: TCheckBox
|
object chkSQLBold: TCheckBox
|
||||||
@ -652,7 +652,7 @@ object optionsform: Toptionsform
|
|||||||
Width = 130
|
Width = 130
|
||||||
Height = 17
|
Height = 17
|
||||||
Caption = 'Bold'
|
Caption = 'Bold'
|
||||||
TabOrder = 12
|
TabOrder = 13
|
||||||
OnClick = SQLFontChange
|
OnClick = SQLFontChange
|
||||||
end
|
end
|
||||||
object chkSQLItalic: TCheckBox
|
object chkSQLItalic: TCheckBox
|
||||||
@ -662,7 +662,7 @@ object optionsform: Toptionsform
|
|||||||
Height = 17
|
Height = 17
|
||||||
Anchors = [akLeft, akTop, akRight]
|
Anchors = [akLeft, akTop, akRight]
|
||||||
Caption = 'Italic'
|
Caption = 'Italic'
|
||||||
TabOrder = 13
|
TabOrder = 14
|
||||||
OnClick = SQLFontChange
|
OnClick = SQLFontChange
|
||||||
end
|
end
|
||||||
object cboxSQLColForeground: TColorBox
|
object cboxSQLColForeground: TColorBox
|
||||||
@ -672,7 +672,7 @@ object optionsform: Toptionsform
|
|||||||
Height = 22
|
Height = 22
|
||||||
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
|
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
TabOrder = 14
|
TabOrder = 15
|
||||||
OnChange = SQLFontChange
|
OnChange = SQLFontChange
|
||||||
end
|
end
|
||||||
object cboxSQLColBackground: TColorBox
|
object cboxSQLColBackground: TColorBox
|
||||||
@ -682,7 +682,7 @@ object optionsform: Toptionsform
|
|||||||
Height = 22
|
Height = 22
|
||||||
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
|
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
TabOrder = 15
|
TabOrder = 16
|
||||||
OnChange = SQLFontChange
|
OnChange = SQLFontChange
|
||||||
end
|
end
|
||||||
object SynMemoSQLSample: TSynMemo
|
object SynMemoSQLSample: TSynMemo
|
||||||
@ -690,7 +690,7 @@ object optionsform: Toptionsform
|
|||||||
Left = 8
|
Left = 8
|
||||||
Top = 215
|
Top = 215
|
||||||
Width = 693
|
Width = 693
|
||||||
Height = 132
|
Height = 131
|
||||||
Cursor = crHandPoint
|
Cursor = crHandPoint
|
||||||
SingleLineMode = False
|
SingleLineMode = False
|
||||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||||
@ -699,7 +699,7 @@ object optionsform: Toptionsform
|
|||||||
Font.Height = -13
|
Font.Height = -13
|
||||||
Font.Name = 'Courier New'
|
Font.Name = 'Courier New'
|
||||||
Font.Style = []
|
Font.Style = []
|
||||||
TabOrder = 16
|
TabOrder = 17
|
||||||
OnClick = SynMemoSQLSampleClick
|
OnClick = SynMemoSQLSampleClick
|
||||||
CodeFolding.GutterShapeSize = 11
|
CodeFolding.GutterShapeSize = 11
|
||||||
CodeFolding.CollapsedLineColor = clGrayText
|
CodeFolding.CollapsedLineColor = clGrayText
|
||||||
@ -730,10 +730,19 @@ object optionsform: Toptionsform
|
|||||||
object chkQueryWarningsMessage: TCheckBox
|
object chkQueryWarningsMessage: TCheckBox
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 136
|
Top = 136
|
||||||
Width = 691
|
Width = 363
|
||||||
Height = 17
|
Height = 17
|
||||||
Caption = 'Show query warnings dialog'
|
Caption = 'Show query warnings dialog'
|
||||||
TabOrder = 8
|
TabOrder = 11
|
||||||
|
OnClick = Modified
|
||||||
|
end
|
||||||
|
object chkAutoUppercase: TCheckBox
|
||||||
|
Left = 377
|
||||||
|
Top = 89
|
||||||
|
Width = 320
|
||||||
|
Height = 17
|
||||||
|
Caption = 'Auto uppercase reserved words and functions'
|
||||||
|
TabOrder = 9
|
||||||
OnClick = Modified
|
OnClick = Modified
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -143,6 +143,7 @@ type
|
|||||||
cboxRowHighlightSameText: TColorBox;
|
cboxRowHighlightSameText: TColorBox;
|
||||||
chkWheelZoom: TCheckBox;
|
chkWheelZoom: TCheckBox;
|
||||||
chkQueryWarningsMessage: TCheckBox;
|
chkQueryWarningsMessage: TCheckBox;
|
||||||
|
chkAutoUppercase: TCheckBox;
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure Modified(Sender: TObject);
|
procedure Modified(Sender: TObject);
|
||||||
procedure Apply(Sender: TObject);
|
procedure Apply(Sender: TObject);
|
||||||
@ -334,6 +335,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
AppSettings.WriteBool(asCompletionProposal, chkCompletionProposal.Checked);
|
AppSettings.WriteBool(asCompletionProposal, chkCompletionProposal.Checked);
|
||||||
|
AppSettings.WriteBool(asAutoUppercase, chkAutoUppercase.Checked);
|
||||||
AppSettings.WriteBool(asTabsToSpaces, chkTabsToSpaces.Checked);
|
AppSettings.WriteBool(asTabsToSpaces, chkTabsToSpaces.Checked);
|
||||||
|
|
||||||
// Shortcuts
|
// Shortcuts
|
||||||
@ -519,6 +521,7 @@ begin
|
|||||||
updownSQLFontSize.Position := SynMemoSQLSample.Font.Size;
|
updownSQLFontSize.Position := SynMemoSQLSample.Font.Size;
|
||||||
updownSQLTabWidth.Position := SynMemoSQLSample.TabWidth;
|
updownSQLTabWidth.Position := SynMemoSQLSample.TabWidth;
|
||||||
chkCompletionProposal.Checked := AppSettings.ReadBool(asCompletionProposal);
|
chkCompletionProposal.Checked := AppSettings.ReadBool(asCompletionProposal);
|
||||||
|
chkAutoUppercase.Checked := AppSettings.ReadBool(asAutoUppercase);
|
||||||
chkTabsToSpaces.Checked := AppSettings.ReadBool(asTabsToSpaces);
|
chkTabsToSpaces.Checked := AppSettings.ReadBool(asTabsToSpaces);
|
||||||
comboSQLColElementChange(Sender);
|
comboSQLColElementChange(Sender);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user