mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Parameter "G-code thumbnails": check value for the out of range
This commit is contained in:
		
							parent
							
								
									2d711d8646
								
							
						
					
					
						commit
						90248bffa5
					
				
					 1 changed files with 16 additions and 3 deletions
				
			
		|  | @ -322,6 +322,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true | |||
|         str.Replace(" ", wxEmptyString, true); | ||||
|         if (!str.IsEmpty()) { | ||||
|             bool invalid_val = false; | ||||
|             bool out_of_range_val = false; | ||||
|             wxStringTokenizer thumbnails(str, ","); | ||||
|             while (thumbnails.HasMoreTokens()) { | ||||
|                 wxString token = thumbnails.GetNextToken(); | ||||
|  | @ -332,8 +333,12 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true | |||
|                     if (x_str.ToDouble(&x) && thumbnail.HasMoreTokens()) { | ||||
|                         wxString y_str = thumbnail.GetNextToken(); | ||||
|                         if (y_str.ToDouble(&y) && !thumbnail.HasMoreTokens()) { | ||||
|                             out_values.push_back(Vec2d(x, y)); | ||||
|                             continue; | ||||
|                             if (0 < x && x < 1000 && 0 < y && y < 1000) { | ||||
|                                 out_values.push_back(Vec2d(x, y)); | ||||
|                                 continue; | ||||
|                             } | ||||
|                             out_of_range_val = true; | ||||
|                             break; | ||||
|                         } | ||||
|                     }  | ||||
|                 }  | ||||
|  | @ -341,7 +346,15 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true | |||
|                 break; | ||||
|             } | ||||
| 
 | ||||
|             if (invalid_val) { | ||||
|             if (out_of_range_val) { | ||||
|                 wxString text_value; | ||||
|                 if (!m_value.empty()) | ||||
|                     text_value = get_thumbnails_string(boost::any_cast<std::vector<Vec2d>>(m_value)); | ||||
|                 set_value(text_value, true); | ||||
|                 show_error(m_parent, _L("Input value is out of range") | ||||
|                 ); | ||||
|             } | ||||
|             else if (invalid_val) { | ||||
|                 wxString text_value; | ||||
|                 if (!m_value.empty()) | ||||
|                     text_value = get_thumbnails_string(boost::any_cast<std::vector<Vec2d>>(m_value)); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 YuSanka
						YuSanka