home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / VPR_DATA / DOGA / SOURCES / MEDIT.LZH / DTRANGE.CPP < prev    next >
C/C++ Source or Header  |  1995-09-07  |  2KB  |  93 lines

  1. /*  Project medit
  2.     Project Team DoGA
  3.     Copyright (c) 1995. All Rights Reserved.
  4.  
  5.     サブシステム:    medit.apx Application
  6.     ファイル:        dtrange.cpp
  7.     作成者:          Taka2
  8.  
  9.  
  10.     概要
  11.     ====
  12.     TDTimeRange (TDialog) のインプリメンテーション用のソースファイル
  13. */
  14.  
  15. #include <owl\owlpch.h>
  16. #pragma hdrstop
  17.  
  18. #include "dtrange.h"
  19. #include "motion.h"
  20.  
  21. const int MaxLength = 8;
  22. const int DefaultMaxFrame = 20;
  23.  
  24. //
  25. // このアプリケーションで処理するすべてのメッセージ/コマンドの
  26. // 応答テーブルを作成する
  27. //
  28. DEFINE_RESPONSE_TABLE1(TDTimeRange, TDialog)
  29. //{{TDTimeRangeRSP_TBL_BEGIN}}
  30.     EV_BN_CLICKED(IDOK, CmOK),
  31. //{{TDTimeRangeRSP_TBL_END}}
  32. END_RESPONSE_TABLE;
  33.  
  34.  
  35. //{{TDTimeRange Implementation}}
  36.  
  37.  
  38. TDTimeRange::TDTimeRange (TWindow* parent, int* begin, int* end, TResId resId, TModule* module):
  39.     TDialog(parent, resId, module)
  40. {
  41.     // INSERT>> コンストラクタ用のコードはここに
  42.  
  43.     beginframe = begin;
  44.     endframe = end;
  45.     EditBegin = new TEdit(this, IDC_EDIT_BEGIN, MaxLength);
  46.     EditEnd   = new TEdit(this, IDC_EDIT_END,   MaxLength);
  47. }
  48.  
  49.  
  50. TDTimeRange::~TDTimeRange ()
  51. {
  52.     Destroy();
  53.  
  54.     // INSERT>> デストラクタ用のコードはここに
  55.  
  56. }
  57.  
  58.  
  59. void TDTimeRange::CmOK ()
  60. {
  61.     // INSERT>> 追加コードはここに
  62.  
  63.     char str[MaxLength+1];
  64.     EditBegin->GetText(str, MaxLength);
  65.     *beginframe = atoi(str);
  66.  
  67.     EditEnd->GetText(str, MaxLength);
  68.     *endframe = atoi(str);
  69.  
  70.     CloseWindow(IDOK);
  71.  
  72. }
  73.  
  74.  
  75. void TDTimeRange::SetupWindow ()
  76. {
  77.     TDialog::SetupWindow();
  78.  
  79.     // INSERT>> 追加のコードはここに
  80.  
  81.     char str[10];
  82.     sprintf(str, "%d", *beginframe);
  83.     EditBegin->SetText(str);
  84.     if (*endframe == 1) {
  85.         sprintf(str, "%d", DefaultMaxFrame);
  86.     } else {
  87.         sprintf(str, "%d", *endframe);
  88.     }
  89.     EditEnd->SetText(str);
  90.     EditEnd->SetSelection(0, strlen(str));
  91. }
  92.  
  93.