From 2e301d10959eb9b0e4857b47ec8066c6a07173be Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Fri, 28 May 2010 23:09:38 +0000 Subject: [PATCH] Code cosmetic: Do not pass default parameter in one zillion callers of ShowStatusMsg() --- source/const.inc | 4 ++-- source/helpers.pas | 8 ++++---- source/main.pas | 40 ++++++++++++++++++++-------------------- source/tabletools.pas | 4 ++-- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/source/const.inc b/source/const.inc index 7ed42a80..19b7d039 100644 --- a/source/const.inc +++ b/source/const.inc @@ -24,8 +24,6 @@ const REGKEY_SESSIONS = 'Servers\'; // Some unique char, used to separate e.g. selected columns in registry DELIM = '|'; - STATUS_MSG_READY = 'Idle.'; - STR_NOTSUPPORTED = 'Not supported by this server'; // Used by maskSQL and fixSQL: SQL_VERSION_ANSI = -1; @@ -321,6 +319,8 @@ const SContainsNulCharGrid = 'This cell contains NUL characters. They have been converted to ASCII spaces (SP). Press ESC to cancel editing.'; SUnhandledTreeLevel = 'Unhandled tree node level.'; MSG_NOGRIDEDITING = 'Selected columns don''t contain a sufficient set of key columns to allow editing. Please select primary or unique key columns, or just all columns.'; + SIdle = 'Idle.'; + SUnsupported = 'Not supported by this server'; PKEY = 'PRIMARY'; KEY = 'KEY'; diff --git a/source/helpers.pas b/source/helpers.pas index 01caaece..42dca272 100644 --- a/source/helpers.pas +++ b/source/helpers.pas @@ -681,7 +681,7 @@ begin '' + CRLF; StreamWrite(S, tmp); Mainform.ProgressBarStatus.Visible := False; - Mainform.ShowStatusMsg(STATUS_MSG_READY); + Mainform.ShowStatusMsg; end; @@ -776,7 +776,7 @@ begin end; end; Mainform.ProgressBarStatus.Visible := False; - Mainform.ShowStatusMsg(STATUS_MSG_READY); + Mainform.ShowStatusMsg; end; @@ -859,7 +859,7 @@ begin tmp := '' + CRLF; StreamWrite(S, tmp); Mainform.ProgressBarStatus.Visible := False; - Mainform.ShowStatusMsg(STATUS_MSG_READY); + Mainform.ShowStatusMsg; end; @@ -942,7 +942,7 @@ begin tmp := CRLF; StreamWrite(S, tmp); Mainform.ProgressBarStatus.Visible := False; - Mainform.ShowStatusMsg(STATUS_MSG_READY); + Mainform.ShowStatusMsg; end; diff --git a/source/main.pas b/source/main.pas index 6e8b0a94..46b917e3 100644 --- a/source/main.pas +++ b/source/main.pas @@ -981,7 +981,7 @@ procedure TMainForm.ShowStatusMsg(Msg: String=''; PanelNr: Integer=6); begin // Show message in some statusbar panel if (PanelNr = 6) and (Msg = '') then - Msg := STATUS_MSG_READY; + Msg := SIdle; StatusBar.Panels[PanelNr].Text := Msg; StatusBar.Repaint; end; @@ -998,7 +998,7 @@ begin 2: ImageIndex := 149; 3: ImageIndex := 1; 6: begin - if Panel.Text = STATUS_MSG_READY then + if Panel.Text = SIdle then ImageIndex := 151 else ImageIndex := 150; @@ -1742,7 +1742,7 @@ begin // Place menuitem on menu miFunction.OnClick := insertFunction; end else begin - miFunction.Hint := miFunction.Hint + ' - ('+STR_NOTSUPPORTED+', needs >= '+Connection.ConvertServerVersion(MySqlFunctions[j].Version)+')'; + miFunction.Hint := miFunction.Hint + ' - ('+SUnsupported+', needs >= '+Connection.ConvertServerVersion(MySqlFunctions[j].Version)+')'; miFunction.Enabled := False; end; // Prevent generating a seperator for ShortHint and LongHint @@ -2209,7 +2209,7 @@ begin if QueryTab.tabsetQuery.Tabs.Count > 0 then QueryTab.tabsetQuery.TabIndex := 0; Screen.Cursor := crDefault; - ShowStatusMsg( STATUS_MSG_READY ); + ShowStatusMsg; end; @@ -2231,7 +2231,7 @@ begin // Ensure controls are in a valid state ValidateControls(Sender); Screen.Cursor := crDefault; - ShowStatusMsg( STATUS_MSG_READY ); + ShowStatusMsg; end; @@ -2261,7 +2261,7 @@ begin finally ShowStatusMsg('Freeing data...'); S.Free; - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; Screen.Cursor := crDefault; end; end; @@ -2280,7 +2280,7 @@ begin finally ShowStatusMsg('Freeing data...'); S.Free; - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; Screen.Cursor := crDefault; end; end; @@ -2299,7 +2299,7 @@ begin finally ShowStatusMsg('Freeing data...'); S.Free; - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; Screen.Cursor := crDefault; end; end; @@ -2325,7 +2325,7 @@ begin finally ShowStatusMsg('Freeing data...'); S.Free; - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; Screen.Cursor := crDefault; end; end; @@ -2352,7 +2352,7 @@ begin ShowStatusMsg('Freeing data...'); FS.Free; finally - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; Screen.Cursor := crDefault; end; end; @@ -2410,7 +2410,7 @@ begin ShellExec(Filename); end; - ShowStatusMsg( STATUS_MSG_READY ); + ShowStatusMsg; Screen.Cursor := crDefault; end; @@ -2577,7 +2577,7 @@ begin Connection := ConnectionAttempt; SessionName := Session; end; - ShowStatusMsg( STATUS_MSG_READY ); + ShowStatusMsg; end; @@ -2828,7 +2828,7 @@ begin SearchReplaceDialog.Options ); SearchReplaceDialog.Editor.EndUpdate; - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; if ssoReplaceAll in SearchReplaceDialog.Options then ShowStatusMsg('Text "'+SearchReplaceDialog.comboSearch.Text+'" '+FormatNumber(Occurences)+' times replaced.', 0) else begin @@ -3765,7 +3765,7 @@ begin vt.Tag := VTREE_LOADED; DataGridFullRowMode := False; Screen.Cursor := crDefault; - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; end; @@ -3943,7 +3943,7 @@ begin Msg := Msg + ')'; end; ShowStatusMsg(Msg, 0); - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; Screen.Cursor := crDefault; // Ensure tree db node displays its chidren initialized DBtree.ReinitChildren(FindDBNode(ActiveDatabase), False); @@ -4747,7 +4747,7 @@ begin if Connection.ServerVersionInt >= 40003 then menuEditVariable.Enabled := (PageControlHost.ActivePage = tabVariables) and Assigned(ListVariables.FocusedNode) else - menuEditVariable.Hint := STR_NOTSUPPORTED; + menuEditVariable.Hint := SUnsupported; end; procedure TMainForm.Saveastextfile1Click(Sender: TObject); @@ -5068,7 +5068,7 @@ begin Item.OnClick := QuickFilterClick; Data.Next; end; - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; end; @@ -6319,7 +6319,7 @@ begin MessageDlg(E.Message+CRLF+CRLF+'You have no privilege to execute SHOW DATABASES. Please specify one or more databases in your session settings, if you want to see any.', mtError, [mbOK], 0); end; end; - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; VT.Tag := VTREE_LOADED; InvalidateVT(ListDatabases, VTREE_NOTLOADED, False); ChildCount := AllDatabases.Count; @@ -6332,7 +6332,7 @@ begin try ChildCount := Connection.GetDBObjects(AllDatabases[Node.Index]).Count; finally - ShowStatusMsg( STATUS_MSG_READY ); + ShowStatusMsg; Screen.Cursor := crDefault; end; end; @@ -9002,7 +9002,7 @@ procedure TMainForm.AnyGridEndOperation(Sender: TBaseVirtualTree; OperationKind: begin // Reset status message after long running operations if OperationKind = okSortTree then - ShowStatusMsg(STATUS_MSG_READY); + ShowStatusMsg; end; diff --git a/source/tabletools.pas b/source/tabletools.pas index 5c5df956..ad191443 100644 --- a/source/tabletools.pas +++ b/source/tabletools.pas @@ -270,7 +270,7 @@ begin if idx = -1 then idx := 0; comboOperation.Items.CommaText := 'Check,Analyze,Checksum,Optimize,Repair'; if Mainform.Connection.ServerVersionInt < 40101 then - comboOperation.Items.Text := StringReplace(comboOperation.Items.Text, 'Checksum', 'Checksum ('+STR_NOTSUPPORTED+')', [rfReplaceAll]); + comboOperation.Items.Text := StringReplace(comboOperation.Items.Text, 'Checksum', 'Checksum ('+SUnsupported+')', [rfReplaceAll]); comboOperation.ItemIndex := idx; comboOperation.OnChange(Sender); @@ -329,7 +329,7 @@ begin SomeChecked := TreeObjects.CheckedCount > 0; if tabsTools.ActivePage = tabMaintenance then begin btnExecute.Caption := 'Execute'; - btnExecute.Enabled := (Pos(STR_NOTSUPPORTED, comboOperation.Text) = 0) and SomeChecked; + btnExecute.Enabled := (Pos(SUnsupported, comboOperation.Text) = 0) and SomeChecked; // Only enable available options op := LowerCase(comboOperation.Text); chkQuick.Enabled := (op = 'check') or (op = 'checksum') or (op = 'repair');