kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #40877
Re: Show grid in eeschema status line
-
To:
kicad-developers@xxxxxxxxxxxxxxxxxxx
-
From:
"Steven A. Falco" <stevenfalco@xxxxxxxxx>
-
Date:
Mon, 3 Jun 2019 12:25:54 -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 FgIDAQACHgECF4AWIQSDrcEoXtTdcq9JzuJtoCQy7y8uvgUCXETrtQUJCWdoHgAK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GzgeiCUm44hZj+TTmIKTY 4NNs
-
In-reply-to:
<8be48599-f9c9-193e-af3c-a24682df0841@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/3/19 10:42 AM, Wayne Stambaugh wrote:
> Hi Steve,
>
> Your patch no longer applies cleanly as there has been some serious
> refactoring and legacy code removal. I think your patch is a good idea
> but it will need to be fixed. I do have a few comments from your
> original patch:
>
> * Please use `git commit` to commit your code to your local repo and
> `git format-patch` to create patches to send to the mailing list.
Thanks for the review, and for your patience as I "learn the ropes" Wayne.
I've attached a rebased patch using "git format-patch". I generated it both for master and for 5.1, in case you want it in both branches. Personally, I'd like it in both.
> * There tabs and indentation errors in your original patch.
I think I've fixed all of those. If I missed any, please let me know.
> * I don't think you need to make the precision of millimeter grid units
> 4. 2 should be more than acceptable given that you are using 3 for
> inches units. You may want to increase this by one for the board
> editor. The board editor has far greater precision than the schematic
> editor.
I chose 4 decimal places because the eeschema grid seems to be in English units internally, even when I switch the UI to metric. I.e., when I switch eeschema to metric, the finest grid in the pull-down menu is shown as "0.0254 mm (1.00 mils)". I don't see a way to set the eeschema grid to a round number of mm. I will be happy to change the display to 2 places if you still want that, but then the status line will show 0.02 mm rather than 0.0254 mm. Please confirm which way you want it.
Steve
From 9c652a1a9c7a60927d1f9d043b00d15d809848cc 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/legacy_gal/eda_draw_frame.cpp | 28 ++++++++++++++++++++++++++++
eeschema/sch_base_frame.cpp | 3 +++
include/draw_frame.h | 5 +++++
kicad/mainframe.cpp | 6 +++---
4 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp
index 6c3a3a47b..d02837ff6 100644
--- a/common/legacy_gal/eda_draw_frame.cpp
+++ b/common/legacy_gal/eda_draw_frame.cpp
@@ -546,6 +546,34 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
m_galDisplayOptions.WriteConfig( *aCfg, baseCfgName );
}
+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( GetUserUnits(), curr_grid_size.x );
+ line.Printf( gridformatter, grid );
+
+ SetStatusText( line, 5 );
+}
+
+
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
COLOR4D color, int pad )
diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp
index 28b664f77..5b2bd0dbc 100644
--- a/eeschema/sch_base_frame.cpp
+++ b/eeschema/sch_base_frame.cpp
@@ -259,6 +259,9 @@ void SCH_BASE_FRAME::UpdateStatusBar()
// refresh units display
DisplayUnitsMsg();
+
+ // refresh grid display
+ DisplayGridMsg();
}
diff --git a/include/draw_frame.h b/include/draw_frame.h
index 431c0d1d6..63aa3ab0e 100644
--- a/include/draw_frame.h
+++ b/include/draw_frame.h
@@ -628,6 +628,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/kicad/mainframe.cpp b/kicad/mainframe.cpp
index 0d1bdd3cd..95d352bde 100644
--- a/kicad/mainframe.cpp
+++ b/kicad/mainframe.cpp
@@ -67,10 +67,10 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
m_AboutTitle = "KiCad";
// Create the status line (bottom of the frame)
- static const int dims[3] = { -1, -1, 100 };
+ static const int dims[4] = { -1, -1, -1, 100 };
- CreateStatusBar( 3 );
- SetStatusWidths( 3, dims );
+ CreateStatusBar( 4 );
+ SetStatusWidths( 4, dims );
// Give an icon
wxIcon icon;
--
2.21.0
From b9ce731455b69db76749e74c066257a4a1218ecf 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/legacy_gal/eda_draw_frame.cpp | 28 ++++++++++++++++++++++++++++
common/legacy_wx/eda_draw_frame.cpp | 28 ++++++++++++++++++++++++++++
eeschema/sch_base_frame.cpp | 3 +++
include/draw_frame.h | 5 +++++
kicad/mainframe.cpp | 6 +++---
5 files changed, 67 insertions(+), 3 deletions(-)
diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp
index 058df54f8..3bf70affe 100644
--- a/common/legacy_gal/eda_draw_frame.cpp
+++ b/common/legacy_gal/eda_draw_frame.cpp
@@ -857,6 +857,34 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
m_galDisplayOptions.WriteConfig( *aCfg, baseCfgName );
}
+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( GetUserUnits(), curr_grid_size.x );
+ line.Printf( gridformatter, grid );
+
+ SetStatusText( line, 5 );
+}
+
+
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper,
const wxString& textLower,
diff --git a/common/legacy_wx/eda_draw_frame.cpp b/common/legacy_wx/eda_draw_frame.cpp
index 3871cfb26..3b3d991ac 100644
--- a/common/legacy_wx/eda_draw_frame.cpp
+++ b/common/legacy_wx/eda_draw_frame.cpp
@@ -645,6 +645,34 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
}
+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( GetUserUnits(), curr_grid_size.x );
+ line.Printf( gridformatter, grid );
+
+ SetStatusText( line, 5 );
+}
+
+
void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
{
m_FrameSize = GetClientSize( );
diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp
index 741ccaa59..14cae0eb7 100644
--- a/eeschema/sch_base_frame.cpp
+++ b/eeschema/sch_base_frame.cpp
@@ -286,6 +286,9 @@ void SCH_BASE_FRAME::UpdateStatusBar()
// refresh units display
DisplayUnitsMsg();
+
+ // refresh grid display
+ DisplayGridMsg();
}
diff --git a/include/draw_frame.h b/include/draw_frame.h
index 464378c11..c39071e5e 100644
--- a/include/draw_frame.h
+++ b/include/draw_frame.h
@@ -835,6 +835,11 @@ public:
*/
virtual bool HandleBlockEnd( wxDC* DC );
+ /**
+ * Display current grid pane on the status bar.
+ */
+ void DisplayGridMsg();
+
/**
* Copy the current page or the current block to the clipboard.
*/
diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp
index 65868028a..560d4c7ae 100644
--- a/kicad/mainframe.cpp
+++ b/kicad/mainframe.cpp
@@ -65,10 +65,10 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
m_AboutTitle = "KiCad";
// Create the status line (bottom of the frame)
- static const int dims[3] = { -1, -1, 100 };
+ static const int dims[4] = { -1, -1, -1, 100 };
- CreateStatusBar( 3 );
- SetStatusWidths( 3, dims );
+ CreateStatusBar( 4 );
+ SetStatusWidths( 4, dims );
// Give an icon
wxIcon icon;
--
2.21.0
Follow ups
References