粘贴箱: OmegaChart 任意のローソク足でルーラーを止める MainFrame.cs 追加・修正ポイントには//☆FixDate

格式
Plain text
提交日期
2019-03-07 17:57
Publication Period
Unlimited
  1. /*
  2. * Copyright (c) Daisuke OKAJIMA All rights reserved.
  3. *
  4. * $Id$
  5. */
  6. using System;
  7. using System.Diagnostics;
  8. using System.Drawing;
  9. using System.Collections;
  10. using System.ComponentModel;
  11. using System.Windows.Forms;
  12. using Zanetti.Forms;
  13. using Zanetti.Data;
  14. using Zanetti.DataSource;
  15. using Zanetti.Indicators;
  16. using Zanetti.Commands;
  17. using Zanetti.UI;
  18. using Crownwood.Magic.Common;
  19. using Crownwood.Magic.Controls;
  20. using Crownwood.Magic.Docking;
  21. namespace Zanetti.Forms
  22. {
  23. /// <summary>
  24. /// MainFrame の概要の説明です。
  25. /// </summary>
  26. internal class MainFrame : System.Windows.Forms.Form
  27. {
  28. private DockingManager _manager;
  29. private Content _bookmarkContent;
  30. private InitialAction _initialAction;
  31. private IZModelessForm _modelessDialog;
  32. private AsyncSchemaLoader _asyncLoader;
  33. private BrandListPane _currentBrandListPane;
  34. private System.Windows.Forms.MainMenu _mainMenu;
  35. private System.Windows.Forms.StatusBar _statusBar;
  36. private ChartCanvas _chartCanvas;
  37. private ZMainMenuItem _menuFile;
  38. private ZMenuItem _menuDownload;
  39. private ZMenuItem _menuMRUDownload;
  40. private ZMenuItem _menuBarFile1;
  41. private ZMenuItem _menuInitialize;
  42. private ZMenuItem _menuBarFile2;
  43. private ZMenuItem _menuPrint;
  44. private ZMenuItem _menuBarFile3;
  45. private ZMenuItem _menuExport;
  46. private ZMenuItem _menuExportHalfDaily;
  47. private ZMenuItem _menuDownloadIndexFile;
  48. private ZMenuItem _menuBarFile4;
  49. private ZMenuItem _menuQuit;
  50. private ZMainMenuItem _menuView;
  51. private ZMenuItem _menuHalfDaily;
  52. private ZMenuItem _menuDaily;
  53. private ZMenuItem _menuWeekly;
  54. private ZMenuItem _menuMonthly;
  55. private ZMenuItem _menuYearly;
  56. private ZMenuItem _menuBarView1;
  57. private ZMenuItem _menuJump;
  58. private ZMenuItem _menuJumpHome;
  59. private ZMenuItem _menuJumpEnd;
  60. private ZMenuItem _menuBarJump;
  61. private ZMenuItem _menuJumpPrev;
  62. private ZMenuItem _menuJumpNext;
  63. private ZMenuItem _menuBarView2;
  64. private ZMenuItem _menuBookmark;
  65. private ZMenuItem _menuAddBookmark;
  66. private ZMenuItem _menuBarView3;
  67. private ZMenuItem _menuClearFreeLines;
  68. private ZMenuItem _menuBarView4;
  69. private ZMenuItem _menuLinkToInfo;
  70. private ZMenuItem _menuLinkToYahoo;
  71. private ZMenuItem _menuLinkToNikkei;
  72. private ZMenuItem _menuLinkToInfoseek;
  73. private ZMenuItem _menuLinkToLivedoor;
  74. private ZMenuItem _menuFixDate;//☆FixDate
  75. private ZMainMenuItem _menuMove;
  76. private ZMenuItem _menuBack;
  77. private ZMenuItem _menuFront;
  78. private ZMenuItem _menuBarMove1;
  79. private ZMenuItem _menuInputCode;
  80. private ZMenuItem _menuInputName;
  81. private ZMenuItem _menuIndices;
  82. private ZMenuItem _menuCommodities;
  83. private ZMenuItem _menuDerivedBrand;
  84. private ZMainMenuItem _menuTool;
  85. private ZMenuItem _menuStartScreening;
  86. private ZMenuItem _menuStartAutoTrading;
  87. private ZMenuItem _menuStartVerification;
  88. private ZMenuItem _menuBarTool1;
  89. private ZMenuItem _menuCustomize;
  90. private ZMenuItem _menuKeyConfig;
  91. private ZMenuItem _menuEnvironment;
  92. private ZMenuItem _menuBarTool2;
  93. private ZMenuItem _menuReloadExtensionKit;
  94. private ZMenuItem _menuListExtensionKit;
  95. private ZMenuItem _menuTestExtensionKit;
  96. private ZMainMenuItem _menuHelp;
  97. private ZMenuItem _menuOpenWeb;
  98. private ZMenuItem _menuRegisterCode;
  99. private ZMenuItem _menuBarHelp;
  100. private ZMenuItem _menuAboutBox;
  101. #if ENABLE_SUPPORT_COMMAND
  102. private ZMainMenuItem _menuSupport;
  103. private ZMenuItem _menuRebuildIndex;
  104. private ZMenuItem _menuCreateKey;
  105. //private ZMenuItem _menuSignKit;
  106. private ZMenuItem _menuReload;
  107. private ZMenuItem _menuCreateCert;
  108. private ZMenuItem _menuStatistics;
  109. private ZMenuItem _menuShrinkData;
  110. #endif
  111. /// <summary>
  112. /// 必要なデザイナ変数です。
  113. /// </summary>
  114. private System.ComponentModel.Container components = null;
  115. //Layout.Initの時点ではFrameにアクセスできないといけないので初期化を分離
  116. public MainFrame() {
  117. }
  118. public void Init() {
  119. Env.Layout.Init();
  120. _chartCanvas = new Zanetti.UI.ChartCanvas();
  121. _chartCanvas.Dock = System.Windows.Forms.DockStyle.Fill;
  122. //
  123. // Windows フォーム デザイナ サポートに必要です。
  124. //
  125. InitializeComponent();
  126. InitStatusBar();
  127. //
  128. // TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。
  129. //
  130. AdjustShortcut();
  131. }
  132. public void WarmUpMagicLibrary() {
  133. Type m = typeof(DockingManager);
  134. }
  135. public InitialAction InitialAction {
  136. get {
  137. return _initialAction;
  138. }
  139. set {
  140. _initialAction = value;
  141. }
  142. }
  143. public DockingManager DockingManager {
  144. get {
  145. return _manager;
  146. }
  147. }
  148. public Content BookmarkPaneContent {
  149. get {
  150. return _bookmarkContent;
  151. }
  152. set {
  153. _bookmarkContent = value;
  154. }
  155. }
  156. public IZModelessForm CurrentModelessDialog {
  157. get {
  158. return _modelessDialog;
  159. }
  160. set {
  161. _modelessDialog = value;
  162. }
  163. }
  164. /// <summary>
  165. /// 使用されているリソースに後処理を実行します。
  166. /// </summary>
  167. protected override void Dispose( bool disposing )
  168. {
  169. if( disposing )
  170. {
  171. if(components != null)
  172. {
  173. components.Dispose();
  174. }
  175. }
  176. base.Dispose( disposing );
  177. }
  178. #region Windows フォーム デザイナで生成されたコード
  179. /// <summary>
  180. /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
  181. /// コード エディタで変更しないでください。
  182. /// </summary>
  183. private void InitializeComponent()
  184. {
  185. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainFrame));
  186. this._mainMenu = new System.Windows.Forms.MainMenu();
  187. this._menuFile = new ZMainMenuItem();
  188. this._menuDownload = new ZMenuItem();
  189. this._menuBarFile1 = new ZMenuItem();
  190. this._menuInitialize = new ZMenuItem();
  191. this._menuMRUDownload = new ZMenuItem();
  192. this._menuBarFile2 = new ZMenuItem();
  193. this._menuPrint = new ZMenuItem();
  194. this._menuBarFile3 = new ZMenuItem();
  195. this._menuExport = new ZMenuItem();
  196. this._menuExportHalfDaily = new ZMenuItem();
  197. this._menuDownloadIndexFile = new ZMenuItem();
  198. this._menuBarFile4 = new ZMenuItem();
  199. this._menuQuit = new ZMenuItem();
  200. this._menuView = new ZMainMenuItem();
  201. this._menuHalfDaily = new ZMenuItem();
  202. this._menuDaily = new ZMenuItem();
  203. this._menuWeekly = new ZMenuItem();
  204. this._menuMonthly = new ZMenuItem();
  205. this._menuYearly = new ZMenuItem();
  206. this._menuBarView1 = new ZMenuItem();
  207. this._menuJump = new ZMenuItem();
  208. this._menuJumpHome = new ZMenuItem();
  209. this._menuJumpEnd = new ZMenuItem();
  210. this._menuBarJump = new ZMenuItem();
  211. this._menuJumpPrev = new ZMenuItem();
  212. this._menuJumpNext = new ZMenuItem();
  213. this._menuBarView2 = new ZMenuItem();
  214. this._menuBookmark = new ZMenuItem();
  215. this._menuAddBookmark = new ZMenuItem();
  216. this._menuBarView3 = new ZMenuItem();
  217. this._menuClearFreeLines = new ZMenuItem();
  218. this._menuBarView4 = new ZMenuItem();
  219. this._menuLinkToInfo = new ZMenuItem();
  220. this._menuLinkToYahoo = new ZMenuItem();
  221. this._menuLinkToInfoseek = new ZMenuItem();
  222. this._menuLinkToNikkei = new ZMenuItem();
  223. this._menuLinkToLivedoor = new ZMenuItem();
  224. this._menuFixDate = new ZMenuItem();//☆FixDate
  225. this._menuMove = new ZMainMenuItem();
  226. this._menuBack = new ZMenuItem();
  227. this._menuFront = new ZMenuItem();
  228. this._menuBarMove1 = new ZMenuItem();
  229. this._menuInputCode = new ZMenuItem();
  230. this._menuInputName = new ZMenuItem();
  231. this._menuIndices = new ZMenuItem();
  232. this._menuCommodities = new ZMenuItem();
  233. this._menuDerivedBrand = new ZMenuItem();
  234. this._menuTool = new ZMainMenuItem();
  235. this._menuStartScreening = new ZMenuItem();
  236. this._menuStartAutoTrading = new ZMenuItem();
  237. this._menuStartVerification = new ZMenuItem();
  238. this._menuBarTool1 = new ZMenuItem();
  239. this._menuCustomize = new ZMenuItem();
  240. this._menuKeyConfig = new ZMenuItem();
  241. this._menuEnvironment = new ZMenuItem();
  242. this._menuBarTool2 = new ZMenuItem();
  243. this._menuReloadExtensionKit = new ZMenuItem();
  244. this._menuListExtensionKit = new ZMenuItem();
  245. this._menuTestExtensionKit = new ZMenuItem();
  246. this._menuHelp = new ZMainMenuItem();
  247. this._menuOpenWeb = new ZMenuItem();
  248. this._menuRegisterCode = new ZMenuItem();
  249. this._menuBarHelp = new ZMenuItem();
  250. this._menuAboutBox = new ZMenuItem();
  251. #if ENABLE_SUPPORT_COMMAND
  252. this._menuSupport = new ZMainMenuItem();
  253. this._menuRebuildIndex = new ZMenuItem();
  254. this._menuCreateKey = new ZMenuItem();
  255. this._menuReload = new ZMenuItem();
  256. this._menuStatistics = new ZMenuItem();
  257. this._menuCreateCert = new ZMenuItem();
  258. this._menuShrinkData = new ZMenuItem();
  259. #endif
  260. this._statusBar = new System.Windows.Forms.StatusBar();
  261. this.SuspendLayout();
  262. //
  263. // _mainMenu
  264. //
  265. this._mainMenu.MenuItems.AddRange(new ZMainMenuItem[] {
  266. this._menuFile,
  267. this._menuView,
  268. this._menuMove,
  269. this._menuTool,
  270. this._menuHelp,
  271. #if ENABLE_SUPPORT_COMMAND
  272. this._menuSupport
  273. #endif
  274. });
  275. //
  276. // _menuFile
  277. //
  278. this._menuFile.Index = 0;
  279. this._menuFile.MenuItems.AddRange(new ZMenuItem[] {
  280. this._menuDownload,
  281. this._menuMRUDownload,
  282. this._menuBarFile1,
  283. this._menuInitialize,
  284. this._menuBarFile2,
  285. this._menuPrint,
  286. this._menuBarFile3,
  287. this._menuExport,
  288. this._menuExportHalfDaily,
  289. this._menuDownloadIndexFile,
  290. this._menuBarFile4,
  291. this._menuQuit});
  292. this._menuFile.Text = "ファイル(&F)";
  293. this._menuFile.Popup += new System.EventHandler(this.OnAdjustFileMenu);
  294. //
  295. // _menuDownload
  296. //
  297. this._menuDownload.Index = 0;
  298. this._menuDownload.Text = "データのダウンロード(&D)...";
  299. this._menuDownload.Click += new System.EventHandler(this.OnMenu);
  300. this._menuDownload.CID = CID.ShowDownloadDialog;
  301. //
  302. // _menuMRUDownload
  303. //
  304. this._menuMRUDownload.Index = 1;
  305. this._menuMRUDownload.Text = "保存した設定でダウンロード(&S)";
  306. //
  307. // _menuBarFile1
  308. //
  309. this._menuBarFile1.Index = 2;
  310. this._menuBarFile1.Text = "-";
  311. //
  312. // _menuInitialize
  313. //
  314. this._menuInitialize.Index = 3;
  315. this._menuInitialize.Text = "データの初期化(&I)...";
  316. this._menuInitialize.Click += new System.EventHandler(this.OnMenu);
  317. this._menuInitialize.CID = CID.ShowInitializeDialog;
  318. //
  319. // _menuBarFile2
  320. //
  321. this._menuBarFile2.Index = 4;
  322. this._menuBarFile2.Text = "-";
  323. //
  324. // _menuPrint
  325. //
  326. this._menuPrint.Index = 5;
  327. this._menuPrint.Text = "印刷(&P)...";
  328. this._menuPrint.Click += new System.EventHandler(this.OnMenu);
  329. this._menuPrint.CID = CID.ShowPrintDialog;
  330. //
  331. // _menuBarFile3
  332. //
  333. this._menuBarFile3.Index = 6;
  334. this._menuBarFile3.Text = "-";
  335. //
  336. // _menuExport
  337. //
  338. this._menuExport.Index = 7;
  339. this._menuExport.Text = "データのエクスポート(&E)...";
  340. this._menuExport.Click += new System.EventHandler(this.OnMenu);
  341. this._menuExport.CID = CID.ExportBrand;
  342. //
  343. // _menuExportHalfDaily
  344. //
  345. this._menuExportHalfDaily.Index = 8;
  346. this._menuExportHalfDaily.Text = "半日足のエクスポート(&H)...";
  347. this._menuExportHalfDaily.Click += new System.EventHandler(this.OnMenu);
  348. this._menuExportHalfDaily.CID = CID.ExportHalfDaily;
  349. this._menuExportHalfDaily.Visible = false;
  350. //
  351. // _menuDownloadIndexFile
  352. //
  353. this._menuDownloadIndexFile.Index = 9;
  354. this._menuDownloadIndexFile.Text = "インデックスファイルのダウンロード(&I)";
  355. this._menuDownloadIndexFile.Click += new System.EventHandler(this.OnMenu);
  356. this._menuDownloadIndexFile.CID = CID.DownloadIndexFile;
  357. //
  358. // _menuBarFile4
  359. //
  360. this._menuBarFile4.Index = 10;
  361. this._menuBarFile4.Text = "-";
  362. //
  363. // _menuQuit
  364. //
  365. this._menuQuit.Index = 11;
  366. this._menuQuit.Text = "終了(&X)";
  367. this._menuQuit.Click += new System.EventHandler(this.OnMenu);
  368. this._menuQuit.CID = CID.Quit;
  369. //
  370. // _menuView
  371. //
  372. this._menuView.Index = 1;
  373. this._menuView.MenuItems.AddRange(new ZMenuItem[] {
  374. this._menuHalfDaily,
  375. this._menuDaily,
  376. this._menuWeekly,
  377. this._menuMonthly,
  378. this._menuYearly,
  379. this._menuBarView1,
  380. this._menuBookmark,
  381. this._menuAddBookmark,
  382. this._menuBarView2,
  383. this._menuClearFreeLines,
  384. this._menuBarView3,
  385. this._menuLinkToInfo//});
  386. , this._menuFixDate});//☆FixDate
  387. this._menuView.Text = "表示(&V)";
  388. this._menuView.Popup += new System.EventHandler(this.OnAdjustViewMenu);
  389. //
  390. // _menuHalfDaily
  391. //
  392. this._menuHalfDaily.Index = 0;
  393. this._menuHalfDaily.Visible = false;
  394. this._menuHalfDaily.Text = "半日足(&H)";
  395. this._menuHalfDaily.Click += new System.EventHandler(this.OnMenu);
  396. this._menuHalfDaily.CID = CID.SetStyleHalfDaily;
  397. //
  398. // _menuDaily
  399. //
  400. this._menuDaily.Index = 1;
  401. this._menuDaily.Text = "日足(&D)";
  402. this._menuDaily.Click += new System.EventHandler(this.OnMenu);
  403. this._menuDaily.CID = CID.SetStyleDaily;
  404. //
  405. // _menuWeekly
  406. //
  407. this._menuWeekly.Index = 2;
  408. this._menuWeekly.Text = "週足(&W)";
  409. this._menuWeekly.Click += new System.EventHandler(this.OnMenu);
  410. this._menuWeekly.CID = CID.SetStyleWeekly;
  411. //
  412. // _menuMonthly
  413. //
  414. this._menuMonthly.Index = 3;
  415. this._menuMonthly.Text = "月足(&M)";
  416. this._menuMonthly.Click += new System.EventHandler(this.OnMenu);
  417. this._menuMonthly.CID = CID.SetStyleMonthly;
  418. //
  419. // _menuMonthly
  420. //
  421. this._menuYearly.Index = 4;
  422. this._menuYearly.Text = "年足(&Y)";
  423. this._menuYearly.Click += new System.EventHandler(this.OnMenu);
  424. this._menuYearly.CID = CID.SetStyleYearly;
  425. //
  426. // _menuBarView1
  427. //
  428. this._menuBarView1.Index = 5;
  429. this._menuBarView1.Text = "-";
  430. //
  431. // _menuBookmark
  432. //
  433. this._menuBookmark.Index = 6;
  434. this._menuBookmark.Text = "お気に入りの表示(&B)";
  435. this._menuBookmark.Click += new System.EventHandler(this.OnMenu);
  436. this._menuBookmark.CID = CID.ToggleBookmarkPane;
  437. //
  438. // _menuAddBookmark
  439. //
  440. this._menuAddBookmark.Index = 7;
  441. this._menuAddBookmark.Text = "お気に入りへ追加(&A)...";
  442. this._menuAddBookmark.Click += new System.EventHandler(this.OnMenu);
  443. this._menuAddBookmark.CID = CID.ShowAddBookmarkDialog;
  444. //
  445. // _menuBarView2
  446. //
  447. this._menuBarView2.Index = 8;
  448. this._menuBarView2.Text = "-";
  449. //
  450. // _menuClearFreeLines
  451. //
  452. this._menuClearFreeLines.Index = 9;
  453. this._menuClearFreeLines.Text = "自由直線のクリア(&C)";
  454. this._menuClearFreeLines.Click += new System.EventHandler(this.OnMenu);
  455. this._menuClearFreeLines.CID = CID.ClearFreeLines;
  456. //
  457. // _menuBarView5
  458. //
  459. this._menuBarView3.Index = 10;
  460. this._menuBarView3.Text = "-";
  461. //
  462. // _menuLinkToInfo
  463. //
  464. this._menuLinkToInfo.Index = 11;
  465. this._menuLinkToInfo.MenuItems.AddRange(new ZMenuItem[] {
  466. this._menuLinkToYahoo,
  467. this._menuLinkToInfoseek,
  468. this._menuLinkToNikkei,
  469. this._menuLinkToLivedoor});
  470. this._menuLinkToInfo.Text = "企業情報へのリンク(&L)";
  471. //
  472. // _menuLinkToYahoo
  473. //
  474. this._menuLinkToYahoo.Index = 0;
  475. this._menuLinkToYahoo.Text = "Yahoo(&Y)";
  476. this._menuLinkToYahoo.Click += new System.EventHandler(this.OnMenu);
  477. this._menuLinkToYahoo.CID = CID.OpenCompanyInfoSite_Yahoo;
  478. //
  479. // _menuLinkToInfoseek
  480. //
  481. this._menuLinkToInfoseek.Index = 1;
  482. this._menuLinkToInfoseek.Text = "Infoseek(&I)";
  483. this._menuLinkToInfoseek.Click += new System.EventHandler(this.OnMenu);
  484. this._menuLinkToInfoseek.CID = CID.OpenCompanyInfoSite_Infoseek;
  485. //
  486. // _menuLinkToNikkei
  487. //
  488. this._menuLinkToNikkei.Index = 2;
  489. this._menuLinkToNikkei.Text = "日経新聞(&N)";
  490. this._menuLinkToNikkei.Click += new System.EventHandler(this.OnMenu);
  491. this._menuLinkToNikkei.CID = CID.OpenCompanyInfoSite_Nikkei;
  492. //
  493. // _menuLinkToLivedoor
  494. //
  495. this._menuLinkToLivedoor.Index = 3;
  496. this._menuLinkToLivedoor.Text = "livedoor(&L)";
  497. this._menuLinkToLivedoor.Click += new System.EventHandler(this.OnMenu);
  498. this._menuLinkToLivedoor.CID = CID.OpenCompanyInfoSite_Livedoor;
  499. //☆FixDate
  500. this._menuFixDate.Index = 12;
  501. this._menuFixDate.Text = "日付ルーラーの固定";
  502. this._menuFixDate.Click += new System.EventHandler(this.OnMenu);
  503. this._menuFixDate.CID = CID.FixDate;
  504. //
  505. // _menuMove
  506. //
  507. this._menuMove.Index = 2;
  508. this._menuMove.MenuItems.AddRange(new ZMenuItem[] {
  509. this._menuBack,
  510. this._menuFront,
  511. this._menuBarMove1,
  512. this._menuInputCode,
  513. this._menuInputName,
  514. this._menuIndices,
  515. this._menuCommodities,
  516. this._menuDerivedBrand
  517. });
  518. this._menuMove.Text = "移動(&M)";
  519. this._menuMove.Popup += new System.EventHandler(this.OnAdjustMoveMenu);
  520. //
  521. // _menuBack
  522. //
  523. this._menuBack.Index = 0;
  524. this._menuBack.Text = "戻る(&B)";
  525. this._menuBack.Click += new System.EventHandler(this.OnMenu);
  526. this._menuBack.CID = CID.Back;
  527. //
  528. // _menuFront
  529. //
  530. this._menuFront.Index = 1;
  531. this._menuFront.Text = "進む(&F)";
  532. this._menuFront.Click += new System.EventHandler(this.OnMenu);
  533. this._menuFront.CID = CID.Front;
  534. //
  535. // _menuBarTool1
  536. //
  537. this._menuBarMove1.Index = 2;
  538. this._menuBarMove1.Text = "-";
  539. //
  540. // _menuInputCode
  541. //
  542. this._menuInputCode.Index = 3;
  543. this._menuInputCode.Text = "銘柄コードを指定(&C)...";
  544. this._menuInputCode.Click += new System.EventHandler(this.OnMenu);
  545. this._menuInputCode.CID = CID.ShowInputCode;
  546. //
  547. // _menuInputName
  548. //
  549. this._menuInputName.Index = 4;
  550. this._menuInputName.Text = "名前から検索(&S)...";
  551. this._menuInputName.Click += new System.EventHandler(this.OnMenu);
  552. this._menuInputName.CID = CID.ShowSearchBrandDialog;
  553. //
  554. // _menuIndices
  555. //
  556. this._menuIndices.Index = 5;
  557. this._menuIndices.Text = "指数・為替(&I)";
  558. //
  559. // _menuCommodities
  560. //
  561. this._menuCommodities.Index = 6;
  562. this._menuCommodities.Visible = false;
  563. this._menuCommodities.Text = "商品先物(&O)";
  564. //
  565. // _menuDerivedBrand
  566. //
  567. this._menuDerivedBrand.Index = 7;
  568. this._menuDerivedBrand.Text = "派生銘柄(&U)";
  569. //
  570. // _menuTool
  571. //
  572. this._menuTool.Index = 3;
  573. this._menuTool.MenuItems.AddRange(new ZMenuItem[] {
  574. this._menuStartScreening,
  575. this._menuStartAutoTrading,
  576. this._menuStartVerification,
  577. this._menuBarTool1,
  578. this._menuCustomize,
  579. this._menuKeyConfig,
  580. this._menuEnvironment,
  581. this._menuBarTool2,
  582. this._menuReloadExtensionKit,
  583. this._menuListExtensionKit,
  584. this._menuTestExtensionKit});
  585. this._menuTool.Text = "ツール(&T)";
  586. //
  587. // _menuStartScreening
  588. //
  589. this._menuStartScreening.Index = 0;
  590. this._menuStartScreening.Text = "スクリーニング(&S)...";
  591. this._menuStartScreening.Click += new System.EventHandler(this.OnMenu);
  592. this._menuStartScreening.CID = CID.ShowScreeningDialog;
  593. //
  594. // _menuStartAutoTrading
  595. //
  596. this._menuStartAutoTrading.Index = 1;
  597. this._menuStartAutoTrading.Text = "自動売買検証(&U)...";
  598. this._menuStartAutoTrading.Click += new System.EventHandler(this.OnMenu);
  599. this._menuStartAutoTrading.CID = CID.ShowAutoTradingDialog;
  600. //
  601. // _menuStartVerification
  602. //
  603. this._menuStartVerification.Index = 2;
  604. this._menuStartVerification.Text = "セオリー検証(&V)...";
  605. this._menuStartVerification.Click += new System.EventHandler(this.OnMenu);
  606. this._menuStartVerification.CID = CID.ShowPredictionDialog;
  607. //
  608. // _menuBarTool1
  609. //
  610. this._menuBarTool1.Index = 3;
  611. this._menuBarTool1.Text = "-";
  612. //
  613. // _menuCustomize
  614. //
  615. this._menuCustomize.Index = 4;
  616. this._menuCustomize.Text = "カスタマイズ(&C)...";
  617. this._menuCustomize.Click += new System.EventHandler(this.OnMenu);
  618. this._menuCustomize.CID = CID.ShowCustomizeDialog;
  619. //
  620. // _menuKeyConfig
  621. //
  622. this._menuKeyConfig.Index = 5;
  623. this._menuKeyConfig.Text = "キー割り当て(&A)...";
  624. this._menuKeyConfig.Click += new System.EventHandler(this.OnMenu);
  625. this._menuKeyConfig.CID = CID.ShowKeyConfigDialog;
  626. //
  627. // _menuEnvironment
  628. //
  629. this._menuEnvironment.Index = 6;
  630. this._menuEnvironment.Text = "環境設定(&E)...";
  631. this._menuEnvironment.Click += new System.EventHandler(this.OnMenu);
  632. this._menuEnvironment.CID = CID.ShowEnvironmentDialog;
  633. //
  634. // _menuBarTool2
  635. //
  636. this._menuBarTool2.Index = 7;
  637. this._menuBarTool2.Text = "-";
  638. //
  639. // _menuReloadExtensionKit
  640. //
  641. this._menuReloadExtensionKit.Index = 8;
  642. this._menuReloadExtensionKit.Text = "拡張キットのリロード(&R)";
  643. this._menuReloadExtensionKit.Click += new System.EventHandler(this.OnMenu);
  644. this._menuReloadExtensionKit.CID = CID.ReloadKit;
  645. //
  646. // _menuListExtensionKit
  647. //
  648. this._menuListExtensionKit.Index = 9;
  649. this._menuListExtensionKit.Text = "拡張キットの一覧(&K)...";
  650. this._menuListExtensionKit.Click += new System.EventHandler(this.OnMenu);
  651. this._menuListExtensionKit.CID = CID.ShowExtensionKitDialog;
  652. //
  653. // _menuTestExtensionKit
  654. //
  655. this._menuTestExtensionKit.Index = 10;
  656. this._menuTestExtensionKit.Text = "拡張キットのテスト(&T)...";
  657. this._menuTestExtensionKit.Click += new System.EventHandler(this.OnMenu);
  658. this._menuTestExtensionKit.CID = CID.ShowTestKitDialog;
  659. //
  660. // _menuHelp
  661. //
  662. this._menuHelp.Index = 4;
  663. this._menuHelp.MenuItems.AddRange(new ZMenuItem[] {
  664. this._menuOpenWeb,
  665. this._menuRegisterCode,
  666. this._menuBarHelp,
  667. this._menuAboutBox});
  668. this._menuHelp.Text = "ヘルプ(&H)";
  669. //
  670. // _menuOpenWeb
  671. //
  672. this._menuOpenWeb.Index = 0;
  673. this._menuOpenWeb.Text = "OmegaChartのWebを開く(&W)";
  674. this._menuOpenWeb.Click += new System.EventHandler(this.OnMenu);
  675. this._menuOpenWeb.CID = CID.OpenWeb;
  676. //
  677. // _menuRegistCode
  678. //
  679. this._menuRegisterCode.Index = 1;
  680. this._menuRegisterCode.Text = "Contribution Certificate登録(&R)...";
  681. this._menuRegisterCode.Click += new System.EventHandler(this.OnMenu);
  682. this._menuRegisterCode.CID = CID.RegisterUserCode;
  683. //
  684. // _menuBarHelp
  685. //
  686. this._menuBarHelp.Index = 2;
  687. this._menuBarHelp.Text = "-";
  688. //
  689. // _menuAboutBox
  690. //
  691. this._menuAboutBox.Index = 3;
  692. this._menuAboutBox.Text = "バージョン情報(&A)...";
  693. this._menuAboutBox.Click += new System.EventHandler(this.OnMenu);
  694. this._menuAboutBox.CID = CID.ShowAboutBox;
  695. #if ENABLE_SUPPORT_COMMAND
  696. //
  697. // _menuSupport
  698. //
  699. this._menuSupport.Index = 5;
  700. this._menuSupport.MenuItems.AddRange(new ZMenuItem[] {
  701. this._menuRebuildIndex,
  702. this._menuCreateKey,
  703. this._menuReload,
  704. this._menuCreateCert,
  705. this._menuStatistics,
  706. this._menuShrinkData
  707. });
  708. this._menuSupport.Text = "サポート";
  709. //
  710. // _menuRebuildIndex
  711. //
  712. this._menuRebuildIndex.Index = 0;
  713. this._menuRebuildIndex.Text = "インデックス再構築";
  714. this._menuRebuildIndex.Click += new System.EventHandler(this.OnMenu);
  715. this._menuRebuildIndex.CID = CID.SupRebuildIndex;
  716. //
  717. // _menuCreateKey
  718. //
  719. this._menuCreateKey.Index = 1;
  720. this._menuCreateKey.Text = "鍵の作成(既存の鍵は消える)";
  721. this._menuCreateKey.Click += new System.EventHandler(this.OnMenu);
  722. this._menuCreateKey.CID = CID.SupCreateKey;
  723. //
  724. // _menuReload
  725. //
  726. this._menuReload.Index = 2;
  727. this._menuReload.Text = "Reload";
  728. this._menuReload.Click += new System.EventHandler(this.OnMenu);
  729. this._menuReload.CID = CID.SupReload;
  730. //
  731. // _menuCreateCert
  732. //
  733. this._menuCreateCert.Index = 3;
  734. this._menuCreateCert.Text = "Certificate生成";
  735. this._menuCreateCert.Click += new System.EventHandler(this.OnMenu);
  736. this._menuCreateCert.CID = CID.SupCreateCert;
  737. //
  738. // _menuStatistics
  739. //
  740. this._menuStatistics.Index = 4;
  741. this._menuStatistics.Text = "Statistics";
  742. this._menuStatistics.Click += new System.EventHandler(this.OnMenu);
  743. this._menuStatistics.CID = CID.SupStatistics;
  744. //
  745. // _menuShrinkData
  746. //
  747. this._menuShrinkData.Index = 4;
  748. this._menuShrinkData.Text = "データ縮小";
  749. this._menuShrinkData.Click += new System.EventHandler(this.OnMenu);
  750. this._menuShrinkData.CID = CID.SupShrinkData;
  751. #endif
  752. //
  753. // _statusBar
  754. //
  755. this._statusBar.Location = new System.Drawing.Point(0, 213);
  756. this._statusBar.Name = "_statusBar";
  757. this._statusBar.Size = new System.Drawing.Size(292, 22);
  758. this._statusBar.TabIndex = 0;
  759. this._statusBar.DoubleClick += new System.EventHandler(this.OnStatusBarDoubleClicked);
  760. //
  761. // MainFrame
  762. //
  763. this.Controls.Add(this._chartCanvas);
  764. this.Controls.Add(this._statusBar);
  765. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  766. this.Menu = this._mainMenu;
  767. this.Name = "MainFrame";
  768. this.Text = Env.Constants.AppTitle;
  769. this.ImeMode = ImeMode.Disable;
  770. this.ResumeLayout(false);
  771. }
  772. #endregion
  773. public ChartCanvas ChartCanvas {
  774. get {
  775. return _chartCanvas;
  776. }
  777. }
  778. public BrandListPane CurrentBrandListPane {
  779. get {
  780. return _currentBrandListPane;
  781. }
  782. set {
  783. _currentBrandListPane = value;
  784. }
  785. }
  786. private void InitMenus() {
  787. //MRU
  788. InitMRUDownloadMenu();
  789. //指標を追加
  790. AddIndexMenu(BuiltInIndex.Nikkei225);
  791. AddIndexMenu(BuiltInIndex.TOPIX);
  792. AddIndexMenu(BuiltInIndex.JASDAQ);
  793. //AddIndexMenu(BuiltInIndex.LONGTERM_INTEREST); DreamVisor
  794. AddIndexMenu(BuiltInIndex.Nikkei225_F);
  795. AddIndexMenu(BuiltInIndex.TOPIX_F);
  796. Util.AddMenuBar(_menuIndices);
  797. AddIndexMenu(BuiltInIndex.JPYUSD);
  798. AddIndexMenu(BuiltInIndex.JPYEUR);
  799. Util.AddMenuBar(_menuIndices);
  800. AddIndexMenu(BuiltInIndex.Dow);
  801. AddIndexMenu(BuiltInIndex.Nasdaq);
  802. AddIndexMenu(BuiltInIndex.SP500);
  803. Util.AddMenuBar(_menuIndices);
  804. MenuItem sectors = new ZMenuItem();
  805. sectors.Text = "業種別(&S)";
  806. _menuIndices.MenuItems.Add(sectors);
  807. for(int i=(int)BuiltInIndexGroup.SectorIndexStart; i<=(int)BuiltInIndexGroup.SectorIndexEnd; i++)
  808. AddBrandMenu(sectors, Env.BrandCollection.FindBrand(i));
  809. #if DOJIMA
  810. for(int i=CommodityUtil.INDEX_START; i<=CommodityUtil.INDEX_END; i++)
  811. AddBrandMenu(_menuCommodities, Env.BrandCollection.FindBrand(i));
  812. _menuCommodities.Visible = true;
  813. _menuHalfDaily.Visible = true;
  814. _menuExportHalfDaily.Visible = true;
  815. _menuOpenWeb.Visible = false;
  816. _menuRegisterCode.Visible = false;
  817. _menuBarHelp.Visible = false;
  818. #endif
  819. ArrayList derived = Env.BrandCollection.DerivedBrands;
  820. if(derived.Count>0) {
  821. foreach(DerivedBrand br in derived)
  822. AddBrandMenu(_menuDerivedBrand, br);
  823. }
  824. }
  825. private void AddIndexMenu(BuiltInIndex mi) {
  826. AbstractBrand br = Env.BrandCollection.FindBrand((int)mi);
  827. AddBrandMenu(_menuIndices, br);
  828. }
  829. private void AddBrandMenu(Menu parent, AbstractBrand br) {
  830. ZMenuItem menu = new ZMenuItem();
  831. menu.Text = String.Format("{0}:{1}", br.CodeAsString, br.Name.Replace("&", "&&"));
  832. menu.Index = _menuIndices.MenuItems.Count;
  833. menu.Click += new EventHandler(OnMenu);
  834. menu.CID = CID.ShowSpecifiedBrand;
  835. parent.MenuItems.Add(menu);
  836. }
  837. public void InitMRUDownloadMenu() {
  838. _menuMRUDownload.MenuItems.Clear();
  839. bool mru_found = false;
  840. for(int i=0; i<Env.Options.DownloadOrders.Count; i++) {
  841. DownloadOrder o = Env.Options.DownloadOrders[i];
  842. ZMenuItem mi = new ZMenuItem();
  843. mi.Text = String.Format("&{0} {1}", i+1, Env.Options.DownloadOrders.GetDescription(i));
  844. mi.Enabled = o!=null;
  845. mi.Click += new EventHandler(OnMRUDownloadOrder);
  846. _menuMRUDownload.MenuItems.Add(mi);
  847. mru_found = true;
  848. }
  849. _menuMRUDownload.Enabled = mru_found;
  850. }
  851. private void OnMRUDownloadOrder(object sender, EventArgs args) {
  852. DownloadOrder o = Env.Options.DownloadOrders[((MenuItem)sender).Index];
  853. Debug.Assert(o!=null);
  854. CommandExec.ShowDownloadDialog(o);
  855. }
  856. private void InitStatusBar() {
  857. StatusBarPanel mp = new StatusBarPanel();
  858. mp.Style = StatusBarPanelStyle.Text;
  859. mp.AutoSize = StatusBarPanelAutoSize.Spring;
  860. _statusBar.ShowPanels = true;
  861. _statusBar.Panels.Add(mp);
  862. }
  863. public void SetStatusBarText(string text, string tooltip) {
  864. _statusBar.Panels[0].Text = text;
  865. _statusBar.Panels[0].ToolTipText = tooltip;
  866. }
  867. private void OnStatusBarDoubleClicked(object sender, EventArgs args) {
  868. if(_modelessDialog!=null) {
  869. _modelessDialog.ZShow();
  870. SetStatusBarText("", "");
  871. }
  872. }
  873. public void AdjustShortcut() {
  874. foreach(MenuItem mi in this._mainMenu.MenuItems)
  875. AdjustShortcut(mi);
  876. }
  877. private void AdjustShortcut(MenuItem mi) {
  878. ZMenuItem zmi = mi as ZMenuItem;
  879. if(zmi!=null && zmi.CID!=CID.None)
  880. zmi.ShortcutKey = Env.Command.Get(zmi.CID).Shortcut;
  881. foreach(MenuItem ch in mi.MenuItems)
  882. AdjustShortcut(ch);
  883. }
  884. public bool IsBookmarkPaneVisible {
  885. get {
  886. return _bookmarkContent!=null && _bookmarkContent.Visible;
  887. }
  888. }
  889. private void OnMenu(object sender, EventArgs args) {
  890. try {
  891. if(_asyncLoader!=null) return; //ロード中はメニュー起動しない
  892. ZMenuItem mi = (ZMenuItem)sender;
  893. if(mi.CID==CID.ShowInputCode)
  894. CommandExec.PromptInputCode(true, '\0');
  895. else if(mi.CID==CID.ShowSpecifiedBrand)
  896. CommandExec.ShowBrand(Env.BrandCollection.FindBrand(MenuItemToCode(mi)));
  897. else if(mi.CID!=CID.None)
  898. Env.Command.Exec(mi.CID);
  899. else
  900. Util.Warning(this, "NOT IMPLEMENTED YET!");
  901. }
  902. catch(Exception ex) {
  903. Util.ReportCriticalError(ex);
  904. }
  905. }
  906. private void OnAdjustViewMenu(object sender, EventArgs args) {
  907. AdjustViewMenu(_menuView);
  908. }
  909. private void OnAdjustMoveMenu(object sender, EventArgs args) {
  910. _menuBack.Enabled = Env.BrandHistory.HasBack;
  911. _menuFront.Enabled = Env.BrandHistory.HasFront;
  912. }
  913. //本体とコンテキストメニューの両方があるので
  914. private void AdjustViewMenu(Menu parent) {
  915. parent.MenuItems[_menuBookmark.Index].Checked = (_bookmarkContent!=null && _bookmarkContent.Visible);
  916. #if DOJIMA
  917. parent.MenuItems[_menuHalfDaily.Index].Checked = Env.CurrentIndicators.Format==ChartFormat.HalfDaily;
  918. #endif
  919. parent.MenuItems[_menuDaily.Index].Checked = Env.CurrentIndicators.Format==ChartFormat.Daily;
  920. parent.MenuItems[_menuWeekly.Index].Checked = Env.CurrentIndicators.Format==ChartFormat.Weekly;
  921. parent.MenuItems[_menuMonthly.Index].Checked = Env.CurrentIndicators.Format==ChartFormat.Monthly;
  922. parent.MenuItems[_menuYearly.Index].Checked = Env.CurrentIndicators.Format == ChartFormat.Yearly;
  923. parent.MenuItems[_menuLinkToInfo.Index].Enabled = !_chartCanvas.GetBrand().IsBuiltIn;
  924. }
  925. private void OnAdjustFileMenu(object sender, EventArgs args) {
  926. _menuDownload.Enabled = _modelessDialog==null;
  927. _menuMRUDownload.Enabled = _modelessDialog==null;
  928. }
  929. public ContextMenu CreateContextMenu() {
  930. ContextMenu cm = new ContextMenu();
  931. foreach(ZMenuItem mi in _menuView.MenuItems) {
  932. MenuItem cl = mi.CloneMenu();
  933. cm.MenuItems.Add(cl);
  934. }
  935. AdjustViewMenu(cm);
  936. return cm;
  937. }
  938. private void FinishAsyncLoad(IntPtr lparam) {
  939. Debug.Assert(_asyncLoader!=null);
  940. InitMenus();
  941. //失敗の場合でもDockingManagerは必要
  942. _manager = new DockingManager(this, VisualStyle.IDE);
  943. _manager.ContentHidden += _manager_ContentHidden;
  944. _manager.ContentShown += _manager_ContentShown;
  945. _manager.OuterControl = _statusBar;
  946. _manager.InnerControl = _chartCanvas;
  947. if(lparam.ToInt32()==AsyncConst.LPARAM_FINISHED) {
  948. Env.CurrentIndicators = _asyncLoader.IndicatorSet;
  949. Env.BrandCollection.ClearAllFarms();
  950. AbstractBrand br = _chartCanvas.GetBrand();
  951. _chartCanvas.ReloadFromPreference();
  952. _chartCanvas.LoadBrand(br, false);
  953. Invalidate(true);
  954. }
  955. else {
  956. Util.Warning(this, "スキーマのロード中にエラーが発生しました。\n"+_asyncLoader.ErrorMessage);
  957. }
  958. _asyncLoader = null;
  959. foreach(MenuItem mi in _mainMenu.MenuItems) mi.Enabled = true;
  960. this.Cursor = Cursors.Default;
  961. CommandExec.ResetLayout();
  962. #if DOJIMA
  963. if(!Env.Options.DojimaPasswordVerified)
  964. new Dojima.PasswordDialog().ShowDialog(this);
  965. #endif
  966. }
  967. protected override void OnActivated(EventArgs e) {
  968. base.OnActivated (e);
  969. if(_initialAction==null || _initialAction.Performed) {
  970. //if(!_chartCanvas.Focused) _chartCanvas.Focus();
  971. return;
  972. }
  973. _initialAction.Performed = true;
  974. //!!こういった処理がOnActivatedにあるのも変だが...
  975. foreach(MenuItem mi in _mainMenu.MenuItems) mi.Enabled = false;
  976. CommandExec.ShowBrand(Env.BrandCollection.FindBrand(_initialAction.BrandCode));
  977. this.Cursor = Cursors.AppStarting;
  978. _asyncLoader = new AsyncSchemaLoader(this);
  979. _asyncLoader.AsyncLoad();
  980. DecupleData.Decuple(); // データの10倍化
  981. }
  982. protected override void OnClosing(CancelEventArgs e) {
  983. base.OnClosing (e);
  984. Env.Options.FrameLocation = new Rectangle(this.Location, this.Size);
  985. Env.Options.WindowState = this.WindowState;
  986. if(_modelessDialog!=null) _modelessDialog.ZAbort();
  987. }
  988. protected override bool ProcessDialogKey(Keys keyData) {
  989. //Debug.WriteLine("ProcessDialogKey(Frame)");
  990. return ProcessShortcut(keyData);
  991. }
  992. public bool IsPriorShortcutKey(Keys keyData) {
  993. return (Keys.D0<=keyData && keyData<=Keys.D9) || (Keys.NumPad0<=keyData && keyData<=Keys.NumPad9);
  994. }
  995. public bool ProcessShortcut(Keys keyData) {
  996. if(Env.Command.Exec(keyData)!=CommandResult.Ignored)
  997. return true;
  998. else
  999. return false;
  1000. }
  1001. protected override void OnMouseWheel(MouseEventArgs e) {
  1002. Env.Command.ExecMouseWheel(e.Delta);
  1003. }
  1004. private int MenuItemToCode(object sender) {
  1005. string t = ((MenuItem)sender).Text;
  1006. return Int32.Parse(t.Substring(0, t.IndexOf(':')));
  1007. }
  1008. private void _manager_ContentHidden(Content c, EventArgs cea) {
  1009. _chartCanvas.Focus();
  1010. if(c.Control is BrandListPane)
  1011. _currentBrandListPane = null;
  1012. }
  1013. private void _manager_ContentShown(Content c, EventArgs cea) {
  1014. if(c.Control is BrandListPane)
  1015. _currentBrandListPane = (BrandListPane)c.Control;
  1016. }
  1017. protected override void WndProc(ref Message m) {
  1018. const int WM_SETCODE = Win32.WM_USER + 100;
  1019. const int WM_SETSPAN = Win32.WM_USER + 101;
  1020. base.WndProc (ref m);
  1021. if(m.Msg==AsyncConst.WM_ASYNCPROCESS)
  1022. FinishAsyncLoad(m.LParam);
  1023. else if (m.Msg == WM_SETCODE)
  1024. {
  1025. int code = (int)m.WParam;
  1026. AbstractBrand br = Env.BrandCollection.FindBrand(code);
  1027. if (br != null) CommandExec.ShowBrand(br);
  1028. }
  1029. else if (m.Msg == WM_SETSPAN)
  1030. {
  1031. int style = (int)m.WParam;
  1032. switch (style)
  1033. {
  1034. case 1:
  1035. CommandExec.SetChartFormat(ChartFormat.Daily);
  1036. break;
  1037. case 2:
  1038. CommandExec.SetChartFormat(ChartFormat.Weekly);
  1039. break;
  1040. case 3:
  1041. CommandExec.SetChartFormat(ChartFormat.Monthly);
  1042. break;
  1043. case 4:
  1044. CommandExec.SetChartFormat(ChartFormat.Yearly);
  1045. break;
  1046. }
  1047. }
  1048. }
  1049. }
  1050. internal interface IZModelessForm {
  1051. void ZShow();
  1052. void ZAbort();
  1053. }
  1054. }
下载 可打印视图

网址

Embed with JavaScript

Embed with iframe

原始文本