Exemple #1
0
TopWindow& TopWindow::SetStyle(const TopWindow::TopStyle& s)
{
	st = &s;
	RefreshLayout();
	RefreshFrame();
	return *this;
}
Exemple #2
0
void SpectDisplay::RefreshDialogValues(int type)
//{=============================================
{
	int ix;
	long int value;
	SpectFrame *sf;

	if(spectseq == NULL)
		return;

	sf = spectseq->frames[sframe];

	spectseq->amplitude = formantdlg->t_amplitude->GetValue();
	sf->amp_adjust = formantdlg->t_ampframe->GetValue();

	if(use_spin_controls)
		value = formantdlg->t_timeframe->GetValue();
	else
		formantdlg->tt_timeframe->GetValue().ToLong(&value);

	sf->length_adjust = value - spectseq->GetFrameLength(sframe,0,NULL);

	for(ix=0; ix < N_KLATTP; ix++)
	{
		sf->klatt_param[ix] = formantdlg->s_klatt[ix]->GetValue();
	}

	if(type==0)
	{
		WriteDialogLength();
		Refresh();
	}
	else
		RefreshFrame(sframe);   // frame amplitude
}
Exemple #3
0
/*
 * If the DLP is on, don't do anything.
 * If the DLP is off, clear the IlluminationFrame
 * and send that to the DLP so that none of hte DLP mirrors
 * are exposed
 */
void ClearDLPifNotDisplayingNow(Experiment* exp) {
	/** If the DLP is not displaying **/
	if (exp->Params->DLPOn == 0) {
		/** Clear the DLP **/
		RefreshFrame(exp->IlluminationFrame);
		if (!(exp->SimDLP))
			T2DLP_SendFrame((unsigned char *) exp->IlluminationFrame->binary,
					exp->myDLP);
	}
}
Exemple #4
0
void Ctrl::SyncMoves()
{
	GuiLock __;
	if(!top)
		return;
	for(int i = 0; i < top->move.GetCount(); i++) {
		MoveCtrl& m = top->move[i];
		if(m.ctrl) {
			RefreshFrame(m.from);
			RefreshFrame(m.to);
		}
	}
	for(int i = 0; i < top->scroll_move.GetCount(); i++) {
		MoveCtrl& s = top->scroll_move[i];
		if(s.ctrl) {
			RefreshFrame(s.from);
			RefreshFrame(s.to);
		}
	}
	top->move.Clear();
	top->scroll_move.Clear();
}
Exemple #5
0
void Ctrl::RefreshFrame() {
	LLOG("RefreshFrame " << Name());
	RefreshFrame(Rect(GetRect().Size()).Inflated(overpaint));
}
Exemple #6
0
void Ctrl::RefreshFrame(int x, int y, int cx, int cy) {
	RefreshFrame(RectC(x, y, cx, cy));
}
Exemple #7
0
void Ctrl::Refresh(const Rect& area) {
	GuiLock __;
	if(fullrefresh || !IsVisible() || !IsOpen()) return;
	LLOG("Refresh " << Name() << ' ' <<  area);
	RefreshFrame((area + GetView().TopLeft()) & GetView().Inflated(OverPaint()));
}
Exemple #8
0
void SpectDisplay::OnKey(wxKeyEvent& event)
{//====================================
	int key;
	int display=0;  // 1=change one peak 2=one frame, 3=all
	int direction=0;
	int x_inc;
	int y_inc;
	int  i;
	int field=0xff;
	int keyfr;
	int control;
	int number;
	double value;
	SpectFrame *sf;
	peak_t *pk;
//	static short pk_inc1[N_PEAKS] = {2,2,2,5,5,5,5,5,5};
	static short pk_inc1[N_PEAKS] = {4,4,4,8,8,8,8,8,8};
	static short pk_inc2[N_PEAKS] = {8,8,20,20,20,20,25,25,25};

	sf = spectseq->frames[sframe];
	pk = &sf->peaks[pk_num];
	key = event.GetKeyCode();
	control = event.ControlDown();
	if(control && isalnum(key)) key |= 0x1000;

	if(event.ShiftDown())
	{
		x_inc = pk_inc1[pk_num];
		y_inc = 0x40;
	}
	else
	{
		x_inc = pk_inc2[pk_num];
		y_inc = 0x100;
	}

	switch(key)
	{
	case WXK_NEXT:
		if(sframe < spectseq->numframes-1)
		{
			formantdlg->GetValues(spectseq, sframe);
			spectseq->SelectAll(0);
			sframe++;
			spectseq->frames[sframe]->selected = 1;
			display = 3;
		}
		break;

	case WXK_PRIOR:
		if(sframe > 0)
		{
			formantdlg->GetValues(spectseq, sframe);
			spectseq->SelectAll(0);
			sframe--;
			spectseq->frames[sframe]->selected = 1;
			display = 3;
		}
		break;


	case 'Z':
		if(pk_num > 0)
		{
			pk_num--;
			display = 2;
		}
		break;

	case 'X':
		if(pk_num < N_PEAKS-1)
		{
			pk_num++;
			display = 2;
		}
		break;

	case WXK_RIGHT:
		pk->pkfreq = pk->pkfreq - (pk->pkfreq % x_inc) + x_inc;
		if(pk->pkfreq >= MAX_DISPLAY_FREQ)
			pk->pkfreq = MAX_DISPLAY_FREQ;
		display = 1;
		direction = 1;
		field = 1;
		break;

	case WXK_LEFT:
		pk->pkfreq = pk->pkfreq - (pk->pkfreq % x_inc) - x_inc;
		if(pk->pkfreq < 50)
			pk->pkfreq = 50;
		display = 1;
		direction = -1;
		field = 1;
		break;

	case WXK_UP:
		pk->pkheight = pk->pkheight - (pk->pkheight % y_inc) + y_inc;
		if(pk->pkheight >= 0x7fff)
			pk->pkheight = 0x7fff;
		display = 1;
		field = 2;
		SetKeyframe(sf,1);
		break;

	case WXK_DOWN:
		pk->pkheight = pk->pkheight - (pk->pkheight % y_inc) - y_inc;
		if(pk->pkheight <= 0)
		{
			pk->pkheight = 0;
			keyfr = 0;  // but only if all the other peaks are zero
			for(i=0; i<N_PEAKS; i++)
			{
				if(sf->peaks[i].pkheight > 0)
					keyfr = 1;
			}
			SetKeyframe(sf,keyfr);
		}

		display = 1;
		field = 2;
		break;

	case ',':   // width--
		if(event.ControlDown())
		{
			// CTRL, rotate, make right slope steeper
			if(pk_num < 3)
			{
				pk->pkright-= 5;
				pk->pkwidth += 5;
			}
		}
		else
		{
			pk->pkright -= 10;
			pk->pkwidth -= 10;
			if(pk->pkright < 0)
				pk->pkright = 0;
			if(pk->pkwidth < 0)
				pk->pkwidth = 0;
		}
		field = 4;
		display = 1;
		break;

	case '.':   // width++
		if(event.ControlDown())
		{
			// CTRL: rotate, make left slope steeper
			if(pk_num < 3)
			{
				pk->pkright += 5;
				pk->pkwidth -= 5;
			}
		}
		else
		{
			pk->pkright += 10;
			pk->pkwidth += 10;
		}
		field = 4;
		display = 1;
		break;

	case '<':   // width--
		pk->pkright -= 2;
		pk->pkwidth -= 2;
		if(pk->pkwidth < 0)
			pk->pkwidth = 0;
		display = 1;
		field = 4;
		break;

	case '>':   // width++
		pk->pkright += 2;
		pk->pkwidth += 2;
		display = 1;
		field = 4;
		break;

	case '[':   // width--
		pk->pkright -= 1;
		if(pk->pkright < 0)
			pk->pkright = 0;
		display = 1;
		field = 4;
		break;

	case ']':   // width++
		pk->pkright += 1;
		display = 1;
		field = 4;
		break;

	case '/':  // make left=right
		i = pk->pkwidth + pk->pkright;
		pk->pkwidth = pk->pkright = i/2;
		display = 1;
		field = 4;
		break;

	case 0x1041:   // CTRL-A
		spectseq->SelectAll(1);
		Refresh();
		break;

	case 0x1042:  // CTRL-B
		// toggle bass reduction
		spectseq->bass_reduction ^= 1;
		Refresh();
		break;
		
	case 0x1043:   // CTRL-C
		spectseq->ClipboardCopy();
		break;

	case 0x1044:   // CTRL-D
		// copy peaks down from previous/next keyframe
		if(event.ShiftDown())
			spectseq->CopyDown(sframe,1);
		else
			spectseq->CopyDown(sframe,-1);
		SetKeyframe(sf,1);
      display = 2;
		break;

	case 0x1047:   // CTRL-G  toggle grid
		spectseq->grid ^= 1;
		Refresh();
		break;

	case 0x1049:   // CTRL-I  interpolate between two frames
		spectseq->InterpolateAdjacent();
		display = 2;
		break;

	case 0x104b:   // CTRL-K
//		spectseq->SetKlattDefaults();
//		display = 3;
		break;

	case 0x104d:   // CTRL-M
		sf->ToggleMarker(1);
      display = 2;
		break;

	case 0x104e:   // CTRL-N
		number = wxGetNumberFromUser(_T("Toggle Marker"),_T("Marker"),_T(""),1,0,7);
		sf->ToggleMarker(number);
      display = 2;
		break;

	case 0x104f:   // CTRL-O
		spectseq->ConstructVowel();
		break;

	case 0x1051:   // CTRL-Q
		if(event.ShiftDown())
			spectseq->InterpolatePeaks(0);  // remove interpolation
		else
			spectseq->InterpolatePeaks(1);  // show interpolation
		display = 3;
		break;

	case 0x1052:   // CTRL-R
		value = sf->GetRms(spectseq->amplitude);
		break;

	case 0x1053:   // CTRL-S
		Save(savepath);
		break;

	case 0x1056:   // CTRL-V
		if(event.ShiftDown())
		{
			// insert frames from the clipboard
			sframe = spectseq->ClipboardInsert(sframe);
			SetExtent();
			display = 3;
			pitchgraph->Refresh();
			break;
		}

		// overwrite just the peaks
		if(clipboard_spect == NULL)
			break;
		i = 0;
		while((i < clipboard_spect->numframes) && ((sframe+i) < spectseq->numframes))
		{
			spectseq->frames[sframe+i]->CopyPeaks(clipboard_spect->frames[i]);
			i++;
		}
		display = 3;
		break;

	case 0x1058:   // CTRL-X
		spectseq->ClipboardCopy();
		spectseq->DeleteSelected();
		SetExtent();
		sframe = 0;
		display = 3;
		pitchgraph->Refresh();
		break;

	case 0x105a:   // CTRK-Z
		sf->ZeroPeaks();
		SetKeyframe(sf,0);
		display = 2;
		break;

	case WXK_F10:
		sf->ApplyVoiceMods();
		display = 2;
		break;

	case WXK_F2:
		// make and play sequence
		ReadDialogValues();
		spectseq->MakeWave(0,spectseq->numframes-1,voicedlg->pitchenv);
		break;

	case WXK_F1:
		// make and play selected
		ReadDialogValues();
		sf->MakeWaveF(0,voicedlg->pitchenv,spectseq->amplitude,spectseq->duration);
		break;
	case WXK_F3:
		// make and play selected
		ReadDialogValues();
		sf->MakeWaveF(1,voicedlg->pitchenv,spectseq->amplitude,spectseq->duration);
		break;

	default:
		if(key>='0' && key<='9')
		{
			i = key-'0';
			if(event.ControlDown())
			{
				if(i==0) i=10;
				PlayChild(i-1,voicedlg->pitchenv);
			}
			else
			{
				// select peak number
				if((pk_num = i) >= N_PEAKS) pk_num = N_PEAKS-1;
			}
			display=2;
		}
		event.Skip();
		break;
	}

	if(display)
	{
		pk_select = pk_num;
		sf = spectseq->frames[sframe];
		pk = &sf->peaks[pk_num];

		if(pk->pkwidth < 50) pk->pkwidth = 50; // min. width
		if(pk->pkright < 50) pk->pkright = 50;

		// ensure minimum separation between peaks & prevent crossover
		if(direction > 0)
		{
			for(i=pk_num+1; i<N_PEAKS; i++)
			{
				if(sf->peaks[i].pkfreq < sf->peaks[i-1].pkfreq + 100)
					sf->peaks[i].pkfreq = sf->peaks[i-1].pkfreq + 100;
			}
		}
		else
		if(direction < 0)
		{
			for(i=pk_num-1; i>=0; i--)
			{
				if(sf->peaks[i].pkfreq > sf->peaks[i+1].pkfreq - 100)
					sf->peaks[i].pkfreq = sf->peaks[i+1].pkfreq - 100;
			}
		}

		if(display==3)
      {
		   formantdlg->ShowFrame(spectseq,sframe,pk_num,0xff);
			Refresh();
		}
		else
		{
			// only one frame needs to be redrawn
			formantdlg->ShowFrame(spectseq,sframe,pk_num,field);
			RefreshFrame(sframe);
		}

		if(sframe >= 0)
		{
			if(ScrollToFrame(sframe,0))
				Refresh();   // shouldn't need this, but we have redraw problems
		}

	}
}  // end of SpectDisplay::OnKey
Exemple #9
0
void Ctrl::Refresh0(const Rect& area) {
	RefreshFrame((area + GetView().TopLeft()) & GetView().Inflated(OverPaint()));
}
Exemple #10
0
void Manager::RefreshFrame(int Index)
{
	_MANAGER(CleverSysLog clv(L"Manager::RefreshFrame(int Index)"));
	_MANAGER(SysLog(L"Index=%d",Index));
	RefreshFrame((*this)[Index]);
}
Exemple #11
0
/* $ Введена для нужд CtrlAltShift OT */
void Manager::ImmediateHide()
{
	if (FramePos<0)
		return;

	// Сначала проверяем, есть ли у прятываемого фрейма SaveScreen
	if (CurrentFrame->HasSaveScreen())
	{
		CurrentFrame->Hide();
		return;
	}

	// Фреймы перерисовываются, значит для нижних
	// не выставляем заголовок консоли, чтобы не мелькал.
	if (ModalStackCount>0)
	{
		/* $ 28.04.2002 KM
		    Проверим, а не модальный ли редактор или вьювер на вершине
		    модального стека? И если да, покажем User screen.
		*/
		if (ModalStack[ModalStackCount-1]->GetType()==MODALTYPE_EDITOR ||
		        ModalStack[ModalStackCount-1]->GetType()==MODALTYPE_VIEWER)
		{
			if (CtrlObject->CmdLine)
				CtrlObject->CmdLine->ShowBackground();
		}
		else
		{
			int UnlockCount=0;
			Global->IsRedrawFramesInProcess++;

			while ((*this)[FramePos]->Locked())
			{
				(*this)[FramePos]->Unlock();
				UnlockCount++;
			}

			RefreshFrame((*this)[FramePos]);
			Commit();

			for (int i=0; i<UnlockCount; i++)
			{
				(*this)[FramePos]->Lock();
			}

			if (ModalStackCount>1)
			{
				for (int i=0; i<ModalStackCount-1; i++)
				{
					if (!(ModalStack[i]->FastHide() & CASR_HELP))
					{
						RefreshFrame(ModalStack[i]);
						Commit();
					}
					else
					{
						break;
					}
				}
			}

			/* $ 04.04.2002 KM
			   Перерисуем заголовок только у активного фрейма.
			   Этим мы предотвращаем мелькание заголовка консоли
			   при перерисовке всех фреймов.
			*/
			Global->IsRedrawFramesInProcess--;
			CurrentFrame->ShowConsoleTitle();
		}
	}
	else
	{
		if (CtrlObject->CmdLine)
			CtrlObject->CmdLine->ShowBackground();
	}
}
Exemple #12
0
void Window::Draw() {
	if (!visible) return;
	if (width <= 0 || height <= 0) return;
	if (x < -width || x > DisplayUi->GetWidth() || y < -height || y > DisplayUi->GetHeight()) return;


	if (windowskin) {
		if (width > 4 && height > 4 && (back_opacity * opacity / 255 > 0)) {
			if (background_needs_refresh) RefreshBackground();

			if (animation_frames > 0) {
				int ianimation_count = (int)animation_count;

				Rect src_rect(0, height / 2 - ianimation_count, width, ianimation_count * 2);

				background->BlitScreen(x, y + src_rect.y, src_rect);
			} else {
				background->BlitScreen(x, y);
			}
		}

		if (width > 0 && height > 0 && opacity > 0) {
			if (frame_needs_refresh) RefreshFrame();

			if (animation_frames > 0) {
				int ianimation_count = (int)animation_count;

				if (ianimation_count > 8) {
					Rect src_rect(0, height / 2 - ianimation_count, 8, ianimation_count * 2 - 16);

					frame_left->BlitScreen(x, y + 8 + src_rect.y, src_rect);
					frame_right->BlitScreen(x + width - 8, y + 8 + src_rect.y, src_rect);

					frame_up->BlitScreen(x, y + height / 2 - ianimation_count);
					frame_down->BlitScreen(x, y + height / 2 + ianimation_count - 8);
				} else {
					frame_up->BlitScreen(x, y + height / 2 - ianimation_count, Rect(0, 0, width, ianimation_count));
					frame_down->BlitScreen(x, y + height / 2, Rect(0, 8 - ianimation_count, width, ianimation_count));
				}
			} else {
				frame_up->BlitScreen(x, y);
				frame_down->BlitScreen(x, y + height - 8);
				frame_left->BlitScreen(x, y + 8);
				frame_right->BlitScreen(x + width - 8, y + 8);
			}
		}

		if (width > 16 && height > 16 && cursor_rect.width > 4 && cursor_rect.height > 4 && animation_frames == 0) {
			if (cursor_needs_refresh) RefreshCursor();

			Rect src_rect(
				-min(cursor_rect.x + border_x, 0),
				-min(cursor_rect.y + border_y, 0),
				min(cursor_rect.width, width - cursor_rect.x + border_x),
				min(cursor_rect.height, height - cursor_rect.y + border_y)
			);

			if (cursor_frame < 16)
				cursor1->BlitScreen(x + cursor_rect.x + border_x, y + cursor_rect.y + border_y, src_rect);
			else
				cursor2->BlitScreen(x + cursor_rect.x + border_x, y + cursor_rect.y + border_y, src_rect);
		}
	}

	if (contents) {
		if (width > 2 * border_x && height > 2 * border_y &&
			-ox < width - 2 * border_x && -oy < height - 2 * border_y &&
			contents_opacity > 0 && animation_frames == 0) {
			Rect src_rect(-min(-ox, 0), -min(-oy, 0),
						  min(width - 2 * border_x, width - 2 * border_x + ox),
						  min(height - 2 * border_y, height - 2 * border_y + oy));

			contents_screen->SetOpacityEffect(contents_opacity);

			contents_screen->BlitScreen(max(x + border_x, x + border_x - ox),
										max(y + border_y, y + border_y - oy), src_rect);
		}
	}

	if (pause && pause_frame > 16 && animation_frames <= 0) {
		Rect src_rect(40, 16, 16, 8);
		windowskin_screen->BlitScreen(x + width / 2 - 8, y + height - 8, src_rect);
	}

	if (up_arrow) {
		Rect src_rect(40, 8, 16, 8);
		windowskin_screen->BlitScreen(x + width / 2 - 8, y, src_rect);
	}

	if (down_arrow) {
		Rect src_rect(40, 16, 16, 8);
		windowskin_screen->BlitScreen(x + width / 2 - 8, y + height - 8, src_rect);
	}

	if (animation_frames > 0) {
		// Open/Close Animation
		animation_frames -= 1;
		animation_count += animation_increment;
		if (closing && animation_frames <= 0) {
			visible = false;
			closing = false;
		}
	}
}