home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
WIREVIEW.LZH
/
WINFRAME.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-12-20
|
7KB
|
253 lines
/* Project wireview
DoGA
Copyright (c) 1995. Project Team DoGA. All Rights Reserved.
サブシステム: wireview.apx Application
ファイル: winframe.cpp
作成者: Masamichi Takatsu
概要
====
TWinFrame (TWindow) のインプリメンテーション用のソースファイル
*/
#include <owl\owlpch.h>
#pragma hdrstop
#include <owl\slider.h>
#include "files.h"
#include "matrix.h"
#include "anim.h"
#include "motion.h"
#include "winframe.h"
#include "view.h"
#include "log.h"
#include "bmpbtn.h"
#define ID_TIME 410
//
// このアプリケーションで処理するすべてのメッセージ/コマンドの
// 応答テーブルを作成する
//
DEFINE_RESPONSE_TABLE1(TWinFrame, TWindow)
//{{TWinFrameRSP_TBL_BEGIN}}
EV_CHILD_NOTIFY_ALL_CODES(ID_TIME, EvSlider),
EV_BN_CLICKED(BITMAP_BUTTON_PLAY, EvButtonPlay),
EV_BN_CLICKED(BITMAP_BUTTON_STOP, EvButtonStop),
EV_BN_CLICKED(BITMAP_BUTTON_FRAMEFORWARD, EvButtonForward),
EV_BN_CLICKED(BITMAP_BUTTON_FRAMEBACKWARD, EvButtonBackward),
EV_WM_TIMER,
EV_WM_SIZE,
EV_WM_ACTIVATE,
//{{TWinFrameRSP_TBL_END}}
END_RESPONSE_TABLE;
//{{TWinFrame Implementation}}
TWinFrame::TWinFrame (TWindow* parent, const char far* title, TModule* module):
TWindow(parent, title, module)
{
// INSERT>> コンストラクタ用のコードはここに
int screenX = GetSystemMetrics(SM_CXSCREEN);
int screenY = GetSystemMetrics(SM_CYSCREEN);
int wx, wy;
if (screenX <= 800) {
wx = screenX-80;
wy = screenX * 3 / 4;
} else {
wx = 800;
wy = 600;
}
Attr.W = wx;
#define BUTTONSIZE 24
Attr.H = wy + BUTTONSIZE;
anim = new AnimationData();
anim->Frame = this;
anim->PersView = new TWinView(this, anim, 0, 0, wx, wy);
anim->frameCounter = new THSlider(this, ID_TIME, 0, wy, wx-BUTTONSIZE*4, BUTTONSIZE);
int x = wx-BUTTONSIZE*4, y = wy;
anim->button[0] = new TBmpButton(this, BITMAP_BUTTON_FRAMEBACKWARD, BITMAP_BUTTON_FRAMEBACKWARD, x, y, 24, 24); x += 24;
anim->button[1] = new TBmpButton(this, BITMAP_BUTTON_STOP, BITMAP_BUTTON_STOP, x, y, 24, 24); x += 24;
anim->button[2] = new TBmpButton(this, BITMAP_BUTTON_PLAY, BITMAP_BUTTON_PLAY, x, y, 24, 24); x += 24;
anim->button[3] = new TBmpButton(this, BITMAP_BUTTON_FRAMEFORWARD, BITMAP_BUTTON_FRAMEFORWARD, x, y, 24, 24); x += 24;
#if 0
if (_argc > 1) {
anim->ReadFile(_argv[1]);
}
#endif
}
TWinFrame::~TWinFrame ()
{
Destroy();
// INSERT>> デストラクタ用のコードはここに
}
void TWinFrame::SetupWindow ()
{
TWindow::SetupWindow();
// INSERT>> 追加のコードはここに
// SetTimer(OpPlay, 66);
// SetTimer(OpPause, 1000);
anim->frameCounter->SetRange(BEGIN,anim->maxframe);
anim->frameCounter->SetPosition(anim->selectframe);
anim->frameCounter->SetRuler(10);
}
void TWinFrame::EvTimer (UINT timerId)
{
TWindow::EvTimer(timerId);
// INSERT>> 追加コードはここに
if (timerId == OpPlay) {
anim->playmode = PmTimer;
anim->PersView->Redraw();
if (anim->selectframe >= anim->maxframe) {
if (anim->playmode == PmTimer) {
SetTimer(OpPause, 30);
KillTimer(OpPlay);
}
anim->SelectFrame(BEGIN);
} else {
anim->SelectFrame(anim->selectframe+1);
}
} else if (timerId == OpPause) {
anim->playmode = PmLoop;
KillTimer(timerId);
anim->PersView->Animation();
}
}
void TWinFrame::EvButtonPlay (void)
{
anim->opstat = OpPlay;
SetTimer(OpPause, 100);
}
void TWinFrame::EvButtonStop (void)
{
KillTimer(OpPause);
anim->opstat = OpPause;
}
void TWinFrame::EvButtonForward (void)
{
KillTimer(OpPause);
anim->opstat = OpPause;
if (anim->selectframe < anim->maxframe) {
anim->SelectFrame(anim->selectframe+1);
anim->PersView->Redraw();
}
}
void TWinFrame::EvButtonBackward (void)
{
KillTimer(OpPause);
anim->opstat = OpPause;
if (anim->selectframe > BEGIN) {
anim->SelectFrame(anim->selectframe-1);
anim->PersView->Redraw();
}
}
void TWinFrame::EvSlider(UINT code)
{
KillTimer(OpPause);
anim->opstat = OpPause;
int frame = anim->frameCounter->GetPosition();
if (code != SB_ENDSCROLL
&& anim->selectframe != frame
&& anim->wireframe != NULL
&& BEGIN <= frame
&& frame <= anim->maxframe
&& anim->wireframe[frame-BEGIN].line != NULL) {
anim->selectframe = frame;
anim->PersView->Redraw();
} else if (code == SB_ENDSCROLL
&& anim->selectframe != frame
&& anim->wireframe != NULL
&& BEGIN <= frame && frame <= anim->maxframe) {
anim->selectframe = frame;
anim->PersView->Redraw();
}
// ::SetFocus(anim->Status->HWindow);
}
void TWinFrame::CloseWindow (int retVal)
{
TWindow::CloseWindow(retVal);
// INSERT>> 追加のコードはここに
anim->opstat = OpPause;
}
void TWinFrame::EvSize (UINT sizeType, TSize& size)
{
TWindow::EvSize(sizeType, size);
// INSERT>> 追加コードはここに
#if 0
int screenX = GetSystemMetrics(SM_CXSCREEN);
int screenY = GetSystemMetrics(SM_CYSCREEN);
int wx, wy;
if (size.cy > size.cx * 3 / 4) {
wx = size.cy * 4 / 3;
wy = size.cy;
} else {
wx = size.cx;
wy = size.cx * 3 / 4;
}
wireview_w = wx;
wireview_h = wy + BUTTONSIZE;
// anim->Frame->MoveWindow(0, 0, wx, wy+BUTTONSIZE);
anim->PersView->MoveWindow(0,0,wx,wy);
anim->frameCounter->MoveWindow(0, wy, wx-BUTTONSIZE*4, BUTTONSIZE);
int x = wx-BUTTONSIZE*4, y = wy;
anim->button[0]->MoveWindow(x, y, BUTTONSIZE, BUTTONSIZE); x += BUTTONSIZE;
anim->button[1]->MoveWindow(x, y, BUTTONSIZE, BUTTONSIZE); x += BUTTONSIZE;
anim->button[2]->MoveWindow(x, y, BUTTONSIZE, BUTTONSIZE); x += BUTTONSIZE;
anim->button[3]->MoveWindow(x, y, BUTTONSIZE, BUTTONSIZE); x += BUTTONSIZE;
Invalidate();
#endif
anim->PersView->MoveWindow(0,0,size.cx,size.cy-BUTTONSIZE);
anim->frameCounter->MoveWindow(0, size.cy-BUTTONSIZE, size.cx-BUTTONSIZE*4, BUTTONSIZE);
int x = size.cx-BUTTONSIZE*4, y = size.cy-BUTTONSIZE;
anim->button[0]->MoveWindow(x, y, BUTTONSIZE, BUTTONSIZE); x += BUTTONSIZE;
anim->button[1]->MoveWindow(x, y, BUTTONSIZE, BUTTONSIZE); x += BUTTONSIZE;
anim->button[2]->MoveWindow(x, y, BUTTONSIZE, BUTTONSIZE); x += BUTTONSIZE;
anim->button[3]->MoveWindow(x, y, BUTTONSIZE, BUTTONSIZE); x += BUTTONSIZE;
Invalidate();
}
void TWinFrame::EvActivate (UINT active, BOOL minimized, HWND hWndOther )
{
TWindow::EvActivate(active, minimized, hWndOther );
// INSERT>> 追加コードはここに
}