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

  1. /*  Project medit
  2.     Project Team DoGA
  3.     Copyright (c) 1995. All Rights Reserved.
  4.  
  5.     サブシステム:    medit.apx Application
  6.     ファイル:        dtexpand.cpp
  7.     作成者:          Taka2
  8.  
  9.  
  10.     概要
  11.     ====
  12.     TDTimeExpand (TDialog) のインプリメンテーション用のソースファイル
  13. */
  14.  
  15. #include <owl\owlpch.h>
  16. #pragma hdrstop
  17.  
  18. #include <owl\scrollba.h>
  19. #include <owl\static.h>
  20. #include <owl\inputdia.h>
  21. #include "dtexpand.h"
  22. #include "anim.h"
  23. #include "motion.h"
  24.  
  25.  
  26. //
  27. // このアプリケーションで処理するすべてのメッセージ/コマンドの
  28. // 応答テーブルを作成する
  29. //
  30. DEFINE_RESPONSE_TABLE1(TDTimeExpand, TDialog)
  31. //{{TDTimeExpandRSP_TBL_BEGIN}}
  32.     EV_BN_CLICKED(IDOK, CmOK),
  33.     EV_CHILD_NOTIFY_ALL_CODES(IDC_SCROLL_TIME_BEGIN, EvScrollBegin),
  34.     EV_CHILD_NOTIFY_ALL_CODES(IDC_SCROLL_TIME_END,   EvScrollEnd),
  35.     EV_BN_CLICKED(IDC_BUTTON_NEWFRAME, CmNewFrame),
  36. //{{TDTimeExpandRSP_TBL_END}}
  37. END_RESPONSE_TABLE;
  38.  
  39.  
  40. //{{TDTimeExpand Implementation}}
  41.  
  42.  
  43. TDTimeExpand::TDTimeExpand (TWindow* parent, AnimationData *a, Motion *m, TResId resId, TModule* module):
  44.     TDialog(parent, resId, module)
  45. {
  46.     // INSERT>> コンストラクタ用のコードはここに
  47.  
  48.     anim = a;
  49.     motion = m;
  50.     scrollbegin = new TScrollBar(this, IDC_SCROLL_TIME_BEGIN);
  51.     scrollend   = new TScrollBar(this, IDC_SCROLL_TIME_END);
  52.     framebegin  = new TStatic(this, IDC_NUM_TIME_BEGIN);
  53.     frameend    = new TStatic(this, IDC_NUM_TIME_END);
  54. }
  55.  
  56.  
  57. TDTimeExpand::~TDTimeExpand ()
  58. {
  59.     Destroy();
  60.  
  61.     // INSERT>> デストラクタ用のコードはここに
  62.  
  63. }
  64.  
  65.  
  66. void TDTimeExpand::CmOK ()
  67. {
  68.     // INSERT>> 追加コードはここに
  69.  
  70.        motion->Zoom(begin, end);
  71.     CloseWindow(IDOK);
  72. }
  73.  
  74.  
  75. void TDTimeExpand::SetupWindow ()
  76. {
  77.     TDialog::SetupWindow();
  78.  
  79.     // INSERT>> 追加のコードはここに
  80.     scrollbegin->PageMagnitude = scrollend  ->PageMagnitude = 5;
  81.     scrollbegin->LineMagnitude = scrollend  ->LineMagnitude = 1;
  82.  
  83.     scrollbegin->SetRange(BEGIN, anim->maxframe);
  84.     scrollend  ->SetRange(BEGIN, anim->maxframe);
  85.     scrollbegin->SetPosition(begin);
  86.     scrollend  ->SetPosition(end);
  87.  
  88.     begin = motion->beginframe;
  89.     end = motion->endframe;
  90.  
  91.     char str[10];
  92.     sprintf(str, "%d", begin);
  93.     framebegin->SetText(str);
  94.     sprintf(str, "%d", end);
  95.     frameend->SetText(str);
  96.  
  97. }
  98.  
  99. void TDTimeExpand::EvScrollBegin(UINT /*code*/)
  100. {
  101.     if (begin != scrollbegin->GetPosition()) {
  102.         begin = scrollbegin->GetPosition();
  103.         char str[10];
  104.         sprintf(str, "%d", begin);
  105.         framebegin->SetText(str);
  106.         if (begin > scrollend->GetPosition()) {
  107.             end = begin;
  108.             frameend->SetText(str);
  109.             scrollend->SetPosition(begin);
  110.         }
  111.     }
  112. }
  113.  
  114. void TDTimeExpand::EvScrollEnd(UINT /*code*/)
  115. {
  116.     if (end != scrollend->GetPosition()) {
  117.         end = scrollend->GetPosition();
  118.         char str[10];
  119.         sprintf(str, "%d", end);
  120.         frameend->SetText(str);
  121.         if (scrollbegin->GetPosition() > end) {
  122.             begin = end;
  123.             framebegin->SetText(str);
  124.             scrollbegin->SetPosition(end);
  125.         }
  126.     }
  127. }
  128.  
  129. void TDTimeExpand::CmNewFrame ()
  130. {
  131.     // INSERT>> 追加コードはここに
  132.  
  133.     char str[16];
  134.     sprintf(str, "%d", anim->maxframe);
  135.     TInputDialog dialog((TWindow*)anim->Frame, "新規フレーム設定", "最大フレームを設定してください", str, 16);
  136.     if (dialog.Execute() == IDOK) {
  137.         int n = atoi(str);
  138.         if (anim->maxframe < n && n < 30000) {
  139.             anim->ExpandFrame(n);
  140.  
  141.             scrollbegin->SetRange(BEGIN, anim->maxframe);
  142.             scrollend  ->SetRange(BEGIN, anim->maxframe);
  143.             scrollbegin->SetPosition(begin);
  144.             scrollend  ->SetPosition(end);
  145.         }
  146.     }
  147. }
  148.  
  149.  
  150.