Permalink
Browse files

Support custom colors for new same-text-background feature. Closes #224.

  • Loading branch information...
ansgarbecker committed Apr 12, 2018
1 parent 604d7f3 commit 3e46092b738bb41addb0173e871f9ede56fba2f0
Showing with 32 additions and 24 deletions.
  1. +3 −3 out/locale/en/LC_MESSAGES/default.po
  2. +2 −2 source/apphelpers.pas
  3. +4 −3 source/main.pas
  4. +19 −13 source/options.dfm
  5. +4 −3 source/options.pas
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2018-04-07 17:59+0200\n"
"PO-Revision-Date: 2018-04-12 19:33+0200\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n"
@@ -5813,8 +5813,8 @@ msgstr "Connection attempts:"
msgid "Pop up SQL text over result tabs"
msgstr "Pop up SQL text over result tabs"
msgid "Hightlight fields with same text as in focused field"
msgstr "Hightlight fields with same text as in focused field"
msgid "Background for fields with same text as in focused field:"
msgstr "Background for fields with same text as in focused field:"
msgid "Default linebreak style:"
msgstr "Default linebreak style:"
@@ -130,7 +130,7 @@ TQueryThread = class(TThread)
TAppSettingDataType = (adInt, adBool, adString);
TAppSettingIndex = (asHiddenColumns, asFilter, asSort, asDisplayedColumnsSorted, asLastSessions,
asLastActiveSession, asAutoReconnect, asRestoreLastUsedDB, asLastUsedDB, asTreeBackground,
asFontName, asFontSize, asTabWidth, asDataFontName, asDataFontSize, asDataLocalNumberFormat, asHintsOnResultTabs, asHightlightSameText,
asFontName, asFontSize, asTabWidth, asDataFontName, asDataFontSize, asDataLocalNumberFormat, asHintsOnResultTabs, asHightlightSameTextBackground,
asLogsqlnum, asLogsqlwidth, asSessionLogsDirectory, asLogHorizontalScrollbar, asSQLColActiveLine,
asSQLColMatchingBraceForeground, asSQLColMatchingBraceBackground,
asMaxColWidth, asDatagridMaximumRows, asDatagridRowsPerStep, asGridRowLineCount, asReuseEditorConfiguration,
@@ -3327,7 +3327,7 @@ constructor TAppSettings.Create;
InitSetting(asDataFontSize, 'DataFontSize', 8);
InitSetting(asDataLocalNumberFormat, 'DataLocalNumberFormat', 0, True);
InitSetting(asHintsOnResultTabs, 'HintsOnResultTabs', 0, True);
InitSetting(asHightlightSameText, 'HightlightSameText', 0, True);
InitSetting(asHightlightSameTextBackground, 'HightlightSameTextBackground', $00DDDDDD);
InitSetting(asLogsqlnum, 'logsqlnum', 300);
InitSetting(asLogsqlwidth, 'logsqlwidth', 2000);
InitSetting(asSessionLogsDirectory, 'SessionLogsDirectory', 0, False, DirnameUserAppData + 'Sessionlogs\');
@@ -9147,7 +9147,7 @@ procedure TMainForm.AnyGridBeforeCellPaint(Sender: TBaseVirtualTree;
var
VT: TVirtualStringTree;
r: TDBQuery;
cl, clNull, clEven, clOdd: TColor;
cl, clNull, clEven, clOdd, clSameData: TColor;
RowNumber: PInt64;
isEven: Boolean;
FieldText, FocusedFieldText: String;
@@ -9190,11 +9190,12 @@ procedure TMainForm.AnyGridBeforeCellPaint(Sender: TBaseVirtualTree;
end;
if (Sender.FocusedNode <> nil) and (Node <> Sender.FocusedNode) and (Column = Sender.FocusedColumn) then begin
if AppSettings.ReadBool(asHightlightSameText) then begin
clSameData := AppSettings.ReadInt(asHightlightSameTextBackground);
if clSameData <> clNone then begin
FieldText := r.Col(Column);
FocusedFieldText := VT.Text[Sender.FocusedNode, Sender.FocusedColumn];
if CompareText(FieldText, FocusedFieldText) = 0 then begin
TargetCanvas.Brush.Color := $00DDDDDD; //clInfoBk;
TargetCanvas.Brush.Color := clSameData; //clInfoBk;
TargetCanvas.FillRect(CellRect);
end;
end;
@@ -774,6 +774,13 @@ object optionsform: Toptionsform
Height = 13
Caption = 'Alternating row background:'
end
object Label3: TLabel
Left = 8
Top = 196
Width = 268
Height = 13
Caption = 'Background for fields with same text as in focused field:'
end
object editMaxColWidth: TEdit
Left = 430
Top = 8
@@ -924,34 +931,33 @@ object optionsform: Toptionsform
end
object chkLocalNumberFormat: TCheckBox
Left = 8
Top = 193
Top = 223
Width = 693
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Local number format'
TabOrder = 14
TabOrder = 15
OnClick = Modified
end
object chkHintsOnResultTabs: TCheckBox
Left = 8
Top = 216
Top = 246
Width = 693
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Pop up SQL text over result tabs'
TabOrder = 15
OnClick = Modified
end
object chkHightlightSameText: TCheckBox
Left = 8
Top = 239
Width = 691
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Hightlight fields with same text as in focused field'
TabOrder = 16
OnClick = Modified
end
object cboxRowHighlightSameText: TColorBox
Left = 430
Top = 193
Width = 133
Height = 22
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone, cbCustomColor, cbPrettyNames]
Anchors = [akTop, akRight]
TabOrder = 14
end
end
object tabDataEditors: TTabSheet
Caption = 'Data editors'
@@ -139,7 +139,8 @@ Toptionsform = class(TForm)
editQueryHistoryKeepDays: TEdit;
updownQueryHistoryKeepDays: TUpDown;
lblQueryHistoryKeepDays: TLabel;
chkHightlightSameText: TCheckBox;
Label3: TLabel;
cboxRowHighlightSameText: TColorBox;
procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject);
procedure Apply(Sender: TObject);
@@ -310,9 +311,9 @@ procedure Toptionsform.Apply(Sender: TObject);
AppSettings.WriteInt(asFieldNullBackground, cboxNullBackground.Selected);
AppSettings.WriteInt(asRowBackgroundEven, cboxRowBackgroundEven.Selected);
AppSettings.WriteInt(asRowBackgroundOdd, cboxRowBackgroundOdd.Selected);
AppSettings.WriteInt(asHightlightSameTextBackground, cboxRowHighlightSameText.Selected);
AppSettings.WriteBool(asDataLocalNumberFormat, chkLocalNumberFormat.Checked);
AppSettings.WriteBool(asHintsOnResultTabs, chkHintsOnResultTabs.Checked);
AppSettings.WriteBool(asHightlightSameText, chkHightlightSameText.Checked);
// Editor Configuration
AppSettings.WriteBool(asFieldEditorBinary, chkEditorBinary.Checked);
@@ -533,9 +534,9 @@ procedure Toptionsform.FormShow(Sender: TObject);
cboxNullBackground.Selected := AppSettings.ReadInt(asFieldNullBackground);
cboxRowBackgroundEven.Selected := AppSettings.ReadInt(asRowBackgroundEven);
cboxRowBackgroundOdd.Selected := AppSettings.ReadInt(asRowBackgroundOdd);
cboxRowHighlightSameText.Selected := AppSettings.ReadInt(asHightlightSameTextBackground);
chkLocalNumberFormat.Checked := AppSettings.ReadBool(asDataLocalNumberFormat);
chkHintsOnResultTabs.Checked := AppSettings.ReadBool(asHintsOnResultTabs);
chkHightlightSameText.Checked := AppSettings.ReadBool(asHightlightSameText);
// Editor Configuration
chkEditorBinary.Checked := AppSettings.ReadBool(asFieldEditorBinary);

0 comments on commit 3e46092

Please sign in to comment.