Permalink
Browse files

Issue #8: Apply theme colors to SynMemo's on help dialog

  • Loading branch information...
ansgarbecker committed Oct 28, 2018
1 parent 4677755 commit fefcc432127862cf520919d27a632c54061253ae
Showing with 16 additions and 6 deletions.
  1. +7 −5 source/main.pas
  2. +9 −1 source/sqlhelp.pas
@@ -4148,13 +4148,11 @@ procedure TMainForm.actSynchronizeDatabaseExecute(Sender: TObject);
@see FieldeditForm.btnDatatypeHelp
}
procedure TMainform.CallSQLHelpWithKeyword( keyword: String );
var
Dialog: TfrmSQLhelp;
begin
if FActiveDbObj.Connection.ServerVersionInt >= 40100 then begin
Dialog := TfrmSQLhelp.Create(Self);
Dialog.Show;
Dialog.Keyword := keyword;
SqlHelpDialog := TfrmSQLhelp.Create(Self);
SqlHelpDialog.Show;
SqlHelpDialog.Keyword := keyword;
end else
ErrorDialog(_('SQL help not available.'), f_('HELP <keyword> requires %s or newer.', ['MySQL 4.1']));
end;
@@ -10946,6 +10944,10 @@ procedure TMainform.SetupSynEditors;
Editors.Add(FPreferencesDialog.SynMemoSQLSample);
if Assigned(FCreateDatabaseDialog) then
Editors.Add(FCreateDatabaseDialog.SynMemoCreateCode);
if SqlHelpDialog <> nil then begin
Editors.Add(SqlHelpDialog.memoDescription);
Editors.Add(SqlHelpDialog.MemoExample);
end;
if AppSettings.ReadBool(asTabsToSpaces) then
BaseEditor.Options := BaseEditor.Options + [eoTabsToSpaces]
@@ -63,6 +63,9 @@ TfrmSQLhelp = class(TFormWithSizeGrip)
property Keyword: String read FKeyword write SetKeyword;
end;
var
SqlHelpDialog: TfrmSQLhelp; // global var, so we can apply settings via SetupSynEditors
const
DEFAULT_WINDOW_CAPTION : String = 'Integrated SQL-help' ;
ICONINDEX_CATEGORY_CLOSED : Integer = 66;
@@ -89,7 +92,6 @@ procedure TfrmSQLhelp.FormCreate(Sender: TObject);
pnlLeft.Width := AppSettings.ReadInt(asSQLHelpPnlLeftWidth);
memoDescription.Height := AppSettings.ReadInt(asSQLHelpPnlRightTopHeight);
Caption := DEFAULT_WINDOW_CAPTION;
MainForm.SetupSynEditors;
FixVT(treeTopics);
TranslateComponent(Self);
@@ -266,11 +268,17 @@ procedure TfrmSQLhelp.FormDestroy(Sender: TObject);
AppSettings.WriteInt(asSQLHelpWindowHeight, Height );
AppSettings.WriteInt(asSQLHelpPnlLeftWidth, pnlLeft.Width );
AppSettings.WriteInt(asSQLHelpPnlRightTopHeight, memoDescription.Height );
SqlHelpDialog := nil;
end;
procedure TfrmSQLhelp.FormShow(Sender: TObject);
begin
// Apply themed colors in OnShow, not OnCreate, as a check with <> nil returns false otherwise
MainForm.SetupSynEditors;
// These SynMemo's don't have any (SQL) highligher, so we have to assign correct colors for basic text
memoDescription.Font.Color := GetThemeColor(clWindowText);
MemoExample.Font.Color := GetThemeColor(clWindowText);
editFilter.SetFocus;
end;

0 comments on commit fefcc43

Please sign in to comment.