コード例 #1
0
ファイル: ob_keycapture.cpp プロジェクト: ChrisVeigl/BrainBay
void KEYCAPTUREOBJ::load(HANDLE hFile) 
{
	load_object_basics(this);
    load_property("mode",P_INT,&mode);
    load_property("findcode",P_INT,&findcode);
    load_property("replacecode",P_INT,&replacecode);
}
コード例 #2
0
ファイル: ob_edf_reader.cpp プロジェクト: RD3BAX/BrainBay
	  void EDF_READEROBJ::load(HANDLE hFile) 
	  {

		  state=0;
		  loading=1;
	  	  load_object_basics(this);
		  load_property("filename",P_STRING,&filename);
		  load_property("offset",P_INT,&offset);
		  if ((edffile=open_edf_file(&header,channel,filename))==INVALID_HANDLE_VALUE)
		  {	 char st[150];
			 reduce_filepath(st,filename);
			 strcpy(filename,GLOBAL.resourcepath);
			 strcat(filename,"ARCHIVES\\");
			 strcat(filename,st);			 
			 edffile=open_edf_file(&header,channel,filename); 
		  }
		  if (edffile!=INVALID_HANDLE_VALUE)
		  {
			  header.samplingrate=PACKETSPERSECOND;
			  calc_session_length();
			  session_pos(0);
			  outports=header.channels;
			  state=1;
		  } else  { report_error("EDF archive file not found, please open file in EDF-Reader"); sessionlength=0; }

		  height=CON_START+outports*CON_HEIGHT+5;
		  sampos=0;
		  get_captions();
		  loading=0;

	  }
コード例 #3
0
ファイル: ob_particle.cpp プロジェクト: RD3BAX/BrainBay
	  void PARTICLEOBJ::load(HANDLE hFile) 
	  {
		  load_object_basics(this);
		  load_property("mute",P_INT,&mute);
    	  load_property("palette-file",P_STRING,palettefile);
		  if (strcmp(palettefile,"none"))
		  {
			char szFileName[MAX_PATH] = "";
			strcpy(szFileName,GLOBAL.resourcepath);
			strcat(szFileName,"PALETTES\\");
			strcat(szFileName,palettefile);
			if (!load_from_file(szFileName, cols, sizeof(cols) ))
			{    
				report_error(szFileName);
				report_error("Could not load Color Palette ");
			}
			else
			{
				for (t=0;t<128;t++)
				{
					colors[t][0]=(float)((cols[t]&0xff)/256.0);
					colors[t][1]=(float)(((cols[t]>>8)&0xff)/256.0);
					colors[t][2]=(float)((cols[t]>>16)/256.0);
				}

			}
		  } 
コード例 #4
0
ファイル: ob_sample_hold.cpp プロジェクト: dadymax/BrainBay
void SAMPLE_HOLDOBJ::load(HANDLE hFile) 
{
	load_object_basics(this);
    load_property("hold",P_FLOAT,&hold);
    load_property("trigmode",P_INT,&mode);
    load_property("resetvalue",P_FLOAT,&resetvalue);
}
コード例 #5
0
ファイル: ob_magnitude.cpp プロジェクト: dadymax/BrainBay
	  void MAGNITUDEOBJ::load(HANDLE hFile) 
	  {
		char sztemp[30];
		char szorder[5];

		load_object_basics(this);
		load_property("type",P_INT,&filtertype);
		load_property("order",P_INT,&order);
		load_property("center",P_FLOAT,&center);
		load_property("width",P_FLOAT,&wid);
		load_property("gain",P_INT,&gain);
		
		strcpy(sztemp,PASSTYPE[filtertype].init);
		sprintf(szorder,"%d",order);
		strcat(sztemp,szorder);

		if (lp1fbuf!=NULL)	 fid_run_freebuf(lp1fbuf);
		if (lp1filt!=NULL)   fid_run_free(lp1filt);
		if (lp2fbuf!=NULL)	 fid_run_freebuf(lp2fbuf);
		if (lp2filt!=NULL)   fid_run_free(lp2filt);
		lp1filt= fid_design(sztemp, PACKETSPERSECOND, (double)wid, 0, 0, 0);
		lp1run= fid_run_new(lp1filt, &(lp1funcp));
		lp1fbuf=fid_run_newbuf(lp1run);
		lp2filt= fid_design(sztemp, PACKETSPERSECOND,(double)wid, 0, 0, 0);
		lp2run= fid_run_new(lp2filt, &(lp2funcp));
		lp2fbuf=fid_run_newbuf(lp2run);
	  }
コード例 #6
0
ファイル: ob_integrate.cpp プロジェクト: dadymax/BrainBay
void INTEGRATEOBJ::load(HANDLE hFile) 
{
	load_object_basics(this);
    load_property("ivalue",P_INT,&i_value);
	load_property("imin",P_FLOAT,&min);
	load_property("imax",P_FLOAT,&max);
}
コード例 #7
0
ファイル: ob_com_writer.cpp プロジェクト: ChrisVeigl/BrainBay
void COM_WRITEROBJ::load(HANDLE hFile) 
{
	load_object_basics(this);
	load_property("command",P_INT,&command);
	load_property("data1",P_INT,&data1);
	load_property("data2",P_INT,&data2);
	load_property("trigger",P_INT,&en_trigger);
}
コード例 #8
0
ファイル: ob_port_io.cpp プロジェクト: ChrisVeigl/BrainBay
void PORTOBJ::load(HANDLE hFile) 
{  
	load_object_basics(this);
	load_property("triggermode",P_INT,&triggermode);
	load_property("val0",P_INT,&val0);
	load_property("val1",P_INT,&val1);
	load_property("portaddress",P_INT,&portaddress);
	load_property("portval",P_INT,&portval);
	
}
コード例 #9
0
ファイル: ob_mixer4.cpp プロジェクト: ChrisVeigl/BrainBay
void MIXER4OBJ::load(HANDLE hFile) 
{
	load_object_basics(this);
    load_property("chn1vol",P_FLOAT,&chn1vol);
    load_property("chn2vol",P_FLOAT,&chn2vol);
    load_property("chn3vol",P_FLOAT,&chn3vol);
    load_property("chn4vol",P_FLOAT,&chn4vol);
	load_property("invmode",P_INT,&invmode);

}
コード例 #10
0
ファイル: ob_tcp_receive.cpp プロジェクト: Smeetal/BrainBay
	  void TCP_RECEIVEOBJ::load(HANDLE hFile) 
	  {

		  load_object_basics(this);
		  load_property("host",P_STRING,&host);
		  load_property("header",P_STRING,&edfheader);
		  parse_edf_header(&header, channel, edfheader);
		  outports=header.channels;
		  height=CON_START+outports*CON_HEIGHT+5;
		  get_captions();
	  }
コード例 #11
0
ファイル: ob_file_reader.cpp プロジェクト: Smeetal/BrainBay
	  void FILE_READEROBJ::load(HANDLE hFile) 
	  {

	 	  load_object_basics(this);
		  load_property("filename",P_STRING,&filename);
		  load_property("format",P_INT,&format);
		  load_property("outports",P_INT,&outports);
		  height=CON_START+outports*CON_HEIGHT+5;

		  if (strcmp(filename,"none")) open_textarchive(this);
		  
	  }
コード例 #12
0
ファイル: ob_mci.cpp プロジェクト: dadymax/BrainBay
void MCIOBJ::load(HANDLE hFile) 
{	
		load_object_basics(this);
		load_property("mci-file",P_STRING,mcifile);
		load_property("wnd-top",P_INT,&top);
		load_property("wnd-bottom",P_INT,&bottom);
		load_property("wnd-left",P_INT,&left);
		load_property("wnd-right",P_INT,&right);
		load_property("upd_speed",P_INT,&upd_speed);
		load_property("pos_center",P_INT,&pos_center);
		load_property("play_once",P_INT,&play_once);

		if (strcmp(mcifile,"none"))
		{
			char szFileName[MAX_PATH] = "";
			strcpy(szFileName,mcifile);
						
//			m_video = MCIWndCreate(ghWndMain, hInst,WS_VISIBLE|WS_THICKFRAME|MCIWNDF_NOMENU|MCIWNDF_NOPLAYBAR|MCIWNDF_NOERRORDLG,mcifile);
			m_video = MCIWndCreate(ghWndMain, hInst,WS_VISIBLE|WS_THICKFRAME|MCIWNDF_NOERRORDLG,mcifile);
			if (!m_video)  report_error ("Cannot open MCI File");
			else
			{
				MCIWndSetTimeFormat(m_video ,"ms");
				MCIWndSetActiveTimer(m_video,500);
				if ((!strstr(mcifile,".mp3")) && (!strstr(mcifile,".wav"))) SetWindowPos(m_video,HWND_TOPMOST,left,top,right-left,bottom-top,SWP_SHOWWINDOW);
				else ShowWindow(m_video,FALSE);
			}
		}
}
コード例 #13
0
ファイル: ob_keystrike.cpp プロジェクト: dadymax/BrainBay
void KEYSTRIKEOBJ::load(HANDLE hFile) 
{
	int i;
	char sztemp[50];

	load_object_basics(this);
    load_property("numkeys",P_INT,&numkeys);
	for (i=0;i<numkeys;i++)
	{
		wsprintf(sztemp,"key%d:",i+1);
		load_property(sztemp,P_STRING,keylist[i]);
	}

}
コード例 #14
0
ファイル: ob_doku.cpp プロジェクト: dadymax/BrainBay
	  void DOKUOBJ::load(HANDLE hFile) 
	  {
	  	  load_object_basics(this);
		  load_property("text",P_STRING,text);
		  apply_nl();

	  }
コード例 #15
0
ファイル: files.cpp プロジェクト: Smeetal/BrainBay
BOOL load_settings(void)
{
   
    HANDLE hFile;
	int t,x,c,f;
	char settingsfilename[256],midipname[256],tempname[256];

	strcpy(settingsfilename,GLOBAL.resourcepath);
	strcat(settingsfilename,"brainbay.cfg");

	write_logfile("load setting from: %s",settingsfilename);
    hFile = CreateFile(settingsfilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
    if(hFile == INVALID_HANDLE_VALUE) return FALSE;


	load_next_config_buffer(hFile);
	load_property("samplingrate",P_INT,&PACKETSPERSECOND);
	//load_property("com-port",P_INT,&TTY.PORT);
	//load_property("baudrate",P_INT,&TTY.BAUDRATE);
	//load_property("devicetype",P_INT,&TTY.devicetype);
	load_property("dialoginterval",P_INT,&GLOBAL.dialog_interval);
	load_property("drawinterval",P_INT,&GLOBAL.draw_interval);
	load_property("startup",P_INT,&GLOBAL.startup);
	load_property("autorun",P_INT,&GLOBAL.autorun);
	load_property("configfile",P_STRING,GLOBAL.configfile);
	load_property("use_cvcapture",P_INT,&GLOBAL.use_cv_capture);


	load_property("midiports",P_INT,&x);
	for (c=0;c<GLOBAL.midiports;c++) midiOutClose(MIDIPORTS[c].midiout);
	for (t=1;t<=x;t++)
	{
		sprintf(midipname,"midiport%d",t);
		load_property(midipname,P_STRING,tempname);
		f=0;
		for (c=0;c<GLOBAL.midiports;c++)
		{
			if (!strcmp(tempname,MIDIPORTS[c].portname))
			{
				write_logfile("open midi port: %s", tempname);
				midi_open_port(&(MIDIPORTS[c].midiout),c);
				f=1;
			}
		}
		if (!f) {strcat (tempname," not found"); report_error (tempname); }
	}

	CloseHandle(hFile);	
	return(TRUE);
	
}
コード例 #16
0
ファイル: ob_evaluator.cpp プロジェクト: RD3BAX/BrainBay
void EVALOBJ::load(HANDLE hFile) 
{
    char expr[MAXEXPRLENGTH];

	load_object_basics(this);
    load_property("expression",P_STRING,expr);
    setExpression(expr);
}
コード例 #17
0
ファイル: ob_translate.cpp プロジェクト: Smeetal/BrainBay
void TRANSLATEOBJ::load(HANDLE hFile) 
{
	int t;
	char sztemp[20];

	load_object_basics(this);
	load_property("points",P_INT,&points);
	for (t=0;t<points;t++)
	{
		wsprintf(sztemp,"pointx%d",t);
		load_property(sztemp,P_INT,&pointx[t]);
		wsprintf(sztemp,"pointy%d",t);
		load_property(sztemp,P_FLOAT,&pointy[t]);
	}
	calculate_map();
	
}
コード例 #18
0
ファイル: ob_neurobit.cpp プロジェクト: Smeetal/BrainBay
	  void NEUROBITOBJ::load(HANDLE hFile) 
	  {
  		  load_object_basics(this);
		  load_property("device",P_STRING,device);

	  	  if (DevCtx>=0) NdCloseDevContext(DevCtx);
		  load_devctx();
		  update_channelinfo();
 		  GLOBAL.neurobit_available=1;
	  }
コード例 #19
0
ファイル: ob_array3600.cpp プロジェクト: dadymax/BrainBay
void ARRAY3600OBJ::load(HANDLE hFile) 
{
	load_object_basics(this);
	load_property("comport",P_INT,&comport);
	load_property("baudrate",P_INT,&baudrate);
	load_property("connected",P_INT,&connected);
	load_property("periodic",P_INT,&periodic);
	load_property("period",P_INT,&period);
	load_property("maxvoltage",P_INT,&maxvoltage);
	load_property("maxcurrent",P_INT,&maxcurrent);
	load_property("maxpower",P_INT,&maxpower);
	load_property("address",P_INT,&address);
	load_property("voltage",P_INT,&voltage);
	if (connected) 
	{ 
		connected=SetupComPort(comport);
	    if (connected) setToPcControlOn(); 
	}

}
コード例 #20
0
ファイル: ob_ballgame.cpp プロジェクト: RD3BAX/BrainBay
	  void BALLGAMEOBJ::load(HANDLE hFile) 
	  {
		  load_object_basics(this);
		  load_property("speed",P_INT,&speed);
		  load_property("racket",P_INT,&racket);
		  load_property("best",P_INT,&best);
		  load_property("middle",P_INT,&reset_middle);
		  load_property("top",P_INT,&top);
		  load_property("left",P_INT,&left);
		  load_property("right",P_INT,&right);
		  load_property("bottom",P_INT,&bottom);
		  MoveWindow(displayWnd,left,top,right-left,bottom-top,TRUE);
	  }
コード例 #21
0
ファイル: ob_avi.cpp プロジェクト: dadymax/BrainBayRaiseUp
void AVIOBJ::load(HANDLE hFile)
{
    load_object_basics(this);
    load_property("avi-file",P_STRING,avifile);
    load_property("wnd-top",P_INT,&top);
    load_property("wnd-bottom",P_INT,&bottom);
    load_property("wnd-left",P_INT,&left);
    load_property("wnd-right",P_INT,&right);

    if (strcmp(avifile,"none"))
    {
        char szFileName[MAX_PATH] = "";
        strcpy(szFileName,avifile);
        if (!OpenAVI (szFileName))
        {
            strcpy(szFileName,"could not Open AVI-File: ");
            strcat(szFileName,avifile);
            report_error ( szFileName);
        }
    }
    MoveWindow(displayWnd,left,top,right-left,bottom-top,TRUE);
}
コード例 #22
0
ファイル: ob_signal.cpp プロジェクト: Smeetal/BrainBay
	  void SIGNALOBJ::load(HANDLE hFile) 
	  {
		  load_object_basics(this);
		  load_property("frequency",P_FLOAT,&frequency);
		  load_property("center",P_FLOAT,&center);
		  load_property("gain",P_FLOAT,&gain);
		  load_property("phase",P_FLOAT,&phase);
		  load_property("noise",P_INT,&noise);
		  load_property("type",P_INT,&sigtype);
		  load_property("enable_in",P_INT,&enable_in);
  		  if (enable_in) { width=80; height=CON_START+2*CON_HEIGHT+5;}
		  else {width=50; height=CON_START+CON_HEIGHT+5; }
	  }
コード例 #23
0
ファイル: files.cpp プロジェクト: Smeetal/BrainBay
int load_next_config_buffer(HANDLE hFile)
{
    DWORD dwRead;
	char buf[2];
	int pos,l;

 	pos=0;
	dwRead=1;l=1;
	while (l&&dwRead)
	{
		ReadFile(hFile, &buf,1,&dwRead,NULL);
		GLOBAL.configbuffer[pos++]=buf[0];	GLOBAL.configbuffer[pos]=0;

		if (strstr(GLOBAL.configbuffer,"end object")!=NULL) l=0;
	}
    //report_error(GLOBAL.configbuffer);
	pos=-1;
	load_property("next object",P_INT,&pos);
	return (pos);
}
コード例 #24
0
ファイル: ob_filter.cpp プロジェクト: dadymax/BrainBay
	  void FILTEROBJ::load(HANDLE hFile) 
	  {	
		char sztemp[30];
		char szorder[5];

		  load_object_basics(this);
		  load_property("name",P_STRING,name);
		  load_property("type",P_INT,&filtertype);
		  load_property("order",P_INT,&par0);
		  load_property("display-from",P_INT,&dispfrom);
		  load_property("display-to",P_INT,&dispto);
		  load_property("par1",P_FLOAT,&par1);
		  load_property("par2",P_FLOAT,&par2);
		
		  if (fbuf!=NULL) fid_run_freebuf(fbuf);
		  if (filt!=NULL) fid_run_free(filt);
 		  strcpy(sztemp,FILTERTYPE[filtertype].init);
		  wsprintf(szorder,"%d",par0);
		  strcat(sztemp,szorder);			
		  filt=fid_design(sztemp, PACKETSPERSECOND, par1, par2, 0, 0);
		  run= fid_run_new(filt, &(funcp));
		  fbuf=fid_run_newbuf(run);
	  }
コード例 #25
0
ファイル: files.cpp プロジェクト: Smeetal/BrainBay
void load_object_basics(BASE_CL * actobj)
{
	int t;
	char temp[100];

	load_property("xpos",P_INT,&(actobj->xPos));
	load_property("ypos",P_INT,&(actobj->yPos));
	load_property("inputports",P_INT,&(actobj->inports));
	load_property("outputports",P_INT,&(actobj->outports));
	load_property("tag",P_STRING,actobj->tag);

	for (t=1;t<=actobj->inports;t++)
	{
		sprintf(temp,"inport%ddesc",t);
		load_property(temp,P_STRING,actobj->in_ports[t-1].in_desc);
		sprintf(temp,"inport%ddim",t);
		load_property(temp,P_STRING,actobj->in_ports[t-1].in_dim);
		sprintf(temp,"inport%dmin",t);
		load_property(temp,P_FLOAT,&(actobj->in_ports[t-1].in_min));
		sprintf(temp,"inport%dmax",t);
		load_property(temp,P_FLOAT,&(actobj->in_ports[t-1].in_max));
		sprintf(temp,"inport%drange",t);
		load_property(temp,P_INT,&(actobj->in_ports[t-1].get_range));

	}
	for (t=1;t<=actobj->outports;t++)
	{
		sprintf(temp,"outport%ddesc",t);
		load_property(temp,P_STRING,actobj->out_ports[t-1].out_desc);
		sprintf(temp,"outport%ddim",t);
		load_property(temp,P_STRING,actobj->out_ports[t-1].out_dim);
		sprintf(temp,"outport%dmin",t);
		load_property(temp,P_FLOAT,&(actobj->out_ports[t-1].out_min));
		sprintf(temp,"outport%dmax",t);
		load_property(temp,P_FLOAT,&(actobj->out_ports[t-1].out_max));
		sprintf(temp,"outport%drange",t);
		load_property(temp,P_INT,&(actobj->out_ports[t-1].get_range));

	}

}
コード例 #26
0
ファイル: files.cpp プロジェクト: Smeetal/BrainBay
BOOL load_configfile(LPCTSTR pszFileName)
{

    HANDLE hFile;
	int t, act_samplingrate=DEF_PACKETSPERSECOND; 
	int act_type,num_objects, save_toolbox, save_connected, try_connect;
	const char * d_name;
	char new_name[256],szdata[20];

	write_logfile("loading design configuration: %s",(char *)pszFileName);

    hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
    if(hFile != INVALID_HANDLE_VALUE)
    {
		GLOBAL.loading=1;
		d_name=pszFileName;
		while (strstr(d_name,"\\")) d_name=strstr(d_name,"\\")+1;
		strcpy(new_name,"BrainBay - ");strcat(new_name,d_name);
	    SetWindowText(ghWndMain,new_name);
		strcpy(GLOBAL.configfile,pszFileName);
		save_settings();
		save_toolbox=-1;

		save_connected=TTY.CONNECTED;
		SendMessage(ghWndStatusbox,WM_COMMAND, IDC_STOPSESSION,0);
		
		//TTY.read_pause=1;
		close_captfile();

		if (ghWndAnimation!=NULL) SendMessage(ghWndAnimation,WM_CLOSE,0,0);
		ghWndAnimation=NULL;

		close_toolbox();actobject=NULL;
		//InvalidateRect(ghWndMain, NULL, TRUE);

		while (GLOBAL.objects>0)
		    free_object(0);

		GLOBAL.run_exception=0;
		GLOBAL.minimized=FALSE;

	     load_next_config_buffer(hFile);
		 load_property("objects",P_INT,&GLOBAL.objects);
		 load_property("main-top",P_INT,&GLOBAL.top);
		 load_property("main-left",P_INT,&GLOBAL.left);
		 load_property("main-right",P_INT,&GLOBAL.right);
		 load_property("main-bottom",P_INT,&GLOBAL.bottom);
		 load_property("anim-top",P_INT,&GLOBAL.anim_top);
		 load_property("anim-left",P_INT,&GLOBAL.anim_left);
		 load_property("anim-right",P_INT,&GLOBAL.anim_right);
		 load_property("anim-bottom",P_INT,&GLOBAL.anim_bottom);
		 load_property("design-top",P_INT,&GLOBAL.design_top);
		 load_property("design-left",P_INT,&GLOBAL.design_left);
		 load_property("design-right",P_INT,&GLOBAL.design_right);
		 load_property("design-bottom",P_INT,&GLOBAL.design_bottom);
		 load_property("tool-top",P_INT,&GLOBAL.tool_top);
		 load_property("tool-left",P_INT,&GLOBAL.tool_left);
		 load_property("tool-right",P_INT,&GLOBAL.tool_right);
		 load_property("tool-bottom",P_INT,&GLOBAL.tool_bottom);
		 load_property("showdesign",P_INT,&GLOBAL.showdesign);
		 load_property("hidestatus",P_INT,&GLOBAL.hidestatus);
		 load_property("showtoolbox",P_INT,&GLOBAL.showtoolbox);
		 load_property("autorun",P_INT,&GLOBAL.autorun);
		 load_property("minimized",P_INT,&GLOBAL.minimized);
		 save_toolbox=GLOBAL.showtoolbox;


		 TTY.PORT=0;try_connect=0;
		 load_property("comport",P_INT,&TTY.PORT);		 
		 load_property("connected",P_INT,&try_connect);	 
		 load_property("bidirect",P_INT,&TTY.BIDIRECT);
		 load_property("devicetype",P_INT,&TTY.devicetype);
		 load_property("samplingtype",P_INT,&TTY.samplingrate);
		 load_property("baudtype",P_INT,&TTY.BAUDRATE);
		 load_property("flow_control",P_INT,&TTY.FLOW_CONTROL);

		 if (save_connected) { update_p21state(); save_connected=TTY.CONNECTED; }
		 BreakDownCommPort();  
		 if (try_connect) { TTY.CONNECTED=SetupCommPort(TTY.PORT); update_p21state(); }
		
		 load_property("captfilename",P_STRING,CAPTFILE.filename);
		 load_property("captfiletype",P_INT,&CAPTFILE.filetype);
		 load_property("captfileoffset",P_INT,&CAPTFILE.offset);
	 	 load_property("dialoginterval",P_INT,&GLOBAL.dialog_interval);
		 load_property("drawinterval",P_INT,&GLOBAL.draw_interval);
		 load_property("samplingrate",P_INT,&act_samplingrate);
		 PACKETSPERSECOND=act_samplingrate;

		 MoveWindow(ghWndMain,GLOBAL.left,GLOBAL.top,GLOBAL.right-GLOBAL.left,GLOBAL.bottom-GLOBAL.top,TRUE);
		 MoveWindow(ghWndDesign,GLOBAL.design_left,GLOBAL.design_top,GLOBAL.design_right-GLOBAL.design_left,GLOBAL.design_bottom-GLOBAL.design_top,TRUE);
		 if (!GLOBAL.showdesign)
		 {  
			 ShowWindow(ghWndDesign, FALSE); 
			 SetDlgItemText(ghWndStatusbox,IDC_DESIGN,"Show Design"); 
		 }
		 else 
		 {
			 ShowWindow(ghWndDesign,TRUE);
		     SetWindowPos(ghWndDesign,0,0,0,0,0,SWP_DRAWFRAME|SWP_NOMOVE|SWP_NOSIZE);
			 SetDlgItemText(ghWndStatusbox,IDC_DESIGN,"Hide Design"); 
		 }
		 if (!GLOBAL.hidestatus)
		 	 ShowWindow(ghWndStatusbox, TRUE); 
		 else	 ShowWindow(ghWndStatusbox,FALSE);
		     
		 num_objects=GLOBAL.objects;
		 GLOBAL.objects=0;
   		 for (t=0;t<num_objects;t++)
		 {
			act_type=load_next_config_buffer(hFile);
			if (act_type>=0)
			{	
				create_object(act_type);
				if (actobject != NULL )
				{
					actobject->load(hFile);
					link_object(actobject);
				}
				else critical_error("Could not load all objects, quitting ...\ndelete brainbay.cfg to prevent this at program startup ... ");

			}
		 }
		 CloseHandle(hFile);
		 for (t=0;t<num_objects;t++) objects[t]->update_inports();
		 update_dimensions();

		 CAPTFILE.filehandle=INVALID_HANDLE_VALUE;
		 CAPTFILE.do_read=0;
		 if (strcmp(CAPTFILE.filename,"none"))
		 {
			 char st[150];
			 reduce_filepath(st,CAPTFILE.filename);
			 strcpy(CAPTFILE.filename,GLOBAL.resourcepath);
			 strcat(CAPTFILE.filename,"ARCHIVES\\");
			 strcat(CAPTFILE.filename,st);			 
			 open_captfile(CAPTFILE.filename);
		 }

		 init_system_time();
		 reset_oscilloscopes();
		 PACKET.readstate=0;
		 ShowWindow( ghWndMain, TRUE ); UpdateWindow( ghWndMain ); 

 		 update_samplingrate(act_samplingrate);
		 update_devicetype();
		 get_session_length();


		 SetDlgItemInt(ghWndStatusbox,IDC_SAMPLINGRATE,act_samplingrate,0);
		 SetDlgItemText(ghWndStatusbox,IDC_STATUS,"Configuration loaded");
		 SetDlgItemText(ghWndStatusbox,IDC_TIME,"0.0");
		 SetDlgItemText(ghWndStatusbox,IDC_JUMPPOS,"0.0");
		 sprintf(szdata, "%.1f", (float)GLOBAL.session_length/(float)PACKETSPERSECOND);
		 SetDlgItemText(ghWndStatusbox,IDC_SESSLEN,szdata);
 		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETPOS,TRUE,(LONG)0);
		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETSELEND,TRUE,(LONG)0);
		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETSELSTART,TRUE,(LONG)0);

		 SetWindowPos(ghWndMain,0,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
		 InvalidateRect(ghWndMain,NULL,TRUE);
 		 InvalidateRect(ghWndDesign,NULL,TRUE);

		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETSELSTART,TRUE,0);
		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETSELEND,TRUE,1000);
		 SendMessage(GetDlgItem(ghWndStatusbox,IDC_SESSIONPOS),TBM_SETPOS,TRUE,(LONG)(0));
		 if (GLOBAL.minimized) ShowWindow(ghWndMain, SW_MINIMIZE);

		 GLOBAL.loading=0;
		 if ((GLOBAL.autorun) && (!GLOBAL.run_exception)) SendMessage(ghWndStatusbox,WM_COMMAND, IDC_RUNSESSION,0);
  	    
		 if (save_toolbox!=-1)
		 {
			GLOBAL.showtoolbox=save_toolbox;
			actobject=objects[GLOBAL.showtoolbox];
			actobject->make_dialog();
		 } 
		 
		write_logfile("load successful");
		return TRUE;
		 
    }
	write_logfile("could not load design configuration file.");
	return FALSE;    	
}
コード例 #27
0
/*
 * Load a property group into a pgroup_t.  Returns
 *   0 - success
 *   ECANCELED - pg was deleted
 *   ECONNABORTED - repository disconnected
 *   EBADF - pg is corrupt (error printed if fmri is given)
 *   ENOMEM - out of memory
 *   EACCES - permission denied when reading property
 */
int
load_pg(const scf_propertygroup_t *pg, pgroup_t **ipgp, const char *fmri,
    const char *snapname)
{
	pgroup_t *ipg;
	int r;

	if (scf_iter_pg_properties(load_propiter, pg) != 0) {
		switch (scf_error()) {
		case SCF_ERROR_DELETED:
			return (ECANCELED);

		case SCF_ERROR_CONNECTION_BROKEN:
			return (ECONNABORTED);

		case SCF_ERROR_HANDLE_MISMATCH:
		case SCF_ERROR_NOT_SET:
		case SCF_ERROR_NOT_BOUND:
		default:
			bad_error("scf_iter_pg_properties", scf_error());
		}
	}

	r = load_pg_attrs(pg, &ipg);
	switch (r) {
	case 0:
		break;

	case ECANCELED:
	case ECONNABORTED:
	case ENOMEM:
		return (r);

	default:
		bad_error("load_pg_attrs", r);
	}

	for (;;) {
		property_t *iprop;

		r = scf_iter_next_property(load_propiter, load_prop);
		if (r == 0)
			break;
		if (r != 1) {
			switch (scf_error()) {
			case SCF_ERROR_DELETED:
				r = ECANCELED;
				goto out;

			case SCF_ERROR_CONNECTION_BROKEN:
				r = ECONNABORTED;
				goto out;

			case SCF_ERROR_HANDLE_MISMATCH:
			case SCF_ERROR_NOT_BOUND:
			case SCF_ERROR_NOT_SET:
			case SCF_ERROR_INVALID_ARGUMENT:
			default:
				bad_error("scf_iter_next_property",
				    scf_error());
			}
		}

		r = load_property(load_prop, &iprop);
		switch (r) {
		case 0:
			break;

		case ECANCELED:
		case ECONNABORTED:
		case ENOMEM:
		case EACCES:
			goto out;

		default:
			bad_error("load_property", r);
		}

		r = internal_attach_property(ipg, iprop);
		if (r != 0) {
			if (fmri != NULL) {
				if (snapname == NULL)
					warn(gettext("Property group \"%s\" of "
					    "%s has multiple definitions of "
					    "property \"%s\".\n"),
					    ipg->sc_pgroup_name, fmri,
					    iprop->sc_property_name);
				else
					warn(gettext("Property group \"%s\" of "
					    "the \"%s\" snapshot of %s has "
					    "multiple definitions of property "
					    "\"%s\".\n"),
					    ipg->sc_pgroup_name, snapname, fmri,
					    iprop->sc_property_name);
			}
			r = EBADF;
			goto out;
		}
	}

	*ipgp = ipg;
	return (0);

out:
	internal_pgroup_free(ipg);
	return (r);
}
コード例 #28
0
ファイル: ob_deviation.cpp プロジェクト: ChrisVeigl/BrainBay
void DEVIATIONOBJ::load(HANDLE hFile) 
{
   load_object_basics(this);
   load_property("interval",P_INT,&interval);
}
コード例 #29
0
ファイル: ob_threshold.cpp プロジェクト: ChrisVeigl/BrainBay
	  void THRESHOLDOBJ::load(HANDLE hFile) 
	  {
		  float temp;
		  load_object_basics(this);
		  load_property("play_interval",P_INT,&play_interval);
		  load_property("interval_len",P_INT,&interval_len);
		  load_property("gain",P_INT,&signal_gain);
		  load_property("from-input",P_FLOAT,&from_input);
		  load_property("to-input",P_FLOAT,&to_input);
		  load_property("and/or",P_INT,&op);
		  load_property("show-meter",P_INT,&showmeter);
		  load_property("only-rising",P_INT,&rising);
		  load_property("only-falling",P_INT,&falling);
		  load_property("usemedian",P_INT,&usemedian);
		  load_property("baseline",P_INT,&baseline);
		  load_property("color",P_FLOAT,&temp);
		  color=(COLORREF)temp;
		  load_property("bkcol",P_FLOAT,&temp);
		  bkcolor=(COLORREF)temp;
		  if (bkcolor==color) bkcolor=RGB(255,255,255);
		  temp=0;
		  load_property("fontcol",P_FLOAT,&temp);
		  fontcolor=(COLORREF)temp;
		  temp=RGB(255,255,255);
		  load_property("fontbkcol",P_FLOAT,&temp);
		  fontbkcolor=(COLORREF)temp;
		  load_property("top",P_INT,&top);
		  load_property("left",P_INT,&left);
		  load_property("right",P_INT,&right);
		  load_property("bottom",P_INT,&bottom);
		  load_property("bigadapt",P_INT,&bigadapt);
		  load_property("smalladapt",P_INT,&smalladapt);
		  load_property("adaptinterval",P_INT,&adapt_interval);
		  load_property("fontsize",P_INT,&fontsize);
		  if (fontsize)
		  {
			if (font) DeleteObject(font);
		    if (!(font = CreateFont(-MulDiv(fontsize, GetDeviceCaps(GetDC(NULL), LOGPIXELSY), 72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Arial")))
					report_error("Font creation failed!");
		  }
		  load_property("barsize",P_INT,&barsize);
		  load_property("wndcaption",P_STRING,wndcaption);

		if (!showmeter)
		{
			if (displayWnd!=NULL){ DestroyWindow(displayWnd); displayWnd=NULL; }
		}
		else 
		{ 
			MoveWindow(displayWnd,left,top,right-left,bottom-top,TRUE); 

			if (GLOBAL.locksession) {
	 			SetWindowLong(displayWnd, GWL_STYLE, GetWindowLong(displayWnd, GWL_STYLE)&~WS_SIZEBOX);
				//SetWindowLong(displayWnd, GWL_STYLE, 0);
			} else { SetWindowLong(displayWnd, GWL_STYLE, GetWindowLong(displayWnd, GWL_STYLE) | WS_SIZEBOX); }
		    SetWindowText(displayWnd,wndcaption);
			InvalidateRect (displayWnd, NULL, TRUE);
		}
		redraw=1;
	  }
コード例 #30
0
ファイル: ob_constant.cpp プロジェクト: dadymax/BrainBay
void CONSTANTOBJ::load(HANDLE hFile) 
{
	load_object_basics(this);
    load_property("value",P_FLOAT,&value);
}