Commit 6431e9c9 authored by charras's avatar charras

pcbnew, gerbview: print&plot: error message displayed when no layer selected.

parent 6cdf7e83
...@@ -5,6 +5,14 @@ Started 2007-June-11 ...@@ -5,6 +5,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-mar-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++pcbnew:
++gerbview:
print,plot: error message displayed when no layer selected.
2009-Mar-5 UPDATE Vesa Solonen <vesa.solonen@hut.fi> 2009-Mar-5 UPDATE Vesa Solonen <vesa.solonen@hut.fi>
================================================================================ ================================================================================
++pcbnew: ++pcbnew:
......
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
#include "id.h" #include "id.h"
#include "dialog_create_component.h" #include "dialog_create_component.h"
/* Routines locales */
/* Variables locales */
/**********************************************/ /**********************************************/
void WinEDA_LibeditFrame::DisplayLibInfos() void WinEDA_LibeditFrame::DisplayLibInfos()
...@@ -47,7 +43,7 @@ void WinEDA_LibeditFrame::DisplayLibInfos() ...@@ -47,7 +43,7 @@ void WinEDA_LibeditFrame::DisplayLibInfos()
if( !CurrentAliasName.IsEmpty() ) if( !CurrentAliasName.IsEmpty() )
msg << wxT( " Alias " ) << CurrentAliasName; msg << wxT( " Alias " ) << CurrentAliasName;
} }
wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" ); static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
msg << wxT( " Unit " ) << UnitLetter[CurrentUnit]; msg << wxT( " Unit " ) << UnitLetter[CurrentUnit];
if( CurrentConvert > 1 ) if( CurrentConvert > 1 )
...@@ -66,7 +62,7 @@ void WinEDA_LibeditFrame::DisplayLibInfos() ...@@ -66,7 +62,7 @@ void WinEDA_LibeditFrame::DisplayLibInfos()
void WinEDA_LibeditFrame::SelectActiveLibrary() void WinEDA_LibeditFrame::SelectActiveLibrary()
/**************************************************/ /**************************************************/
/* Routine to Select Current library /* Function to select the current library (working library)
*/ */
{ {
LibraryStruct* Lib; LibraryStruct* Lib;
...@@ -80,10 +76,15 @@ void WinEDA_LibeditFrame::SelectActiveLibrary() ...@@ -80,10 +76,15 @@ void WinEDA_LibeditFrame::SelectActiveLibrary()
} }
/*************************************************/
/* Routine to Load one selected library content. */
/*************************************************/
bool WinEDA_LibeditFrame::LoadOneLibraryPart() bool WinEDA_LibeditFrame::LoadOneLibraryPart()
/**
* Function LoadOneLibraryPart()
* load a library component from the current selected library
* Prompt user for component name
* If there is no current selected library,
* prompt user for library name and make the selected library the current lib.
*/
{ {
int i; int i;
wxString msg; wxString msg;
...@@ -96,10 +97,11 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart() ...@@ -96,10 +97,11 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart()
return FALSE; return FALSE;
} }
if( CurrentLib == NULL ) if( CurrentLib == NULL ) // No current lib, ask user for the library to use
{ {
SelectActiveLibrary(); SelectActiveLibrary();
return FALSE; if( CurrentLib == NULL )
return FALSE;
} }
i = GetNameOfPartToLoad( this, CurrentLib, CmpName ); i = GetNameOfPartToLoad( this, CurrentLib, CmpName );
...@@ -109,13 +111,13 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart() ...@@ -109,13 +111,13 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart()
g_ScreenLib->ClrModify(); g_ScreenLib->ClrModify();
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
// Effacement ancien composant affich� // Delete previous library component, if any
if( CurrentLibEntry ) if( CurrentLibEntry )
{ {
SAFE_DELETE( CurrentLibEntry ); SAFE_DELETE( CurrentLibEntry );
} }
/* Chargement du composant */ /* Load the new library component */
LibEntry = FindLibPart( CmpName.GetData(), CurrentLib->m_Name, FIND_ALIAS ); LibEntry = FindLibPart( CmpName.GetData(), CurrentLib->m_Name, FIND_ALIAS );
if( LibEntry == NULL ) if( LibEntry == NULL )
...@@ -199,7 +201,8 @@ int WinEDA_LibeditFrame::LoadOneLibraryPartAux( ...@@ -199,7 +201,8 @@ int WinEDA_LibeditFrame::LoadOneLibraryPartAux(
/*********************************************************************/ /*********************************************************************/
void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*********************************************************************/ /*********************************************************************/
/* Routine generale d'affichage a l'ecran du "PartLib" en cours d'edition */ /* Function to redraw the current loaded library component
*/
{ {
if( GetScreen() == NULL ) if( GetScreen() == NULL )
return; return;
...@@ -208,9 +211,9 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -208,9 +211,9 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DC->SetBackground( *wxBLACK_BRUSH ); DC->SetBackground( *wxBLACK_BRUSH );
DC->SetBackgroundMode( wxTRANSPARENT ); DC->SetBackgroundMode( wxTRANSPARENT );
GRResetPenAndBrush( DC ); // reinit de la brosse et plume courante GRResetPenAndBrush( DC );
DrawPanel->CursorOff( DC ); // effacement curseur DrawPanel->CursorOff( DC ); // erase cursor
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); // effacement affichage lie au curseur DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); // effacement affichage lie au curseur
...@@ -225,11 +228,11 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -225,11 +228,11 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ), DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentUnit, CurrentConvert, GR_DEFAULT_DRAWMODE ); CurrentUnit, CurrentConvert, GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // reaffichage curseur DrawPanel->CursorOn( DC ); // redraw cursor
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); // reaffichage lie au curseur DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
} }
GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
...@@ -242,8 +245,8 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -242,8 +245,8 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
void WinEDA_LibeditFrame::SaveActiveLibrary() void WinEDA_LibeditFrame::SaveActiveLibrary()
/*************************************************/ /*************************************************/
/* Sauvegarde en fichier la librairie pointee par CurrentLib /* Save (on disk) the current library
* une sauvegarde en .bak de l'ancien fichier est egalement cree * if exists the old file is renamed (.bak)
*/ */
{ {
wxString Name, msg; wxString Name, msg;
...@@ -321,8 +324,8 @@ void WinEDA_LibeditFrame::DeleteOnePart() ...@@ -321,8 +324,8 @@ void WinEDA_LibeditFrame::DeleteOnePart()
* alias deviennent dependants de celui ci. * alias deviennent dependants de celui ci.
*/ */
{ {
wxString CmpName; wxString CmpName;
int NumOfParts; int NumOfParts;
EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry;
WinEDAListBox* ListBox; WinEDAListBox* ListBox;
const wxChar** ListNames; const wxChar** ListNames;
...@@ -365,7 +368,7 @@ void WinEDA_LibeditFrame::DeleteOnePart() ...@@ -365,7 +368,7 @@ void WinEDA_LibeditFrame::DeleteOnePart()
} }
ListBox = new WinEDAListBox( this, msg, ListNames, wxEmptyString, NULL, ListBox = new WinEDAListBox( this, msg, ListNames, wxEmptyString, NULL,
wxColour( 255, 255, 255 ) ); wxColour( 255, 255, 255 ) );
int ii = ListBox->ShowModal(); int ii = ListBox->ShowModal();
...@@ -407,7 +410,7 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart() ...@@ -407,7 +410,7 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart()
int diag; int diag;
if( CurrentLibEntry if( CurrentLibEntry
&& !IsOK( this, _( "Clear old component from screen (changes will be lost)?" ) ) ) && !IsOK( this, _( "Clear old component from screen (changes will be lost)?" ) ) )
return; return;
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
...@@ -429,8 +432,8 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart() ...@@ -429,8 +432,8 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart()
{ {
wxString msg; wxString msg;
msg << _( "Component \"" ) << Dialogbox.ReturnCmpName() << msg << _( "Component \"" ) << Dialogbox.ReturnCmpName() <<
_( "\" exists in library \"" ) << CurrentLib->m_Name << _( "\" exists in library \"" ) << CurrentLib->m_Name <<
_( "\"." ); _( "\"." );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -485,7 +488,7 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library, ...@@ -485,7 +488,7 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library,
if( Entry->Type == ALIAS ) if( Entry->Type == ALIAS )
{ {
RootEntry = FindLibPart( RootEntry = FindLibPart(
( (EDA_LibCmpAliasStruct*) Entry )->m_RootName.GetData(), ( (EDA_LibCmpAliasStruct*) Entry )->m_RootName.GetData(),
Library->m_Name, FIND_ROOT ); Library->m_Name, FIND_ROOT );
/* Remove alias name from the root component alias list */ /* Remove alias name from the root component alias list */
if( RootEntry == NULL ) if( RootEntry == NULL )
...@@ -539,7 +542,7 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library, ...@@ -539,7 +542,7 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library,
{ {
wxString msg; wxString msg;
msg.Printf( wxT( "Warning: Alias <%s> not found" ), msg.Printf( wxT( "Warning: Alias <%s> not found" ),
AliasName.GetData() ); AliasName.GetData() );
DisplayError( this, msg, 30 ); DisplayError( this, msg, 30 );
} }
else else
...@@ -576,18 +579,20 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library, ...@@ -576,18 +579,20 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library,
Library->m_Name, Library->m_Name,
FIND_ALIAS ); FIND_ALIAS );
if( AliasEntry == NULL ) if( AliasEntry == NULL )
{ // Should not occurs. If happens, this is an error (or bug) {
// Should not occurs. If happens, this is an error (or bug)
wxString msg; wxString msg;
msg.Printf( wxT( "Warning: Alias <%s> not found" ), msg.Printf( wxT( "Warning: Alias <%s> not found" ),
AliasName.GetData() ); AliasName.GetData() );
DisplayError( this, msg, 30 ); DisplayError( this, msg, 30 );
continue; continue;
} }
if( AliasEntry->Type != ALIAS ) if( AliasEntry->Type != ALIAS )
{ // Should not occurs. If happens, this is an error (or bug) {
// Should not occurs. If happens, this is an error (or bug)
wxString msg; wxString msg;
msg.Printf( wxT( "Warning: <%s> is not an Alias" ), msg.Printf( wxT( "Warning: <%s> is not an Alias" ),
AliasName.GetData() ); AliasName.GetData() );
DisplayError( this, msg, 30 ); DisplayError( this, msg, 30 );
continue; continue;
} }
...@@ -635,7 +640,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory() ...@@ -635,7 +640,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
CurrentLib->m_Name, FIND_ROOT ) ) != NULL ) CurrentLib->m_Name, FIND_ROOT ) ) != NULL )
{ {
msg.Printf( _( "Component \"%s\" exists. Change it?" ), msg.Printf( _( "Component \"%s\" exists. Change it?" ),
Entry->m_Name.m_Text.GetData() ); Entry->m_Name.m_Text.GetData() );
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
return; return;
NewCmp = FALSE; NewCmp = FALSE;
...@@ -685,6 +690,6 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory() ...@@ -685,6 +690,6 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
} }
msg.Printf( _( "Component %s saved in %s" ), msg.Printf( _( "Component %s saved in %s" ),
Entry->m_Name.m_Text.GetData(), CurrentLib->m_Name.GetData() ); Entry->m_Name.m_Text.GetData(), CurrentLib->m_Name.GetData() );
Affiche_Message( msg ); Affiche_Message( msg );
} }
No preview for this file type
This diff is collapsed.
...@@ -22,9 +22,9 @@ DEBUG = 0 ...@@ -22,9 +22,9 @@ DEBUG = 0
#Define the wxWidget path (if not found in environment variables): #Define the wxWidget path (if not found in environment variables):
ifndef WXWIN ifndef WXWIN
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
WXWIN=f:/wxMSW-2.8.910-rc2/Debug WXWIN=d:/wxMSW-2.8.10/Debug
else else
WXWIN=f:/wxMSW-2.8.10-rc2/Release WXWIN=d:/wxMSW-2.8.10/Release
endif endif
endif endif
LIBVERSION = 2.8 LIBVERSION = 2.8
......
This diff is collapsed.
...@@ -732,6 +732,11 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event ) ...@@ -732,6 +732,11 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
} }
} }
// If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in pcbnew:
if ( s_SelectedLayers == 0 )
DisplayError( this, _("No layer selected") );
// Close(true); // Close(true);
} }
......
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