コード例 #1
0
ファイル: clipboard.c プロジェクト: ysei/NetSurf
void gui_start_selection(struct gui_window *g)
{
	if(!g) return;
	if(!g->shared->win) return;
	if(nsoption_bool(kiosk_mode) == true) return;

	OnMenu(g->shared->win, AMI_MENU_CLEAR);
	OnMenu(g->shared->win, AMI_MENU_COPY);

	if (browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_CUT)
		OnMenu(g->shared->win, AMI_MENU_CUT);
}
コード例 #2
0
ファイル: clipboard.c プロジェクト: seanregan/browser
void gui_start_selection(struct gui_window *g)
{
	if(!g) return;
	if(!g->shared->win) return;
	if(option_kiosk_mode == true) return;

	OnMenu(g->shared->win, AMI_MENU_CLEAR);
	OnMenu(g->shared->win, AMI_MENU_COPY);

	if(selection_read_only(browser_window_get_selection(g->shared->bw)) == false)
		OnMenu(g->shared->win, AMI_MENU_CUT);
}
コード例 #3
0
 void CAutoPlaylists::OnEndPlaylist( IVideoplayerPlaylist* pPlaylist )
 {
     if ( pPlaylist == m_pSplashScreen && gVideoplayerSystem->GetScreenState() == eSS_StartScreen )
     {
         OnMenu( false );
     }
 }
コード例 #4
0
ファイル: Level.cpp プロジェクト: ulissesalmeida/pier-game
//---------------------------------------------------------------------------- 
// Nome: Execute(void)
// Desc: Executa o jogo. Verifica cada estado da máquina e chama o método adequado.
// Pams: nenhum
//---------------------------------------------------------------------------- 
void CLevel::Execute(void)
{
	switch(State)
	{
		case GS_MENU:
		{
			OnMenu();
			break;
		}
		case GS_GAME:
		{
			OnGame();
			break;
		}
		case GS_PAUSE:
		{
			OnPause();
			break;
		}
		case GS_CONGRATULATIONS:
		{
			OnCongratulations();
			break;
		}
		case GS_GAMEOVER:
		{
			OnGameOver();
			break;
		}
	}
}
コード例 #5
0
ファイル: main_amiga.c プロジェクト: AndrewCRMartin/AMPlot
/*>OnPieMenus(void)
   ----------------
   Switch on menus not applicable to pie charts
   12.03.92 Framework
   10.07.92 Original
*/
OnPieMenus(void)
{
   OnMenu(MainWind, MenuNumErrors);
   OnMenu(MainWind, MenuNumLogX);
   OnMenu(MainWind, MenuNumLogY);
   OnMenu(MainWind, MenuNumGrid);
   OnMenu(MainWind, MenuNumFZero);
   OnMenu(MainWind, MenuNumAxTitle);
   OnMenu(MainWind, MenuNumPen);
   OnMenu(MainWind, MenuNumLStyle);
   OnMenu(MainWind, MenuNumFit);

   return(0);
}
コード例 #6
0
ファイル: PlotDlg.cpp プロジェクト: jhp333/aux
void CPlotDlg::OnCommand(int idc, HWND hwndCtl, UINT event)
{
	switch (idc)
	{
	case IDM_FULLVIEW:
	case IDM_ZOOM_IN:
	case IDM_ZOOM_OUT:
	case IDM_SCROLL_LEFT:
	case IDM_SCROLL_RIGHT:
	case IDM_LEFT_STEP:
	case IDM_RIGHT_STEP:
	case IDM_PLAY:
	case IDM_SPECTRUM:
	case IDM_WAVWRITE:
		OnMenu(idc);
	}
}
コード例 #7
0
    void CAutoPlaylists::OnStart()
    {
        OnScreenChange();

        if ( m_pSplashScreen )
        {
            if ( m_pSplashScreen->Open( AUTOPLAY_SPLASHSCREEN ) )
            {
                gVideoplayerSystem->ShowMenu( false );
                m_pSplashScreen->Resume();
                m_pSplashScreen->RegisterListener( this );
            }

            else
            {
                OnMenu( false );
            }
        }
    }
コード例 #8
0
void CMainWindow::Notify( TNotifyUI &msg )
{
	DUI__Trace(msg.sType);
	if (msg.sType==_T("windowinit"))
	{
		OnInitWindow(msg);
	}
	else if (msg.sType==_T("click"))
	{
		OnClick(msg);
	}
	else if (msg.sType==_T("selectchanged"))
	{
		OnSelectChanged(msg);
	}
	else if (msg.sType==_T("itemactivate"))
	{
		OnItemActive(msg);
	}
	else if (msg.sType==_T("itemclick"))
	{
		OnItemClick(msg);
	}
	else if (msg.sType==_T("menu"))
	{
		OnMenu(msg);
	}
	else if (msg.sType==_T("killfocus"))
	{
		OnKillFocus(msg);
	}
	else if (msg.sType==_T("return"))
	{
		OnReturn(msg);
	}
}
コード例 #9
0
ファイル: menu.c プロジェクト: ysei/NetSurf
void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c)
{
	struct Window *win = g->shared->win;

	if(nsoption_bool(kiosk_mode) == true) return;

	if(content_get_type(c) <= CONTENT_CSS)
	{
		OnMenu(win,AMI_MENU_SAVEAS_TEXT);
		OnMenu(win,AMI_MENU_SAVEAS_COMPLETE);
#ifdef WITH_PDF_EXPORT
		OnMenu(win,AMI_MENU_SAVEAS_PDF);
#endif
		if(browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_COPY)
		{
			OnMenu(win,AMI_MENU_COPY);
			OnMenu(win,AMI_MENU_CLEAR);
		} else {
			OffMenu(win,AMI_MENU_COPY);
			OffMenu(win,AMI_MENU_CLEAR);	
		}

		if(browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_CUT)
			OnMenu(win,AMI_MENU_CUT);
		else
			OffMenu(win,AMI_MENU_CUT);		
		
		if(browser_window_get_editor_flags(g->shared->bw) & BW_EDITOR_CAN_PASTE)
			OnMenu(win,AMI_MENU_PASTE);
		else
			OffMenu(win,AMI_MENU_PASTE);

		OnMenu(win,AMI_MENU_SELECTALL);
		OnMenu(win,AMI_MENU_FIND);
		OffMenu(win,AMI_MENU_SAVEAS_IFF);
	}
	else
	{
		OffMenu(win,AMI_MENU_CUT);
		OffMenu(win,AMI_MENU_PASTE);
		OffMenu(win,AMI_MENU_CLEAR);

		OffMenu(win,AMI_MENU_SAVEAS_TEXT);
		OffMenu(win,AMI_MENU_SAVEAS_COMPLETE);
#ifdef WITH_PDF_EXPORT
		OffMenu(win,AMI_MENU_SAVEAS_PDF);
#endif
		OffMenu(win,AMI_MENU_SELECTALL);
		OffMenu(win,AMI_MENU_FIND);

#ifdef WITH_NS_SVG
		if(content_get_bitmap(c) || (ami_mime_compare(c, "svg") == true))
#else
		if(content_get_bitmap(c))
#endif
		{
			OnMenu(win,AMI_MENU_COPY);
			OnMenu(win,AMI_MENU_SAVEAS_IFF);
		}
		else
		{
			OffMenu(win,AMI_MENU_COPY);
			OffMenu(win,AMI_MENU_SAVEAS_IFF);
		}
	}
}
コード例 #10
0
ファイル: PlotDlg.cpp プロジェクト: jhp333/aux
void CPlotDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	static double prev_ylim[2] = {0, -1};
	static CTick prev_ytick;

	int id, *itemp;
	CLine **temp;
//	if (nChar==17) {CDialog::OnKeyDown(nChar, nRepCnt, nFlags); return;}
	switch(nChar)
	{
	case VK_F2:
		id = nChar - VK_F2;
		itemp = new int [gca->nLines];
		temp = new CLine*[gca->nLines];
		for (int j(0), i(0); i<gca->nLines; i++)
		{
			itemp[i] = (i==id) ? gca->nLines-1 : j++;
		}
		for (int i=0; i<gca->nLines; i++) temp[i] = gca->m_ln[itemp[i]] ;
		delete[] gca->m_ln;
		gca->m_ln = temp;
		delete[] itemp;
		InvalidateRect(NULL);
		break;
	case VK_F1:	// toggle between fixed and automatic y range/tick
		if (prev_ylim[0] > prev_ylim[1]) {
			prev_ylim[0] = gca->ylim[0];
			prev_ylim[1] = gca->ylim[1];
			gca->ylim[0] = 0;
			gca->ylim[1] = -1;
		} else {
			gca->ylim[0] = prev_ylim[0];
			gca->ylim[1] = prev_ylim[1];
			prev_ylim[0] = 0;
			prev_ylim[1] = -1;
		}
		if (prev_ytick.a1 > prev_ytick.a2) {
			prev_ytick.a1 = gca->ytick.a1;
			prev_ytick.a2 = gca->ytick.a2;
			gca->ytick.a1 = 0;
			gca->ytick.a2 = -1;
		} else {
			gca->ytick.a1 = prev_ytick.a1;
			gca->ytick.a2 = prev_ytick.a2;
			prev_ytick.a1 = 0;
			prev_ytick.a2 = -1;
		}
		InvalidateRect(NULL);
		break;
	case VK_F4:
		OnMenu(IDM_SPECTRUM);
		break;
	case VK_DIVIDE:
		OnMenu(IDM_WAVWRITE);
		break;
	case VK_TAB:
		OnMenu(IDM_PAUSE);
		break;
	case VK_SPACE:
		OnMenu(IDM_PLAY);
		break;
	case VK_MULTIPLY:
		OnMenu(IDM_FULLVIEW);
		break;
	case VK_F8:
		OnMenu(IDM_SCROLL_LEFT);
		break;
	case VK_F9:
		OnMenu(IDM_SCROLL_RIGHT);
		break;
	case VK_LEFT:
		OnMenu(IDM_LEFT_STEP);
		break;
	case VK_RIGHT:
		OnMenu(IDM_RIGHT_STEP);
		break;
	case VK_ADD:
	case '=':
		OnMenu(IDM_ZOOM_IN);
		break;
	case VK_SUBTRACT:
		OnMenu(IDM_ZOOM_OUT);
		break;
	}
}
コード例 #11
0
ファイル: PlotDlg.cpp プロジェクト: jhp333/aux
void CPlotDlg::OnMenu(UINT nID)
{
	static char fullfname[MAX_PATH];
	static CAxis *axSpec(NULL);
	CAxis *localax(gcf->ax[0]); // Following the convention
	CRect rt;
	CSize sz;
	CFont editFont;
	CPosition pos;
	double range, miin(1.e15), maax(-1.e15);
	double width, newmin, newmax;
	int i, len, id1, id2, iSel(-1);
	char errstr[256];
	CSignals signal;
	bool multi;
	static void  *playPoint;
	switch (nID)
	{
	case IDM_FULLVIEW:
		localax->setRange('x',localax->m_ln[0]->xdata[0], localax->m_ln[0]->xdata[localax->m_ln[0]->len-1]);
		localax->setTick('x', 0, localax->m_ln[0]->xdata[localax->m_ln[0]->len-1]/10, 1, 0, "%6.3f");
		// 2/3/2011, commented out by jhpark, because y axis is not affected by zooming.
		//localax->setRange('y', -1, 1);
		OnMenu(IDM_SPECTRUM_INTERNAL);
		return;

	case IDM_ZOOM_IN:
		width = localax->xlim[1] - localax->xlim[0];
		if (width<0.005) return;
		localax->setRange('x', localax->xlim[0] + width/4., localax->xlim[1] - width/4.);
		width = localax->xtick.a2 - localax->xtick.a1;
		localax->xtick.a2 -= width/4.;
		localax->xtick.a1 += width/4.;
		OnMenu(IDM_SPECTRUM_INTERNAL);
		return;

	case IDM_ZOOM_OUT:
		if (localax->xlim[1]==localax->xlimFull[1] && localax->xlim[0]==localax->xlimFull[0]) return;
		for (i=0; i<localax->nLines; i++)
			miin = min(miin, getMin(localax->m_ln[i]->len, localax->m_ln[i]->xdata));
		for (i=0; i<localax->nLines; i++)
			maax = max(maax, getMax(localax->m_ln[i]->len, localax->m_ln[i]->xdata));
		width = localax->xlim[1] - localax->xlim[0];
		localax->setRange('x', max(miin,localax->xlim[0] - width/2.), min(maax,localax->xlim[1] + width/2.));
		width = localax->xtick.a2 - localax->xtick.a1;
		//Oh, I just realized that a1 and a2 do not need to be within the range==> no need to check, it will still draw the ticks only within the range.
		localax->xtick.a2 += width/2.;
		localax->xtick.a1 -= width/2.;
		if (localax->xtick.a1<0) localax->xtick.a1=0;
		OnMenu(IDM_SPECTRUM_INTERNAL);
		return;
	case IDM_SCROLL_LEFT:
		for (i=0; i<localax->nLines; i++)
			miin = min(miin, getMin(localax->m_ln[i]->len, localax->m_ln[i]->xdata));
		range = localax->xlim[1] - localax->xlim[0];
		newmin = max(miin, localax->xlim[0]-range);
		localax->setRange('x', newmin, newmin+range);
		rt = localax->axRect;
		rt.InflateRect(5,0,5,30);
		InvalidateRect(&rt);
		OnMenu(IDM_SPECTRUM_INTERNAL);
		return;
	case IDM_SCROLL_RIGHT:
		for (i=0; i<localax->nLines; i++)
			maax = max(maax, getMax(localax->m_ln[i]->len, localax->m_ln[i]->xdata));
		range = localax->xlim[1] - localax->xlim[0];
		newmax = min(maax, localax->xlim[1]+range);
		localax->setRange('x', newmax-range, newmax);
		rt = localax->axRect;
		rt.InflateRect(5,0,5,30);
		InvalidateRect(&rt);
		OnMenu(IDM_SPECTRUM_INTERNAL);
		return;
	case IDM_LEFT_STEP:
		for (i=0; i<localax->nLines; i++)
			miin = min(miin, getMin(localax->m_ln[i]->len, localax->m_ln[i]->xdata));
		range = localax->xlim[1] - localax->xlim[0];
		newmin = max(miin, localax->xlim[0]-range/4.);
		localax->setRange('x', newmin, newmin+range);
		rt = localax->axRect;
		rt.InflateRect(5,0,5,30);
		InvalidateRect(&rt);
		OnMenu(IDM_SPECTRUM_INTERNAL);
		return;
	case IDM_RIGHT_STEP:
		for (i=0; i<localax->nLines; i++)
			maax = max(maax, getMax(localax->m_ln[i]->len, localax->m_ln[i]->xdata));
		range = localax->xlim[1] - localax->xlim[0];
		newmax = min(maax, localax->xlim[1]+range/4.);
		localax->setRange('x', newmax-range, newmax);
		rt = localax->axRect;
		rt.InflateRect(5,0,5,30);
		InvalidateRect(&rt);
		OnMenu(IDM_SPECTRUM_INTERNAL);
		return;
	case IDM_PLAY:
		errstr[0]=0;
		if (!playing)
			if(!GetSignalInRange(signal,1))		MessageBox (errStr);
			else 
			{
				playPoint = signal.PlayArray(devID, WM__SOUND_EVENT, hDlg, &block, errstr);
				playing = true;
			}
		else
		{
			PauseResumePlay(playPoint, paused);
			playing = paused;
			if (paused) paused = false;
		}
		return;
	case IDM_PAUSE:
		errstr[0]=0;
		if (playing)
		{
			PauseResumePlay(playPoint, false);
			paused = true;
		}
		return;
	case IDM_SPECTRUM:
		// To draw a spectrum, first re-adjust the aspect ratio of the client window 
		// so that the width is at least 1.5 times the height.
		if (!specView)
		{
			GetWindowRect(&rt);
			sz = rt.Size();
			if (sz.cx<3*sz.cy/2)
			{
				rt.InflateRect(0, 0, 3*sz.cy/2, 0);
				MoveWindow(&rt, 0);
			}
			//Again, //Assuming that the first axis is the waveform viewer, the second one is for spectrum viewing
			lastPos = gcf->ax[0]->pos;
			gcf->ax[0]->setPos(.08, .1, .62, .8);
			axSpec = gcf->axes(.75, .3, .22, .4);
			axSpec->colorBack = RGB(230, 230, 190);
			OnMenu(IDM_SPECTRUM_INTERNAL);
		}
		else
		{
			deleteObj(axSpec);
			axSpec=NULL;
			gcf->ax[0]->setPos(lastPos);
		}
		specView = !specView;
		break;
	case IDM_SPECTRUM_INTERNAL:
		rfftw_plan plan;
		double *freq, *fft, *mag, *fft2, *mag2, fs, maxx, maxmag, ylim;
		multi = localax->nLines>1 ? true : false;
		if (gcf->nAxes==1) break;
		fs = (double)sig.GetFs();
		for (; gcf->ax[1]->nLines>0;)	
			deleteObj(gcf->ax[1]->m_ln[0]);
		GetIndicesInRange(localax, id1, id2);
		len = id2-id1+1;
		freq = new double[len];
		fft = new double[len];
		mag = new double[len/2];
		for (i=0; i<len; i++)
			freq[i]=(double)i/(double)len*fs;
		plan = rfftw_create_plan(len, FFTW_FORWARD, FFTW_ESTIMATE|FFTW_OUT_OF_PLACE);
		rfftw_one(plan, &localax->m_ln[0]->ydata[id1], fft);
		if (multi) 
		{
			fft2 = new double[len];
			mag2 = new double[len/2];
			rfftw_one(plan, &localax->m_ln[1]->ydata[id1], fft2);
		}
		rfftw_destroy_plan(plan);
		for (i=0; i<len/2; i++)		mag[i] = 20.*log10(fabs(fft[len-i]));
		if (multi) for (i=0; i<len/2; i++)	mag2[i] = 20.*log10(fabs(fft2[len-i]));
		maxmag = getMax(len/2,mag);
		maxx = 5.*(maxmag/5.+1);
		for (int j=0; j<len/2; j++)	mag[j] -= maxx;
		if (multi) 
		{
			maxmag = getMax(len/2,mag2);
			maxx = 5.*(maxmag/5.+1);
			for (int j=0; j<len/2; j++)	mag2[j] -= maxx;
		}
		ylim = 10.*(maxmag/10.+1)-maxx;
		PlotDouble(gcf->ax[1], len/2, freq, mag);
		SetRange(gcf->ax[1], 'x', 0, fs/2);
		SetTick(gcf->ax[1], 'x', 0, 1000, 0, 0, "%2.0lfk", 0.001);
		SetRange(gcf->ax[1], 'y', getMean(len/2,mag)-40, ylim);
		SetTick(gcf->ax[1], 'y', 0, 10);
		gcf->ax[1]->m_ln[0]->color = gcf->ax[0]->m_ln[0]->color;
		if (multi) 
		{
			PlotDouble(gcf->ax[1], len/2, freq, mag2);
			gcf->ax[1]->m_ln[1]->color = gcf->ax[0]->m_ln[1]->color;
			delete[] fft2;
			delete[] mag2;
		}
		delete[] freq;
		delete[] fft;
		delete[] mag;
		break;
	case IDM_WAVWRITE:
		char fname[MAX_PATH];
		CFileDlg fileDlg;
		fileDlg.InitFileDlg(hDlg, hInst, "");
		errstr[0]=0;
		if(!GetSignalInRange(signal,1))
		{	MessageBox (errStr);	return;	}
		if (fileDlg.FileSaveDlg(fullfname, fname, "Wav file (*.WAV)\0*.wav\0", "wav"))
			if (!signal.Wavwrite(fullfname, errstr))	
			{MessageBox (errstr);}
		else
		{
			CStdString str;
			if (GetLastError()!=0) { GetLastErrorStr(str); MessageBox (str.c_str(), "Filesave error");}
		}
		return;
	}
	InvalidateRect(NULL);
}
コード例 #12
0
ファイル: PlotDlg.cpp プロジェクト: jhp333/aux
void CPlotDlg::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	OnMenu(IDM_PLAY);
}
コード例 #13
0
ファイル: FormBase.cpp プロジェクト: Kreyl/nute
fresult FormBase::DefaultMenuHandler( IMenuItem* mi )
{
	fresult fres;

	//exec virtual OnAnyMenu
	bool_t found = FALSE;
	fres = OnMenu(mi, &found);
	if (found == TRUE)
	{
		return fres;
	}

	//search menu handler
	char* miName = mi->GetName();
	MenuFactory* mf = _Factories->GetMenuFactory();
	FAILIF(mf==NULL);
	MenuItemSettings* mis = mf->Settings;

	//function pointer
	fresult (FormBase::*handler)(IMenuItem* mi);

	for(ubyte_t i=0; i<MenuItemOriginsLast;i++)
	{
		if (StringEquals(miName, mis[i].Name) == TRUE)
		{
			switch (i)
			{
			case ItemOriginA:
				handler = &FormBase::OnMenuA;
				break;
			case ItemOriginB:
				handler = &FormBase::OnMenuB;
				break;
			case ItemOriginC:
				handler = &FormBase::OnMenuC;
				break;
			case ItemOriginX:
				handler = &FormBase::OnMenuX;
				break;
			case ItemOriginY:
				handler = &FormBase::OnMenuY;
				break;
			case ItemOriginZ:
				handler = &FormBase::OnMenuZ;
				break;
			case ItemOriginL:
				handler = &FormBase::OnMenuL;
				break;
			case ItemOriginE:
				handler = &FormBase::OnMenuE;
				break;
			case ItemOriginR:
				handler = &FormBase::OnMenuR;
				break;
			default:
				return GENERAL_ERROR;
			}
			
			found = TRUE;
			break;
		}
	}

	if (found==TRUE)
	{
		//Call found handler
		fres = (this->*handler)(mi);
		ENSURESUCCESS(fres);
	}
	else
	{
		//call default
		fres = OnMenuOther(mi);
		ENSURESUCCESS(fres);
	}

	return SUCCESS;
}