mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	Added axis-labels to RammingChart
This commit is contained in:
		
							parent
							
								
									7d9e892edc
								
							
						
					
					
						commit
						56fef5302c
					
				
					 3 changed files with 20 additions and 7 deletions
				
			
		|  | @ -2,6 +2,12 @@ | |||
| #include "RammingChart.hpp" | ||||
| 
 | ||||
| 
 | ||||
| //! macro used to mark string used at localization,
 | ||||
| //! return same string
 | ||||
| #define L(s) s | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| wxDEFINE_EVENT(EVT_WIPE_TOWER_CHART_CHANGED, wxCommandEvent); | ||||
| 
 | ||||
| 
 | ||||
|  | @ -43,9 +49,9 @@ void Chart::draw(wxDC& dc) { | |||
| 
 | ||||
|     // draw x-axis:
 | ||||
|     float last_mark = -10000; | ||||
|     for (float math_x=int(visible_area.m_x*10)/10 ; math_x <= (visible_area.m_x+visible_area.m_width) ; math_x+=0.1) { | ||||
|     for (float math_x=int(visible_area.m_x*10)/10 ; math_x < (visible_area.m_x+visible_area.m_width) ; math_x+=0.1) { | ||||
|         int x = math_to_screen(wxPoint2DDouble(math_x,visible_area.m_y)).x; | ||||
|         int y = m_rect.GetBottom();  | ||||
|         int y = m_rect.GetBottom(); | ||||
|         if (x-last_mark < 50) continue; | ||||
|         dc.DrawLine(x,y+3,x,y-3); | ||||
|         dc.DrawText(wxString().Format(wxT("%.1f"), math_x),wxPoint(x-10,y+7)); | ||||
|  | @ -54,7 +60,7 @@ void Chart::draw(wxDC& dc) { | |||
|      | ||||
|     // draw y-axis:
 | ||||
|     last_mark=10000; | ||||
|     for (int math_y=visible_area.m_y ; math_y <= (visible_area.m_y+visible_area.m_height) ; math_y+=1) { | ||||
|     for (int math_y=visible_area.m_y ; math_y < (visible_area.m_y+visible_area.m_height) ; math_y+=1) { | ||||
|         int y = math_to_screen(wxPoint2DDouble(visible_area.m_x,math_y)).y; | ||||
|         int x = m_rect.GetLeft(); | ||||
|         if (last_mark-y < 50) continue;     | ||||
|  | @ -63,8 +69,15 @@ void Chart::draw(wxDC& dc) { | |||
|         last_mark = y; | ||||
|     } | ||||
|      | ||||
|      | ||||
|      | ||||
|     // axis labels:
 | ||||
|     wxString label = L("Time (s)"); | ||||
|     int text_width = 0; | ||||
|     int text_height = 0; | ||||
|     dc.GetTextExtent(label,&text_width,&text_height); | ||||
|     dc.DrawText(label,wxPoint(0.5*(m_rect.GetRight()+m_rect.GetLeft())-text_width/2.f, m_rect.GetBottom()+25)); | ||||
|     label = L("Volumetric speed (mm\u00B3/s)"); | ||||
|     dc.GetTextExtent(label,&text_width,&text_height); | ||||
|     dc.DrawRotatedText(label,wxPoint(0,0.5*(m_rect.GetBottom()+m_rect.GetTop())+text_width/2.f),90); | ||||
| } | ||||
| 
 | ||||
| void Chart::mouse_right_button_clicked(wxMouseEvent& event) { | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ public: | |||
|     Chart(wxWindow* parent, wxRect rect,const std::vector<std::pair<float,float>>& initial_buttons,int ramming_speed_size, float sampling) : | ||||
|         wxWindow(parent,wxID_ANY,rect.GetTopLeft(),rect.GetSize()) | ||||
|     { | ||||
|         m_rect=wxRect(wxPoint(30,0),rect.GetSize()-wxSize(30,30)); | ||||
|         m_rect = wxRect(wxPoint(50,0),rect.GetSize()-wxSize(50,50)); | ||||
|         visible_area = wxRect2DDouble(0.0, 0.0, sampling*ramming_speed_size, 20.); | ||||
|         m_buttons.clear(); | ||||
|         if (initial_buttons.size()>0) | ||||
|  |  | |||
|  | @ -38,7 +38,7 @@ RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters) | |||
| 
 | ||||
| 
 | ||||
| RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters) | ||||
| : wxPanel(parent,wxID_ANY,wxPoint(50,50), wxSize(800,350),wxBORDER_RAISED) | ||||
| : wxPanel(parent,wxID_ANY,wxPoint(50,50), wxSize(800,400),wxBORDER_RAISED) | ||||
| { | ||||
|     new wxStaticText(this,wxID_ANY,wxString("Total ramming time (s):"),     wxPoint(500,105),      wxSize(200,25),wxALIGN_LEFT); | ||||
|     m_widget_time = new wxSpinCtrlDouble(this,wxID_ANY,wxEmptyString,       wxPoint(700,100),      wxSize(75,25),wxSP_ARROW_KEYS|wxALIGN_RIGHT,0.,5.0,3.,0.5);         | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lukas Matena
						Lukas Matena