From 601edef3054fdaa30a46f149bd32f242e6e1ed54 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Wed, 24 Feb 2010 22:53:45 +0000 Subject: [PATCH] Realign most controls on SQL help dialog, sanitize them from weird paddings and margins. Remove statusbar which was just there to display the size grip in the lower right corner. --- source/sqlhelp.dfm | 311 ++++++++++++++++++++------------------------- source/sqlhelp.pas | 50 +++----- 2 files changed, 160 insertions(+), 201 deletions(-) diff --git a/source/sqlhelp.dfm b/source/sqlhelp.dfm index dd0f9015..06b690e5 100644 --- a/source/sqlhelp.dfm +++ b/source/sqlhelp.dfm @@ -16,102 +16,133 @@ object frmSQLhelp: TfrmSQLhelp OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 - object Splitter1: TSplitter - Left = 153 - Top = 0 - Width = 8 - Height = 336 - Cursor = crSizeWE - ResizeStyle = rsUpdate - end - object pnlLeft: TPanel - Left = 0 - Top = 0 - Width = 153 - Height = 336 - Align = alLeft - BevelOuter = bvNone + object btnSearchOnline: TButton + Left = 363 + Top = 322 + Width = 103 + Height = 25 + Anchors = [akRight, akBottom] + Caption = 'Search online' + ImageIndex = 69 + Images = MainForm.ImageListMain TabOrder = 0 - object treeTopics: TTreeView - AlignWithMargins = True - Left = 3 - Top = 27 - Width = 147 - Height = 309 - Margins.Bottom = 0 - Align = alClient - ChangeDelay = 50 - Images = MainForm.ImageListMain - Indent = 19 - ReadOnly = True - ShowLines = False - TabOrder = 1 - OnChange = treeTopicsChange - OnExpanding = treeTopicsExpanding - end - object editFilter: TButtonedEdit - AlignWithMargins = True - Left = 3 - Top = 3 - Width = 147 - Height = 21 - Margins.Bottom = 0 - Align = alTop - Images = MainForm.ImageListMain - LeftButton.Hint = 'Search' - LeftButton.ImageIndex = 53 - LeftButton.Visible = True - TabOrder = 0 - OnChange = editFilterChange - end + OnClick = ButtonOnlinehelpClick end - object StatusBar1: TStatusBar - Left = 0 - Top = 336 - Width = 582 - Height = 19 - Panels = <> + object ButtonClose: TButton + Left = 472 + Top = 322 + Width = 102 + Height = 25 + Anchors = [akRight, akBottom] + Cancel = True + Caption = 'Close' + Default = True + ModalResult = 1 + TabOrder = 1 + OnClick = ButtonCloseClick end - object pnlRight: TPanel - Left = 161 - Top = 0 - Width = 421 - Height = 336 + object pnlMain: TPanel + AlignWithMargins = True + Left = 8 + Top = 8 + Width = 566 + Height = 307 + Margins.Left = 8 + Margins.Top = 8 + Margins.Right = 8 + Margins.Bottom = 40 Align = alClient BevelOuter = bvNone - Padding.Top = 3 - Padding.Right = 3 - Padding.Bottom = 3 TabOrder = 2 - object Splitter2: TSplitter - Left = 0 - Top = 171 - Width = 418 - Height = 8 - Cursor = crSizeNS - Align = alTop + object Splitter1: TSplitter + Left = 153 + Top = 0 + Width = 8 + Height = 307 + Cursor = crSizeWE ResizeStyle = rsUpdate end - object pnlRightTop: TPanel + object pnlLeft: TPanel Left = 0 - Top = 3 - Width = 418 - Height = 168 - Align = alTop - Anchors = [akLeft, akTop, akRight, akBottom] + Top = 0 + Width = 153 + Height = 307 + Align = alLeft BevelOuter = bvNone TabOrder = 0 - object lblKeyword: TLabel + object treeTopics: TTreeView AlignWithMargins = True Left = 0 - Top = 5 - Width = 418 - Height = 16 + Top = 24 + Width = 153 + Height = 283 + Margins.Left = 0 + Margins.Right = 0 + Margins.Bottom = 0 + Align = alClient + ChangeDelay = 50 + Images = MainForm.ImageListMain + Indent = 19 + ReadOnly = True + ShowLines = False + TabOrder = 1 + OnChange = treeTopicsChange + OnExpanding = treeTopicsExpanding + end + object editFilter: TButtonedEdit + AlignWithMargins = True + Left = 0 + Top = 0 + Width = 153 + Height = 21 + Margins.Left = 0 + Margins.Top = 0 + Margins.Right = 0 + Margins.Bottom = 0 + Align = alTop + Images = MainForm.ImageListMain + LeftButton.Hint = 'Search' + LeftButton.ImageIndex = 53 + LeftButton.Visible = True + TabOrder = 0 + OnChange = editFilterChange + end + end + object pnlRight: TPanel + Left = 161 + Top = 0 + Width = 405 + Height = 307 + Align = alClient + BevelOuter = bvNone + TabOrder = 1 + object Splitter2: TSplitter + Left = 0 + Top = 182 + Width = 405 + Height = 8 + Cursor = crSizeNS + Align = alTop + ResizeStyle = rsUpdate + end + object lblDescription: TLabel + Left = 0 + Top = 16 + Width = 405 + Height = 13 Margins.Left = 0 Margins.Top = 5 Margins.Right = 0 Margins.Bottom = 0 Align = alTop + Caption = 'Description:' + end + object lblKeyword: TLabel + Left = 0 + Top = 0 + Width = 405 + Height = 16 + Align = alTop Caption = 'lblKeyword' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -120,68 +151,10 @@ object frmSQLhelp: TfrmSQLhelp Font.Style = [fsBold] ParentFont = False end - object lblDescription: TLabel - AlignWithMargins = True - Left = 0 - Top = 26 - Width = 418 - Height = 13 - Margins.Left = 0 - Margins.Top = 5 - Margins.Right = 0 - Margins.Bottom = 0 - Align = alTop - Caption = 'Description:' - end - object memoDescription: TSynMemo - AlignWithMargins = True - Left = 0 - Top = 44 - Width = 418 - Height = 124 - Margins.Left = 0 - Margins.Top = 5 - Margins.Right = 0 - Margins.Bottom = 0 - SingleLineMode = False - Align = alClient - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -13 - Font.Name = 'Courier New' - Font.Style = [] - TabOrder = 0 - OnKeyDown = memosKeyDown - Gutter.Font.Charset = DEFAULT_CHARSET - Gutter.Font.Color = clWindowText - Gutter.Font.Height = -11 - Gutter.Font.Name = 'Courier New' - Gutter.Font.Style = [] - Gutter.Visible = False - Gutter.Width = 0 - Highlighter = URIHighlighter - Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoTabsToSpaces] - ReadOnly = True - RightEdge = 0 - WordWrap = True - end - end - object pnlRightBottom: TPanel - Left = 0 - Top = 179 - Width = 418 - Height = 154 - Align = alClient - BevelOuter = bvNone - TabOrder = 1 - DesignSize = ( - 418 - 154) object lblExample: TLabel - AlignWithMargins = True Left = 0 - Top = 5 - Width = 418 + Top = 190 + Width = 405 Height = 13 Margins.Left = 0 Margins.Top = 5 @@ -190,31 +163,13 @@ object frmSQLhelp: TfrmSQLhelp Align = alTop Caption = 'Example:' end - object btnSearchOnline: TButton - Left = 207 - Top = 128 - Width = 103 - Height = 25 - Anchors = [akRight, akBottom] - Caption = 'Search online' - ImageIndex = 69 - Images = MainForm.ImageListMain - TabOrder = 2 - OnClick = ButtonOnlinehelpClick - end - object MemoExample: TSynMemo - AlignWithMargins = True + object memoDescription: TSynMemo Left = 0 - Top = 23 - Width = 418 - Height = 90 - Margins.Left = 0 - Margins.Top = 5 - Margins.Right = 0 - Margins.Bottom = 0 + Top = 29 + Width = 405 + Height = 153 SingleLineMode = False Align = alTop - Anchors = [akLeft, akTop, akRight, akBottom] Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 @@ -235,18 +190,32 @@ object frmSQLhelp: TfrmSQLhelp RightEdge = 0 WordWrap = True end - object ButtonClose: TButton - Left = 316 - Top = 128 - Width = 102 - Height = 25 - Anchors = [akRight, akBottom] - Cancel = True - Caption = 'Close' - Default = True - ModalResult = 1 + object MemoExample: TSynMemo + Left = 0 + Top = 203 + Width = 405 + Height = 104 + SingleLineMode = False + Align = alClient + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] TabOrder = 1 - OnClick = ButtonCloseClick + OnKeyDown = memosKeyDown + Gutter.Font.Charset = DEFAULT_CHARSET + Gutter.Font.Color = clWindowText + Gutter.Font.Height = -11 + Gutter.Font.Name = 'Courier New' + Gutter.Font.Style = [] + Gutter.Visible = False + Gutter.Width = 0 + Highlighter = URIHighlighter + Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoTabsToSpaces] + ReadOnly = True + RightEdge = 0 + WordWrap = True end end end diff --git a/source/sqlhelp.pas b/source/sqlhelp.pas index e7da8d02..be2d5e83 100644 --- a/source/sqlhelp.pas +++ b/source/sqlhelp.pas @@ -10,25 +10,23 @@ uses type TfrmSQLhelp = class(TForm) - pnlLeft: TPanel; - StatusBar1: TStatusBar; - Splitter1: TSplitter; - treeTopics: TTreeView; - pnlRight: TPanel; - pnlRightTop: TPanel; - lblKeyword: TLabel; - lblDescription: TLabel; - memoDescription: TSynMemo; - Splitter2: TSplitter; - pnlRightBottom: TPanel; - lblExample: TLabel; - MemoExample: TSynMemo; - ButtonClose: TButton; - btnSearchOnline: TButton; URIOpenerDescription: TSynURIOpener; URIHighlighter: TSynURISyn; URIOpenerExample: TSynURIOpener; + btnSearchOnline: TButton; + ButtonClose: TButton; + pnlMain: TPanel; + pnlLeft: TPanel; + treeTopics: TTreeView; editFilter: TButtonedEdit; + pnlRight: TPanel; + Splitter2: TSplitter; + Splitter1: TSplitter; + lblDescription: TLabel; + lblKeyword: TLabel; + memoDescription: TSynMemo; + lblExample: TLabel; + MemoExample: TSynMemo; procedure FormCreate(Sender: TObject); procedure treeTopicsExpanding(Sender: TObject; Node: TTreeNode; var AllowExpansion: Boolean); @@ -73,6 +71,7 @@ uses helpers, main; procedure TfrmSQLhelp.FormCreate(Sender: TObject); begin InheritFont(Font); + SetWindowSizeGrip(Handle, True); end; @@ -87,7 +86,7 @@ begin Width := GetRegValue( REGNAME_SQLHELPWINWIDTH, Width ); Height := GetRegValue( REGNAME_SQLHELPWINHEIGHT, Height ); pnlLeft.Width := GetRegValue( REGNAME_SQLHELPPLWIDTH, pnlLeft.Width ); - pnlRightTop.Height := GetRegValue( REGNAME_SQLHELPPRHEIGHT, pnlRightTop.Height ); + memoDescription.Height := GetRegValue( REGNAME_SQLHELPPRHEIGHT, memoDescription.Height ); Caption := DEFAULT_WINDOW_CAPTION; MainForm.SetupSynEditors; @@ -263,19 +262,10 @@ begin end; // Show the user if topic is (not) available - with MemoDescription do - begin - Enabled := Text <> ''; - if not Enabled then - Text := 'No help available for this keyword or no keyword was selected.'; - end; - with MemoExample do - begin - Enabled := Text <> ''; - if not Enabled then - Text := 'No example available or no keyword was selected.'; - end; - + if memoDescription.Text = '' then + memoDescription.Text := 'No help available for this keyword or no keyword was selected.'; + if memoExample.Text = '' then + memoExample.Text := 'No example available or no keyword was selected.'; end; @@ -291,7 +281,7 @@ begin MainReg.WriteInteger( REGNAME_SQLHELPWINWIDTH, Width ); MainReg.WriteInteger( REGNAME_SQLHELPWINHEIGHT, Height ); MainReg.WriteInteger( REGNAME_SQLHELPPLWIDTH, pnlLeft.Width ); - MainReg.WriteInteger( REGNAME_SQLHELPPRHEIGHT, PnlRightTop.Height ); + MainReg.WriteInteger( REGNAME_SQLHELPPRHEIGHT, memoDescription.Height ); Close; end;