PageRenderTime 49ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/SharpMedia/main/Controls/HUDVideoOptions.cs

#
C# | 879 lines | 683 code | 176 blank | 20 comment | 21 complexity | b0b973b0e3619775a6787ef46cb16dd9 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Lizk.SimpleHUD;
  5. using SharpMedia.Pages;
  6. namespace SharpMedia.Controls
  7. {
  8. public class HUDVideoOptions : HUDContainerSimple
  9. {
  10. HUDVideo2 video;
  11. public HUDVideo2 Video
  12. {
  13. get { return video; }
  14. set { video = value; }
  15. }
  16. HUDContainerSimple ctxContainer, ctxCentering;
  17. HUDCenterList ctxList;
  18. HUDLabel ctxSelectionLabel;
  19. HUDContainerSimple contextControls = new HUDContainerSimple();
  20. /*
  21. HUDLabel sldLblMinValue, sldLblValue, sldLblMaxValue;
  22. HUDContainerSimple sldContainer;
  23. HUDVertBar sldBar;
  24. HUDContainerSimple listContainer, listBox;
  25. HUDMoveList listList;
  26. HUDImage listSelection;
  27. */
  28. Lizk.SimpleHUD.TripTrigger trigger = new Lizk.SimpleHUD.TripTrigger(new TimeSpan(0, 0, 0, 0, 200));
  29. public int SelectedIndex
  30. {
  31. get { return ctxList.SelectedIndex; }
  32. set { ctxList.SelectedIndex = value; }
  33. }
  34. public ContextBarItem SelectedItem
  35. {
  36. get { return ctxList.SelectedControl.GetTag<ContextBarItem>(); }
  37. }
  38. public void Up()
  39. {
  40. if (ctxList.SelectedControl != null)
  41. ((ContextBarItem)ctxList.SelectedControl.Tag).Up();
  42. }
  43. public void Down()
  44. {
  45. if (ctxList.SelectedControl != null)
  46. ((ContextBarItem)ctxList.SelectedControl.Tag).Down();
  47. }
  48. public void OkPressed()
  49. {
  50. if (ctxList.SelectedControl != null)
  51. ((ContextBarItem)ctxList.SelectedControl.Tag).Ok();
  52. }
  53. public HUDVideoOptions(HUDVideo2 video)
  54. {
  55. this.video = video;
  56. InitializeComponents();
  57. }
  58. public bool Contains(ContextBarItem item)
  59. {
  60. foreach (HUDControl hc in ctxList)
  61. {
  62. if (hc.Tag == item)
  63. return true;
  64. }
  65. return false;
  66. }
  67. public void Remove(ContextBarItem item)
  68. {
  69. for (int i = 0; i < ctxList.Count; i++)
  70. {
  71. if (ctxList[i].Tag == item)
  72. {
  73. ctxList.RemoveAt(i);
  74. contextControls.RemoveAt(i);
  75. return;
  76. }
  77. }
  78. }
  79. private void InitializeComponents()
  80. {
  81. ctxContainer = new HUDContainerSimple();
  82. ctxContainer.Bounds = new RectangleS(0, 0, Bounds.Width, 110);
  83. ctxContainer.Anchor = Anchor.All ^ Anchor.Top;
  84. ctxContainer.Alpha = 255;
  85. ctxCentering = new HUDCentering(this, ctxContainer);
  86. ctxCentering.Bounds = new RectangleS(0, 0, Bounds.Width, 110);
  87. ctxCentering.Anchor = Anchor.All ^ Anchor.Bottom;
  88. Add(ctxCentering);
  89. contextControls.Bounds = new RectangleS(0, 110, Bounds.Width, Bounds.Height - 110);
  90. contextControls.Anchor = Anchor.All ^ Anchor.Bottom;
  91. Add(contextControls);
  92. HUDImage ctxBarBackground = new HUDImage("white.png");
  93. ctxBarBackground.Color = Lizk.SimpleHUD.ColorS.Black;
  94. ctxBarBackground.Alpha = 127;
  95. ctxBarBackground.Anchor = Anchor.All;
  96. ctxBarBackground.ConstrainProportions = false;
  97. ctxBarBackground.Size = ctxContainer.Size;
  98. ctxContainer.Add(ctxBarBackground);
  99. ctxList = new HUDCenterList(new SizeS(70, 70));
  100. ctxList.Bounds = new RectangleS(0, 35, ctxContainer.Bounds.Width, 70);
  101. ctxList.Anchor = Anchor.All ^ Anchor.Bottom;
  102. ctxContainer.Add(ctxList);
  103. ctxList.SelectedIndexChanged += new EventHandler<SelectionEventArgs>(ctxList_SelectedIndexChanged);
  104. ctxList.SelectedIndex = 0;
  105. ctxList.MoveItems(false);
  106. ctxSelectionLabel = new HUDLabel("", "tahoma30b");
  107. ctxSelectionLabel.Bounds = new RectangleS(0, 0, ctxContainer.Bounds.Width, 50);
  108. ctxSelectionLabel.Alignment = Alignment.Top | Alignment.Center;
  109. ctxSelectionLabel.Anchor = Anchor.All ^ Anchor.Top;
  110. ctxContainer.Add(ctxSelectionLabel);
  111. trigger.TimeOut += new EventHandler(trigger_TimeOut);
  112. }
  113. void trigger_TimeOut(object sender, EventArgs e)
  114. {
  115. ctxSelectionLabel.Text = (string)ctxList.GetSelectedControl<HUDContainerSimple>().Get<HUDImage>(1).Tag;
  116. ctxList.GetSelectedControl<HUDContainerSimple>().Get<HUDImage>(0).Fade(255, 6f);
  117. SelectedItem.Control.Fade(255, 6f);
  118. contextControls.Size = new SizeS(contextControls.Size.Width, SelectedItem.Control.Size.Height);
  119. ctxSelectionLabel.Fade(255, 6f);
  120. }
  121. void ctxList_SelectedIndexChanged(object sender, SelectionEventArgs e)
  122. {
  123. if (e.OldIndex > -1 && e.OldIndex < ctxList.Count)
  124. {
  125. ((ContextBarItem)ctxList[e.OldIndex].Tag).Deselect();
  126. ctxList.Get<HUDContainerSimple>(e.OldIndex).Get<HUDImage>(0).Fade(0, 6f);
  127. contextControls.Get<HUDCentering>(e.OldIndex)[0].Fade(0, 6f);
  128. }
  129. trigger.Trigger();
  130. ContextBarItem item = (ContextBarItem)ctxList.SelectedControl.Tag;
  131. item.Selected();
  132. ctxSelectionLabel.Fade(0, 6f);
  133. }
  134. public void AddItem(ContextBarItem item)
  135. {
  136. HUDContainerSimple s = new HUDContainerSimple();
  137. s.Size = new SizeS(70,70);
  138. s.Tag = item;
  139. ctxList.Add(s);
  140. HUDImage bg = new HUDImage("glow.png");
  141. bg.Size = new SizeS(70, 70);
  142. bg.Alpha = 0;
  143. s.Add(bg);
  144. HUDImage img = new HUDImage(item.Image);
  145. img.Size = new SizeS(64, 64);
  146. img.Location = new PointS(3, 3);
  147. img.Tag = item.Title;
  148. s.Add(img);
  149. contextControls.Add(new HUDCentering(contextControls, item.Control) { Size = contextControls.Size, Anchor = Anchor.All });
  150. if(ctxList.Count == 1)
  151. ctxList.SelectedIndex = 0;
  152. ctxList.MoveItems(false);
  153. }
  154. public override void Update(TimeSpan ts)
  155. {
  156. base.Update(ts);
  157. trigger.Update();
  158. foreach (HUDControl h in ctxList)
  159. {
  160. ((ContextBarItem)h.Tag).Update(ts);
  161. }
  162. }
  163. }
  164. public abstract class ContextBarItem
  165. {
  166. private string title;
  167. public string Title
  168. {
  169. get { return title; }
  170. set { title = value; }
  171. }
  172. private string image;
  173. public string Image
  174. {
  175. get { return image; }
  176. set { image = value; }
  177. }
  178. private HUDVideoOptions options;
  179. public HUDVideoOptions Options
  180. {
  181. get { return options; }
  182. set { options = value; }
  183. }
  184. public HUDControl Control { get; set; }
  185. public virtual void Update(TimeSpan ts) { }
  186. public ContextBarItem(HUDVideoOptions options, string title, string image)
  187. {
  188. this.title = title;
  189. this.image = image;
  190. this.options = options;
  191. }
  192. public abstract void Deselect();
  193. public abstract void Selected();
  194. public abstract void Ok();
  195. public abstract void Up();
  196. public abstract void Down();
  197. public abstract void Reapply();
  198. }
  199. public abstract class SliderContextBarItem : ContextBarItem
  200. {
  201. protected float value;
  202. public float Value
  203. {
  204. get { return value; }
  205. set { this.value = value; }
  206. }
  207. protected HUDLabel sldLblValue, sldLblMaxValue, sldLblMinValue;
  208. protected HUDVertBar sldBar;
  209. public SliderContextBarItem(HUDVideoOptions options, string title, string image) : base(options, title, image)
  210. {
  211. HUDContainerSimple sliderContainer = new HUDContainerSimple();
  212. sliderContainer.Size = new SizeS(105, 200);
  213. sliderContainer.Alpha = 0;
  214. HUDImage bg = new HUDImage("white.png");
  215. bg.Size = sliderContainer.Size;
  216. bg.Color = ColorS.Black;
  217. bg.Alpha = 127;
  218. bg.ConstrainProportions = false;
  219. sliderContainer.Add(bg);
  220. sldLblValue = new HUDLabel("-100", "verdana22b2");
  221. sldLblValue.Size = new SizeS(100, 200);
  222. sldLblValue.Location = new PointS(40, 0);
  223. sldLblValue.Alignment = Alignment.Left | Alignment.VCenter;
  224. sliderContainer.Add(sldLblValue);
  225. sldLblMaxValue = new HUDLabel("100", "tahoma14b");
  226. sldLblMaxValue.Size = new SizeS(100, 20);
  227. sldLblMaxValue.Location = new PointS(40, 0);
  228. sldLblMaxValue.Alignment = Alignment.Left | Alignment.VCenter;
  229. sliderContainer.Add(sldLblMaxValue);
  230. sldLblMinValue = new HUDLabel("-100", "tahoma14b");
  231. sldLblMinValue.Size = new SizeS(100, 20);
  232. sldLblMinValue.Location = new PointS(40, 180);
  233. sldLblMinValue.Alignment = Alignment.Left | Alignment.VCenter;
  234. sliderContainer.Add(sldLblMinValue);
  235. sldBar = new HUDVertBar();
  236. sldBar.Size = new SizeS(27, 180);
  237. sldBar.Location = new PointS(10, 10);
  238. sldBar.Value = 50;
  239. sliderContainer.Add(sldBar);
  240. Control = sliderContainer;
  241. }
  242. public override void Deselect()
  243. {
  244. }
  245. public override void Selected()
  246. {
  247. }
  248. }
  249. public abstract class ListContextBarItem : ContextBarItem
  250. {
  251. HUDImage listSelection;
  252. protected HUDMoveList list;
  253. public ListContextBarItem(HUDVideoOptions options, string title, string image) : base(options, title, image)
  254. {
  255. HUDContainerSimple listBox = new HUDContainerSimple();
  256. listBox.Size = new SizeS(210, 100);
  257. listBox.Alpha = 0;
  258. HUDImage bg = new HUDImage("white.png");
  259. bg.Size = listBox.Size;
  260. bg.Color = ColorS.Black;
  261. bg.Alpha = 127;
  262. bg.ConstrainProportions = false;
  263. bg.Anchor = Anchor.All;
  264. listBox.Add(bg);
  265. listSelection = new HUDImage("white.png");
  266. listSelection.Size = new SizeS(210, 30);
  267. listSelection.ConstrainProportions = false;
  268. listSelection.Color = ColorS.Green;
  269. listSelection.Alpha = 127;
  270. listBox.Add(listSelection);
  271. list = new HUDMoveList(new SizeS(210, 30), false);
  272. list.Bounds = new RectangleS(0, 0, 280, 100);
  273. list.Anchor = Anchor.All;
  274. listBox.Add(list);
  275. Control = listBox;
  276. }
  277. public override void Deselect()
  278. {
  279. }
  280. public override void Selected()
  281. {
  282. }
  283. public override void Up()
  284. {
  285. list.SelectedIndex--;
  286. UpdateList(true);
  287. }
  288. public override void Down()
  289. {
  290. list.SelectedIndex++;
  291. UpdateList(true);
  292. }
  293. protected void UpdateList(bool animate)
  294. {
  295. list.MoveItems(animate);
  296. listSelection.Destination = list.Selection.Location + list.Location;
  297. listSelection.DestinationSize = list.Selection.Size;
  298. if (!animate)
  299. {
  300. listSelection.Location = list.Selection.Location + list.Location;
  301. listSelection.Size = list.Selection.Size;
  302. }
  303. }
  304. }
  305. public class AudioTrackSelector : ListContextBarItem
  306. {
  307. private int selectedAudioTrack = 0;
  308. public AudioTrackSelector(HUDVideoOptions options, string title, string image)
  309. : base(options, title, image)
  310. {
  311. languageTrigger.TimeOut += new EventHandler(languageTrigger_TimeOut);
  312. }
  313. void languageTrigger_TimeOut(object sender, EventArgs e)
  314. {
  315. selectedAudioTrack = Options.Video.ActiveAudiotrack = list.SelectedIndex;
  316. //Options.video.ActiveAudiotrack = ((Lizk.SimpleHUD.HUDVideo2.TrackIdentifier)Options.listList.SelectedControl.Tag).id;
  317. }
  318. TimedTrigger<string> languageTrigger = new TimedTrigger<string>(null, new TimeSpan(0, 0, 1));
  319. public override void Deselect()
  320. {
  321. base.Deselect();
  322. }
  323. public void UpdateTracks()
  324. {
  325. list.Clear();
  326. Control.Size = new SizeS(Control.Size.Width, list.ItemSize.Height * Options.Video.Audiotracks.Count);
  327. //Options.listContainer.Location = new PointS(0, 110);
  328. int i = 0;
  329. foreach (Lizk.SimpleHUD.HUDVideo2.TrackIdentifier ti in Options.Video.Audiotracks)
  330. {
  331. HUDContainerSimple hat = new HUDContainerSimple();
  332. hat.Size = list.ItemSize;
  333. hat.Tag = ti;
  334. list.Add(hat);
  335. if (i == Options.Video.ActiveAudiotrack)
  336. list.SelectedIndex = i;
  337. HUDLabel lbl = new HUDLabel(ti.name, "tahoma23b");
  338. lbl.Size = list.ItemSize;
  339. hat.Add(lbl);
  340. i++;
  341. }
  342. UpdateList(false);
  343. }
  344. public override void Selected()
  345. {
  346. base.Selected();
  347. UpdateTracks();
  348. }
  349. public override void Ok()
  350. {
  351. }
  352. public override void Up()
  353. {
  354. base.Up();
  355. languageTrigger.Trigger();
  356. }
  357. public override void Down()
  358. {
  359. base.Down();
  360. languageTrigger.Trigger();
  361. }
  362. public override void Update(TimeSpan ts)
  363. {
  364. base.Update(ts);
  365. languageTrigger.Update();
  366. }
  367. public override void Reapply()
  368. {
  369. Options.Video.ActiveAudiotrack = selectedAudioTrack;
  370. }
  371. }
  372. public class SubtitleTrackSelector : ListContextBarItem
  373. {
  374. private int selectedSubtitle = 0;
  375. public SubtitleTrackSelector(HUDVideoOptions options, string title, string image)
  376. : base(options, title, image)
  377. {
  378. languageTrigger.TimeOut += new EventHandler(languageTrigger_TimeOut);
  379. }
  380. void languageTrigger_TimeOut(object sender, EventArgs e)
  381. {
  382. selectedSubtitle = Options.Video.ActiveSubtitle = list.SelectedIndex;
  383. }
  384. TimedTrigger<string> languageTrigger = new TimedTrigger<string>(null, new TimeSpan(0, 0, 1));
  385. public override void Deselect()
  386. {
  387. base.Deselect();
  388. }
  389. public void UpdateTracks()
  390. {
  391. /* if (Options.ctxList.SelectedControl.Tag != this)
  392. return;
  393. */
  394. list.Clear();
  395. Control.Size = new SizeS(Control.Size.Width, list.ItemSize.Height * Options.Video.Subtitles.Count);
  396. //Options.listContainer.Location = new PointS(0, 110);
  397. int i = 0;
  398. foreach (Lizk.SimpleHUD.HUDVideo2.TrackIdentifier ti in Options.Video.Subtitles)
  399. {
  400. HUDContainerSimple hat = new HUDContainerSimple();
  401. hat.Size = list.ItemSize;
  402. hat.Tag = ti;
  403. list.Add(hat);
  404. if (i == Options.Video.ActiveSubtitle)
  405. list.SelectedIndex = i;
  406. HUDLabel lbl = new HUDLabel(ti.name, "tahoma23b");
  407. lbl.Size = list.ItemSize;
  408. hat.Add(lbl);
  409. i++;
  410. }
  411. UpdateList(false);
  412. }
  413. public override void Selected()
  414. {
  415. base.Selected();
  416. UpdateTracks();
  417. }
  418. public override void Ok()
  419. {
  420. }
  421. public override void Up()
  422. {
  423. base.Up();
  424. languageTrigger.Trigger();
  425. }
  426. public override void Down()
  427. {
  428. base.Down();
  429. languageTrigger.Trigger();
  430. }
  431. public override void Update(TimeSpan ts)
  432. {
  433. base.Update(ts);
  434. languageTrigger.Update();
  435. }
  436. public override void Reapply()
  437. {
  438. Options.Video.ActiveSubtitle = selectedSubtitle;
  439. }
  440. }
  441. public class ZoomSelector : ListContextBarItem
  442. {
  443. private enum Zoom
  444. {
  445. Normal,
  446. Stretch,
  447. FullscreenToWidescreen
  448. }
  449. private Zoom currentZoom = Zoom.Normal;
  450. public ZoomSelector(HUDVideoOptions options, string title, string image)
  451. : base(options, title, image)
  452. {
  453. list.Clear();
  454. Control.Size = new SizeS(Control.Size.Width, list.ItemSize.Height * 3);
  455. //Options.listContainer.Location = new PointS(0, 110);
  456. HUDContainerSimple hat = new HUDContainerSimple();
  457. hat.Size = list.ItemSize;
  458. hat.Tag = Zoom.Normal;
  459. list.Add(hat);
  460. HUDLabel lbl = new HUDLabel("No Zoom", "tahoma23b");
  461. lbl.Size = list.ItemSize;
  462. hat.Add(lbl);
  463. hat = new HUDContainerSimple();
  464. hat.Size = list.ItemSize;
  465. hat.Tag = Zoom.Stretch;
  466. list.Add(hat);
  467. lbl = new HUDLabel("Stretch", "tahoma23b");
  468. lbl.Size = list.ItemSize;
  469. hat.Add(lbl);
  470. hat = new HUDContainerSimple();
  471. hat.Size = list.ItemSize;
  472. hat.Tag = Zoom.FullscreenToWidescreen;
  473. list.Add(hat);
  474. lbl = new HUDLabel("Zoom 16:9", "tahoma23b");
  475. lbl.Size = list.ItemSize;
  476. hat.Add(lbl);
  477. }
  478. public override void Selected()
  479. {
  480. base.Selected();
  481. /*if (Options.ctxList.SelectedControl.Tag != this)
  482. return;
  483. */
  484. UpdateList(false);
  485. }
  486. public override void Up()
  487. {
  488. base.Up();
  489. currentZoom = (Zoom)list.SelectedControl.Tag;
  490. SetZoom(currentZoom);
  491. }
  492. public override void Down()
  493. {
  494. base.Down();
  495. currentZoom = (Zoom)list.SelectedControl.Tag;
  496. SetZoom(currentZoom);
  497. }
  498. private void SetZoom(Zoom z)
  499. {
  500. switch (z)
  501. {
  502. case Zoom.Stretch:
  503. Options.Video.ConstrainProportions = false;
  504. Options.Video.Bounds = Options.Bounds;
  505. break;
  506. case Zoom.FullscreenToWidescreen:
  507. Options.Video.ConstrainProportions = false;
  508. RectangleS r = HUDImage.ResizeConstrained(true, new SizeS(4, 3), Options.Bounds.Size);
  509. SizeS dsage = new SizeS(Options.Bounds.Width, Options.Bounds.Height * Options.Bounds.Width / r.Width);
  510. PointS pso = new PointS(0, -(dsage.Height - Options.Bounds.Height) / 2);
  511. Options.Video.Bounds = new RectangleS(pso, dsage);
  512. break;
  513. case Zoom.Normal:
  514. Options.Video.Bounds = Options.Bounds;
  515. Options.Video.ConstrainProportions = true;
  516. break;
  517. }
  518. }
  519. public override void Ok()
  520. {
  521. }
  522. public override void Reapply()
  523. {
  524. SetZoom(currentZoom);
  525. }
  526. }
  527. public class BrightnessSelector : SliderContextBarItem
  528. {
  529. public BrightnessSelector(HUDVideoOptions options, string title, string image) : base(options, title, image) { }
  530. public override void Selected()
  531. {
  532. base.Selected();
  533. UpdateLabels();
  534. }
  535. private void UpdateLabels()
  536. {
  537. sldLblValue.Text = (sldBar.Value = Options.Video.Brightness).ToString();
  538. sldLblMaxValue.Text = (sldBar.MaxValue = Options.Video.MaxBrightness).ToString();
  539. sldLblMinValue.Text = (sldBar.MinValue = Options.Video.MinBrightness).ToString();
  540. }
  541. public override void Ok()
  542. {
  543. }
  544. public override void Up()
  545. {
  546. value = Options.Video.Brightness += Options.Video.StepBrightness;
  547. UpdateLabels();
  548. }
  549. public override void Down()
  550. {
  551. value = Options.Video.Brightness -= Options.Video.StepBrightness;
  552. UpdateLabels();
  553. }
  554. public override void Reapply()
  555. {
  556. Options.Video.Brightness = value;
  557. }
  558. }
  559. public class ContrastSelector : SliderContextBarItem
  560. {
  561. public ContrastSelector(HUDVideoOptions options, string title, string image) : base(options, title, image) { }
  562. public override void Selected()
  563. {
  564. base.Selected();
  565. UpdateLabels();
  566. }
  567. private void UpdateLabels()
  568. {
  569. sldLblValue.Text = (value = sldBar.Value = Options.Video.Contrast).ToString();
  570. sldLblMaxValue.Text = (sldBar.MaxValue = Options.Video.MaxContrast).ToString();
  571. sldLblMinValue.Text = (sldBar.MinValue = Options.Video.MinContrast).ToString();
  572. }
  573. public override void Ok()
  574. {
  575. }
  576. public override void Up()
  577. {
  578. value = Options.Video.Contrast += Options.Video.StepContrast * 2f;
  579. UpdateLabels();
  580. }
  581. public override void Down()
  582. {
  583. value = Options.Video.Contrast -= Options.Video.StepContrast * 2f;
  584. UpdateLabels();
  585. }
  586. public override void Reapply()
  587. {
  588. Options.Video.Contrast = value;
  589. }
  590. }
  591. public class SaturationSelector : SliderContextBarItem
  592. {
  593. public SaturationSelector(HUDVideoOptions options, string title, string image) : base(options, title, image) { }
  594. public override void Selected()
  595. {
  596. base.Selected();
  597. UpdateLabels();
  598. }
  599. private void UpdateLabels()
  600. {
  601. sldLblValue.Text = (value = sldBar.Value = Options.Video.Saturation).ToString();
  602. sldLblMaxValue.Text = (sldBar.MaxValue = Options.Video.MaxSaturation).ToString();
  603. sldLblMinValue.Text = (sldBar.MinValue = Options.Video.MinSaturation).ToString();
  604. }
  605. public override void Ok()
  606. {
  607. }
  608. public override void Up()
  609. {
  610. value = Options.Video.Saturation += Options.Video.StepSaturation * 2f;
  611. UpdateLabels();
  612. }
  613. public override void Down()
  614. {
  615. value = Options.Video.Saturation -= Options.Video.StepSaturation * 2f;
  616. UpdateLabels();
  617. }
  618. public override void Reapply()
  619. {
  620. Options.Video.Saturation = value;
  621. }
  622. }
  623. public class HueSelector : SliderContextBarItem
  624. {
  625. public HueSelector(HUDVideoOptions options, string title, string image) : base(options, title, image) { }
  626. public override void Selected()
  627. {
  628. base.Selected();
  629. UpdateLabels();
  630. }
  631. private void UpdateLabels()
  632. {
  633. sldLblValue.Text = (value = sldBar.Value = Options.Video.Hue).ToString();
  634. sldLblMaxValue.Text = (sldBar.MaxValue = Options.Video.MaxHue).ToString();
  635. sldLblMinValue.Text = (sldBar.MinValue = Options.Video.MinHue).ToString();
  636. }
  637. public override void Ok()
  638. {
  639. }
  640. public override void Up()
  641. {
  642. value = Options.Video.Hue += Options.Video.StepHue;
  643. UpdateLabels();
  644. }
  645. public override void Down()
  646. {
  647. value = Options.Video.Hue -= Options.Video.StepHue;
  648. UpdateLabels();
  649. }
  650. public override void Reapply()
  651. {
  652. Options.Video.Hue = value;
  653. }
  654. }
  655. public class YesNoSelector : ListContextBarItem
  656. {
  657. public bool Enabled { get; set; }
  658. public YesNoSelector(HUDVideoOptions options, string title, string image)
  659. : base(options, title, image)
  660. {
  661. list.Clear();
  662. Control.Size = new SizeS(Control.Size.Width, list.ItemSize.Height * 2);
  663. //Options.listContainer.Location = new PointS(0, 110);
  664. HUDContainerSimple hat = new HUDContainerSimple();
  665. hat.Size = list.ItemSize;
  666. hat.Tag = true;
  667. list.Add(hat);
  668. HUDLabel lbl = new HUDLabel("Yes", "tahoma23b");
  669. lbl.Size = list.ItemSize;
  670. hat.Add(lbl);
  671. hat = new HUDContainerSimple();
  672. hat.Size = list.ItemSize;
  673. hat.Tag = false;
  674. list.Add(hat);
  675. lbl = new HUDLabel("No", "tahoma23b");
  676. lbl.Size = list.ItemSize;
  677. hat.Add(lbl);
  678. }
  679. public override void Selected()
  680. {
  681. base.Selected();
  682. list.SelectedIndex = Enabled ? 0 : 1;
  683. UpdateList(false);
  684. }
  685. public override void Up()
  686. {
  687. base.Up();
  688. Enabled = (bool)list.SelectedControl.Tag;
  689. }
  690. public override void Down()
  691. {
  692. base.Down();
  693. Enabled = (bool)list.SelectedControl.Tag;
  694. }
  695. public override void Ok()
  696. {
  697. }
  698. public override void Reapply()
  699. {
  700. }
  701. }
  702. }