void gui::slider::slide_to_fit(int position) {
    int top = magnitude;
    int bot = magnitude + space - 1;
    
    if (position < top) {
        magnitude = math::clamp(position, minimum, maximum);
        update_dimensions();
    } else if (position > bot) {
        magnitude = math::clamp(position - space + 1, minimum, maximum);
        update_dimensions();
    }
}
bool gui::slider::go_forward() {
    if (magnitude + 1 <= maximum) {
        ++magnitude;
        update_dimensions();
        return true;
    }
    return false;
}
bool gui::slider::go_backward() {
    if (magnitude - 1 >= minimum) {
        --magnitude;
        update_dimensions();
        return true;
    }
    return false;
}
示例#4
0
	void NEUROBITOBJ::update_channelinfo(void)
	{
  	  	  NDGETVAL gv;
		  int chans,i;
		  float max_sr;

		  if (DevCtx<0) { 
			  write_logfile ("could not open Neurobit device context");
			  return;
		  }
  		  if (NdGetParam(ND_PAR_CHAN_NUM, 0, &gv) || (gv.type&~ND_T_LIST)!=ND_T_INT) 
			  return;

		  max_sr=0;
		  chans = gv.val.i;
		  outports = chans;

		  strcpy(out_ports[0].out_dim,"uV");
		  chncol[0]=CI_GREEN;
		  for (i=1; i<5; i++) chncol[i]=CI_GRAY;
	  	  for (i=0; i<chans; i++) {
			/* Update channel indicator field info */
			if (!NdGetParam(ND_PAR_CH_LABEL, i, &gv)) {
				 strcpy( out_ports[i].out_name,gv.val.t);
			}
			if (!NdGetParam(ND_PAR_CH_RANGE_MAX, i, &gv)) {
				out_ports[i].out_max = gv.val.f;
			}
			if (!NdGetParam(ND_PAR_CH_RANGE_MIN, i, &gv)) {
				out_ports[i].out_min = gv.val.f;
			}
			if (!NdGetParam(ND_PAR_CH_SR, i, &gv)) {
				if (gv.val.f>max_sr) max_sr=gv.val.f;
			}

			strcpy(out_ports[i].out_dim,NdParamInfo(ND_PAR_CH_RANGE_MAX, i)->unit);
/*
			if (!NdGetParam(ND_PAR_CH_FUNC, i, &gv)) {
				if (!strcmp(gv.val.t,"Voltage")) strcpy(out_ports[i].out_dim,"uV");
				if (!strcmp(gv.val.t,"Temperature")) strcpy(out_ports[i].out_dim,"Deg");
				if (!strcmp(gv.val.t,"Conductance")) strcpy(out_ports[i].out_dim,"uS");
				if (!strcmp(gv.val.t,"Resistance")) strcpy(out_ports[i].out_dim,"kOhm");

			}*/
			if (!NdGetParam(ND_PAR_CH_EN, i, &gv)) {
				if (gv.val.b) chncol[i+1]= CI_GREEN; else chncol[i+1]=CI_GRAY;
			}
		  }
         if (max_sr>0) update_samplingrate((int)max_sr);

		 dev_chans=0;
		 update_dimensions();
 	 	 reset_oscilloscopes();

		 InvalidateRect(ghWndMain,NULL,TRUE);
		 InvalidateRect(ghWndDesign,NULL,TRUE);
		 if (ghWndToolbox == hDlg) InvalidateRect(ghWndToolbox,NULL,FALSE);
	}
示例#5
0
void RenderableChunk::reset() {
    memset(blk, 0, sizeof blk);
    elements = 0;
    block_counter = -1;
    slot = 0;
    lastused = get_current_time();
    changed = true;
    left = right = below = above = front = back = 0;
    has_lights = false;
    update_dimensions();
}
示例#6
0
RenderableChunk::RenderableChunk(block_type from[CX][CY][CZ]) {
    memset(blk, 0, sizeof blk);
    elements = 0;
    block_counter = -1;
    slot = 0;
    lastused = get_current_time();
    changed = true;
    left = right = below = above = front = back = 0;
    memcpy(&blk[0][0][0], &from[0][0][0], sizeof(block_type)*CX*CY*CZ);
    has_lights = false;
    update_dimensions();
}
示例#7
0
void init()
{
    GS_ASSERT(mech_list == NULL);
    mech_list = new MechList;
    #if DC_CLIENT
    GS_ASSERT(mech_list_renderer == NULL);
    mech_list_renderer = new MechListRenderer;
    mech_list_mesh_renderer = new MechListMeshRenderer;
    mech_light_effect_renderer = new MechLightEffect;
    // update the mech attribute dimensions after we determine sprite dimensions
    // TODO -- handle this on server too?
    update_dimensions();
    #endif
}
示例#8
0
// --------------------------------------------------------------------
// UI_SCROLLBAR::set_bmaps
//
// Call the UI_GADGET::set_bmaps() function for the child components
// of a scroll bar (the up and down button).  Set up the bmaps for the
// line itself.
//
// We also need to get the dimensions of the bitmap button so we can update
// the dimensions of the scrollbar.
//
// returns:		-1 ==> error
//					 0 ==> success
//
int UI_SCROLLBAR::set_bmaps(char *up_button_fname, char *down_button_fname, char *line_fname)
{
	int bx, by, bh, bw;

	up_button.set_bmaps(up_button_fname);
	down_button.set_bmaps(down_button_fname);
	up_button.get_dimensions(&bx, &by, &bw, &bh);
	
	// set the bitmaps for the rectangle that is the scrollbar itself
	((UI_GADGET*)this)->set_bmaps(line_fname);
	uses_bmaps = 1;

	update_dimensions(x,y+bw,bw,h-bw*2);

	return 0;
}
示例#9
0
void RenderableChunk::set(int x, int y, int z, block_type type) {
    uint16_t prev = blk[x][y][z].type;
    blk[x][y][z] = type;
    if (!prev) {
        // assume i'm adding a block
        block_counter++;
    }
    if (!type.type) {
        // pysch i'm actually not adding a block
        block_counter--;
        if (prev) {
            // i removed a block. dude...
            bool anyMatchingLower = (x == lower_bound.x) || (y == lower_bound.y) || (z == lower_bound.z);
            bool anyMatchingUpper = (x == upper_bound.x) || (y == upper_bound.y) || (z == upper_bound.z);
            if (anyMatchingLower || anyMatchingUpper) {
                // we removed a block on the periphery. update dimensions!
                update_dimensions();
            }
        }
    }
    else {
        // update lower_bound, upper_bound
        
        lower_bound.x = imin(x, lower_bound.x);
        lower_bound.y = imin(y, lower_bound.y);
        lower_bound.z = imin(z, lower_bound.z);
        upper_bound.x = imax(x, upper_bound.x);
        upper_bound.y = imax(y, upper_bound.y);
        upper_bound.z = imax(z, upper_bound.z);
    }
    // When updating blocks at the edge of this chunk,
    // visibility of blocks in the neighbouring chunk might change.
    if(x == 0 && left)
        left->changed = true;
    if(x == CX - 1 && right)
        right->changed = true;
    if(y == 0 && below)
        below->changed = true;
    if(y == CY - 1 && above)
        above->changed = true;
    if(z == 0 && front)
        front->changed = true;
    if(z == CZ - 1 && back)
        back->changed = true;
    changed = true;
}
示例#10
0
gui::slider::slider(int p_x, int p_y, unsigned int p_length, int p_items, int p_space, orientation p_orientation) {
    x = p_x;
    y = p_y;
    
    m_orientation = p_orientation;
    
    width  = (m_orientation == orientation::horizontal? p_length : 24);
    height = (m_orientation == orientation::vertical?   p_length : 24);
    
    slider_box.setFillColor(colors::charcoal);
    slider_box.setOutlineColor(colors::black);
    slider_box.setOutlineThickness(1.0f);
    
    items = p_items;
    space = p_space;
    
    if (m_orientation == orientation::horizontal) {
        const sf::Texture& right_arrow = resource_cache::get_texture(resource_directory::get("slider_arrow_right"));
        const sf::Texture& left_arrow  = resource_cache::get_texture(resource_directory::get("slider_arrow_left"));
        
        slider_pre_arrow = make_unique<texture_button>(left_arrow);
        
        slider_pre_arrow  = make_unique<texture_button>(left_arrow);
        slider_post_arrow = make_unique<texture_button>(right_arrow);
        slider_button     = make_unique<generic_button>(0, 0, 0, 0, colors::matterhorn);
    } else if (m_orientation == orientation::vertical) {
        const sf::Texture& up_arrow   = resource_cache::get_texture(resource_directory::get("slider_arrow_up"));
        const sf::Texture& down_arrow = resource_cache::get_texture(resource_directory::get("slider_arrow_down"));
        
        slider_pre_arrow  = make_unique<texture_button>(up_arrow);
        slider_post_arrow = make_unique<texture_button>(down_arrow);
        slider_button     = make_unique<generic_button>(0, 0, 0, 0, colors::matterhorn);
    }
    
    slider_pre_arrow->set_callback([this] { go_backward(); });
    slider_post_arrow->set_callback([this] { go_forward(); });
    
    minimum = 0;
    maximum = items >= space? items - space : 0;
    magnitude = 0;
    
    update_dimensions();
}
示例#11
0
void gui::slider::resize_slider_button(int new_items) {
    items = new_items;
    maximum = items >= space? items - space : 0;
    magnitude = math::clamp(magnitude, minimum, maximum);
    update_dimensions();
}
示例#12
0
void gui::slider::set_width(unsigned int p_width) {
    width = p_width;
    update_dimensions();
}
示例#13
0
void gui::slider::set_position(int p_x, int p_y) {
    x = p_x;
    y = p_y;
    update_dimensions();
}
示例#14
0
void gui::slider::set_y(int p_y) {
    y = p_y;
    update_dimensions();
}
示例#15
0
void gui::slider::set_x(int p_x) {
    x = p_x;
    update_dimensions();
}
示例#16
0
void gui::slider::set_height(unsigned int p_height) {
    height = p_height;
    update_dimensions();
}
示例#17
0
void gui::slider::set_size(unsigned int p_width, unsigned int p_height) {
    width = p_width;
    height = p_height;
    update_dimensions();
}
示例#18
0
LRESULT CALLBACK EdfReaderDlgHandler( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
	EDF_READEROBJ * st;
	int x;
	static int actchn;
	char strfloat[21];

	
	st = (EDF_READEROBJ *) actobject;
    if ((st==NULL)||(st->type!=OB_EDF_READER)) return(FALSE);
 

	switch( message )
	{
		case WM_INITDIALOG:
				actchn=0;
				update_header(hDlg,&st->header);
				update_channelcombo(hDlg, st->channel, st->header.channels);
				update_channel(hDlg,st->channel,actchn);
				update_state(hDlg,st->state);

				sprintf(strfloat,"%.2f",(float)st->offset/(float)PACKETSPERSECOND);
				SetDlgItemText(hDlg,IDC_OFFSET,strfloat);

				if (st->edffile!=INVALID_HANDLE_VALUE)
				   SetDlgItemText(hDlg, IDC_EDFFILE, st->filename);
				else
					SetDlgItemText(hDlg, IDC_EDFFILE, "none");


				return TRUE;
	
		case WM_CLOSE: 
				EndDialog(hDlg, LOWORD(wParam));
				return TRUE;
			
		case WM_COMMAND:
			switch (LOWORD(wParam)) 
			{ 

			case IDC_SELECT:
			 
				 st->filename[0]=0;
				 if ((st->edffile=open_edf_file(&st->header,st->channel,st->filename))==INVALID_HANDLE_VALUE) st->state=0;
				 else if (st->header.channels==0) 
				 {
					SendMessage(hDlg,WM_COMMAND,IDC_CLOSE,0);
					report("EDF-File contained no channel inforamtion, file closed.");
					st->state=0;
				 }
				 else st->state=1;

				 update_state(hDlg,st->state);
				 if (!st->state) break;
				 st->calc_session_length();
				 get_session_length();
				 //set_session_pos(0);
				 st->session_pos(0);
				 st->packetcount=0;
				 st->sampos=0;

				 if (st->outports!=st->header.channels)
				 {
				   for (x=0;x<MAX_CONNECTS;x++)
				   {	
					st->out[x].from_port=-1;
					st->out[x].to_port=-1;
					st->out[x].to_object=-1;
				   }
				   for (x=0;x<MAX_PORTS;x++)
					st->out_ports[x].out_name[0]=0;
				 }
				 st->outports=st->header.channels;
				 st->height=CON_START+st->outports*CON_HEIGHT+5;

				 update_header(hDlg,&st->header);
				 update_channelcombo(hDlg, st->channel, st->header.channels);
				 update_channel(hDlg,st->channel,actchn);
				 st->get_captions();
				 update_dimensions();
			     SetDlgItemText(hDlg, IDC_EDFFILE, st->filename);
				 EnableWindow(GetDlgItem(hDlg, IDC_CLOSE), TRUE);
				 EnableWindow(GetDlgItem(hDlg, IDC_SELECT), FALSE);
				 InvalidateRect(ghWndDesign,NULL,TRUE);
				 
				 break; 

			case IDC_CLOSE: 
					st->state=0;
					update_state(hDlg,st->state);
					SetDlgItemText(hDlg, IDC_EDFFILE, "none");
					add_to_listbox(hDlg,IDC_LIST, "file closed.");
					strcpy(st->filename,"none");
					if (st->edffile==INVALID_HANDLE_VALUE) break;
					CloseHandle(st->edffile);
					st->edffile=INVALID_HANDLE_VALUE;
				    get_session_length();
 				    InvalidateRect(ghWndDesign,NULL,TRUE);

					break;
			case IDC_APPLYOFFSET:
					GetDlgItemText(hDlg, IDC_OFFSET, strfloat, 20);
					st->offset = (int)((float)atof(strfloat) * (float) PACKETSPERSECOND);
					st->calc_session_length();
					get_session_length();
				 break;
			case IDC_CHANNELCOMBO:
					if (HIWORD(wParam)==CBN_SELCHANGE)
					{
						get_channel(hDlg, st->channel, actchn);
						actchn=SendMessage(GetDlgItem(hDlg, IDC_CHANNELCOMBO), CB_GETCURSEL , 0, 0);
						update_channel(hDlg, st->channel,actchn);
					}
				 break;

			}
			return TRUE;
		case WM_SIZE:
		case WM_MOVE:  update_toolbox_position(hDlg);
		break;
		return TRUE;
	}
    return FALSE;
} 
示例#19
0
bool gui::slider::handle_event(context& context) {
    bool handled_0 = clickable::handle_event(context);
    bool handled_1 = slider_button->handle_event(context);
    
    bool handled_2 = slider_pre_arrow->handle_event(context);
    bool handled_3 = slider_post_arrow->handle_event(context);
    
    bool handled_4 = false;
    
    if (!handled_1 && !handled_2 && !handled_3) {
        int minimumX;
        int maximumX;
        int minimumY;
        int maximumY;
        
        if (m_orientation == orientation::horizontal) {
            minimumX = static_cast<int>(x + 24 + slider_button->get_width()/2);
            maximumX = static_cast<int>(x + width - 24 - slider_button->get_width()/2);
        } else if (m_orientation == orientation::vertical) {
            minimumY = static_cast<int>(y + 24 + slider_button->get_height()/2);
            maximumY = static_cast<int>(y + height - 24 - slider_button->get_height()/2);
        }
        
        int mouseX;
        int mouseY;
        bool detectedRelevantMouseEvent = false;
        
        if (context.event.type == sf::Event::EventType::MouseButtonPressed
         && contains_xy(context.event.mouseButton.x + (m_orientation == orientation::horizontal? 24 : 0),
                        context.event.mouseButton.y + (m_orientation == orientation::horizontal? 0  : 24))
         && !slider_button->is_left_clicked())
        {
            mouseX = std::min(std::max(context.event.mouseButton.x, minimumX), maximumX);
            mouseY = std::min(std::max(context.event.mouseButton.y, minimumY), maximumY);
            detectedRelevantMouseEvent = true;
        } else if (context.event.type == sf::Event::EventType::MouseMoved && slider_button->is_left_clicked()) {
            mouseX = std::min(std::max(context.event.mouseMove.x, minimumX), maximumX);
            mouseY = std::min(std::max(context.event.mouseMove.y, minimumY), maximumY);
            detectedRelevantMouseEvent = true;
        }
        
        if (detectedRelevantMouseEvent) {
            if (m_orientation == orientation::horizontal) {
                int horizontalSpace = maximumX - minimumX;
                int positions = std::max(items - space, 1);
                double offsetPerMagnitude = horizontalSpace / positions;
                
                magnitude = std::min(std::max(static_cast<int>((static_cast<double>(mouseX - minimumX) / offsetPerMagnitude) + 0.5), minimum), maximum);
	    } else if (m_orientation == orientation::vertical) {
                int verticalSpace = maximumY - minimumY;
                int positions = std::max(items - space, 1);
                double offsetPerMagnitude = verticalSpace / positions;
                
                magnitude = std::min(std::max(static_cast<int>((static_cast<double>(mouseY - minimumY) / offsetPerMagnitude) + 0.5), minimum), maximum);
            }
            update_dimensions();
            handled_4 = true;
        }
    }
    return handled_0 || handled_1 || handled_2 || handled_3 || handled_4;
}
示例#20
0
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;    	
}
示例#21
0
void gui::slider::set_slider_unitary_position(int value) {
    magnitude = math::clamp(value, minimum, maximum);
    update_dimensions();
}