kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #31171
Re: Datasheet confusion
Glad to hear it, I fixed a patch up that will highlight the differences
a bit better than I explain it.
Basically it will fill the field from the properties if the field is
empty when adding components to the schematic.
It will also use the Field to determine when to show the context menu
instead of relying on the library.
- Kristoffer
On 10/16/2017 07:33 PM, Fabrizio Tappero wrote:
Hi Kristoffer,
I am a big supporter of this option. I am often in need of showing a
datasheet with a right click on component. It would be great to be able
to do it in the completed schematic as well as in the completed pcb layout.
cheers
Fabrizio
On Fri, Oct 13, 2017 at 2:18 PM, Kristoffer Ödmark
<kristofferodmark90@xxxxxxxxx <mailto:kristofferodmark90@xxxxxxxxx>> wrote:
There is a "show documentation" context field, but it only uses the
documentation string, so if i put a value into the datasheet field.
The menu doesnt show, I do not think that adding a "Show
documentation" and a "Show Datasheet" is a good solution.
I will create a patch, probably this weekend and submit, I think it
will highlight the problem better. I believe its a trivial fix.
- Kristoffer
On 10/13/2017 01:54 PM, Wayne Stambaugh wrote:
On 10/13/2017 6:19 AM, Kristoffer Ödmark wrote:
Thanks you very much for that clarification, I for one would
really
enjoy a clarification of the documentation and Datasheet
string. KiCad
has been around for quite a while now, interesting how
technology has
changed during that time.
For another question, would It be okay to redirect the
context menu in
eeschema, so that the "Show documentation" context menu
would use the
Field "Datasheet"? And use the "documentation" string to
fill the
"Datasheet" field when adding the symbol to the schematic?
I'm OK with adding both a "Show Documentation" (should be
visible only
when the field is not empty) to the symbol context menu and an "Edit
Datasheet Field" entry to the "Properties" sub-menu.
I guess this would be considered a temporary fix if okay?
On 10/13/2017 08:51 AM, jp charras wrote:
FYI, in fact this confusion comes from a bug introduced
a long time ago:
Initially, the field name was "Sheet" not "Datasheet".
It should be "SchematicSheet"
The purpose was to be able to create a component acting as a
hierarchical sheet:
The component in a root sheet, and its internal sheet
("SchematicSheet") similar to a sub sheet.
But unfortunately, it was never done, and one day the
word "Sheet"
became "Datasheet", thus creating
a serious confusion.
Perhaps the "DATASHEET" field (attached to the symbol)
and the
"documentation" string (attached to a
alias) should be clearly redefined for the V5.
By the way, do you know why the .dcm file exists?
It is similar to the .idx index file of old spice libs.
In the early time of eeschema, Kicad was stored on a
server and was
used in classrooms and on PCs
connected by a "slow" network link: network cards were
ISA cards and
the link speed was roughly 2400
bps.
So loading all needed schematic libraries to choose a
symbol was a too
time costly process, making
Eeschema barely usable.
Using small .dcm files to display a list of symbols and
some info
fixed this issue.
Nowadays, link speed, PC speed and memory sizes have 3
order of
magnitude, and .dcm files (a relic
of this time) is more an annoying feature.
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
<https://launchpad.net/~kicad-developers>
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
<mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~kicad-developers
<https://launchpad.net/~kicad-developers>
More help : https://help.launchpad.net/ListHelp
<https://help.launchpad.net/ListHelp>
--
-Kristoffer
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
<https://launchpad.net/~kicad-developers>
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
<mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~kicad-developers
<https://launchpad.net/~kicad-developers>
More help : https://help.launchpad.net/ListHelp
<https://help.launchpad.net/ListHelp>
>From c303c69e5debfdc4cd8686552bc182afec2708af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= <kristoffer.odmark90@xxxxxxxxx>
Date: Wed, 18 Oct 2017 20:09:08 +0200
Subject: [PATCH] Use the Component Field when determining when to choose the
"Show Documentation" context menu
This instead of using the library alias property. But to not break any library. When adding
new compononents to the schematic, copy the value from the library into the Field variable
only if the field variable would otherwise be empty.
This way, the context menu for showing the docs is more understandable for users, and is
also changeable from the schematic without having to modify the actual libraries.
---
eeschema/getpart.cpp | 12 ++++++++++++
eeschema/onrightclick.cpp | 2 +-
eeschema/schedit.cpp | 13 ++++---------
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp
index ac7deec23..8e8401add 100644
--- a/eeschema/getpart.cpp
+++ b/eeschema/getpart.cpp
@@ -254,6 +254,18 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component(
// Set the component value that can differ from component name in lib, for aliases
component->GetField( VALUE )->SetText( sel.Name );
+ // If there is no field defined in the component, copy one over from the library
+ // ( from the .dcm file )
+ // This way the Datasheet field will not be empty and can be changed from the schematic
+ auto libs = Prj().SchLibs();
+ if( component->GetField( DATASHEET )->GetText().IsEmpty() )
+ {
+ LIB_ALIAS* entry = libs->FindLibraryAlias( component->GetLibId() );
+
+ if( entry && !!entry->GetDocFileName() )
+ component->GetField( DATASHEET )->SetText( entry->GetDocFileName() );
+ }
+
MSG_PANEL_ITEMS items;
component->SetCurrentSheetPath( &GetCurrentSheet() );
diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp
index e84e44246..ab2c712e1 100644
--- a/eeschema/onrightclick.cpp
+++ b/eeschema/onrightclick.cpp
@@ -397,7 +397,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_LIBS*
msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
- if( libEntry && !libEntry->GetDocFileName().IsEmpty() )
+ if( !Component->GetFieldText("Datasheet").IsEmpty() )
AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ), KiBitmap( datasheet_xpm ) );
}
diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp
index 23d4bdafa..54c798b6f 100644
--- a/eeschema/schedit.cpp
+++ b/eeschema/schedit.cpp
@@ -302,16 +302,11 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a piece of a component, like Field, text..)
if( item && item->Type() == SCH_COMPONENT_T )
{
- if( PART_LIBS* libs = Prj().SchLibs() )
- {
- LIB_ALIAS* entry = libs->FindLibraryAlias( ( (SCH_COMPONENT*) item )->GetLibId() );
-
- if( entry && !!entry->GetDocFileName() )
- {
- SEARCH_STACK* lib_search = Prj().SchSearchS();
+ auto text = static_cast<SCH_COMPONENT*>( item )->GetFieldText( "Datasheet" );
- GetAssociatedDocument( this, entry->GetDocFileName(), lib_search );
- }
+ if( !text.IsEmpty() )
+ {
+ ::wxLaunchDefaultBrowser( text );
}
}
break;
--
2.14.2
Follow ups
References
-
Datasheet confusion
From: Kristoffer Ödmark, 2017-10-12
-
Re: Datasheet confusion
From: Kristoffer Ödmark, 2017-10-12
-
Re: Datasheet confusion
From: Wayne Stambaugh, 2017-10-12
-
Re: Datasheet confusion
From: Kristoffer Ödmark, 2017-10-12
-
Re: Datasheet confusion
From: Wayne Stambaugh, 2017-10-12
-
Re: Datasheet confusion
From: jp charras, 2017-10-13
-
Re: Datasheet confusion
From: Kristoffer Ödmark, 2017-10-13
-
Re: Datasheet confusion
From: Wayne Stambaugh, 2017-10-13
-
Re: Datasheet confusion
From: Kristoffer Ödmark, 2017-10-13
-
Re: Datasheet confusion
From: Fabrizio Tappero, 2017-10-16