예제 #1
0
void ModelViewController::ConvertToGCode()
{
	string GcodeTxt;

	Fl_Text_Buffer* buffer = gui->GCodeResult->buffer();
	buffer->remove(0, buffer->length());

	buffer = gui->GCodeStart->buffer();
	char* pText = buffer->text();
	string GCodeStart(pText);
	buffer = gui->GCodeLayer->buffer();
	free(pText);
	pText = buffer->text();
	string GCodeLayer(pText);
	buffer = gui->GCodeEnd->buffer();
	free(pText);
	pText = buffer->text();
	string GCodeEnd(pText);
	free(pText);

	ProcessControl.ConvertToGCode(GcodeTxt, GCodeStart, GCodeLayer, GCodeEnd);
	buffer = gui->GCodeResult->buffer();

	GcodeTxt += "\0";
	buffer->append( GcodeTxt.c_str() );
	redraw();
}
예제 #2
0
void create_about_tab(int x, int y, int w, int h)
{
  int              border;
  Fl_Text_Display *ptext;
  Fl_Text_Buffer  *pbuff;

  Fl_Group *group1 = new Fl_Group(x, y, w, h, "About");
  {
    border = 10;
    ptext = new Fl_Text_Display(x + border, y + border, w - 3 * border, h - 3 * border);
    pbuff = new Fl_Text_Buffer();
    ptext->buffer(pbuff);
    ptext->textcolor(fl_rgb_color(85, 170, 255));
    ptext->color(fl_rgb_color(8, 7, 5));
    pbuff->text("\n"
		" BMS manager Feb 2016.\n"
		" Part of SombreroBMS (battery management system)\n"
		" Copyright 2016 Patrick Xavier Areny\n"
		"\n"
		"\n"
		" Used libraries:\n"
		"\n"
		"  Tinyxml    \tLee Thomason\n"
		"  FLTK       \twww.fltk.org\n"
		"  OpenGl     \tKhronos group\n"
		"\n"
		"\n"
		" Used font: "
		"\n"
		"\n"
		" VeraMono ttf, Bitstream, Inc.\n"
		"\n");
  }
  group1->end();
}
예제 #3
0
static void Timer_CB(void *data)                // timer callback
{
    if(enable_timer==1)
    {
        Fl_Text_Buffer* buf;
        buf=new Fl_Text_Buffer();

        char text[1024];
        if(count_min<=0)
            sprintf(text,"Time elapsed : %d Secs",count_sec);
        else
        {
            if(count_min==1)
                sprintf(text,"Time elapsed : %d min , %d Secs",count_min,count_sec);
            else
                sprintf(text,"Time elapsed : %d mins , %d Secs",count_min,count_sec);
        }

        buf->text(text);
        count_sec=count_sec+1;
        if(count_sec>=60)
        {
            count_sec=0;
            count_min=count_min+1;
        }
        clock1->buffer(buf);
    }
    Fl::repeat_timeout(1, Timer_CB, data);
    //}
}
예제 #4
0
void ModelViewController::init()
{

	Fl_Text_Buffer* buffer = gui->GCodeStart->buffer();
	buffer->text(ProcessControl.GCodeStartText.c_str());
	buffer = gui->GCodeLayer->buffer();
	buffer->text(ProcessControl.GCodeLayerText.c_str());
	buffer = gui->GCodeEnd->buffer();
	buffer->text(ProcessControl.GCodeEndText.c_str());
    //buffer->text(ProcessControl.Notes.c_str());

	buffer = gui->LuaScriptEditor->buffer();
	buffer->text("--Clear existing gcode\nbase:ClearGcode()\n-- Set start speed for acceleration firmware\nbase:AddText(\"G1 F2600\\n\")\n\n	 z=0.0\n	 e=0;\n	oldx = 0;\n	oldy=0;\n	while(z<47) do\n	angle=0\n		while (angle < math.pi*2) do\n	x=(50*math.cos(z/30)*math.sin(angle))+70\n		y=(50*math.cos(z/30)*math.cos(angle))+70\n\n		--how much to extrude\n\n		dx=oldx-x\n		dy=oldy-y\n		if not (angle==0) then\n			e = e+math.sqrt(dx*dx+dy*dy)\n			end\n\n			-- Make gcode string\n\n			s=string.format(\"G1 X%f Y%f Z%f F2600 E%f\\n\", x,y,z,e)\n			if(angle == 0) then\n				s=string.format(\"G1 X%f Y%f Z%f F2600 E%f\\n\", x,y,z,e)\n				end\n				-- Add gcode to gcode result\nbase:AddText(s)\n	 angle=angle+0.2\n	 oldx=x\n	 oldy=y\n	 end\n	 z=z+0.4\n	 end\n	 ");

	//	buffer = gui->CommunationsLogText->buffer();
//	buffer->text("Dump");
}
예제 #5
0
void ModelViewController::GetCustomButtonText(int nr)
{
	string Text = ProcessControl.CustomButtonGcode[nr];

	Fl_Text_Buffer* buffer = gui->CustomButtonText->buffer();
	buffer->text(Text.c_str());
	gui->CustomButtonLabel->value(ProcessControl.CustomButtonLabel[nr].c_str());
	Fl::check();
}
예제 #6
0
void ProcessController::SaveBuffers()
{
	Fl_Text_Buffer* buffer = gui->GCodeStart->buffer();
	char* pText = buffer->text();
	GCodeStartText = string(pText);
	free(pText);

	buffer = gui->GCodeLayer->buffer();
	pText = buffer->text();
	GCodeLayerText = string(pText);
	free(pText);

	buffer = gui->GCodeEnd->buffer();
	pText = buffer->text();
	GCodeEndText = string(pText);
	free(pText);

	AltInfillLayersText = string(gui->AltInfillLayersInput->value());
}
예제 #7
0
/*************************************************************************************
** Function: putChordInTextBox
** Description: Create current scale and write it to fullscale c string, pass
**				fullscale to buffer and print to display text box.
*************************************************************************************/
void putChordInTextBox(Fl_Widget * o, void *v){
	//Get the chord based on the chord meu and chord root menu selections
	//using the ScaleWindow's scale object
	((ScaleWindow*)v)->getChord(((ScaleWindow*)v)->chordMenu->value(), ((ScaleWindow*)v)->chordRootMenu->value());
	//Prepare the text with fullscale c-string and the buffer
	Fl_Text_Buffer *buffer = new Fl_Text_Buffer();
	buffer->text(((ScaleWindow *)v)->fullscale);
	//Print the buffer
	((ScaleWindow*)v)->out->buffer(buffer);
}
예제 #8
0
void ModelViewController::Print()
{
	if( !serial->isConnected() )
	{
		fl_alert ("Not connected to printer.\nCannot start printing");
		return;
	}

	gui->ContinueButton->value(0);
	gui->ContinueButton->activate();
	gui->ContinueButton->label("Pause");
	gui->PrintButton->value(1);
	gui->PrintButton->label("Print");
	gui->PrintButton->deactivate();

	// Snack one line at a time from the Gcode view, and buffer it.
/*
	if(gui->PrintButton->value() == 0)	// Turned off print, cancel buffer and flush
	{
		m_bPrinting = false;
		return;
	}
*/
	serial->Clear();	// resets line nr and buffer
	serial->m_bPrinting = false;
	serial->SetDebugMask();
	serial->SetLineNr(-1);	// Reset LineNr Count
	gui->CommunationLog->clear();
	Fl_Text_Buffer* buffer = gui->GCodeResult->buffer();
	char* pText = buffer->text();
	uint length = buffer->length();

	uint pos = 2;
	while(pos < length)
		{
		char* line = buffer->line_text(pos);
		if(line[0] == ';')
			{
			pos = buffer->line_end(pos)+1;	// skip newline
			continue;
			}
		serial->AddToBuffer(line);
		pos = buffer->line_end(pos)+1;	// find end of line
		}

	gui->ProgressBar->maximum(serial->Length());
	gui->ProgressBar->label("Printing");
	gui->ProgressBar->value(0);
	free(pText);
	serial->StartPrint();
}
예제 #9
0
/*************************************************************************************
** Function: putScaleInTextBox
** Description: Create current scale and write it to fullscale c string, pass
**				fullscale to buffer and print to display text box.
*************************************************************************************/
void putScaleInTextBox(Fl_Widget * o, void *v){
	//Get the scale using the ScaleWindow's scale object
	((ScaleWindow*)v)->getScale(((ScaleWindow*)v)->modeMenu->value(), ((ScaleWindow*)v)->rootMenu->value());
	//Get a buffer so we can print in the display box
	Fl_Text_Buffer *buffer = new Fl_Text_Buffer();
	//Set the buffer to use the fullscale char string
	buffer->text(((ScaleWindow *)v)->fullscale);
	//Print the buffer
	((ScaleWindow*)v)->out->buffer(buffer);
	//Reset the chrord root menu and chord menu selections to zero
	((ScaleWindow*)v)->chordRootMenu->value(0);	
	((ScaleWindow*)v)->chordMenu->value(0);
	((ScaleWindow*)v)->scale.clearCurrentChord();
}
예제 #10
0
void ModelViewController::SaveCustomButton()
{
	int ButtonNr = gui->CustomButtonSelectorSlider->value()-1;

	Fl_Text_Buffer* buffer = gui->CustomButtonText->buffer();
	char* pText = buffer->text();
	string Text = string(pText);
	free(pText);
	ProcessControl.CustomButtonGcode[ButtonNr] = Text;

	const char* text = gui->CustomButtonLabel->value();
	string label(text);
	ProcessControl.CustomButtonLabel[ButtonNr] = label;

	RefreshCustomButtonLabels();
}
예제 #11
0
/*************************************************************************************
** Function: printErrorInProgression
** Description: This function is called when there's an error in adding a chord
**				to the chord progression. It adds an error message to the output
**				c-string which is printed in the text display
*************************************************************************************/
void ScaleWindow::printErrorInProgression(){
	//Create a buffer to printing
	Fl_Text_Buffer *buffer = new Fl_Text_Buffer();

	//Get the current progression so we can add it to the c-string
	//before addiging the error message
	std::vector<std::vector<std::string> > prog;
	prog = scale.getProgression();

	//Clear c-string
	char progChar[2000];
	for(int i = 0; i < 2000; i++)
		progChar[i] = '\0';

	//Find out which chord in the progression has the most notes
	//in it (since we're printing them vertically)
	int pos = 0;
	int max = 0; 
	for(int i = 0; i < prog.size(); i++){
		if(prog[i].size() > max) max = prog[i].size();
	}

	//Loop through the progression, getting the first, second, third, etc.
	//note in each chord and printing them row by row.
	//So the first note from each chord is printed in the first row,
	//then the second notes in the second row, etc.
	int x = 0;
	while(x < max){
		for(int i = 0; i < prog.size(); i++){
			int curLen = 0;
			if(x < prog[i].size()){
				curLen = prog[i][x].length();
				for(int j = 0; j < curLen; j++){
					progChar[pos] = prog[i][x][j];
					pos++;
				}
			}
			//If the corresponding chord has less than the max
			//number of notes, just print a space for it
			else{
				progChar[pos] = ' ';
				pos++;
				curLen = 1;
			}
			//Pad it out with white space
			while(curLen < 4){
				progChar[pos] = ' ';
				pos++;
				curLen++;
			}
		}
		//Add a new line at the end of each row
		progChar[pos] = '\n';
		pos++;
		x++;
	}

	//Error message to add to the c-string
	std::string errorMessage = "You must select a chord before adding to progression.";

	//Add the message!
	for(int i = 0; i < errorMessage.length(); i++){
		progChar[pos] = errorMessage[i];
		pos++;
	}

	//Print everything
	buffer->text(progChar);
	outProg->buffer(buffer);
}
예제 #12
0
파일: main.cpp 프로젝트: joewan/NeoEditor
void send_report(Fl_Button* button, void*)
{
	Neo::HTTPRequest connection(REPORT_DOMAIN, 80);
	const char* response = connection.sendPostRequest("/crash.php", buffer.text());
}
예제 #13
0
void check_answer(int usr_ans)
{
    rapidxml::xml_node<> *question_data=questions->first_node();
    int c=atoi(get_attr_value(question_data,"qid"));
    if(c<cur_qid)
    {
        while(c!=cur_qid)
        {
            question_data=question_data->next_sibling();
            c=atoi(get_attr_value(question_data,"qid"));
        }
    }
    else if(c>cur_qid)
    {
        while(c!=cur_qid)
        {
            question_data=question_data->previous_sibling();
            c=atoi(get_attr_value(question_data,"qid"));
        }
    }
    //at this point we are at the right question
    //printf("%s",get_attr_value(question_data,"qid"));
    rapidxml::xml_node<> *q_data=question_data->first_node();
    //printf("%s",get_attr_value(q_data,"txt"));
    Fl_Text_Buffer* buf;
    buf=new Fl_Text_Buffer();
    char options[6]= {'A','B','C','D','E'};
    char temp[16];
    buf->text("<p><font face='courier' size=5>");
    buf->append(get_attr_value(q_data,"txt"));
    buf->append("</font></p><table border='0' cellspacing='0' cellpadding='0'>");
    rapidxml::xml_node<> *answer=q_data->next_sibling();
    q_data=q_data->next_sibling();

    //printf("%d=",cur_qid);
    for(int i=0; i<5; i++)
    {

        if(i!=cur_ans)
        {
            q_data=q_data->next_sibling();
            if(i!=usr_ans)
            {
                buf->append("<tr><td width='20' valign='top'><font face='courier' size=5><b>");
                sprintf(temp,"%c",options[i]);
                buf->append(temp);
                buf->append(".</b></font></td><td width='365' valign='top'><font face='courier' size='5'>");
                buf->append(get_attr_value(q_data,"txt"));
                buf->append("</font></td></tr>");
            }
            else
            {
                buf->append("<tr><td width='20' valign='top' bgcolor='#ff6666'><font face='courier' size=5><b>");
                sprintf(temp,"%c",options[i]);
                buf->append(temp);
                buf->append(".</b></font></td><td width='365' valign='top' bgcolor='#ff6666'><font face='courier' size='5'>");
                buf->append(get_attr_value(q_data,"txt"));
                buf->append("</font></td></tr>");
            }

        }
        else
        {

            buf->append("<tr><td width='20' valign='top' bgcolor='#66ff66'><font face='courier' size=5><b>");
            sprintf(temp,"%c",options[i]);
            buf->append(temp);
            buf->append(".</b></font></td><td width='365' valign='top' bgcolor='#66ff66'><font face='courier' size='5'>");
            buf->append(get_attr_value(answer,"txt"));
            buf->append("</font></td></tr>");
        }

    }
    buf->append("</table>");

    cur_progress *o1 = (cur_progress*)obj_progress;
    Fl_Text_Buffer* buf1;
    buf1=new Fl_Text_Buffer();
    if(usr_ans==cur_ans)
    {
        buf1->text("<body><center><font face='courier' size='5' color='#009900'><b>&#10004;&nbsp;Correct answer</b></font></center></body>");
        o1->circle_data[cur_qid]=2;
    }

    else
    {
        buf1->text("<body><center><font face='courier' size='5' color='#cc3300'><b>&#10006;&nbsp;Incorrect. Correct answer is ");
        sprintf(temp,"%c",options[cur_ans]);
        buf1->append(temp);
        buf1->append("</b></font></center></body>");
        o1->circle_data[cur_qid]=1;
    }
    info_box->value(buf1->text());
    //o1->circle_data=cur_answers;    //1 = wrong, 2=right, 3=not asked
    o1->redraw();
    q->value(buf->text());
    disable_buttons(1);
    nxt_question->activate();
    nxt_question->take_focus();
    enable_timer=0;
}
예제 #14
0
void ModelViewController::TestCustomButton()
{
	Fl_Text_Buffer* buffer = gui->CustomButtonText->buffer();
	char* pText = buffer->text();
	serial->SendNow(pText);
}
예제 #15
0
void populate_psg(int pid_no)
{
    rapidxml::xml_node<> *passage_data=node->first_node();
    char cur_img_file_name[16];
    int cur_pid=atoi(get_attr_value(passage_data,"pid"));
    if(cur_pid<pid_no)
    {
        while(cur_pid!=pid_no)
        {
            passage_data=passage_data->next_sibling();
            cur_pid=atoi(get_attr_value(passage_data,"pid"));
        }
    }
    else if(cur_pid>pid_no)
    {
        while(cur_pid!=pid_no)
        {
            passage_data=passage_data->previous_sibling();
            cur_pid=atoi(get_attr_value(passage_data,"pid"));
        }
    }
    pid=pid_no;
    //so at this point i should have the right pid
    char temp[4];
    sprintf(temp,"%d",(pid+1)); // as the pids go from 0 to n while we count from 1 to n+1
    p_no->value(temp);
    rapidxml::xml_node<> *p_data=passage_data->first_node();
    Fl_Text_Buffer* buf;
    buf=new Fl_Text_Buffer();
    buf->text(get_attr_value(p_data,"txt"));
    unsigned char *pixels;
    int w,h;

    gen_random(cur_img_file_name,10);
    char *file_path=NULL;
    file_path = (char*)malloc((strlen(current_path)+16)*sizeof(char));
    strcpy(file_path,current_path);
    strcat(file_path,"line_no.gif");
    #ifdef __APPLE__
    pixels = stbi_load(file_path, &w, &h, 0, 3);
    #else
    pixels = stbi_load("line_no.gif", &w, &h, 0, 3);
    #endif
    if (pixels == 0)
    {
        fprintf(stderr, "Couldn't open input file '%s'\n", "line_no.gif");
        exit(1);
    }
    strcpy(file_path,current_path);
    strcat(file_path,cur_img_file_name);
    #ifdef __APPLE__
    stbi_write_png(file_path, w, (int)(buf->length()/1.6), 3, pixels, w*3);
    #else
    stbi_write_png(cur_img_file_name, w, (int)(buf->length()/1.6), 3, pixels, w*3);
    #endif

    buf->text("<body><table width='378' cellspacing=0 cellpadding=0 border=0><tr><td width='100' valign='top'><img src='");
    #ifdef __APPLE__
    buf->append(file_path);
    #else
    buf->append(cur_img_file_name);
    #endif
    buf->append("'></td><td><font face='courier' size=5>");
    buf->append(get_attr_value(p_data,"txt"));
    buf->append("</font></p></td></tr></table><table>");
    p->value(buf->text());
    //free(questions);
    questions=p_data->next_sibling();
    rapidxml::xml_node<> *temp_node=questions->last_node();
    totalq=atoi(get_attr_value(temp_node,"qid"));
    cur_progress *o1 = (cur_progress*)obj_progress;
    free(o1->circle_data);
    o1->circle_data = (int*)malloc((totalq+1)*sizeof(int));
    for(int i=0;i<=totalq;i++)  //1 = wrong, 2=right, 3=not asked
        o1->circle_data[i]=3;
    o1->num_circles=totalq+1;
    o1->redraw();
    populate_question(0);
    count_sec=0;
    count_min=0;
    enable_timer=1;
    #ifdef __APPLE__
    unlink(file_path);
    #else
    unlink(cur_img_file_name);
    #endif
}
예제 #16
0
void populate_question(int qid_no)
{
    rapidxml::xml_node<> *question_data=questions->first_node();
    int c=atoi(get_attr_value(question_data,"qid"));
    if(c<qid_no)
    {
        while(c!=qid_no)
        {
            question_data=question_data->next_sibling();
            c=atoi(get_attr_value(question_data,"qid"));
        }
    }
    else if(c>qid_no)
    {
        while(c!=qid_no)
        {
            question_data=question_data->previous_sibling();
            c=atoi(get_attr_value(question_data,"qid"));
        }
    }
    cur_qid=qid_no;

    //at this point we are at the right question
    //printf("%s",get_attr_value(question_data,"qid"));
    rapidxml::xml_node<> *q_data=question_data->first_node();
    //printf("%s",get_attr_value(q_data,"txt"));
    Fl_Text_Buffer* buf;
    buf=new Fl_Text_Buffer();
    char options[6]= {'A','B','C','D','E'};
    char temp[16];
    buf->text("<p><font face='courier' size=5>");
    buf->append(get_attr_value(q_data,"txt"));
    buf->append("</font></p><table border='0' cellspacing='0' cellpadding='0'>");
    rapidxml::xml_node<> *answer=q_data->next_sibling();
    q_data=q_data->next_sibling();
    srand (time(NULL));
    cur_ans=rand() % 5;
    //printf("%d  ",cur_ans);
    for(int i=0; i<5; i++)
    {

        if(i!=cur_ans)
        {
            q_data=q_data->next_sibling();
            buf->append("<tr><td width='20' valign='top'><font face='courier' size=5><b>");
            sprintf(temp,"%c",options[i]);
            buf->append(temp);
            buf->append(".</b></font></td><td width='365' valign='top'><font face='courier' size=5>");
            buf->append(get_attr_value(q_data,"txt"));
            buf->append("</font></td></tr>");
        }
        else
        {
            buf->append("<tr><td width='20' valign='top'><font face='courier' size=5><b>");
            sprintf(temp,"%c",options[i]);
            buf->append(temp);
            buf->append(".</b></font></td><td width='365' valign='top'><font face='courier' size=5>");
            buf->append(get_attr_value(answer,"txt"));
            buf->append("</font></td></tr>");
        }

    }
    buf->append("</table>");
    q->value(buf->text());
    disable_buttons(0);
    nxt_question->deactivate();
    enable_timer=1;
}
예제 #17
0
/*************************************************************************************
** Function: showProgression
** Description: This function gets the current chord progression and displays it
**				in the text display box
*************************************************************************************/
void ScaleWindow::showProgression(){

	//If the current chord is empty, we have a problem. Abort!
	if(scale.isCurrentChordEmpty() == true){
		printErrorInProgression();	
		return;
	}

	//Get a buffer for printing later and vector to hold the progression
	Fl_Text_Buffer *buffer = new Fl_Text_Buffer();
	std::vector<std::vector<std::string> > prog;

	//Get the progression!
	prog = scale.getProgression();

	//Create and initialize a c-string for printing
	char progChar[2000];
	for(int i = 0; i < 2000; i++)
		progChar[i] = '\0';

	//Find how many notes the chord with the most notes has
	int pos = 0;
	int max = 0; 
	for(int i = 0; i < prog.size(); i++){
		if(prog[i].size() > max) max = prog[i].size();
	}

	//Loop through the progression, getting the first, second, third, etc.
	//note in each chord and printing them row by row.
	//So the first note from each chord is printed in the first row,
	//then the second notes in the second row, etc.
	int x = 0;
	while(x < max){
		for(int i = 0; i < prog.size(); i++){
			int curLen = 0;
			if(x < prog[i].size()){
				curLen = prog[i][x].length();
				for(int j = 0; j < curLen; j++){
					progChar[pos] = prog[i][x][j];
					pos++;
				}
			}
			//If the corresponding chord has less than the max
			//number of notes, just print a space for it
			else{
				progChar[pos] = ' ';
				pos++;
				curLen = 1;
			}
			//Pad with white space!
			while(curLen < 4){
				progChar[pos] = ' ';
				pos++;
				curLen++;
			}
		}
		progChar[pos] = '\n';
		pos++;
		x++;
	}

	//Print the progression!
	buffer->text(progChar);
	outProg->buffer(buffer);

}
예제 #18
0
void ModelViewController::CopySettingsToGUI()
{
	if(gui == 0)
		return;
	Fl_Text_Buffer* buffer = gui->GCodeStart->buffer();
	buffer->text(ProcessControl.GCodeStartText.c_str());
	buffer = gui->GCodeLayer->buffer();
	buffer->text(ProcessControl.GCodeLayerText.c_str());
	buffer = gui->GCodeEnd->buffer();
	buffer->text(ProcessControl.GCodeEndText.c_str());
    //buffer->text(ProcessControl.Notes.c_str());

	gui->RaftEnableButton->value(ProcessControl.RaftEnable);
	gui->RaftSizeSlider->value(ProcessControl.RaftSize);
	gui->RaftBaseLayerCountSlider->value(ProcessControl.RaftBaseLayerCount);
	gui->RaftMaterialPrDistanceRatioSlider->value(ProcessControl.RaftMaterialPrDistanceRatio);
	gui->RaftRotationSlider->value(ProcessControl.RaftRotation);
	gui->RaftBaseDistanceSlider->value(ProcessControl.RaftBaseDistance);
	gui->RaftBaseThicknessSlider->value(ProcessControl.RaftBaseThickness);
	gui->RaftBaseTemperatureSlider->value(ProcessControl.RaftBaseTemperature);
	gui->RaftInterfaceLayerCountSlider->value(ProcessControl.RaftInterfaceLayerCount);
	gui->RaftInterfaceMaterialPrDistanceRatioSlider->value(ProcessControl.RaftInterfaceMaterialPrDistanceRatio);
	gui->RaftRotationPrLayerSlider->value(ProcessControl.RaftRotationPrLayer);
	gui->RaftInterfaceDistanceSlider->value(ProcessControl.RaftInterfaceDistance);
	gui->RaftInterfaceThicknessSlider->value(ProcessControl.RaftInterfaceThickness);
	gui->RaftInterfaceTemperatureSlider->value(ProcessControl.RaftInterfaceTemperature);

	gui->ValidateConnection->value(ProcessControl.m_bValidateConnection);
	gui->portInput->value(ProcessControl.m_sPortName.c_str());
	gui->portInputSimple->value(ProcessControl.m_sPortName.c_str());
	gui->SerialSpeedInput->value(ProcessControl.m_iSerialSpeed);
	gui->SerialSpeedInputSimple->value(ProcessControl.m_iSerialSpeed);

	// GCode
	gui->GCodeDrawStartSlider->value(ProcessControl.GCodeDrawStart);
	gui->GCodeDrawEndSlider->value(ProcessControl.GCodeDrawEnd);
	gui->MinPrintSpeedXYSlider->value(ProcessControl.MinPrintSpeedXY);
	gui->MaxPrintSpeedXYSlider->value(ProcessControl.MaxPrintSpeedXY);
	gui->MinPrintSpeedZSlider->value(ProcessControl.MinPrintSpeedZ);
	gui->MaxPrintSpeedZSlider->value(ProcessControl.MaxPrintSpeedZ);

	gui->distanceToReachFullSpeedSlider->value(ProcessControl.DistanceToReachFullSpeed);
//	gui->UseFirmwareAccelerationButton->value(ProcessControl.UseFirmwareAcceleration);
	gui->extrusionFactorSlider->value(ProcessControl.extrusionFactor);
	gui->UseIncrementalEcodeButton->value(ProcessControl.UseIncrementalEcode);
	gui->Use3DGcodeButton->value(ProcessControl.Use3DGcode);

	gui->antioozeDistanceSlider->value(ProcessControl.AntioozeDistance);
	gui->EnableAntioozeButton->value(ProcessControl.EnableAntiooze);
	gui->antioozeSpeedSlider->value(ProcessControl.AntioozeSpeed);

	// Printer
	gui->VolumeX->value(ProcessControl.m_fVolume.x);
	gui->VolumeY->value(ProcessControl.m_fVolume.y);
	gui->VolumeZ->value(ProcessControl.m_fVolume.z);
	gui->MarginX->value(ProcessControl.PrintMargin.x);
	gui->MarginY->value(ProcessControl.PrintMargin.y);
	gui->MarginZ->value(ProcessControl.PrintMargin.z);

	gui->ExtrudedMaterialWidthSlider->value(ProcessControl.ExtrudedMaterialWidth);

	// STL
	gui->LayerThicknessSlider->value(ProcessControl.LayerThickness);
	gui->CuttingPlaneValueSlider->value(ProcessControl.CuttingPlaneValue);
	gui->PolygonOpasitySlider->value(ProcessControl.PolygonOpasity);
	// CuttingPlane
	gui->InfillDistanceSlider->value(ProcessControl.InfillDistance);
	gui->InfillRotationSlider->value(ProcessControl.InfillRotation);
	gui->InfillRotationPrLayerSlider->value(ProcessControl.InfillRotationPrLayer);
	gui->AltInfillLayersInput->value(ProcessControl.AltInfillLayersText.c_str());
	gui->AltInfillDistanceSlider->value(ProcessControl.AltInfillDistance);
	gui->ExamineSlider->value(ProcessControl.Examine);

	gui->ShellOnlyButton->value(ProcessControl.ShellOnly);
	gui->ShellCountSlider->value(ProcessControl.ShellCount);

	gui->EnableAccelerationButton->value(ProcessControl.EnableAcceleration);

	gui->FileLogginEnabledButton->value(ProcessControl.FileLogginEnabled);
	gui->TempReadingEnabledButton->value(ProcessControl.TempReadingEnabled);
	gui->ClearLogfilesWhenPrintStartsButton->value(ProcessControl.ClearLogfilesWhenPrintStarts);

	// GUI GUI
	gui->DisplayEndpointsButton->value(ProcessControl.DisplayEndpoints);
	gui->DisplayNormalsButton->value(ProcessControl.DisplayNormals);
	gui->DisplayWireframeButton->value(ProcessControl.DisplayWireframe);
	gui->DisplayWireframeShadedButton->value(ProcessControl.DisplayWireframeShaded);
	gui->DisplayPolygonsButton->value(ProcessControl.DisplayPolygons);
	gui->DisplayAllLayersButton->value(ProcessControl.DisplayAllLayers);
	gui->DisplayinFillButton->value(ProcessControl.DisplayinFill);
	gui->DisplayDebuginFillButton->value(ProcessControl.DisplayDebuginFill);
	gui->DisplayDebugButton->value(ProcessControl.DisplayDebug);
	gui->DisplayCuttingPlaneButton->value(ProcessControl.DisplayCuttingPlane);
	gui->DrawVertexNumbersButton->value(ProcessControl.DrawVertexNumbers);
	gui->DrawLineNumbersButton->value(ProcessControl.DrawLineNumbers);

	// Rendering
	gui->PolygonValSlider->value(ProcessControl.PolygonVal);
	gui->PolygonSatSlider->value(ProcessControl.PolygonSat);
	gui->PolygonHueSlider->value(ProcessControl.PolygonHue);
	gui->WireframeValSlider->value(ProcessControl.WireframeVal);
	gui->WireframeSatSlider->value(ProcessControl.WireframeSat);
	gui->WireframeHueSlider->value(ProcessControl.WireframeHue);
	gui->NormalSatSlider->value(ProcessControl.NormalsSat);
	gui->NormalValSlider->value(ProcessControl.NormalsVal);
	gui->NormalHueSlider->value(ProcessControl.NormalsHue);
	gui->EndpointSatSlider->value(ProcessControl.EndpointsSat);
	gui->EndpointValSlider->value(ProcessControl.EndpointsVal);
	gui->EndpointHueSlider->value(ProcessControl.EndpointsHue);
	gui->GCodeExtrudeHueSlider->value(ProcessControl.GCodeExtrudeHue);
	gui->GCodeExtrudeSatSlider->value(ProcessControl.GCodeExtrudeSat);
	gui->GCodeExtrudeValSlider->value(ProcessControl.GCodeExtrudeVal);
	gui->GCodeMoveHueSlider->value(ProcessControl.GCodeMoveHue);
	gui->GCodeMoveSatSlider->value(ProcessControl.GCodeMoveSat);
	gui->GCodeMoveValSlider->value(ProcessControl.GCodeMoveVal);
	gui->HighlightSlider->value(ProcessControl.Highlight);

	gui->NormalLengthSlider->value(ProcessControl.NormalsLength);
	gui->EndpointSizeSlider->value(ProcessControl.EndPointSize);
	gui->TempUpdateSpeedSlider->value(ProcessControl.TempUpdateSpeed);

	gui->DisplayGCodeButton->value(ProcessControl.DisplayGCode);
	gui->LuminanceShowsSpeedButton->value(ProcessControl.LuminanceShowsSpeed);

	switch(ProcessControl.m_ShrinkQuality)
	{
	case SHRINK_FAST:
		gui->shrinkAlgorithm->value(0);
		break;
	case SHRINK_LOGICK:
		gui->shrinkAlgorithm->value(2);
		break;
	}
	gui->OptimizationSlider->value(ProcessControl.Optimization);
	gui->ReceivingBufferSizeSlider->value(ProcessControl.ReceivingBufferSize);

	RefreshCustomButtonLabels();
	GetCustomButtonText(0);
}