diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-09-23 10:24:31 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-09-23 10:24:31 +0200 |
commit | d2539f25a961e163385b39d4825126e9bd342474 (patch) | |
tree | 23ed873bd2f47351bae3964776e0f99c08e0d385 /src/gui | |
parent | 3a6ee1212cc7a5119eeb9687ad295a50fffaebdd (diff) | |
download | fpGUI-d2539f25a961e163385b39d4825126e9bd342474.tar.xz |
memo: minor optimization - SomethingSelected is only called once now.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/fpg_memo.pas | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/gui/fpg_memo.pas b/src/gui/fpg_memo.pas index 994959e7..7818ff41 100644 --- a/src/gui/fpg_memo.pas +++ b/src/gui/fpg_memo.pas @@ -352,22 +352,15 @@ procedure TfpgMemo.SetDefaultPopupMenuItemsState; var i: integer; itm: TfpgMenuItem; + b: boolean; function SomethingSelected: boolean; - var - selsl: integer; - selsp: integer; - selel: integer; - selep: integer; begin - Result := FSelecting; - //Result := (FSelStartPos <> FCursorPos) - // and (FSelEndPos <> 0) - // and (FSelStartLine <> -1) - // and (FSelEndLine <> -1); + Result := SelectionText <> ''; end; begin + b := SomethingSelected; for i := 0 to FDefaultPopupMenu.ComponentCount-1 do begin if FDefaultPopupMenu.Components[i] is TfpgMenuItem then @@ -375,9 +368,9 @@ begin itm := TfpgMenuItem(FDefaultPopupMenu.Components[i]); // enabled/disable menu items if itm.Name = ipmCut then - itm.Enabled := (not ReadOnly) and SomethingSelected + itm.Enabled := (not ReadOnly) and b else if itm.Name = ipmCopy then - itm.Enabled := SomethingSelected + itm.Enabled := b else if itm.Name = ipmPaste then itm.Enabled := (not ReadOnly) and (fpgClipboard.Text <> '') else if itm.Name = ipmClearAll then |