kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #41050
Re: [PATCH] Show the current grid setting.
-
To:
kicad-developers@xxxxxxxxxxxxxxxxxxx
-
From:
"Steven A. Falco" <stevenfalco@xxxxxxxxx>
-
Date:
Thu, 13 Jun 2019 14:11:15 -0400
-
Autocrypt:
addr=stevenfalco@xxxxxxxxx; keydata= xsFNBFxDhRcBEAC6Imgmt25S/CEOFsv+gHf52PQavJDRWK3pytsiD91DUmZnIwpWkYwJiKo8 E8nYMxw8R4g0YhCXCc7DwYXUnHQgIaO3SnLryLGZntJUuCuZxMjE4YEGOhq0mePnlhz1gcMQ 2TOAvBVXVg2841rEzGWZlXIg53eBavAobB9oJG2/5MyDzyB7d7nhvpuDuEDSKbIR69tbtTQC EQ86hZM+mUvekkU6FiMJQEU4hqJBF4BKmp+0mZ+dN1ZjRPCmCcShj9c6W6n9YITZuOPEBhIB v88m+3YQBkzsPu6tGjAXlk2H4jrkry9BQK27Ddn1N3Gz+oRDkX/UVd/jY2m0A0gxMi++N0wO K2DTShAAO4Imdrb5G1K+UJ0kNbLnkO4CmVVBD/yvnZo1WLRh4MGgUW8J+l1EPjQZvJHSOdIU 7HoLkWDoH6CZg2UqSNrhYIfJJD/K1H0gcXfCVEVhbDlQxclhiWID+8wQ9c0fVa/EabU0zBXJ sLBkO6tEtSaiLKHaIqkYGXCQxvpwHQwPR5ZNt9DXrRkmVm77ymh2jLJbHVv8XgtOJE7XkXn8 3Iv9iUFESd/1xZFUB51eVu+8aDjxDkwaqzlf/rUiOV+S8KZ4//gc1CC0EhqFCRFSZEJsblR1 c0wdF86NVFqeH+g+Z6n/yLKJWAvRLuw8w9JlWnoTMnIzS77J/wARAQABzSdTdGV2ZW4gQS4g RmFsY28gPHN0ZXZlbmZhbGNvQGdtYWlsLmNvbT7CwZQEEwEKAD4CGwEFCwkIBwMFFQoJCAsF FgIDAQACHgECF4AWIQSDrcEoXtTdcq9JzuJtoCQy7y8uvgUCXETrtQUJCWdo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XoYvGzgeiCUm44hZj+TTmIKTY 4NNs
-
In-reply-to:
<3eaae8fa-7f2c-1e07-1511-dcdee81201c5@gmail.com>
-
Openpgp:
preference=signencrypt
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0
On 6/13/19 12:27 PM, Wayne Stambaugh wrote:
> Steve,
>
> I merged you 5.1 branch patch but the master branch patch would not
> apply cleanly. Please rebase it when you get a chance. I will do me
> best to get it merged as quickly as possible.
Attached please find a rebased patch. I'm not able to build right now - I'm getting errors like:
/home/sfalco/src/kicad/kicad5/launchpad/kicad/pcbnew/pcb_parser.cpp: In member function ‘void PCB_PARSER::parseSetup()’:
/home/sfalco/src/kicad/kicad5/launchpad/kicad/pcbnew/pcb_parser.cpp:1383:14: error: ‘T_max_error’ was not declared in this scope
1383 | case T_max_error:
| ^~~~~~~~~~~
I don't think these are related to my patch. Has anyone else seen this error?
Steve
>From 4dab51327dfbda27adab7f38ffeb449da266d467 Mon Sep 17 00:00:00 2001
From: "Steven A. Falco" <stevenfalco@xxxxxxxxx>
Date: Fri, 24 May 2019 09:55:33 -0400
Subject: [PATCH] Show the current grid setting.
---
common/eda_draw_frame.cpp | 38 ++++++++++++++++++++--
eeschema/sch_base_frame.cpp | 3 ++
gerbview/gerbview_frame.cpp | 38 ++++++++++++++++++++++
gerbview/gerbview_frame.h | 7 ++++
include/eda_draw_frame.h | 5 +++
include/pcb_base_frame.h | 7 ++++
pagelayout_editor/pl_editor_frame.cpp | 46 ++++++++++++++++++++++++---
pagelayout_editor/pl_editor_frame.h | 2 ++
pcbnew/pcb_base_frame.cpp | 38 ++++++++++++++++++++++
9 files changed, 177 insertions(+), 7 deletions(-)
diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp
index e0ee94636..740d0cb16 100644
--- a/common/eda_draw_frame.cpp
+++ b/common/eda_draw_frame.cpp
@@ -113,7 +113,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_auimgr.SetFlags(wxAUI_MGR_DEFAULT);
- CreateStatusBar( 6 );
+ CreateStatusBar( 7 );
// set the size of the status bar subwindows:
@@ -136,6 +136,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
// delta distances
GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10,
+ // grid size
+ GetTextSize( wxT( "grid X 0234.567890 Y 0234.567890" ), stsbar ).x + 10,
+
// units display, Inches is bigger than mm
GetTextSize( _( "Inches" ), stsbar ).x + 10,
@@ -361,6 +364,37 @@ void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
}
+/*
+ * Display the grid status.
+ */
+void EDA_DRAW_FRAME::DisplayGridMsg()
+{
+ wxString line;
+ wxString gridformatter;
+
+ switch( m_userUnits )
+ {
+ case INCHES:
+ gridformatter = "grid %.3f";
+ break;
+
+ case MILLIMETRES:
+ gridformatter = "grid %.4f";
+ break;
+
+ default:
+ gridformatter = "grid %f";
+ break;
+ }
+
+ wxRealPoint curr_grid_size = GetScreen()->GetGridSize();
+ double grid = To_User_Unit( m_userUnits, curr_grid_size.x );
+ line.Printf( gridformatter, grid );
+
+ SetStatusText( line, 4 );
+}
+
+
void EDA_DRAW_FRAME::DisplayUnitsMsg()
{
wxString msg;
@@ -372,7 +406,7 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
default: msg = _( "Units" ); break;
}
- SetStatusText( msg, 4 );
+ SetStatusText( msg, 5 );
}
diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp
index 7721e0423..0dbc33366 100644
--- a/eeschema/sch_base_frame.cpp
+++ b/eeschema/sch_base_frame.cpp
@@ -241,6 +241,9 @@ void SCH_BASE_FRAME::UpdateStatusBar()
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
SetStatusText( line, 3 );
+ // refresh grid display
+ DisplayGridMsg();
+
// refresh units display
DisplayUnitsMsg();
}
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index 82ba60ca5..89f31cdfd 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -983,6 +983,42 @@ void GERBVIEW_FRAME::SetGridColor( COLOR4D aColor )
}
+/*
+ * Display the grid status.
+ */
+void GERBVIEW_FRAME::DisplayGridMsg()
+{
+ wxString line;
+ wxString gridformatter;
+
+ switch( m_userUnits )
+ {
+ case INCHES:
+ gridformatter = "grid X %.6f Y %.6f";
+ break;
+
+ case MILLIMETRES:
+ gridformatter = "grid X %.6f Y %.6f";
+ break;
+
+ default:
+ gridformatter = "grid X %f Y %f";
+ break;
+ }
+
+ BASE_SCREEN* screen = GetScreen();
+ wxArrayString gridsList;
+
+ int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != INCHES );
+ GRID_TYPE& grid = screen->GetGrid( icurr );
+ double grid_x = To_User_Unit( m_userUnits, grid.m_Size.x );
+ double grid_y = To_User_Unit( m_userUnits, grid.m_Size.y );
+ line.Printf( gridformatter, grid_x, grid_y );
+
+ SetStatusText( line, 4 );
+}
+
+
void GERBVIEW_FRAME::UpdateStatusBar()
{
EDA_DRAW_FRAME::UpdateStatusBar();
@@ -1058,6 +1094,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
line.Printf( relformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
SetStatusText( line, 3 );
}
+
+ DisplayGridMsg();
}
diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h
index 8953e597e..af3d6be4e 100644
--- a/gerbview/gerbview_frame.h
+++ b/gerbview/gerbview_frame.h
@@ -391,6 +391,13 @@ public:
*/
void UpdateTitleAndInfo();
+ /**
+ * Function DisplayGridMsg()
+ *
+ * Display the current grid pane on the status bar.
+ */
+ void DisplayGridMsg();
+
/**
* Function GetConfigurationSettings
* Populates the GerbView applications settings list.
diff --git a/include/eda_draw_frame.h b/include/eda_draw_frame.h
index 46a5673cb..b59a15eda 100644
--- a/include/eda_draw_frame.h
+++ b/include/eda_draw_frame.h
@@ -491,6 +491,11 @@ public:
*/
void DisplayUnitsMsg();
+ /**
+ * Display current grid pane on the status bar.
+ */
+ void DisplayGridMsg();
+
/* interprocess communication */
void CreateServer( int service, bool local = true );
void OnSockRequest( wxSocketEvent& evt );
diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h
index e4fbde1b4..f73932ee9 100644
--- a/include/pcb_base_frame.h
+++ b/include/pcb_base_frame.h
@@ -418,6 +418,13 @@ public:
*/
void SetFastGrid2();
+ /**
+ * Function DisplayGridMsg()
+ *
+ * Display the current grid pane on the status bar.
+ */
+ void DisplayGridMsg();
+
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
virtual void ActivateGalCanvas() override;
diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp
index a2548c53b..a595a81ff 100644
--- a/pagelayout_editor/pl_editor_frame.cpp
+++ b/pagelayout_editor/pl_editor_frame.cpp
@@ -141,11 +141,14 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// delta distances
GetTextSize( wxT( "dx 0234.567 dx 0234.567" ), stsbar ).x + 10,
+ // grid size
+ GetTextSize( wxT( "grid 0234.567" ), stsbar ).x + 10,
+
// Coord origin (use the bigger message)
GetTextSize( _( "coord origin: Right Bottom page corner" ), stsbar ).x + 10,
// units display, Inches is bigger than mm
- GetTextSize( _( "Inches" ), stsbar ).x + 10
+ GetTextSize( _( "Inches" ), stsbar ).x + 20
};
SetStatusWidths( arrayDim( dims ), dims );
@@ -498,6 +501,37 @@ wxPoint PL_EDITOR_FRAME::ReturnCoordOriginCorner() const
}
+/*
+ * Display the grid status.
+ */
+void PL_EDITOR_FRAME::DisplayGridMsg()
+{
+ wxString line;
+ wxString gridformatter;
+
+ switch( m_userUnits )
+ {
+ case INCHES:
+ gridformatter = "grid %.3f";
+ break;
+
+ case MILLIMETRES:
+ gridformatter = "grid %.4f";
+ break;
+
+ default:
+ gridformatter = "grid %f";
+ break;
+ }
+
+ wxRealPoint curr_grid_size = GetScreen()->GetGridSize();
+ double grid = To_User_Unit( m_userUnits, curr_grid_size.x );
+ line.Printf( gridformatter, grid );
+
+ SetStatusText( line, 4 );
+}
+
+
void PL_EDITOR_FRAME::UpdateStatusBar()
{
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
@@ -551,9 +585,9 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
switch( GetUserUnits() )
{
- case INCHES: SetStatusText( _("inches"), 5 ); break;
- case MILLIMETRES: SetStatusText( _("mm"), 5 ); break;
- case UNSCALED_UNITS: SetStatusText( wxEmptyString, 5 ); break;
+ case INCHES: SetStatusText( _("inches"), 6 ); break;
+ case MILLIMETRES: SetStatusText( _("mm"), 6 ); break;
+ case UNSCALED_UNITS: SetStatusText( wxEmptyString, 6 ); break;
case DEGREES: wxASSERT( false ); break;
}
@@ -578,10 +612,12 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
line.Printf( locformatter, dXpos, dYpos );
SetStatusText( line, 3 );
+ DisplayGridMsg();
+
// Display corner reference for coord origin
line.Printf( _("coord origin: %s"),
m_originSelectBox->GetString( m_originSelectChoice ).GetData() );
- SetStatusText( line, 4 );
+ SetStatusText( line, 5 );
// Display units
}
diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h
index db9ea26ee..12e8531fb 100644
--- a/pagelayout_editor/pl_editor_frame.h
+++ b/pagelayout_editor/pl_editor_frame.h
@@ -141,6 +141,8 @@ public:
const TITLE_BLOCK& GetTitleBlock() const override;
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
+ void DisplayGridMsg();
+
void UpdateStatusBar() override;
/**
diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp
index ca6e00795..1bc2122bb 100644
--- a/pcbnew/pcb_base_frame.cpp
+++ b/pcbnew/pcb_base_frame.cpp
@@ -596,6 +596,42 @@ void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
}
+/*
+ * Display the grid status.
+ */
+void PCB_BASE_FRAME::DisplayGridMsg()
+{
+ wxString line;
+ wxString gridformatter;
+
+ switch( m_userUnits )
+ {
+ case INCHES:
+ gridformatter = "grid X %.6f Y %.6f";
+ break;
+
+ case MILLIMETRES:
+ gridformatter = "grid X %.6f Y %.6f";
+ break;
+
+ default:
+ gridformatter = "grid X %f Y %f";
+ break;
+ }
+
+ BASE_SCREEN* screen = GetScreen();
+ wxArrayString gridsList;
+
+ int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != INCHES );
+ GRID_TYPE& grid = screen->GetGrid( icurr );
+ double grid_x = To_User_Unit( m_userUnits, grid.m_Size.x );
+ double grid_y = To_User_Unit( m_userUnits, grid.m_Size.y );
+ line.Printf( gridformatter, grid_x, grid_y );
+
+ SetStatusText( line, 4 );
+}
+
+
/*
* Update the status bar information.
*/
@@ -675,6 +711,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
SetStatusText( line, 3 );
}
+
+ DisplayGridMsg();
}
--
2.21.0
Follow ups
References