Commit 764b5c11 authored by jean-pierre charras's avatar jean-pierre charras

Minor code cleanup in 3d viewer (remove dead or useless code). Some minor other fixes.

parent b33fa0cc
......@@ -84,7 +84,7 @@ public:
GLuint DisplayCubeforTest(); // Just a test function
void SetView3D( int keycode );
void DisplayStatus();
void Redraw( bool finish = false );
void Redraw();
void Render();
/**
......
......@@ -52,8 +52,15 @@ void S3D_MATERIAL::SetMaterial()
#if 0
glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
#endif
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
#endif
}
void S3D_MASTER::Insert( S3D_MATERIAL* aMaterial )
{
aMaterial->SetNext( m_Materials );
m_Materials = aMaterial;
}
......
......@@ -50,7 +50,6 @@
#include <3d_draw_basic_functions.h>
// Imported function:
extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
extern void CheckGLError();
/* returns true if aLayer should be displayed, false otherwise
......@@ -99,7 +98,7 @@ static void BuildPadShapeThickOutlineAsPolygon( D_PAD* aPad,
}
void EDA_3D_CANVAS::Redraw( bool finish )
void EDA_3D_CANVAS::Redraw()
{
// SwapBuffer requires the window to be shown before calling
if( !IsShown() )
......@@ -139,11 +138,6 @@ void EDA_3D_CANVAS::Redraw( bool finish )
else
CreateDrawGL_List();
glFlush();
if( finish )
glFinish();
SwapBuffers();
}
......@@ -593,8 +587,11 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
// draw modules 3D shapes
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
module->ReadAndInsert3DComponentShape( this );
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
{
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
module->ReadAndInsert3DComponentShape( this );
}
}
......@@ -831,41 +828,32 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )
void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
{
// Draw module shape: 3D shape if exists (or module outlines if not exists)
S3D_MASTER* struct3D = m_3D_Drawings;
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
{
double zpos;
if( IsFlipped() )
zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( true );
else
zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( false );
// Read from disk and draws the footprint 3D shapes if exists
S3D_MASTER* shape3D = m_3D_Drawings;
double zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( IsFlipped() );
glPushMatrix();
glPushMatrix();
glTranslatef( m_Pos.x * g_Parm_3D_Visu.m_BiuTo3Dunits,
-m_Pos.y * g_Parm_3D_Visu.m_BiuTo3Dunits,
zpos );
glTranslatef( m_Pos.x * g_Parm_3D_Visu.m_BiuTo3Dunits,
-m_Pos.y * g_Parm_3D_Visu.m_BiuTo3Dunits,
zpos );
if( m_Orient )
glRotatef( (double) m_Orient / 10, 0.0, 0.0, 1.0 );
if( m_Orient )
glRotatef( (double) m_Orient / 10, 0.0, 0.0, 1.0 );
if( IsFlipped() )
{
glRotatef( 180.0, 0.0, 1.0, 0.0 );
glRotatef( 180.0, 0.0, 0.0, 1.0 );
}
for( ; struct3D != NULL; struct3D = struct3D->Next() )
{
if( struct3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
struct3D->ReadData();
}
if( IsFlipped() )
{
glRotatef( 180.0, 0.0, 1.0, 0.0 );
glRotatef( 180.0, 0.0, 0.0, 1.0 );
}
glPopMatrix();
for( ; shape3D != NULL; shape3D = shape3D->Next() )
{
if( shape3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
shape3D->ReadData();
}
glPopMatrix();
}
......
......@@ -38,9 +38,6 @@
#include "3d_struct.h"
#include "modelparsers.h"
// Imported function:
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster,
const wxString aExtension )
......@@ -96,9 +93,7 @@ const wxString S3D_MASTER::GetShape3DFullFilename()
int S3D_MASTER::ReadData()
{
if( m_Shape3DName.IsEmpty() )
{
return 1;
}
wxString filename = GetShape3DFullFilename();
......@@ -135,15 +130,3 @@ int S3D_MASTER::ReadData()
return -1;
}
int STRUCT_3D_SHAPE::ReadData( FILE* file, int* LineNum )
{
char line[512];
while( GetLine( file, line, LineNum, 512 ) )
{
}
return -1;
}
......@@ -117,12 +117,7 @@ public:
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
S3D_MASTER* Back() const { return (S3D_MASTER*) Pback; }
void Insert( S3D_MATERIAL* aMaterial )
{
aMaterial->SetNext( m_Materials );
m_Materials = aMaterial;
}
void Insert( S3D_MATERIAL* aMaterial );
void Copy( S3D_MASTER* pattern );
int ReadData();
......@@ -171,8 +166,6 @@ public:
STRUCT_3D_SHAPE* Next() const { return (STRUCT_3D_SHAPE*) Pnext; }
STRUCT_3D_SHAPE* Back() const { return (STRUCT_3D_SHAPE*) Pback; }
int ReadData( FILE* file, int* LineNum );
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif
......
......@@ -282,8 +282,6 @@ int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum )
}
#define BUFSIZE 2000
void VRML_MODEL_PARSER::readCoordsList( FILE* file, char* text_buffer,
std::vector< double >& aList, int* LineNum )
{
......
......@@ -221,6 +221,13 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
LoadSettings();
// Ensure m_LastGridSizeId is an offset inside the allowed schematic range
if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
......
......@@ -215,6 +215,13 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle,
/* Get config */
LoadSettings();
// Ensure m_LastGridSizeId is an offset inside the allowed schematic range
if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000 )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000 )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
if( m_canvas )
......
......@@ -17,27 +17,31 @@
; General Product Description Definitions
!define PRODUCT_NAME "KiCad"
!define PRODUCT_VERSION "2013.03.13"
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
!define PRODUCT_VERSION "2014.03.05"
!define ALT_DOWNLOAD_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
!define LIBRARIES_WEB_SITE "https://github.com/KiCad/"
!define KICAD_MAIN_SITE "www.kicad-pcb.org/"
!define COMPANY_NAME ""
!define TRADE_MARKS ""
!define COPYRIGHT "Kicad Developers Team"
!define COMMENTS ""
!define HELP_WEB_SITE "http://groups.yahoo.com/group/kicad-users/"
!define DEVEL_WEB_SITE "https://launchpad.net/~kicad-developers/"
!define DEVEL_WEB_SITE "https://launchpad.net/kicad/"
!define WINGS3D_WEB_SITE "http://www.wings3d.com"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define UNINST_ROOT "HKLM"
;Comment out the following SetCompressor command while testing this script
SetCompressor /final /solid lzma
;SetCompressor /final /solid lzma
CRCCheck force
XPStyle on
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME}_stable-${PRODUCT_VERSION}-BZR4000_Win_full_version.exe"
InstallDir "$PROGRAMFILES\KiCad"
OutFile "${PRODUCT_NAME}_stable-${PRODUCT_VERSION}-BZR4xxx_Win_full_version.exe"
;InstallDir "$PROGRAMFILES\KiCad"
InstallDir "C:\KiCad"
ShowInstDetails hide
ShowUnInstDetails hide
......@@ -72,21 +76,25 @@ ShowUnInstDetails hide
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
; - To add another language; add an insert macro line here and inlcude a language file as below
; - To add another language; add an insert macro line here and include a language file as below
; - This must be after all page macros have been inserted
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Japanese"
!include "English.nsh"
!include "French.nsh"
!include "Polish.nsh"
!include "Dutch.nsh"
!include "Russian.nsh"
!include "Italian.nsh"
!include "Japanese.nsh"
!include "Polish.nsh"
!include "Portuguese.nsh"
!include "Russian.nsh"
; MUI end ------
......@@ -150,20 +158,22 @@ SectionEnd
Section -CreateShortcuts
SetOutPath $INSTDIR
WriteIniStr "$INSTDIR\HomePage.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
WriteIniStr "$INSTDIR\SourceForge.url" "InternetShortcut" "URL" "${SOURCEFORGE_WEB_SITE}"
WriteIniStr "$INSTDIR\UserGroup.url" "InternetShortcut" "URL" "${HELP_WEB_SITE}"
WriteIniStr "$INSTDIR\DevelGroup.url" "InternetShortcut" "URL" "${DEVEL_WEB_SITE}"
WriteIniStr "$INSTDIR\Wings3D.url" "InternetShortcut" "URL" "${WINGS3D_WEB_SITE}"
WriteIniStr "$INSTDIR\HomePage.url" "InternetShortcut" "URL" "${KICAD_MAIN_SITE}"
WriteIniStr "$INSTDIR\AltDownloadSite.url" "InternetShortcut" "URL" "${ALT_DOWNLOAD_WEB_SITE}"
WriteIniStr "$INSTDIR\UserGroup.url" "InternetShortcut" "URL" "${HELP_WEB_SITE}"
WriteIniStr "$INSTDIR\DevelGroup.url" "InternetShortcut" "URL" "${DEVEL_WEB_SITE}"
WriteIniStr "$INSTDIR\LibrariesGroup.url" "InternetShortcut" "URL" "${LIBRARIES_WEB_SITE}"
WriteIniStr "$INSTDIR\Wings3D.url" "InternetShortcut" "URL" "${WINGS3D_WEB_SITE}"
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\KiCad"
CreateShortCut "$SMPROGRAMS\KiCad\Home Page.lnk" "$INSTDIR\HomePage.url"
CreateShortCut "$SMPROGRAMS\KiCad\Kicad SourceForge.lnk" "$INSTDIR\SourceForge.url"
CreateShortCut "$SMPROGRAMS\KiCad\Kicad Alternate Download.lnk" "$INSTDIR\AltDownloadSite.url"
CreateShortCut "$SMPROGRAMS\KiCad\Kicad Libraries.lnk" "$INSTDIR\LibrariesGroup.url"
CreateShortCut "$SMPROGRAMS\KiCad\Wings3D.lnk" "$INSTDIR\Wings3D.url"
CreateShortCut "$SMPROGRAMS\KiCad\User Group.lnk" "$INSTDIR\UserGroup.url"
CreateShortCut "$SMPROGRAMS\KiCad\Devel Group.lnk" "$INSTDIR\DevelGroup.url"
CreateShortCut "$SMPROGRAMS\KiCad\Uninstall.lnk" "$INSTDIR\uninstaller.exe"
CreateShortCut "$SMPROGRAMS\KiCad\KiCad.lnk" "$INSTDIR\bin\kicad.exe"
CreateShortCut "$SMPROGRAMS\KiCad\Wings3D.lnk" "$INSTDIR\Wings3D.url"
CreateShortCut "$DESKTOP\KiCad.lnk" "$INSTDIR\bin\kicad.exe"
SectionEnd
......@@ -172,13 +182,13 @@ Section -CreateAddRemoveEntry
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "Publisher" "${COMPANY_NAME}"
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstaller.exe"
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${KICAD_MAIN_SITE}"
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\kicad.exe"
WriteRegDWORD ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "NoModify" "1"
WriteRegDWORD ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "Comments" "${COMMENTS}"
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "HelpLink" "${HELP_WEB_SITE}"
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_WEB_SITE}"
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${KICAD_MAIN_SITE}"
WriteRegStr ${UNINST_ROOT} "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
WriteUninstaller "$INSTDIR\uninstaller.exe"
......@@ -213,6 +223,9 @@ Section Uninstall
;remove start menu shortcuts and web page links
SetShellVarContext all
Delete "$SMPROGRAMS\KiCad\Home Page.lnk"
Delete "$SMPROGRAMS\KiCad\Kicad Libraries.lnk"
Delete "$SMPROGRAMS\KiCad\Kicad Alternate Download.lnk"
Delete "$SMPROGRAMS\KiCad\Devel Group.lnk"
Delete "$SMPROGRAMS\KiCad\User Group.lnk"
Delete "$SMPROGRAMS\KiCad\Uninstall.lnk"
Delete "$SMPROGRAMS\KiCad\KiCad.lnk"
......@@ -221,6 +234,9 @@ Section Uninstall
Delete "$INSTDIR\Wings3D.url"
Delete "$INSTDIR\HomePage.url"
Delete "$INSTDIR\UserGroup.url"
Delete "$INSTDIR\AltDownloadSite.url"
Delete "$INSTDIR\DevelGroup.url"
Delete "$INSTDIR\LibrariesGroup.url"
RMDir "$SMPROGRAMS\KiCad"
;remove all program files now
......
......@@ -184,23 +184,23 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly )
// Build candidate list
// calculate also the area needed by these footprints
MODULE* Module = GetBoard()->m_Modules;
MODULE* module = GetBoard()->m_Modules;
std::vector <MODULE*> moduleList;
for( ; Module != NULL; Module = Module->Next() )
for( ; module != NULL; module = module->Next() )
{
Module->CalculateBoundingBox();
module->CalculateBoundingBox();
if( outsideBrdFilter )
{
if( bbox.Contains( Module->GetPosition() ) )
if( bbox.Contains( module->GetPosition() ) )
continue;
}
if( Module->IsLocked() )
if( module->IsLocked() )
continue;
moduleList.push_back(Module);
moduleList.push_back(module);
}
if( moduleList.size() == 0 ) // Nothing to do
......@@ -216,18 +216,17 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly )
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
{
Module = moduleList[ii];
module = moduleList[ii];
// Undo: add copy of module to undo list
picker.SetItem( Module );
picker.SetLink( Module->Clone() );
picker.SetItem( module );
picker.SetLink( module->Clone() );
undoList.PushItem( picker );
}
// Extract and place footprints by sheet
std::vector <MODULE*> moduleListBySheet;
std::vector <EDA_RECT> placementSheetAreas;
wxString curr_sheetPath ;
double subsurface;
double placementsurface = 0.0;
......@@ -253,22 +252,25 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly )
for( int pass = 0; pass < 2; pass++ )
{
int subareaIdx = 0;
curr_sheetPath = moduleList[0]->GetPath().BeforeLast( '/' );
moduleListBySheet.clear();
subsurface = 0.0;
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
{
Module = moduleList[ii];
bool iscurrPath = curr_sheetPath == moduleList[ii]->GetPath().BeforeLast( '/' );
module = moduleList[ii];
bool islastItem = false;
if( iscurrPath )
{
moduleListBySheet.push_back( Module );
subsurface += Module->GetArea();
}
if( ii == moduleList.size() - 1 ||
( moduleList[ii]->GetPath().BeforeLast( '/' ) !=
moduleList[ii+1]->GetPath().BeforeLast( '/' ) ) )
islastItem = true;
moduleListBySheet.push_back( module );
moduleListBySheet.push_back( module );
subsurface += module->GetArea();
if( !iscurrPath || (ii == moduleList.size()-1) )
if( islastItem )
{
// end of the footprint sublist relative to the same sheet path
// calculate placement of the current sublist
......@@ -306,14 +308,9 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly )
sub_area.GetHeight();
}
curr_sheetPath = moduleList[ii]->GetPath().BeforeLast( '/' );
// Prepare buffers for next sheet
subsurface = 0.0;
moduleListBySheet.clear();
// Enter first module of next sheet
moduleListBySheet.push_back( Module );
subsurface += Module->GetArea();
subareaIdx++;
}
}
......@@ -350,7 +347,14 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly )
}
// Sort function, used to group footprints by sheet.
// Footprints are sorted by their sheet path.
// (the full sheet path restricted to the time stamp of the sheet itself,
// without the time stamp of the footprint ).
static bool sortModulesbySheetPath( MODULE* ref, MODULE* compare )
{
return compare->GetPath().Cmp( ref->GetPath() ) < 0;
if( ref->GetPath().Length() == compare->GetPath().Length() )
return ref->GetPath().BeforeLast( '/' ).Cmp( compare->GetPath().BeforeLast( '/' ) ) < 0;
return ref->GetPath().Length() < compare->GetPath().Length();
}
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="12" />
<FileVersion major="1" minor="11" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
......
......@@ -680,13 +680,14 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
{
if( m_dummyPad->GetDrillSize().x || m_dummyPad->GetDrillSize().y )
{
msg = _( "Error: pad is not on a copper layer and has a hole" );
// Note: he message is shown in an HTML window
msg = _( "Error: the pad is not on a copper layer and has a hole" );
if( m_dummyPad->GetAttribute() == PAD_HOLE_NOT_PLATED )
{
msg += wxT("\n");
msg += _( "For NPTH pad, set pad drill value to pad size value,\n"
"if you do not want this pad plotted in gerber files"
msg += wxT("<br><br><i>");
msg += _( "For NPTH pad, set pad size value to pad drill value,"
" if you do not want this pad plotted in gerber files"
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment