ScrollView.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. //
  2. // ScrollView.cs: ScrollView view.
  3. //
  4. // Authors:
  5. // Miguel de Icaza ([email protected])
  6. //
  7. //
  8. // TODO:
  9. // - focus in scrollview
  10. // - focus handling in scrollview to auto scroll to focused view
  11. // - Raise events
  12. // - Perhaps allow an option to not display the scrollbar arrow indicators?
  13. using System;
  14. using System.Linq;
  15. namespace Terminal.Gui {
  16. /// <summary>
  17. /// Scrollviews are views that present a window into a virtual space where subviews are added. Similar to the iOS UIScrollView.
  18. /// </summary>
  19. /// <remarks>
  20. /// <para>
  21. /// The subviews that are added to this <see cref="Gui.ScrollView"/> are offset by the
  22. /// <see cref="ContentOffset"/> property. The view itself is a window into the
  23. /// space represented by the <see cref="ContentSize"/>.
  24. /// </para>
  25. /// <para>
  26. /// Use the
  27. /// </para>
  28. /// </remarks>
  29. public class ScrollView : View {
  30. // The ContentView is the view that contains the subviews and content that are being scrolled
  31. // The ContentView is the size of the ContentSize and is offset by the ContentOffset
  32. private class ContentView : View {
  33. public ContentView (Rect frame) : base (frame)
  34. {
  35. Id = "ScrollView.ContentView";
  36. CanFocus = true;
  37. }
  38. }
  39. ContentView _contentView;
  40. ScrollBarView _vertical, _horizontal;
  41. /// <summary>
  42. /// Initializes a new instance of the <see cref="Gui.ScrollView"/> class using <see cref="LayoutStyle.Absolute"/> positioning.
  43. /// </summary>
  44. /// <param name="frame"></param>
  45. public ScrollView (Rect frame) : base (frame)
  46. {
  47. SetInitialProperties (frame);
  48. }
  49. /// <summary>
  50. /// Initializes a new instance of the <see cref="Gui.ScrollView"/> class using <see cref="LayoutStyle.Computed"/> positioning.
  51. /// </summary>
  52. public ScrollView () : base ()
  53. {
  54. SetInitialProperties (Rect.Empty);
  55. }
  56. void SetInitialProperties (Rect frame)
  57. {
  58. _contentView = new ContentView (frame);
  59. _vertical = new ScrollBarView (1, 0, isVertical: true) {
  60. X = Pos.AnchorEnd (1),
  61. Y = 0,
  62. Width = 1,
  63. Height = Dim.Fill (_showHorizontalScrollIndicator ? 1 : 0),
  64. Host = this
  65. };
  66. _horizontal = new ScrollBarView (1, 0, isVertical: false) {
  67. X = 0,
  68. Y = Pos.AnchorEnd (1),
  69. Width = Dim.Fill (_showVerticalScrollIndicator ? 1 : 0),
  70. Height = 1,
  71. Host = this
  72. };
  73. _vertical.OtherScrollBarView = _horizontal;
  74. _horizontal.OtherScrollBarView = _vertical;
  75. base.Add (_contentView);
  76. CanFocus = true;
  77. MouseEnter += View_MouseEnter;
  78. MouseLeave += View_MouseLeave;
  79. _contentView.MouseEnter += View_MouseEnter;
  80. _contentView.MouseLeave += View_MouseLeave;
  81. // Things this view knows how to do
  82. AddCommand (Command.ScrollUp, () => ScrollUp (1));
  83. AddCommand (Command.ScrollDown, () => ScrollDown (1));
  84. AddCommand (Command.ScrollLeft, () => ScrollLeft (1));
  85. AddCommand (Command.ScrollRight, () => ScrollRight (1));
  86. AddCommand (Command.PageUp, () => ScrollUp (Bounds.Height));
  87. AddCommand (Command.PageDown, () => ScrollDown (Bounds.Height));
  88. AddCommand (Command.PageLeft, () => ScrollLeft (Bounds.Width));
  89. AddCommand (Command.PageRight, () => ScrollRight (Bounds.Width));
  90. AddCommand (Command.TopHome, () => ScrollUp (_contentSize.Height));
  91. AddCommand (Command.BottomEnd, () => ScrollDown (_contentSize.Height));
  92. AddCommand (Command.LeftHome, () => ScrollLeft (_contentSize.Width));
  93. AddCommand (Command.RightEnd, () => ScrollRight (_contentSize.Width));
  94. // Default keybindings for this view
  95. AddKeyBinding (Key.CursorUp, Command.ScrollUp);
  96. AddKeyBinding (Key.CursorDown, Command.ScrollDown);
  97. AddKeyBinding (Key.CursorLeft, Command.ScrollLeft);
  98. AddKeyBinding (Key.CursorRight, Command.ScrollRight);
  99. AddKeyBinding (Key.PageUp, Command.PageUp);
  100. AddKeyBinding ((Key)'v' | Key.AltMask, Command.PageUp);
  101. AddKeyBinding (Key.PageDown, Command.PageDown);
  102. AddKeyBinding (Key.V | Key.CtrlMask, Command.PageDown);
  103. AddKeyBinding (Key.PageUp | Key.CtrlMask, Command.PageLeft);
  104. AddKeyBinding (Key.PageDown | Key.CtrlMask, Command.PageRight);
  105. AddKeyBinding (Key.Home, Command.TopHome);
  106. AddKeyBinding (Key.End, Command.BottomEnd);
  107. AddKeyBinding (Key.Home | Key.CtrlMask, Command.LeftHome);
  108. AddKeyBinding (Key.End | Key.CtrlMask, Command.RightEnd);
  109. Initialized += (s, e) => {
  110. if (!_vertical.IsInitialized) {
  111. _vertical.BeginInit ();
  112. _vertical.EndInit ();
  113. }
  114. if (!_horizontal.IsInitialized) {
  115. _horizontal.BeginInit ();
  116. _horizontal.EndInit ();
  117. }
  118. SetContentOffset (_contentOffset);
  119. _contentView.Frame = new Rect (ContentOffset, ContentSize);
  120. _vertical.ChangedPosition += delegate {
  121. ContentOffset = new Point (ContentOffset.X, _vertical.Position);
  122. };
  123. _horizontal.ChangedPosition += delegate {
  124. ContentOffset = new Point (_horizontal.Position, ContentOffset.Y);
  125. };
  126. };
  127. }
  128. //public override void BeginInit ()
  129. //{
  130. // SetContentOffset (contentOffset);
  131. // base.BeginInit ();
  132. //}
  133. Size _contentSize;
  134. Point _contentOffset;
  135. bool _showHorizontalScrollIndicator;
  136. bool _showVerticalScrollIndicator;
  137. bool _keepContentAlwaysInViewport = true;
  138. bool _autoHideScrollBars = true;
  139. /// <summary>
  140. /// Represents the contents of the data shown inside the scrollview
  141. /// </summary>
  142. /// <value>The size of the content.</value>
  143. public Size ContentSize {
  144. get {
  145. return _contentSize;
  146. }
  147. set {
  148. if (_contentSize != value) {
  149. _contentSize = value;
  150. _contentView.Frame = new Rect (_contentOffset, value);
  151. _vertical.Size = _contentSize.Height;
  152. _horizontal.Size = _contentSize.Width;
  153. SetNeedsDisplay ();
  154. }
  155. }
  156. }
  157. /// <summary>
  158. /// Represents the top left corner coordinate that is displayed by the scrollview
  159. /// </summary>
  160. /// <value>The content offset.</value>
  161. public Point ContentOffset {
  162. get {
  163. return _contentOffset;
  164. }
  165. set {
  166. if (!IsInitialized) {
  167. // We're not initialized so we can't do anything fancy. Just cache value.
  168. _contentOffset = new Point (-Math.Abs (value.X), -Math.Abs (value.Y)); ;
  169. return;
  170. }
  171. SetContentOffset (value);
  172. }
  173. }
  174. private void SetContentOffset (Point offset)
  175. {
  176. var co = new Point (-Math.Abs (offset.X), -Math.Abs (offset.Y));
  177. _contentOffset = co;
  178. _contentView.Frame = new Rect (_contentOffset, _contentSize);
  179. var p = Math.Max (0, -_contentOffset.Y);
  180. if (_vertical.Position != p) {
  181. _vertical.Position = Math.Max (0, -_contentOffset.Y);
  182. }
  183. p = Math.Max (0, -_contentOffset.X);
  184. if (_horizontal.Position != p) {
  185. _horizontal.Position = Math.Max (0, -_contentOffset.X);
  186. }
  187. SetNeedsDisplay ();
  188. }
  189. /// <summary>
  190. /// If true the vertical/horizontal scroll bars won't be showed if it's not needed.
  191. /// </summary>
  192. public bool AutoHideScrollBars {
  193. get => _autoHideScrollBars;
  194. set {
  195. if (_autoHideScrollBars != value) {
  196. _autoHideScrollBars = value;
  197. if (Subviews.Contains (_vertical)) {
  198. _vertical.AutoHideScrollBars = value;
  199. }
  200. if (Subviews.Contains (_horizontal)) {
  201. _horizontal.AutoHideScrollBars = value;
  202. }
  203. SetNeedsDisplay ();
  204. }
  205. }
  206. }
  207. /// <summary>
  208. /// Get or sets if the view-port is kept always visible in the area of this <see cref="ScrollView"/>
  209. /// </summary>
  210. public bool KeepContentAlwaysInViewport {
  211. get { return _keepContentAlwaysInViewport; }
  212. set {
  213. if (_keepContentAlwaysInViewport != value) {
  214. _keepContentAlwaysInViewport = value;
  215. _vertical.OtherScrollBarView.KeepContentAlwaysInViewport = value;
  216. _horizontal.OtherScrollBarView.KeepContentAlwaysInViewport = value;
  217. Point p = default;
  218. if (value && -_contentOffset.X + Bounds.Width > _contentSize.Width) {
  219. p = new Point (_contentSize.Width - Bounds.Width + (_showVerticalScrollIndicator ? 1 : 0), -_contentOffset.Y);
  220. }
  221. if (value && -_contentOffset.Y + Bounds.Height > _contentSize.Height) {
  222. if (p == default) {
  223. p = new Point (-_contentOffset.X, _contentSize.Height - Bounds.Height + (_showHorizontalScrollIndicator ? 1 : 0));
  224. } else {
  225. p.Y = _contentSize.Height - Bounds.Height + (_showHorizontalScrollIndicator ? 1 : 0);
  226. }
  227. }
  228. if (p != default) {
  229. ContentOffset = p;
  230. }
  231. }
  232. }
  233. }
  234. View _contentBottomRightCorner;
  235. /// <summary>
  236. /// Adds the view to the scrollview.
  237. /// </summary>
  238. /// <param name="view">The view to add to the scrollview.</param>
  239. public override void Add (View view)
  240. {
  241. if (view.Id == "contentBottomRightCorner") {
  242. _contentBottomRightCorner = view;
  243. base.Add (view);
  244. } else {
  245. if (!IsOverridden (view, "MouseEvent")) {
  246. view.MouseEnter += View_MouseEnter;
  247. view.MouseLeave += View_MouseLeave;
  248. }
  249. _contentView.Add (view);
  250. }
  251. SetNeedsLayout ();
  252. }
  253. void View_MouseLeave (object sender, MouseEventEventArgs e)
  254. {
  255. if (Application.MouseGrabView != null && Application.MouseGrabView != _vertical && Application.MouseGrabView != _horizontal) {
  256. Application.UngrabMouse ();
  257. }
  258. }
  259. void View_MouseEnter (object sender, MouseEventEventArgs e)
  260. {
  261. Application.GrabMouse (this);
  262. }
  263. /// <summary>
  264. /// Gets or sets the visibility for the horizontal scroll indicator.
  265. /// </summary>
  266. /// <value><c>true</c> if show horizontal scroll indicator; otherwise, <c>false</c>.</value>
  267. public bool ShowHorizontalScrollIndicator {
  268. get => _showHorizontalScrollIndicator;
  269. set {
  270. if (value != _showHorizontalScrollIndicator) {
  271. _showHorizontalScrollIndicator = value;
  272. SetNeedsLayout ();
  273. if (value) {
  274. _horizontal.OtherScrollBarView = _vertical;
  275. base.Add (_horizontal);
  276. _horizontal.ShowScrollIndicator = value;
  277. _horizontal.AutoHideScrollBars = _autoHideScrollBars;
  278. _horizontal.OtherScrollBarView.ShowScrollIndicator = value;
  279. _horizontal.MouseEnter += View_MouseEnter;
  280. _horizontal.MouseLeave += View_MouseLeave;
  281. } else {
  282. base.Remove (_horizontal);
  283. _horizontal.OtherScrollBarView = null;
  284. _horizontal.MouseEnter -= View_MouseEnter;
  285. _horizontal.MouseLeave -= View_MouseLeave;
  286. }
  287. }
  288. _vertical.Height = Dim.Fill (_showHorizontalScrollIndicator ? 1 : 0);
  289. }
  290. }
  291. /// <summary>
  292. /// Removes all widgets from this container.
  293. /// </summary>
  294. /// <remarks>
  295. /// </remarks>
  296. public override void RemoveAll ()
  297. {
  298. _contentView.RemoveAll ();
  299. }
  300. /// <summary>
  301. /// Gets or sets the visibility for the vertical scroll indicator.
  302. /// </summary>
  303. /// <value><c>true</c> if show vertical scroll indicator; otherwise, <c>false</c>.</value>
  304. public bool ShowVerticalScrollIndicator {
  305. get => _showVerticalScrollIndicator;
  306. set {
  307. if (value != _showVerticalScrollIndicator) {
  308. _showVerticalScrollIndicator = value;
  309. SetNeedsLayout ();
  310. if (value) {
  311. _vertical.OtherScrollBarView = _horizontal;
  312. base.Add (_vertical);
  313. _vertical.ShowScrollIndicator = value;
  314. _vertical.AutoHideScrollBars = _autoHideScrollBars;
  315. _vertical.OtherScrollBarView.ShowScrollIndicator = value;
  316. _vertical.MouseEnter += View_MouseEnter;
  317. _vertical.MouseLeave += View_MouseLeave;
  318. } else {
  319. Remove (_vertical);
  320. _vertical.OtherScrollBarView = null;
  321. _vertical.MouseEnter -= View_MouseEnter;
  322. _vertical.MouseLeave -= View_MouseLeave;
  323. }
  324. }
  325. _horizontal.Width = Dim.Fill (_showVerticalScrollIndicator ? 1 : 0);
  326. }
  327. }
  328. /// <inheritdoc/>
  329. public override void OnDrawContent (Rect contentArea)
  330. {
  331. SetViewsNeedsDisplay ();
  332. var savedClip = ClipToBounds ();
  333. Driver.SetAttribute (GetNormalColor ());
  334. Clear ();
  335. if (!string.IsNullOrEmpty (_contentView.Text) || _contentView.Subviews.Count > 0) {
  336. _contentView.Draw ();
  337. }
  338. DrawScrollBars ();
  339. Driver.Clip = savedClip;
  340. }
  341. private void DrawScrollBars ()
  342. {
  343. if (_autoHideScrollBars) {
  344. ShowHideScrollBars ();
  345. } else {
  346. if (ShowVerticalScrollIndicator) {
  347. _vertical.Draw ();
  348. }
  349. if (ShowHorizontalScrollIndicator) {
  350. _horizontal.Draw ();
  351. }
  352. if (ShowVerticalScrollIndicator && ShowHorizontalScrollIndicator) {
  353. SetContentBottomRightCornerVisibility ();
  354. _contentBottomRightCorner.Draw ();
  355. }
  356. }
  357. }
  358. private void SetContentBottomRightCornerVisibility ()
  359. {
  360. if (_showHorizontalScrollIndicator && _showVerticalScrollIndicator) {
  361. _contentBottomRightCorner.Visible = true;
  362. } else if (_horizontal.IsAdded || _vertical.IsAdded) {
  363. _contentBottomRightCorner.Visible = false;
  364. }
  365. }
  366. void ShowHideScrollBars ()
  367. {
  368. bool v = false, h = false; bool p = false;
  369. if (Bounds.Height == 0 || Bounds.Height > _contentSize.Height) {
  370. if (ShowVerticalScrollIndicator) {
  371. ShowVerticalScrollIndicator = false;
  372. }
  373. v = false;
  374. } else if (Bounds.Height > 0 && Bounds.Height == _contentSize.Height) {
  375. p = true;
  376. } else {
  377. if (!ShowVerticalScrollIndicator) {
  378. ShowVerticalScrollIndicator = true;
  379. }
  380. v = true;
  381. }
  382. if (Bounds.Width == 0 || Bounds.Width > _contentSize.Width) {
  383. if (ShowHorizontalScrollIndicator) {
  384. ShowHorizontalScrollIndicator = false;
  385. }
  386. h = false;
  387. } else if (Bounds.Width > 0 && Bounds.Width == _contentSize.Width && p) {
  388. if (ShowHorizontalScrollIndicator) {
  389. ShowHorizontalScrollIndicator = false;
  390. }
  391. h = false;
  392. if (ShowVerticalScrollIndicator) {
  393. ShowVerticalScrollIndicator = false;
  394. }
  395. v = false;
  396. } else {
  397. if (p) {
  398. if (!ShowVerticalScrollIndicator) {
  399. ShowVerticalScrollIndicator = true;
  400. }
  401. v = true;
  402. }
  403. if (!ShowHorizontalScrollIndicator) {
  404. ShowHorizontalScrollIndicator = true;
  405. }
  406. h = true;
  407. }
  408. var dim = Dim.Fill (h ? 1 : 0);
  409. if (!_vertical.Height.Equals (dim)) {
  410. _vertical.Height = dim;
  411. }
  412. dim = Dim.Fill (v ? 1 : 0);
  413. if (!_horizontal.Width.Equals (dim)) {
  414. _horizontal.Width = dim;
  415. }
  416. if (v) {
  417. _vertical.SetRelativeLayout (Bounds);
  418. _vertical.Draw ();
  419. }
  420. if (h) {
  421. _horizontal.SetRelativeLayout (Bounds);
  422. _horizontal.Draw ();
  423. }
  424. SetContentBottomRightCornerVisibility ();
  425. if (v && h) {
  426. _contentBottomRightCorner.SetRelativeLayout (Bounds);
  427. _contentBottomRightCorner.Draw ();
  428. }
  429. }
  430. void SetViewsNeedsDisplay ()
  431. {
  432. foreach (View view in _contentView.Subviews) {
  433. view.SetNeedsDisplay ();
  434. }
  435. }
  436. ///<inheritdoc/>
  437. public override void PositionCursor ()
  438. {
  439. if (InternalSubviews.Count == 0)
  440. Move (0, 0);
  441. else
  442. base.PositionCursor ();
  443. }
  444. /// <summary>
  445. /// Scrolls the view up.
  446. /// </summary>
  447. /// <returns><c>true</c>, if left was scrolled, <c>false</c> otherwise.</returns>
  448. /// <param name="lines">Number of lines to scroll.</param>
  449. public bool ScrollUp (int lines)
  450. {
  451. if (_contentOffset.Y < 0) {
  452. ContentOffset = new Point (_contentOffset.X, Math.Min (_contentOffset.Y + lines, 0));
  453. return true;
  454. }
  455. return false;
  456. }
  457. /// <summary>
  458. /// Scrolls the view to the left
  459. /// </summary>
  460. /// <returns><c>true</c>, if left was scrolled, <c>false</c> otherwise.</returns>
  461. /// <param name="cols">Number of columns to scroll by.</param>
  462. public bool ScrollLeft (int cols)
  463. {
  464. if (_contentOffset.X < 0) {
  465. ContentOffset = new Point (Math.Min (_contentOffset.X + cols, 0), _contentOffset.Y);
  466. return true;
  467. }
  468. return false;
  469. }
  470. /// <summary>
  471. /// Scrolls the view down.
  472. /// </summary>
  473. /// <returns><c>true</c>, if left was scrolled, <c>false</c> otherwise.</returns>
  474. /// <param name="lines">Number of lines to scroll.</param>
  475. public bool ScrollDown (int lines)
  476. {
  477. if (_vertical.CanScroll (lines, out _, true)) {
  478. ContentOffset = new Point (_contentOffset.X, _contentOffset.Y - lines);
  479. return true;
  480. }
  481. return false;
  482. }
  483. /// <summary>
  484. /// Scrolls the view to the right.
  485. /// </summary>
  486. /// <returns><c>true</c>, if right was scrolled, <c>false</c> otherwise.</returns>
  487. /// <param name="cols">Number of columns to scroll by.</param>
  488. public bool ScrollRight (int cols)
  489. {
  490. if (_horizontal.CanScroll (cols, out _)) {
  491. ContentOffset = new Point (_contentOffset.X - cols, _contentOffset.Y);
  492. return true;
  493. }
  494. return false;
  495. }
  496. ///<inheritdoc/>
  497. public override bool ProcessKey (KeyEvent kb)
  498. {
  499. if (base.ProcessKey (kb))
  500. return true;
  501. var result = InvokeKeybindings (kb);
  502. if (result != null)
  503. return (bool)result;
  504. return false;
  505. }
  506. ///<inheritdoc/>
  507. public override bool MouseEvent (MouseEvent me)
  508. {
  509. if (me.Flags != MouseFlags.WheeledDown && me.Flags != MouseFlags.WheeledUp &&
  510. me.Flags != MouseFlags.WheeledRight && me.Flags != MouseFlags.WheeledLeft &&
  511. // me.Flags != MouseFlags.Button1Pressed && me.Flags != MouseFlags.Button1Clicked &&
  512. !me.Flags.HasFlag (MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition)) {
  513. return false;
  514. }
  515. if (me.Flags == MouseFlags.WheeledDown && ShowVerticalScrollIndicator) {
  516. ScrollDown (1);
  517. } else if (me.Flags == MouseFlags.WheeledUp && ShowVerticalScrollIndicator) {
  518. ScrollUp (1);
  519. } else if (me.Flags == MouseFlags.WheeledRight && _showHorizontalScrollIndicator) {
  520. ScrollRight (1);
  521. } else if (me.Flags == MouseFlags.WheeledLeft && ShowVerticalScrollIndicator) {
  522. ScrollLeft (1);
  523. } else if (me.X == _vertical.Frame.X && ShowVerticalScrollIndicator) {
  524. _vertical.MouseEvent (me);
  525. } else if (me.Y == _horizontal.Frame.Y && ShowHorizontalScrollIndicator) {
  526. _horizontal.MouseEvent (me);
  527. } else if (IsOverridden (me.View, "MouseEvent")) {
  528. Application.UngrabMouse ();
  529. }
  530. return true;
  531. }
  532. ///<inheritdoc/>
  533. protected override void Dispose (bool disposing)
  534. {
  535. if (!_showVerticalScrollIndicator) {
  536. // It was not added to SuperView, so it won't get disposed automatically
  537. _vertical?.Dispose ();
  538. }
  539. if (!_showHorizontalScrollIndicator) {
  540. // It was not added to SuperView, so it won't get disposed automatically
  541. _horizontal?.Dispose ();
  542. }
  543. base.Dispose (disposing);
  544. }
  545. ///<inheritdoc/>
  546. public override bool OnEnter (View view)
  547. {
  548. if (Subviews.Count == 0 || !Subviews.Any (subview => subview.CanFocus)) {
  549. Application.Driver?.SetCursorVisibility (CursorVisibility.Invisible);
  550. }
  551. return base.OnEnter (view);
  552. }
  553. }
  554. }