home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / VPR_DATA / DOGA / SOURCES / MEDIT.LZH / DROTKEY.CPP < prev    next >
C/C++ Source or Header  |  1995-08-10  |  6KB  |  262 lines

  1. /*  Project medit
  2.     Project Team DoGA
  3.     Copyright (c) 1995. All Rights Reserved.
  4.  
  5.     サブシステム:    medit.apx Application
  6.     ファイル:        drotkey.cpp
  7.     作成者:          Taka2
  8.  
  9.  
  10.     概要
  11.     ====
  12.     TDRotKey (TDialog) のインプリメンテーション用のソースファイル
  13. */
  14.  
  15. #include <owl\owlpch.h>
  16. #pragma hdrstop
  17.  
  18. #include <owl\button.h>
  19. #include <owl\radiobut.h>
  20. #include <owl\groupbox.h>
  21. #include "drotkey.h"
  22. #include "motion.h"
  23.  
  24. #include "log.h"
  25.  
  26.  
  27. //
  28. // このアプリケーションで処理するすべてのメッセージ/コマンドの
  29. // 応答テーブルを作成する
  30. //
  31. DEFINE_RESPONSE_TABLE1(TDRotKey, TDialog)
  32. //{{TDRotKeyRSP_TBL_BEGIN}}
  33.     EV_BN_CLICKED(IDOK, OKClicked),
  34.     EV_BN_CLICKED(IDCANCEL, CancelClicked),
  35.     EV_BN_CLICKED(IDC_DELETE, DelClicked),
  36.  
  37.     EV_BN_CLICKED(IDC_RADIOBUTTON_PREV_FORWARD, CmPrevForward),
  38.     EV_BN_CLICKED(IDC_RADIOBUTTON_PREV_LINEAR,  CmPrevLinear),
  39.     EV_BN_CLICKED(IDC_RADIOBUTTON_PREV_TARGET,  CmPrevTarget),
  40.     EV_BN_CLICKED(IDC_RADIOBUTTON_NEXT_FORWARD, CmNextForward),
  41.     EV_BN_CLICKED(IDC_RADIOBUTTON_NEXT_LINEAR,  CmNextLinear),
  42.     EV_BN_CLICKED(IDC_RADIOBUTTON_NEXT_TARGET,  CmNextTarget),
  43. //{{TDRotKeyRSP_TBL_END}}
  44. END_RESPONSE_TABLE;
  45.  
  46.  
  47. //{{TDRotKey Implementation}}
  48.  
  49.  
  50. TDRotKey::TDRotKey (TWindow* parent, Motion *m, int frame, TResId resId, TModule* module):
  51.     TDialog(parent, resId, module)
  52. {
  53.     // INSERT>> コンストラクタ用のコードはここに
  54.     motion = m;
  55.     nowpose = frame - m->beginframe;
  56.  
  57.     prev_box = new TGroupBox(this, IDC_GROUPBOX1);
  58.     prev_forward = new TRadioButton(this, IDC_RADIOBUTTON_PREV_FORWARD, prev_box);
  59.     prev_linear  = new TRadioButton(this, IDC_RADIOBUTTON_PREV_LINEAR,  prev_box);
  60.     prev_target  = new TRadioButton(this, IDC_RADIOBUTTON_PREV_TARGET,  prev_box);
  61.     next_box = new TGroupBox(this, IDC_GROUPBOX2);
  62.     next_forward = new TRadioButton(this, IDC_RADIOBUTTON_NEXT_FORWARD, next_box);
  63.     next_linear  = new TRadioButton(this, IDC_RADIOBUTTON_NEXT_LINEAR,  next_box);
  64.     next_target  = new TRadioButton(this, IDC_RADIOBUTTON_NEXT_TARGET,  next_box);
  65.     button_delete = new TButton(this, IDC_DELETE);
  66. }
  67.  
  68.  
  69. TDRotKey::~TDRotKey ()
  70. {
  71.     Destroy();
  72.  
  73.     // INSERT>> デストラクタ用のコードはここに
  74.  
  75. }
  76.  
  77.  
  78. void TDRotKey::SetupWindow ()
  79. {
  80.     TDialog::SetupWindow();
  81.  
  82.     // INSERT>> 追加のコードはここに
  83.  
  84.     nextkeypose = -1;
  85.     for (int i = nowpose+1; i < motion->endframe - motion->beginframe + 1; ++i) {
  86.         if (motion->pose[i].dirtype != DirNone) {
  87.             nextkeypose = i;
  88.             break;
  89.         }
  90.     }
  91.  
  92.     prev_target->EnableWindow(FALSE);
  93.     next_target->EnableWindow(FALSE);
  94.  
  95.     if (nextkeypose < 0) {
  96.         nowpose = motion->endframe - motion->beginframe;
  97.         switch (motion->pose[nowpose].dirtype) {
  98.         case DirInit:
  99.         case DirNone:
  100.         case DirForward:
  101.             prev_forward->SetCheck(BF_CHECKED);
  102.             break;
  103.         case DirLinear:
  104.             prev_linear->SetCheck(BF_CHECKED);
  105.             break;
  106.         case DirTarget:
  107.             prev_target->SetCheck(BF_CHECKED);
  108.             break;
  109.         }
  110.         next_forward->EnableWindow(FALSE);
  111.         next_linear->EnableWindow(FALSE);
  112.         next_target->EnableWindow(FALSE);
  113.         next_box->EnableWindow(FALSE);
  114.         button_delete->EnableWindow(FALSE);
  115.     } else if (motion->pose[nowpose].dirtype == DirNone) {
  116.         switch (motion->pose[nextkeypose].dirtype) {
  117.         case DirInit:
  118.         case DirNone:
  119.         case DirForward:
  120.             prev_forward->SetCheck(BF_CHECKED);
  121.             next_forward->SetCheck(BF_CHECKED);
  122.             break;
  123.         case DirLinear:
  124.             prev_linear->SetCheck(BF_CHECKED);
  125.             next_linear->SetCheck(BF_CHECKED);
  126.             break;
  127.         case DirTarget:
  128.             prev_target->SetCheck(BF_CHECKED);
  129.             next_target->SetCheck(BF_CHECKED);
  130.             break;
  131.         }
  132.         button_delete->EnableWindow(FALSE);
  133.     } else {
  134.         switch (motion->pose[nextkeypose].dirtype) {
  135.         case DirInit:
  136.         case DirNone:
  137.         case DirForward:
  138.             next_forward->SetCheck(BF_CHECKED);
  139.             break;
  140.         case DirLinear:
  141.             next_linear->SetCheck(BF_CHECKED);
  142.             break;
  143.         case DirTarget:
  144.             next_target->SetCheck(BF_CHECKED);
  145.             break;
  146.         }
  147.         switch (motion->pose[nowpose].dirtype) {
  148.         case DirInit:
  149.         case DirNone:
  150.         case DirForward:
  151.             prev_forward->SetCheck(BF_CHECKED);
  152.             break;
  153.         case DirLinear:
  154.             prev_linear->SetCheck(BF_CHECKED);
  155.             break;
  156.         case DirTarget:
  157.             prev_target->SetCheck(BF_CHECKED);
  158.             break;
  159.         }
  160.     }
  161. }
  162.  
  163.  
  164. void TDRotKey::BNClicked ()
  165. {
  166.     // INSERT>> 追加コードはここに
  167.  
  168. }
  169.  
  170.  
  171. void TDRotKey::OKClicked ()
  172. {
  173.     // INSERT>> 追加コードはここに
  174.  
  175.     if (prev_forward->GetCheck() == BF_CHECKED) {
  176.         motion->pose[nowpose].dirtype = DirForward;
  177.     } else if (prev_linear->GetCheck() == BF_CHECKED) {
  178.         motion->pose[nowpose].dirtype = DirLinear;
  179.     } else if (prev_target->GetCheck() == BF_CHECKED) {
  180.         motion->pose[nowpose].dirtype = DirTarget;
  181.     }
  182.     if (next_forward->GetCheck() == BF_CHECKED) {
  183.         motion->pose[nextkeypose].dirtype = DirForward;
  184.     } else if (next_linear->GetCheck() == BF_CHECKED) {
  185.         motion->pose[nextkeypose].dirtype = DirLinear;
  186.     } else if (next_target->GetCheck() == BF_CHECKED) {
  187.         motion->pose[nextkeypose].dirtype = DirTarget;
  188.     }
  189.     CloseWindow(IDOK);
  190. }
  191.  
  192.  
  193. void TDRotKey::CancelClicked ()
  194. {
  195.     // INSERT>> 追加コードはここに
  196.  
  197.     Destroy(IDCANCEL);
  198. }
  199.  
  200.  
  201. void TDRotKey::DelClicked ()
  202. {
  203.     // INSERT>> 追加コードはここに
  204.  
  205.     motion->pose[nowpose].dirtype = DirNone;
  206.     CloseWindow(IDOK);
  207. }
  208.  
  209. void TDRotKey::CmNextForward ()
  210. {
  211.     // INSERT>> 追加コードはここに
  212.     next_forward->SetCheck(TRUE);
  213.     next_linear ->SetCheck(FALSE);
  214.     next_target ->SetCheck(FALSE);
  215.  
  216. }
  217. void TDRotKey::CmNextLinear ()
  218. {
  219.     // INSERT>> 追加コードはここに
  220.  
  221.     next_forward->SetCheck(FALSE);
  222.     next_linear ->SetCheck(TRUE);
  223.     next_target ->SetCheck(FALSE);
  224.  
  225. }
  226. void TDRotKey::CmNextTarget ()
  227. {
  228.     // INSERT>> 追加コードはここに
  229.  
  230.     next_forward->SetCheck(FALSE);
  231.     next_linear ->SetCheck(FALSE);
  232.     next_target ->SetCheck(TRUE);
  233.  
  234. }
  235. void TDRotKey::CmPrevForward ()
  236. {
  237.     // INSERT>> 追加コードはここに
  238.  
  239.     prev_forward->SetCheck(TRUE);
  240.     prev_linear ->SetCheck(FALSE);
  241.     prev_target ->SetCheck(FALSE);
  242.  
  243. }
  244. void TDRotKey::CmPrevLinear ()
  245. {
  246.     // INSERT>> 追加コードはここに
  247.     prev_forward->SetCheck(FALSE);
  248.     prev_linear ->SetCheck(TRUE);
  249.     prev_target ->SetCheck(FALSE);
  250.  
  251. }
  252. void TDRotKey::CmPrevTarget ()
  253. {
  254.     // INSERT>> 追加コードはここに
  255.  
  256.     prev_forward->SetCheck(FALSE);
  257.     prev_linear ->SetCheck(FALSE);
  258.     prev_target ->SetCheck(TRUE);
  259.  
  260. }
  261.  
  262.