Beispiel #1
0
//************************************************************************
int Man::Move(Field* src,SDL_Surface* screen)
{
// Przegladanie listy mozliwych ruchow.
    for(std::list<Field*>::iterator iter=Moves.begin();iter!=Moves.end();iter++){
    // Gdy w lisce znajduje sie ruch o takich samych wspulrzednych jakie zostaly podane do funkcji..
        if(src == (*iter)){
        // Gdy na polu jest figura przeciwnika..
            if((*iter)->figureOnField!=NULL){
                // Wyklucza figure z gry.
                dynamic_cast<Chessman*>((*iter)->figureOnField)->ChessmanOut();
                ((*iter)->figureOnField)=NULL;
            }
            firstMove=false;
    // Zmienia wspulrzedne polozenia figury na planszy i w tablicy na wskazane przez argumenty w funkcji.
            ChangePosition((*iter)->positionOnBoardX,(*iter)->positionOnBoardY);
    // Odrysowuje pole na ktorym figura stala.
            figureOnField->ShowField(screen);
    // Zeruje wskaznik w polu. Pole staje sie wolne.
            figureOnField->figureOnField=NULL;
    // Przypisuje jako pole bazowe pole na ktore figura sie ruszyla.
            figureOnField=(*iter);
    // Polu bazowym przypisuje wskaznik na figure.
            figureOnField->figureOnField=this;
    // Odrysowuje figure na nowym polu.
            ShowField(screen);

            return 1;
        }
    }
return 0;
}
TILE :: TILE()
{
	ClassName="TILE";
	ChangePosition(-1,-1);
	color = 0;
	invisible = false;
	positionX=-1;
	positionY=-1;
}
long TabStops :: InitDlg(wInitDlgMsg m)
{
 	spin = new wSpinButton(this, TABSTOPS);
	spin->SetRange(wRange(1,200));
	spin->SetValue( (long)(*((ushort*)(m.pCreateParams()))) );
	spin->SetFocus();
	ChangePosition(PosCenter, OwnerWindow());
	return FALSE;
}
Beispiel #4
0
// --------------------------------------------------------------------------------------------
// Initialisierung der Sheet (Call-Back-Funktion)
void CDesignDlg::WindowInit (Event)
{
	m_OK.FInit();
//	m_Cancel.FInit();
	
// Position dieses Dialoges bestimmen
Point Pt = DialogPosition (m_FixPt, m_FixPt, GetSize());

//	_ASSERTE (Pt.X() >= 0);	// durch die Änderung in DialogPosition()
//	_ASSERTE (Pt.Y() >= 0);

	ChangePosition (Pt);	// Dialog positionieren

} // WindowInit
AppWindow :: AppWindow()
{	
	CreateWindow(FaTitleBar | FaTaskList | FaSysMenu | FaSizeBorder | FaMinMax);
	SetCaption("FormWindow Demo");					  // Set captions
	SetSwitchTitle("FormWindow Demo Program");
	SetIcon(icon = new wIcon(ResIcon, I_FORMDEMO));   // Set the app's icon

	// This section create a menu bar and then adds items to the
	// sub menu itself.  It is also possible to construct the menu
	// from the resource file if desired

	menubar = new wMenu(this, 100, "~Form\\~Help\\");
	menubar->SetSubMenuItems(SM_HELP, MI_HELP, "~Help for help...;~General help...;~Keys help...;Help ~index;");
	
	// connect to HelpManager object
	AssociateHelp();	
	help = ThisThread->HelpInstance();

	np = new FormNoteBook(this, IdNotebook, wPointl(2, 0, DlgUnits),
						 wDimension(296, 150, DlgUnits), WsVisible | BkSpiralBinding);

	np->SetMajorTabDimension(wDimension(42, 12, DlgUnits));
	np->SetMinorTabDimension(wDimension(40, 12, DlgUnits));
	wNoteBookPageList *pages = np->Pages();
	data = new FormData;

	forms[0]  = new StringForm(pages, data);
	forms[1]  = new CharForm(pages, data);
	forms[2]  = new MLEStringForm(pages, data);
	forms[3]  = new DateForm(pages, data);
	forms[4]  = new TimeForm(pages, data);
	forms[5]  = new ShortForm(pages, data);
	forms[6]  = new LongForm(pages, data);
	forms[7]  = new FloatForm(pages, data);
	forms[8]  = new MoneyForm(pages, data);
	forms[9]  = new ButtonForm(pages, data);
	forms[10] = new ListForm(pages, data);

	ChangeFrameSize( CalcFrameSize(wDimension(310, 160, DlgUnits)) );
	ChangePosition(PosCenter);
	np->GotoPage((*pages)[1]);
	Show();
	ToTop();
}
Beispiel #6
0
void JamCracker::NewNote(void)
{
	NoteInfo *adr;
	PattInfo *pattInfo;

	adr = address;
	address += 4;		// Go to the next row

	if (--noteCnt == 0)
	{
		songPos++;
		if (--songCnt == 0)
		{
			songPos = 0;
			songCnt = songLen;

			//
			// Next module
			//
			endReached = true;
		}

		//
		// Next position
		//
		ChangePosition();

		pattInfo = &pattTable[songTable[songPos]];
		noteCnt  = pattInfo->size;
		address  = pattInfo->address;
	}

	tmpDMACON = 0;
	NwNote(adr, &variables[0]);
	NwNote(++adr, &variables[1]);
	NwNote(++adr, &variables[2]);
	NwNote(++adr, &variables[3]);

	SetVoice(&variables[0]);
	SetVoice(&variables[1]);
	SetVoice(&variables[2]);
	SetVoice(&variables[3]);
}
long SearchDlg :: InitDlg(wInitDlgMsg)
{
	srch = new wEntry(this, SEARCH);
	repl = new wEntry(this, REPLACE);
	cs = new wCheckBox(this, CASE);
	srch->SetText(*search);
	repl->SetText(*replace);

	// SELECT ALL CURRENT FIND TEXT
	if (!search->IsBlank())
		srch->SetSelection(wRange(0, search->Length()));

	cs->SetCheck(*sens);		// SET CHECKBOX TO PREVIOUS STATE
	ChangePosition(PosCenter, OwnerWindow());	// CENTER DIALOG WINDOW IN PARENT
	ToTop();

	srch->SetFocus();	// SET FOCUS TO THE ENTRY FIELD
	return TRUE;
}
Beispiel #8
0
//------------------------------- Close ---------------------------------------
//-----------------------------------------------------------------------------
void Raven_Door::Close()
{
  if (m_Status == closing)
  {
    if (m_dCurrentSize == m_dSize)
    {
      m_Status = closed;
      return;
      
    }

    //reduce the current size
    m_dCurrentSize += 1;

    Clamp(m_dCurrentSize, 0, m_dSize);

    ChangePosition(m_vP1, m_vP1 + m_vtoP2Norm * m_dCurrentSize);

  }
}
Beispiel #9
0
void SoundFX::PlaySound(void)
{
	uint32 *patternAdr;

	// Find the pattern address
	patternAdr = patterns[orders[trackPos]] + posCounter;

	// Parse the pattern data
	PlayNote(&channelInfo[0], virtChannels[0], patternAdr[0]);
	PlayNote(&channelInfo[1], virtChannels[1], patternAdr[1]);
	PlayNote(&channelInfo[2], virtChannels[2], patternAdr[2]);
	PlayNote(&channelInfo[3], virtChannels[3], patternAdr[3]);

	// Did we need to break the current pattern?
	if (breakFlag)
	{
		breakFlag  = false;
		posCounter = 4 * 63;
	}

	// Go to the next pattern line
	posCounter += 4;
	if (posCounter == 4 * 64)
	{
		// Okay, the pattern is done, go to the next pattern
		posCounter = 0;
		trackPos++;

		// Tell APlayer we have changed the position
		ChangePosition();

		if (trackPos == songLength)
		{
			// Module is done, loop it
			trackPos   = 0;
			endReached = true;
		}
	}
}
Beispiel #10
0
//---------------------------- Open -------------------------------------------
void Raven_Door::Open()
{
  if (m_Status == opening)
  {
    if (m_dCurrentSize < 2)
    {
      m_Status = open;

      m_iNumTicksCurrentlyOpen = m_iNumTicksStayOpen;

      return;
      
    }

    //reduce the current size
    m_dCurrentSize -= 1;

    Clamp(m_dCurrentSize, 0, m_dSize);

    ChangePosition(m_vP1, m_vP1 + m_vtoP2Norm * m_dCurrentSize);

  }
}
Document :: Document(wWindow *parent) : wMdiDocument(MDI_MAXTITLEAUTO)
{
	char 		buf[80];
	wDimension 	d=parent->GetSize();

	CreateWindow(parent, FaTitleBar | FaSysMenu | FaMinMax | FaSizeBorder);
	mle = 0;

	ChangeFrameSize(wDimension(d.xWidth() / 3, d.yHeight() / 3));
	ChangePosition(wPointl(5,5));
	mle = new wMLEntry(this, 0, wPointl(0,0), GetSize(), MlHscroll | MlVscroll);

	SetIcon(icon = new wIcon(ResIcon, I_DOC));

	sprintf(buf, "Untitled #%d", ++unnamed);
	SetCaption(buf);
	fname = buf;
	saveas = TRUE;

	mle->SetForeground(((Editor*)parent)->ForeG());
	mle->SetBackground(((Editor*)parent)->BackG());

	mle->SetFont( ((Editor*)parent)->Font() );
	mle->SetTabStop(((Editor*)parent)->Tab());
	mle->SetWrap(((Editor*)parent)->WordWrap());

	mle->SetFirstChar(0);		// REPOSITION TO FIRST CHARACTER
	mle->SetCursorPosition(0);	// PLACE CURSOR
	mle->EnableUpdate();
	mle->Show();				// SHOW IT
	mle->SetFocus();			// GIVE IT FOCUS SO CURSOR APPEARS
	mle->SetModified(FALSE);


	Show();
}
		long InitDlg(wInitDlgMsg)               { ChangePosition(PosCenter, OwnerWindow()); return FALSE; }
Beispiel #13
0
ReturnType FrequencyFilter::onExecute()
{
    // 영상을 Inport로부터 취득
    opros_any *pData = ImageIn.pop();
    RawImage result;

    if(pData != NULL) {

        // 포트로 부터 이미지 취득
        RawImage Image = ImageIn.getContent(*pData);
        RawImageData *RawImage = Image.getImage();

        // 현재영상의 크기를 취득
        m_in_width = RawImage->getWidth();
        m_in_height = RawImage->getHeight();

        // 받은 영상의 2의 승수임을 확인
        if(!Check2Square(m_in_width) || !Check2Square(m_in_height)) {

            std::cout << "This image is not a multifplier of 2" << std::endl;

            return OPROS_BAD_INPUT_PARAMETER;

        }

        // 받은 영상의 가로 세로 사이즈가 같은지 확인
        if(m_in_width != m_in_height) {

            std::cout << "Size(width and height) of Image is not equal" << std::endl;

            return OPROS_BAD_INPUT_PARAMETER;

        }

        // 원본영상의 이미지영역 확보
        if(m_orig_img == NULL) {
            m_orig_img = cvCreateImage(cvSize(m_in_width, m_in_height), IPL_DEPTH_8U, 3);
        }
        // 바이너리 영상영역의 확보
        if(m_gray_img == NULL) {
            m_gray_img = cvCreateImage(cvSize(m_in_width, m_in_height), IPL_DEPTH_8U, 1);
        }
        // 수행결과 영상영역의 확보
        if(m_result_img == NULL) {
            m_result_img = cvCreateImage(cvSize(m_in_width, m_in_height), IPL_DEPTH_8U, 1);
        }
        // 출력결과 영상영역의 확보
        if(m_final_img == NULL) {
            m_final_img = cvCreateImage(cvSize(m_in_width, m_in_height), IPL_DEPTH_8U, 3);
        }
        // Re영역 영상영역의 확보(실수)
        if(m_image_Re == NULL) {
            m_image_Re = cvCreateImage(cvSize(m_in_width, m_in_height), IPL_DEPTH_32F, 1);
        }
        // Im영역 영상영역의 확보(허수)
        if(m_image_Im == NULL) {
            m_image_Im = cvCreateImage(cvSize(m_in_width, m_in_height), IPL_DEPTH_32F, 1);
        }
        // 주파수 변환 영상영역의 확보.
        if(m_pDFT_A == NULL) {
            m_pDFT_A = cvCreateImage(cvSize(m_in_width, m_in_height), IPL_DEPTH_32F, 2);
        }

        // 영상에 대한 정보를 확보!memcpy
        memcpy(m_orig_img->imageData, RawImage->getData(), RawImage->getSize());

        // 둘다 none 이 아니거나, 둘중에 하나가 none 일경우
        if((m_low_Pass_Filtering != "none" || m_high_Pass_Filtering != "none") &&
                (m_low_Pass_Filtering == "none" || m_high_Pass_Filtering == "none")) {

            // 입력 받은 영상을 이진화 시킴
            cvCvtColor( m_orig_img, m_gray_img, CV_BGR2GRAY );

            // 주파수영역으로의 작업을 위한 깊이 정보 변경
            cvConvertScale(m_gray_img, m_image_Re);		// 8U -> 32F
            // m_image_Im의 초기화
            cvZero(m_image_Im);

            // shift center
            // 입력영상을 실수부로 변환한 이미지가 홀수인 화소의 부호를 변경하여
            // 푸리에변환에 의한 주파수 영역의 원점을 중심으로 이동시키기 위함
            ChangePosition(m_image_Re);

            cvMerge(m_image_Re, m_image_Im, NULL, NULL, m_pDFT_A);

            // m_pDFT_A에 대해 푸리에 변환을 수행
            cvDFT(m_pDFT_A, m_pDFT_A, CV_DXT_FORWARD);

            // 이상적 저주파 통과 필터링 실행
            if(m_low_Pass_Filtering == "ideal" && m_high_Pass_Filtering == "none") {

                IdealLowPassFiltering(m_pDFT_A, m_cutoff_Frequency);

            }
            // 버터워스 저주파 통과 필터링 실행
            else if(m_low_Pass_Filtering == "butterworth" && m_high_Pass_Filtering == "none") {

                ButterworthLowPassFiltering(m_pDFT_A, m_cutoff_Frequency, 2);

            }
            // 가우시안 저주파 통과 필터링 실행
            else if(m_low_Pass_Filtering == "gaussian" && m_high_Pass_Filtering == "none") {

                GaussianLowPassFiltering(m_pDFT_A, m_cutoff_Frequency);

            }
            // 이상적 고주파 통과 필터링 실행
            else if(m_high_Pass_Filtering == "ideal" && m_low_Pass_Filtering == "none") {

                IdealHighPassFiltering(m_pDFT_A, m_cutoff_Frequency);

            }
            // 버터워스 고주파 통과 필터링 실행
            else if(m_high_Pass_Filtering == "butterworth" && m_low_Pass_Filtering == "none") {

                ButterworthHighPassFiltering(m_pDFT_A, m_cutoff_Frequency, 2);

            }
            // 가우시안 고주파 통과 필터링 실행
            else if(m_high_Pass_Filtering == "gaussian" && m_low_Pass_Filtering == "none") {

                GaussianHighpassFiltering(m_pDFT_A, m_cutoff_Frequency);


            }
            else {
                //none
            }

            // 퓨리에 역변환 실행
            cvDFT(m_pDFT_A, m_pDFT_A, CV_DXT_INV_SCALE);

            // 다중 채널의 행렬을 단일 채널 행렬로 분할(Re, Im으로)
            cvSplit(m_pDFT_A, m_image_Re, m_image_Im, NULL, NULL);

            // 저주파일때만 실행
            if((m_low_Pass_Filtering == "ideal" || m_low_Pass_Filtering == "butterworth" || m_low_Pass_Filtering == "gaussian")
                    && m_high_Pass_Filtering == "none") {
                ChangePosition(m_image_Re);
                cvScale(m_image_Re, m_result_img, 1);
            }

            // 고주파일때만 실행
            if((m_high_Pass_Filtering == "ideal" || m_high_Pass_Filtering == "butterworth" || m_high_Pass_Filtering == "gaussian")
                    && m_low_Pass_Filtering == "none") {

                // 스펙트럼의 진폭을 계산 Mag=sqrt(Re^2 + Im^2)
                cvPow(m_image_Re, m_image_Re, 2.0);
                cvPow(m_image_Im, m_image_Im, 2.0);
                cvAdd(m_image_Re, m_image_Re, m_image_Re);
                cvPow(m_image_Re, m_image_Re, 0.5);

                // 진폭 화상의 픽셀치가 min과 max사이에 분포하로독 스케일링
                double min_val, max_val;
                cvMinMaxLoc(m_image_Re, &min_val, &max_val, NULL, NULL);
                cvScale(m_image_Re, m_result_img, 255.0/max_val);
            }

            // 1채널 영상의 3채널 영상으로의 변환
            cvMerge(m_result_img, m_result_img, m_result_img, NULL, m_final_img);

            // 아웃풋 push
            // RawImage의 이미지 포인터 변수 할당
            RawImageData *pimage = result.getImage();

            // 입력된 이미지 사이즈 및 채널수로 로 재 설정
            pimage->resize(m_final_img->width, m_final_img->height, m_final_img->nChannels);

            // 영상의 총 크기(pixels수) 취득
            int size = m_final_img->width * m_final_img->height * m_final_img->nChannels;

            // 영상 데이터로부터 영상값만을 할당하기 위한 변수
            unsigned char *ptrdata = pimage->getData();

            // 현재 프레임 영상을 사이즈 만큼 memcpy
            memcpy(ptrdata, m_final_img->imageData, size);

            // 포트아웃
            opros_any mdata = result;
            ImageOut.push(result);//전달

            delete pData;

        } else {

            // 아웃풋 push
            // 아웃풋 push
            // RawImage의 이미지 포인터 변수 할당
            RawImageData *pimage = result.getImage();

            // 입력된 이미지 사이즈 및 채널수로 로 재 설정
            pimage->resize(m_orig_img->width, m_orig_img->height, m_orig_img->nChannels);

            // 영상의 총 크기(pixels수) 취득
            int size = m_orig_img->width * m_orig_img->height * m_orig_img->nChannels;

            // 영상 데이터로부터 영상값만을 할당하기 위한 변수
            unsigned char *ptrdata = pimage->getData();

            // 현재 프레임 영상을 사이즈 만큼 memcpy
            memcpy(ptrdata, m_orig_img->imageData, size);

            // 포트아웃
            opros_any mdata = result;
            ImageOut.push(result);//전달

            delete pData;

        }

    }

    return OPROS_SUCCESS;
}
Beispiel #14
0
    void UpdateAI(const uint32 diff)
    {
        if(!UpdateVictim())
            return;

        if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 60) && (Phase == 1))
        {
            Phase = 2;
            m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
            m_creature->SetHover(true);
            m_creature->GetMotionMaster()->Clear(false);
            m_creature->GetMotionMaster()->MoveIdle();
            DoScriptText(SAY_PHASE_2_TRANS, m_creature);
        }

        if(((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 40) && (Phase == 2))
        {
            Phase = 3;
            m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
            m_creature->SetHover(false);
            m_creature->GetMotionMaster()->MovePoint(0, -10.6155, -219.357, -87.7344);
            DoStartMovement(m_creature->getVictim());
            m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
            DoScriptText(SAY_PHASE_3_TRANS, m_creature);
        }

        if(Phase == 1 || Phase == 3)
        {
            if(FlameBreathTimer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_FLAMEBREATH);
                FlameBreathTimer = 15000;
            }else FlameBreathTimer -= diff;

            if(TailSweepTimer < diff)
            {
                Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
                if(target && !m_creature->HasInArc(M_PI, target))
                    DoCast(target, SPELL_TAILSWEEP);

                TailSweepTimer = 10000;
            }else TailSweepTimer -= diff;

            if(CleaveTimer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_CLEAVE);
                CleaveTimer = 10000;
            }else CleaveTimer -= diff;

            if(WingBuffetTimer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_WINGBUFFET);
                WingBuffetTimer = 7000 + ((rand()%8)*1000);
            }else WingBuffetTimer -= diff;

            if(KnockAwayTimer < diff)
            {
                if(rand() <= 30)
                {
                    DoCast(m_creature->getVictim(), SPELL_KNOCK_AWAY);
                }
                KnockAwayTimer = 15000;
            }else KnockAwayTimer -= diff;

            if(Phase == 3)
            {
                if(BellowingRoarTimer < diff)
                {
                    DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR);

                    BellowingRoarTimer = 30000;
                }else BellowingRoarTimer -= diff;

                if(SummonWhelpsTimer < diff)
                {
                    SummonWhelps(Phase);

                    SummonWhelpsTimer = 45000;
                }else SummonWhelpsTimer -= diff;
            }

            DoMeleeAttackIfReady();
        }

        if(Phase == 2)
        {
            if(InitialSpawn)
            {
                InitialSpawn = false;

                for(uint32 i = 0; i < 10; ++i)
                {
                    uint32 random = rand()%4;
                    Creature* Whelp = m_creature->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
                    if(Whelp)
                        Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0));
                }
            }

            if(EngulfingFlamesTimer < diff)
            {
                DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_ENGULFINGFLAMES);
                m_creature->HandleEmoteCommand(ANIM_FLY);

                EngulfingFlamesTimer = 10000;
            }
            else EngulfingFlamesTimer -= diff;

            if(FireballTimer < diff)
            {
                DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL);

                FireballTimer = 18000;
            }
            else FireballTimer -= diff;

            if(MovementTimer < diff)
            {
                if(rand()%100 < 30)
                {
                    DoScriptText(EMOTE_BREATH, m_creature);
                    DoCast(m_creature->getVictim(), SPELL_DEEPBREATH);
                }
                else ChangePosition();

                MovementTimer = 25000;
            }else MovementTimer -= diff;

            if(SummonWhelpsTimer < diff)
            {
                SummonWhelps(Phase);

                SummonWhelpsTimer = 45000;
            }
            else SummonWhelpsTimer -= diff;
        }
    }
Beispiel #15
0
void cbKeyPressed(unsigned char key, int x, int y)
{
    int tmp;
    double tmpd;
    switch (key) {
    
    case 'Q': case 'q': case 27:
        glutDestroyWindow(window_id);
        //        exit(1);
        break;

    // force entropy changes
	case 'a':
		ff_io_entropy_change();
		break;
	
	case 'd':
        Lx *= 1.05;
        Ly *= 1.05;
        Lz *= 1.05;
        break;

    case 'D':
        Lx /= 1.05;
        Ly /= 1.05;
        Lz /= 1.05;
        break;

	case 'V': case 'v':
		show_m = show_m ? 0 : 1;
		show_sphere = show_sphere ? 0 : 1;
		break;

	case 'M': case 'm':
        show_m = show_m?0:1;
        break;

    case 'X': case 'x':
        show_cube = show_cube ? 0 : 1;
        break;

    case '5':
        show_steric = show_steric?0:1;
        break;

    case 'O': case 'o':
        show_droplet = show_droplet?0:1;
        break;

    case 'B': case 'b':
        show_b = show_b?0:1;
        break;

    case 'R': case 'r':
        if (BmanY == 0) {BmanY = BmanX; BmanX = 0;}
        else if (BmanX == 0) {BmanX = -BmanY; BmanY = 0;}
        break;

    case 'l':
        ff_io_load(0);
        break;

    case 'L':
        ff_io_load(100);
        break;

    case 'S': case 's':
        show_sphere = show_sphere?0:1;
        break;

    case 'T': case 't':
        T += 1;
        break;

    case 'C': case 'c':
        T -= 1;
        break;

    case 'P': case 'p':
        projection_type = projection_type ? 0 : 1;
        cbResizeScene(window_width, window_height);
        break;

    case 'E': case 'e':
        show_bext = show_bext?0:1;
        break;
	
	case 'N': case 'n':
		
		out<<"step ="<<step << " V_oleic = " << v_oleic<<" V_car = "<<v_car<<" Bmanz ="<<BmanZ;
		GetScreenShot(out.str());
		out.str("");
		out.flush();
		break;
	case 'z':
		addPosition(x_rot, y_rot, space_k, projection_type);
		break;
	case 'Z':
		delPosition();
		break;
	case 'f':
		ChangePosition();
		break;
	case '0':
		ff_pieces_coord_info();
        BmanX = BmanY = BmanZ = 0;
        break;
    case '1':
        if (manual_field_control)
        {
            BmanX += 10;
        }
        break;
    case '2':
        if (manual_field_control)
        {
            BmanY += 10;
        }
        break;
    case '3':
        if (manual_field_control)
        {
            BmanZ += 10;
        }
        break;
	case '4':
			
			cout << eta_car0 << "-----" << eta_car << "-----------" << eta_oleic <<"------------" <<T<< endl;
			T += 10;
		break;
    case 'i':case 'I':
        show_info = show_info?0:1;
        break;
    case '9':
        Lx /= 2;
        Ly /= 2;
        Lz /= 2;
        break;
    case ' ':
        time_go = time_go?0:1;
		ActiveWindow();
        break;
    
    case '[':
        scaling_cube /= 1.05;
        break;
    
    case ']':
        scaling_cube *= 1.05;
        break;

    case ',':
        gr_quality --;
        break;
    
    case '.':
        gr_quality ++;
        break;

    case 'g':
        gr_x0 -= 0.05;
        break;
    
    case 'h':
        gr_x0 += 0.05;
        break;
    
    case 'j':
        gr_y0 -= 0.05;
        break;
    
    case 'k':
        gr_y0 += 0.05;
        break;

    case ';':
        gr_z0 -= 0.05;
        break;
    
    case '\'':
        gr_z0 += 0.05;
        break;

    case 'u':
        dt *= 1.1;
        break;
    
    case 'y':
        dt /= 1.1;
        break;

    default:
        printf ("KP: No action assigned for %c.\n", key);
        break;
    }
}
void ABrainNormalInteractiveObject::PerformAction4()
{
	if (_canBeTranslate)
		ChangePosition(-1);
}
Document :: Document(wWindow *parent, const char *fn) : wMdiDocument(MDI_MAXTITLEAUTO)
{
	short		err;
	File		f(fn);
	bFileName	nm;
	wDimension 	d=parent->GetSize();

	CreateWindow(parent, FaTitleBar | FaSysMenu | FaMinMax | FaSizeBorder);
	mle = 0;

	SetIcon(icon = new wIcon(ResIcon, I_DOC));   

	nm.Parse(fn);
	SetCaption(nm.Filename());

	HourGlass();

	modified = FALSE;
	saveas = FALSE;
	fname = fn;
	ChangeFrameSize(wDimension(d.xWidth() / 3, d.yHeight() / 3));
	ChangePosition(wPointl(5,5));
	mle = new wMLEntry(this, 0, wPointl(0,0), GetSize(), MlHscroll | MlVscroll);	

	if ((err = f.Open("r")) == 0)
	{
		ushort	numb;
		long	pos = 0;
		bString str(NULL, 4096);

		while ((numb = (ushort)f.Read((char *)(const char *)str, 1, 4096)) != 0)
		{
			str.AdjustLength(numb);
			mle->Import(str, &pos, MlCfText);
		}
		f.Close();
	}
	else
	{
		char	buf[300];
		sprintf(buf, "Error %d opening %s", err, fn);
		wMessageBox	mb(this, buf, "Error", MbIconExclamation | MbOk);
	}

	HourGlass();

	mle->SetForeground(((Editor*)parent)->ForeG());
	mle->SetBackground(((Editor*)parent)->BackG());

	mle->SetFont( ((Editor*)parent)->Font() );
	mle->SetTabStop(((Editor*)parent)->Tab());
	mle->SetWrap(((Editor*)parent)->WordWrap());

	mle->SetFirstChar(0);		// REPOSITION TO FIRST CHARACTER
	mle->SetCursorPosition(0);	// PLACE CURSOR
	mle->EnableUpdate();
	mle->Show();				// SHOW IT
	mle->SetFocus();			// GIVE IT FOCUS SO CURSOR APPEARS
	mle->SetModified(FALSE);
	Show();
}