Commit 2a5676b2 authored by CHARRAS's avatar CHARRAS

Add class_marker.cpp and class_marker.h. Some other minor changes

parent 2728aa59
...@@ -4,6 +4,14 @@ Started 2007-June-11 ...@@ -4,6 +4,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.
2007-Oct-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ pcbnew:
Add class_marker.cpp and class_marker.h and move MARQUEUR functions in class_marker.cpp
Change MARQUEUR::HitTest to take in account the zoom level.
change global var EDA_Appl to g_EDA_Appl
2007-Oct-25 UPDATE Geoff Harland <gharlandau@yahoo.com.au> 2007-Oct-25 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================ ================================================================================
+ cvpcb + cvpcb
......
...@@ -147,8 +147,8 @@ bool success = FALSE; ...@@ -147,8 +147,8 @@ bool success = FALSE;
} }
/* Try to launch some browser (usefull under linux) */ /* Try to launch some browser (usefull under linux) */
EDA_Appl->ReadPdfBrowserInfos(); g_EDA_Appl->ReadPdfBrowserInfos();
if ( EDA_Appl->m_PdfBrowserIsDefault ) if ( g_EDA_Appl->m_PdfBrowserIsDefault )
{ {
wxFileType * filetype; wxFileType * filetype;
wxFileName CurrentFileName(fullfilename); wxFileName CurrentFileName(fullfilename);
...@@ -205,7 +205,7 @@ bool success = FALSE; ...@@ -205,7 +205,7 @@ bool success = FALSE;
else else
{ {
command = EDA_Appl->m_PdfBrowser; command = g_EDA_Appl->m_PdfBrowser;
if ( wxFileExists(command) ) if ( wxFileExists(command) )
{ {
success = TRUE; success = TRUE;
......
...@@ -76,7 +76,7 @@ static wxString s_KicadBinaryPathList[] = { ...@@ -76,7 +76,7 @@ static wxString s_KicadBinaryPathList[] = {
#endif #endif
wxT( "end_list" ) // End of list symbol, do not change wxT( "end_list" ) // End of list symbol, do not change
}; };
extern WinEDA_App* EDA_Appl; extern WinEDA_App* g_EDA_Appl;
/***************************************************************************/ /***************************************************************************/
...@@ -339,12 +339,12 @@ wxString FindKicadHelpPath() ...@@ -339,12 +339,12 @@ wxString FindKicadHelpPath()
bool PathFound = FALSE; bool PathFound = FALSE;
/* find kicad/help/ */ /* find kicad/help/ */
tmp = EDA_Appl->m_BinDir; tmp = g_EDA_Appl->m_BinDir;
if( tmp.Last() == '/' ) if( tmp.Last() == '/' )
tmp.RemoveLast(); tmp.RemoveLast();
FullPath = tmp.BeforeLast( '/' ); // Idem cd .. FullPath = tmp.BeforeLast( '/' ); // Idem cd ..
FullPath += wxT( "/help/" ); FullPath += wxT( "/help/" );
LocaleString = EDA_Appl->m_Locale->GetCanonicalName(); LocaleString = g_EDA_Appl->m_Locale->GetCanonicalName();
wxString path_tmp = FullPath; wxString path_tmp = FullPath;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
...@@ -357,9 +357,9 @@ wxString FindKicadHelpPath() ...@@ -357,9 +357,9 @@ wxString FindKicadHelpPath()
} }
/* find kicad/help/ from environment variable KICAD */ /* find kicad/help/ from environment variable KICAD */
if( !PathFound && EDA_Appl->m_Env_Defined ) if( !PathFound && g_EDA_Appl->m_Env_Defined )
{ {
FullPath = EDA_Appl->m_KicadEnv + wxT( "/help/" ); FullPath = g_EDA_Appl->m_KicadEnv + wxT( "/help/" );
if( wxDirExists( FullPath ) ) if( wxDirExists( FullPath ) )
PathFound = TRUE; PathFound = TRUE;
} }
...@@ -424,15 +424,15 @@ wxString FindKicadFile( const wxString& shortname ) ...@@ -424,15 +424,15 @@ wxString FindKicadFile( const wxString& shortname )
/* test de la presence du fichier shortname dans le repertoire de /* test de la presence du fichier shortname dans le repertoire de
* des binaires de kicad */ * des binaires de kicad */
FullFileName = EDA_Appl->m_BinDir + shortname; FullFileName = g_EDA_Appl->m_BinDir + shortname;
if( wxFileExists( FullFileName ) ) if( wxFileExists( FullFileName ) )
return FullFileName; return FullFileName;
/* test de la presence du fichier shortname dans le repertoire /* test de la presence du fichier shortname dans le repertoire
* defini par la variable d'environnement KICAD */ * defini par la variable d'environnement KICAD */
if( EDA_Appl->m_Env_Defined ) if( g_EDA_Appl->m_Env_Defined )
{ {
FullFileName = EDA_Appl->m_KicadEnv + shortname; FullFileName = g_EDA_Appl->m_KicadEnv + shortname;
if( wxFileExists( FullFileName ) ) if( wxFileExists( FullFileName ) )
return FullFileName; return FullFileName;
} }
...@@ -519,7 +519,7 @@ void SetRealLibraryPath( const wxString& shortlibname ) ...@@ -519,7 +519,7 @@ void SetRealLibraryPath( const wxString& shortlibname )
else else
{ {
g_RealLibDirBuffer = ReturnKicadDatasPath(); g_RealLibDirBuffer = ReturnKicadDatasPath();
if( EDA_Appl->m_Env_Defined ) // Chemin impose par la variable d'environnement if( g_EDA_Appl->m_Env_Defined ) // Chemin impose par la variable d'environnement
{ {
PathFound = TRUE; PathFound = TRUE;
} }
...@@ -552,22 +552,22 @@ wxString ReturnKicadDatasPath() ...@@ -552,22 +552,22 @@ wxString ReturnKicadDatasPath()
bool PathFound = FALSE; bool PathFound = FALSE;
wxString data_path; wxString data_path;
if( EDA_Appl->m_Env_Defined ) // Chemin impose par la variable d'environnement if( g_EDA_Appl->m_Env_Defined ) // Chemin impose par la variable d'environnement
{ {
data_path = EDA_Appl->m_KicadEnv; data_path = g_EDA_Appl->m_KicadEnv;
PathFound = TRUE; PathFound = TRUE;
} }
else // Chemin cherche par le chemin des executables else // Chemin cherche par le chemin des executables
{ {
// le chemin est bindir../ // le chemin est bindir../
wxString tmp = EDA_Appl->m_BinDir; wxString tmp = g_EDA_Appl->m_BinDir;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
tmp.MakeLower(); tmp.MakeLower();
#endif #endif
if( tmp.Contains( wxT( "kicad" ) ) ) if( tmp.Contains( wxT( "kicad" ) ) )
{ {
#ifdef __WINDOWS__ #ifdef __WINDOWS__
tmp = EDA_Appl->m_BinDir; tmp = g_EDA_Appl->m_BinDir;
#endif #endif
if( tmp.Last() == '/' ) if( tmp.Last() == '/' )
tmp.RemoveLast(); tmp.RemoveLast();
...@@ -636,10 +636,10 @@ wxString GetEditorName() ...@@ -636,10 +636,10 @@ wxString GetEditorName()
); );
} }
if( ( !editorname.IsEmpty() ) && EDA_Appl->m_EDA_CommonConfig ) if( ( !editorname.IsEmpty() ) && g_EDA_Appl->m_EDA_CommonConfig )
{ {
g_EditorName = editorname; g_EditorName = editorname;
EDA_Appl->m_EDA_CommonConfig->Write( wxT( "Editor" ), g_EditorName ); g_EDA_Appl->m_EDA_CommonConfig->Write( wxT( "Editor" ), g_EditorName );
} }
return g_EditorName; return g_EditorName;
} }
...@@ -651,11 +651,11 @@ void OpenPDF( const wxString& file ) ...@@ -651,11 +651,11 @@ void OpenPDF( const wxString& file )
wxString filename = file; wxString filename = file;
wxString type; wxString type;
EDA_Appl->ReadPdfBrowserInfos(); g_EDA_Appl->ReadPdfBrowserInfos();
if( !EDA_Appl->m_PdfBrowserIsDefault ) if( !g_EDA_Appl->m_PdfBrowserIsDefault )
{ {
AddDelimiterString( filename ); AddDelimiterString( filename );
command = EDA_Appl->m_PdfBrowser + filename; command = g_EDA_Appl->m_PdfBrowser + filename;
} }
else else
{ {
......
...@@ -207,8 +207,8 @@ bool WinEDA_App::ReadProjectConfig(const wxString & local_config_filename, ...@@ -207,8 +207,8 @@ bool WinEDA_App::ReadProjectConfig(const wxString & local_config_filename,
return: return:
TRUE si lue. TRUE si lue.
Met a jour en plus: Met a jour en plus:
EDA_Appl->m_CurrentOptionFileDateAndTime g_EDA_Appl->m_CurrentOptionFileDateAndTime
EDA_Appl->m_CurrentOptionFile g_EDA_Appl->m_CurrentOptionFile
*/ */
{ {
const PARAM_CFG_BASE * pt_cfg; const PARAM_CFG_BASE * pt_cfg;
...@@ -221,22 +221,22 @@ wxString timestamp; ...@@ -221,22 +221,22 @@ wxString timestamp;
g_Prj_Config->SetPath(UNIX_STRING_DIR_SEP); g_Prj_Config->SetPath(UNIX_STRING_DIR_SEP);
timestamp = g_Prj_Config->Read( wxT("update") ); timestamp = g_Prj_Config->Read( wxT("update") );
if ( Load_Only_if_New && ( !timestamp.IsEmpty() ) && if ( Load_Only_if_New && ( !timestamp.IsEmpty() ) &&
(timestamp == EDA_Appl->m_CurrentOptionFileDateAndTime) ) (timestamp == g_EDA_Appl->m_CurrentOptionFileDateAndTime) )
{ {
return FALSE; return FALSE;
} }
EDA_Appl->m_CurrentOptionFileDateAndTime = timestamp; g_EDA_Appl->m_CurrentOptionFileDateAndTime = timestamp;
if ( ! g_Prj_Default_Config_FullFilename.IsEmpty() ) if ( ! g_Prj_Default_Config_FullFilename.IsEmpty() )
EDA_Appl->m_CurrentOptionFile = g_Prj_Default_Config_FullFilename; g_EDA_Appl->m_CurrentOptionFile = g_Prj_Default_Config_FullFilename;
else else
{ {
if ( wxPathOnly(g_Prj_Config_LocalFilename).IsEmpty() ) if ( wxPathOnly(g_Prj_Config_LocalFilename).IsEmpty() )
EDA_Appl->m_CurrentOptionFile = g_EDA_Appl->m_CurrentOptionFile =
wxGetCwd() + STRING_DIR_SEP + g_Prj_Config_LocalFilename; wxGetCwd() + STRING_DIR_SEP + g_Prj_Config_LocalFilename;
else else
EDA_Appl->m_CurrentOptionFile = g_Prj_Config_LocalFilename; g_EDA_Appl->m_CurrentOptionFile = g_Prj_Config_LocalFilename;
} }
for( ; *List != NULL ; List++) for( ; *List != NULL ; List++)
......
...@@ -35,7 +35,7 @@ wxString FullFileName = FileName ; ...@@ -35,7 +35,7 @@ wxString FullFileName = FileName ;
g_LibName_List.Clear(); g_LibName_List.Clear();
g_ListName_Equ.Clear(); g_ListName_Equ.Clear();
EDA_Appl->ReadProjectConfig(FullFileName, g_EDA_Appl->ReadProjectConfig(FullFileName,
GROUP, ParamCfgList, FALSE); GROUP, ParamCfgList, FALSE);
if ( PkgInExtBuffer.IsEmpty() ) PkgInExtBuffer = wxT(".pkg"); if ( PkgInExtBuffer.IsEmpty() ) PkgInExtBuffer = wxT(".pkg");
...@@ -80,6 +80,6 @@ wxString mask( wxT("*")); ...@@ -80,6 +80,6 @@ wxString mask( wxT("*"));
if ( FullFileName.IsEmpty()) return; if ( FullFileName.IsEmpty()) return;
/* ecriture de la configuration */ /* ecriture de la configuration */
EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList); g_EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList);
} }
...@@ -33,7 +33,7 @@ bool WinEDA_App::OnInit() ...@@ -33,7 +33,7 @@ bool WinEDA_App::OnInit()
wxString msg; wxString msg;
wxString currCWD = wxGetCwd(); wxString currCWD = wxGetCwd();
EDA_Appl = this; g_EDA_Appl = this;
InitEDA_Appl( wxT("cvpcb") ); InitEDA_Appl( wxT("cvpcb") );
if ( m_Checker && m_Checker->IsAnotherRunning() ) if ( m_Checker && m_Checker->IsAnotherRunning() )
......
...@@ -73,7 +73,7 @@ wxString title; ...@@ -73,7 +73,7 @@ wxString title;
m_Parent = parent; m_Parent = parent;
m_DoUpdate = TRUE; m_DoUpdate = TRUE;
title = _("from ") + EDA_Appl->m_CurrentOptionFile; title = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
SetTitle(title); SetTitle(title);
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
} }
......
...@@ -86,7 +86,7 @@ void KiConfigCvpcbFrame::SetDialogDatas() ...@@ -86,7 +86,7 @@ void KiConfigCvpcbFrame::SetDialogDatas()
m_PkgExtBoxSizer, wxDefaultSize); m_PkgExtBoxSizer, wxDefaultSize);
wxString DocModuleFileName = wxString DocModuleFileName =
EDA_Appl->m_EDA_CommonConfig->Read( wxT("module_doc_file"), wxT("pcbnew/footprints.pdf")); g_EDA_Appl->m_EDA_CommonConfig->Read( wxT("module_doc_file"), wxT("pcbnew/footprints.pdf"));
m_TextHelpModulesFileName = new WinEDA_EnterText(this, m_TextHelpModulesFileName = new WinEDA_EnterText(this,
_("Module Doc File:"), DocModuleFileName, _("Module Doc File:"), DocModuleFileName,
m_RightBoxSizer, wxDefaultSize); m_RightBoxSizer, wxDefaultSize);
...@@ -132,7 +132,7 @@ wxString msg; ...@@ -132,7 +132,7 @@ wxString msg;
if ( ! m_DoUpdate ) return; if ( ! m_DoUpdate ) return;
NetInExtBuffer = m_NetInputExtCtrl->GetValue(); NetInExtBuffer = m_NetInputExtCtrl->GetValue();
PkgInExtBuffer = m_PkgExtCtrl->GetValue(); PkgInExtBuffer = m_PkgExtCtrl->GetValue();
EDA_Appl->m_EDA_CommonConfig->Write( wxT("module_doc_file"), g_EDA_Appl->m_EDA_CommonConfig->Write( wxT("module_doc_file"),
m_TextHelpModulesFileName->GetValue()); m_TextHelpModulesFileName->GetValue());
msg = m_LibDirCtrl->GetValue(); msg = m_LibDirCtrl->GetValue();
......
...@@ -681,7 +681,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ) ...@@ -681,7 +681,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
MirrorYPoint( px, Center ); MirrorYPoint( px, Center );
px.x -= dx; px.x -= dx;
EDA_Appl->m_SchematicFrame->PutOnGrid( &px ); g_EDA_Appl->m_SchematicFrame->PutOnGrid( &px );
DrawText->m_Pos.x = px.x; DrawText->m_Pos.x = px.x;
break; break;
...@@ -696,14 +696,14 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ) ...@@ -696,14 +696,14 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
px = DrawText->m_Pos; px = DrawText->m_Pos;
MirrorYPoint( px, Center ); MirrorYPoint( px, Center );
EDA_Appl->m_SchematicFrame->PutOnGrid( &px ); g_EDA_Appl->m_SchematicFrame->PutOnGrid( &px );
DrawText->m_Pos.x = px.x; DrawText->m_Pos.x = px.x;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
DrawLibItem = (EDA_SchComponentStruct*) DrawStruct; DrawLibItem = (EDA_SchComponentStruct*) DrawStruct;
dx = DrawLibItem->m_Pos.x; dx = DrawLibItem->m_Pos.x;
EDA_Appl->m_SchematicFrame->CmpRotationMiroir( DrawLibItem, g_EDA_Appl->m_SchematicFrame->CmpRotationMiroir( DrawLibItem,
NULL, CMP_MIROIR_Y ); NULL, CMP_MIROIR_Y );
MirrorYPoint( DrawLibItem->m_Pos, Center ); MirrorYPoint( DrawLibItem->m_Pos, Center );
dx -= DrawLibItem->m_Pos.x; dx -= DrawLibItem->m_Pos.x;
......
...@@ -63,7 +63,7 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) ...@@ -63,7 +63,7 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
} }
} }
EDA_Appl->m_SchematicFrame->TestDanglingEnds( EEDrawList, DC ); g_EDA_Appl->m_SchematicFrame->TestDanglingEnds( EEDrawList, DC );
return Modify; return Modify;
} }
......
...@@ -36,7 +36,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -36,7 +36,7 @@ void RemoteCommand( const char* cmdline )
char line[1024]; char line[1024];
char* idcmd; char* idcmd;
char* text; char* text;
WinEDA_SchematicFrame* frame = EDA_Appl->m_SchematicFrame; WinEDA_SchematicFrame* frame = g_EDA_Appl->m_SchematicFrame;
wxString part_ref, msg; wxString part_ref, msg;
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
......
...@@ -24,7 +24,7 @@ void DeleteSubHierarchy(DrawSheetStruct * FirstSheet, bool confirm_deletion) ...@@ -24,7 +24,7 @@ void DeleteSubHierarchy(DrawSheetStruct * FirstSheet, bool confirm_deletion)
{ {
EDA_BaseStruct *DrawStruct; EDA_BaseStruct *DrawStruct;
EDA_BaseStruct *EEDrawList; EDA_BaseStruct *EEDrawList;
WinEDA_SchematicFrame * frame = EDA_Appl->m_SchematicFrame; WinEDA_SchematicFrame * frame = g_EDA_Appl->m_SchematicFrame;
wxString msg; wxString msg;
if( FirstSheet == NULL ) return; if( FirstSheet == NULL ) return;
......
...@@ -102,7 +102,7 @@ wxString msg; ...@@ -102,7 +102,7 @@ wxString msg;
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
msg = _("from ") + EDA_Appl->m_CurrentOptionFile; msg = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
SetTitle(msg); SetTitle(msg);
SetFormatsNetListes(); SetFormatsNetListes();
m_ListLibr->InsertItems(g_LibName_List, 0); m_ListLibr->InsertItems(g_LibName_List, 0);
......
...@@ -142,7 +142,7 @@ wxArrayString liblist_tmp = g_LibName_List; ...@@ -142,7 +142,7 @@ wxArrayString liblist_tmp = g_LibName_List;
else FullFileName = CfgFileName; else FullFileName = CfgFileName;
g_LibName_List.Clear(); g_LibName_List.Clear();
if ( ! EDA_Appl->ReadProjectConfig(FullFileName, if ( ! g_EDA_Appl->ReadProjectConfig(FullFileName,
GROUP, ParamCfgList, ForceRereadConfig ? FALSE : TRUE) ) // Config non lue GROUP, ParamCfgList, ForceRereadConfig ? FALSE : TRUE) ) // Config non lue
{ {
g_LibName_List = liblist_tmp; g_LibName_List = liblist_tmp;
...@@ -159,13 +159,13 @@ wxArrayString liblist_tmp = g_LibName_List; ...@@ -159,13 +159,13 @@ wxArrayString liblist_tmp = g_LibName_List;
g_LibName_List.Add( wxT("device") ); g_LibName_List.Add( wxT("device") );
} }
if ( EDA_Appl->m_SchematicFrame ) if ( g_EDA_Appl->m_SchematicFrame )
{ {
EDA_Appl->m_SchematicFrame->SetDrawBgColor(g_DrawBgColor); g_EDA_Appl->m_SchematicFrame->SetDrawBgColor(g_DrawBgColor);
EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid; g_EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid;
} }
LoadLibraries(EDA_Appl->m_SchematicFrame); LoadLibraries(g_EDA_Appl->m_SchematicFrame);
return IsRead; return IsRead;
} }
...@@ -197,6 +197,6 @@ wxString mask( wxT("*") ); ...@@ -197,6 +197,6 @@ wxString mask( wxT("*") );
if ( FullFileName.IsEmpty() ) return; if ( FullFileName.IsEmpty() ) return;
/* ecriture de la configuration */ /* ecriture de la configuration */
EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList); g_EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList);
} }
...@@ -46,7 +46,7 @@ bool WinEDA_App::OnInit() ...@@ -46,7 +46,7 @@ bool WinEDA_App::OnInit()
{ {
wxString FFileName; wxString FFileName;
EDA_Appl = this; g_EDA_Appl = this;
g_DebugLevel = 0; // Debug level */ g_DebugLevel = 0; // Debug level */
......
...@@ -329,7 +329,7 @@ void WinEDA_NetlistFrame::SetupPlugin(wxCommandEvent& event) ...@@ -329,7 +329,7 @@ void WinEDA_NetlistFrame::SetupPlugin(wxCommandEvent& event)
{ {
wxString FullFileName, Mask, Path; wxString FullFileName, Mask, Path;
Mask = wxT("*"); Mask = wxT("*");
Path = EDA_Appl->m_BinDir; Path = g_EDA_Appl->m_BinDir;
FullFileName = EDA_FileSelector( _("Plugin files:"), FullFileName = EDA_FileSelector( _("Plugin files:"),
Path, /* Chemin par defaut */ Path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */ FullFileName, /* nom fichier par defaut */
......
...@@ -793,7 +793,7 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre ) ...@@ -793,7 +793,7 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
wxString msg; wxString msg;
angle = DrawItem->t2 - DrawItem->t1; angle = DrawItem->t2 - DrawItem->t1;
msg.Printf( _( "Arc %.1f deg" ), (float) angle / 10 ); msg.Printf( _( "Arc %.1f deg" ), (float) angle / 10 );
EDA_Appl->m_LibeditFrame->PrintMsg( msg ); g_EDA_Appl->m_LibeditFrame->PrintMsg( msg );
while( (DrawItem->t2 - DrawItem->t1) >= 1800 ) while( (DrawItem->t2 - DrawItem->t1) >= 1800 )
{ {
......
...@@ -26,7 +26,7 @@ bool WinEDA_App::OnInit() ...@@ -26,7 +26,7 @@ bool WinEDA_App::OnInit()
{ {
wxString FFileName; wxString FFileName;
EDA_Appl = this; g_EDA_Appl = this;
InitEDA_Appl( wxT("gerbview") ); InitEDA_Appl( wxT("gerbview") );
if(argc > 1) FFileName = MakeFileName(wxEmptyString, argv[1], g_PhotoFilenameExt); if(argc > 1) FFileName = MakeFileName(wxEmptyString, argv[1], g_PhotoFilenameExt);
......
...@@ -91,7 +91,7 @@ bool Read_Config() ...@@ -91,7 +91,7 @@ bool Read_Config()
*/ */
{ {
g_Prj_Config_Filename_ext = wxT( ".cnf" ); g_Prj_Config_Filename_ext = wxT( ".cnf" );
EDA_Appl->ReadProjectConfig( wxT( "gerbview" ), GROUP, ParamCfgList, FALSE ); g_EDA_Appl->ReadProjectConfig( wxT( "gerbview" ), GROUP, ParamCfgList, FALSE );
/* Inits autres variables */ /* Inits autres variables */
if( ScreenPcb ) if( ScreenPcb )
...@@ -137,7 +137,7 @@ void WinEDA_GerberFrame::Update_config() ...@@ -137,7 +137,7 @@ void WinEDA_GerberFrame::Update_config()
return; return;
/* ecriture de la configuration */ /* ecriture de la configuration */
EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList ); g_EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
} }
......
...@@ -22,7 +22,7 @@ OBJECTS= \ ...@@ -22,7 +22,7 @@ OBJECTS= \
drawpanel.o\ drawpanel.o\
set_color.o \ set_color.o \
gerbview_config.o \ gerbview_config.o \
cursors.o \ class_marker.o \
affiche.o \ affiche.o \
tracepcb.o \ tracepcb.o \
class_pcb_text.o\ class_pcb_text.o\
...@@ -65,7 +65,7 @@ set_color.o: set_color.cpp set_color.h $(COMMON) ...@@ -65,7 +65,7 @@ set_color.o: set_color.cpp set_color.h $(COMMON)
files.o: files.cpp $(COMMON) files.o: files.cpp $(COMMON)
cursors.o: ../pcbnew/cursors.cpp $(COMMON) class_marker.o: ../pcbnew/class_marker.cpp ../pcbnew/class_marker.h $(COMMON)
$(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
sel_layer.o: ../pcbnew/sel_layer.cpp $(COMMON) sel_layer.o: ../pcbnew/sel_layer.cpp $(COMMON)
......
...@@ -95,7 +95,7 @@ wxString title; ...@@ -95,7 +95,7 @@ wxString title;
m_Parent = parent; m_Parent = parent;
SetFont(* g_DialogFont); SetFont(* g_DialogFont);
title = _("from ") + EDA_Appl->m_CurrentOptionFile; title = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
SetTitle(title); SetTitle(title);
LibModified = FALSE; LibModified = FALSE;
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
/**********************************************/ /**********************************************/
/* Class representing the entire Application */ /* Class representing the entire Application */
/**********************************************/ /**********************************************/
eda_global WinEDA_App* EDA_Appl; /* application representant le programme */
class WinEDA_App : public wxApp class WinEDA_App : public wxApp
{ {
......
...@@ -264,6 +264,9 @@ COMMON_GLOBL wxString g_ProductName ...@@ -264,6 +264,9 @@ COMMON_GLOBL wxString g_ProductName
#endif #endif
; ;
COMMON_GLOBL WinEDA_App* g_EDA_Appl; /* this is the main application */
/* Gestion des librairies */ /* Gestion des librairies */
COMMON_GLOBL wxString g_RealLibDirBuffer; // Chemin reel des librairies de module COMMON_GLOBL wxString g_RealLibDirBuffer; // Chemin reel des librairies de module
// = UserLibDirBuffer si non vide // = UserLibDirBuffer si non vide
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/* define default path for config key file */ /* define default path for config key file */
#define DEFAULT_HOTKEY_FILENAME_PATH_IS_HOME wxGetHomeDir() + wxT( "/" ) #define DEFAULT_HOTKEY_FILENAME_PATH_IS_HOME wxGetHomeDir() + wxT( "/" )
#define DEFAULT_HOTKEY_FILENAME_PATH_IS_KICAD EDA_Appl->m_BinDir + wxT( "../template/" ) #define DEFAULT_HOTKEY_FILENAME_PATH_IS_KICAD g_EDA_Appl->m_BinDir + wxT( "../template/" )
/* keyword idetifier in kicad config use ti store/retrieve path option */ /* keyword idetifier in kicad config use ti store/retrieve path option */
#define HOTKEY_CFG_PATH_OPT wxT( "HotkeyPathOption" ) #define HOTKEY_CFG_PATH_OPT wxT( "HotkeyPathOption" )
......
...@@ -339,14 +339,14 @@ public: ...@@ -339,14 +339,14 @@ public:
BOARD_ITEM* GetCurItem() const { return (BOARD_ITEM*) BASE_SCREEN::GetCurItem(); } BOARD_ITEM* GetCurItem() const { return (BOARD_ITEM*) BASE_SCREEN::GetCurItem(); }
}; };
/***************************/ /**********************************/
/* Description des Modules */ /* Module (Footprint) description */
/***************************/ /**********************************/
#include "class_pad.h" /* Description des Pastilles :*/ #include "class_pad.h" // class for pads
#include "class_edge_mod.h" #include "class_edge_mod.h" // Class for footprint graphic elements
#include "class_text_mod.h" #include "class_text_mod.h" // Class for footprint fields
#include "class_module.h" #include "class_module.h" // Class for the footprint
#include "class_equipot.h" #include "class_equipot.h"
...@@ -413,6 +413,7 @@ public: ...@@ -413,6 +413,7 @@ public:
#include "class_cotation.h" #include "class_cotation.h"
#include "class_mire.h" #include "class_mire.h"
#include "class_track.h" #include "class_track.h"
#include "class_marker.h"
/*******************/ /*******************/
/* class EDGE_ZONE */ /* class EDGE_ZONE */
...@@ -427,43 +428,6 @@ public: ...@@ -427,43 +428,6 @@ public:
}; };
/***************************************/
/* Markers: used to show a drc problem */
/***************************************/
class MARQUEUR : public BOARD_ITEM
{
public:
wxPoint m_Pos;
char* m_Bitmap; /* Shape (bitmap) */
int m_Type;
int m_Color; /* color */
wxString m_Diag; /* Associated text (comment) */
public:
MARQUEUR( BOARD_ITEM* StructFather );
~MARQUEUR();
void UnLink();
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode );
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param ref_pos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& ref_pos );
};
class DISPLAY_OPTIONS class DISPLAY_OPTIONS
{ {
......
...@@ -286,6 +286,9 @@ public: ...@@ -286,6 +286,9 @@ public:
/* Return the zoom level which displays the full page on screen */ /* Return the zoom level which displays the full page on screen */
virtual int BestZoom() = 0; virtual int BestZoom() = 0;
/* Return the current zoom level */
int GetZoom(void);
void ToPrinter( wxCommandEvent& event ); void ToPrinter( wxCommandEvent& event );
void SVG_Print( wxCommandEvent& event ); void SVG_Print( wxCommandEvent& event );
......
...@@ -170,7 +170,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() ...@@ -170,7 +170,7 @@ void WinEDA_MainFrame::ReCreateMenuBar()
SETBITMAPS(datasheet_xpm); SETBITMAPS(datasheet_xpm);
SubMenuPdfBrowserChoice->Append(item); SubMenuPdfBrowserChoice->Append(item);
SubMenuPdfBrowserChoice->Check(ID_SELECT_DEFAULT_PDF_BROWSER, SubMenuPdfBrowserChoice->Check(ID_SELECT_DEFAULT_PDF_BROWSER,
EDA_Appl->m_PdfBrowserIsDefault); g_EDA_Appl->m_PdfBrowserIsDefault);
item = new wxMenuItem(SubMenuPdfBrowserChoice , ID_SELECT_PREFERED_PDF_BROWSER, item = new wxMenuItem(SubMenuPdfBrowserChoice , ID_SELECT_PREFERED_PDF_BROWSER,
_("Favourite Pdf Viewer"), _("Use your favourite PDF viewer used to browse datasheets"), _("Favourite Pdf Viewer"), _("Use your favourite PDF viewer used to browse datasheets"),
wxITEM_CHECK); wxITEM_CHECK);
...@@ -178,7 +178,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() ...@@ -178,7 +178,7 @@ void WinEDA_MainFrame::ReCreateMenuBar()
SubMenuPdfBrowserChoice->Append(item); SubMenuPdfBrowserChoice->Append(item);
SubMenuPdfBrowserChoice->AppendSeparator(); SubMenuPdfBrowserChoice->AppendSeparator();
SubMenuPdfBrowserChoice->Check(ID_SELECT_PREFERED_PDF_BROWSER, SubMenuPdfBrowserChoice->Check(ID_SELECT_PREFERED_PDF_BROWSER,
!EDA_Appl->m_PdfBrowserIsDefault); !g_EDA_Appl->m_PdfBrowserIsDefault);
item = new wxMenuItem(SubMenuPdfBrowserChoice , ID_SELECT_PREFERED_PDF_BROWSER_NAME, item = new wxMenuItem(SubMenuPdfBrowserChoice , ID_SELECT_PREFERED_PDF_BROWSER_NAME,
_("Select Pdf Viewer"), _("Select your favourite PDF viewer used to browse datasheets")); _("Select Pdf Viewer"), _("Select your favourite PDF viewer used to browse datasheets"));
item->SetBitmap(datasheet_xpm); item->SetBitmap(datasheet_xpm);
......
...@@ -144,7 +144,7 @@ static void Create_NewPrj_Config( const wxString PrjFullFileName ) ...@@ -144,7 +144,7 @@ static void Create_NewPrj_Config( const wxString PrjFullFileName )
g_BoardFileName = wxFileNameFromPath( PrjFullFileName ); g_BoardFileName = wxFileNameFromPath( PrjFullFileName );
ChangeFileNameExt( g_BoardFileName, g_BoardExtBuffer ); ChangeFileNameExt( g_BoardFileName, g_BoardExtBuffer );
EDA_Appl->WriteProjectConfig( PrjFullFileName, wxT( "/general" ), CfgParamList ); g_EDA_Appl->WriteProjectConfig( PrjFullFileName, wxT( "/general" ), CfgParamList );
} }
......
...@@ -195,7 +195,7 @@ static void py_common_init() ...@@ -195,7 +195,7 @@ static void py_common_init()
bool WinEDA_App::OnInit() bool WinEDA_App::OnInit()
{ {
EDA_Appl = this; g_EDA_Appl = this;
InitEDA_Appl( wxT("kicad")); InitEDA_Appl( wxT("kicad"));
/* init kicad */ /* init kicad */
......
...@@ -28,8 +28,8 @@ wxString mask(wxT("*")); ...@@ -28,8 +28,8 @@ wxString mask(wxT("*"));
mask += wxT(".exe"); mask += wxT(".exe");
#endif #endif
EDA_Appl->ReadPdfBrowserInfos(); g_EDA_Appl->ReadPdfBrowserInfos();
wxString FullFileName = EDA_Appl->m_PdfBrowser; wxString FullFileName = g_EDA_Appl->m_PdfBrowser;
FullFileName = EDA_FileSelector( _("Prefered Pdf Browser:"), FullFileName = EDA_FileSelector( _("Prefered Pdf Browser:"),
wxPathOnly(FullFileName), /* Default path */ wxPathOnly(FullFileName), /* Default path */
FullFileName, /* default filename */ FullFileName, /* default filename */
...@@ -39,10 +39,10 @@ mask += wxT(".exe"); ...@@ -39,10 +39,10 @@ mask += wxT(".exe");
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/ wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
TRUE /* true = keep the current path */ TRUE /* true = keep the current path */
); );
if ( ! FullFileName.IsEmpty() && (EDA_Appl->m_PdfBrowser != FullFileName) ) if ( ! FullFileName.IsEmpty() && (g_EDA_Appl->m_PdfBrowser != FullFileName) )
{ {
EDA_Appl->m_PdfBrowser = FullFileName; g_EDA_Appl->m_PdfBrowser = FullFileName;
EDA_Appl->WritePdfBrowserInfos(); g_EDA_Appl->WritePdfBrowserInfos();
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
...@@ -62,31 +62,31 @@ mask += wxT(".exe"); ...@@ -62,31 +62,31 @@ mask += wxT(".exe");
switch (id) switch (id)
{ {
case ID_SELECT_DEFAULT_PDF_BROWSER: case ID_SELECT_DEFAULT_PDF_BROWSER:
EDA_Appl->m_PdfBrowserIsDefault = TRUE; g_EDA_Appl->m_PdfBrowserIsDefault = TRUE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, EDA_Appl->m_PdfBrowserIsDefault); GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, g_EDA_Appl->m_PdfBrowserIsDefault);
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, !EDA_Appl->m_PdfBrowserIsDefault); GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, !g_EDA_Appl->m_PdfBrowserIsDefault);
EDA_Appl->WritePdfBrowserInfos(); g_EDA_Appl->WritePdfBrowserInfos();
break; break;
case ID_SELECT_PREFERED_PDF_BROWSER: case ID_SELECT_PREFERED_PDF_BROWSER:
if ( EDA_Appl->m_PdfBrowser.IsEmpty() ) if ( g_EDA_Appl->m_PdfBrowser.IsEmpty() )
{ {
DisplayError(this, _("You must choose a PDF viewer before use this option")); DisplayError(this, _("You must choose a PDF viewer before use this option"));
ChoosePdfBrowser(this); ChoosePdfBrowser(this);
} }
if ( EDA_Appl->m_PdfBrowser.IsEmpty() ) if ( g_EDA_Appl->m_PdfBrowser.IsEmpty() )
{ {
EDA_Appl->m_PdfBrowserIsDefault = TRUE; g_EDA_Appl->m_PdfBrowserIsDefault = TRUE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, TRUE); GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, TRUE);
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, FALSE); GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, FALSE);
} }
else else
{ {
EDA_Appl->m_PdfBrowserIsDefault = FALSE; g_EDA_Appl->m_PdfBrowserIsDefault = FALSE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, FALSE); GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, FALSE);
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, TRUE); GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, TRUE);
} }
EDA_Appl->WritePdfBrowserInfos(); g_EDA_Appl->WritePdfBrowserInfos();
break; break;
case ID_SELECT_PREFERED_PDF_BROWSER_NAME: case ID_SELECT_PREFERED_PDF_BROWSER_NAME:
...@@ -103,10 +103,10 @@ mask += wxT(".exe"); ...@@ -103,10 +103,10 @@ mask += wxT(".exe");
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/ wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
TRUE /* true = keep the current path */ TRUE /* true = keep the current path */
); );
if ( ( !FullFileName.IsEmpty() ) && EDA_Appl->m_EDA_CommonConfig) if ( ( !FullFileName.IsEmpty() ) && g_EDA_Appl->m_EDA_CommonConfig)
{ {
g_EditorName = FullFileName; g_EditorName = FullFileName;
EDA_Appl->m_EDA_CommonConfig->Write(wxT("Editor"), g_EditorName); g_EDA_Appl->m_EDA_CommonConfig->Write(wxT("Editor"), g_EditorName);
} }
break; break;
......
...@@ -66,7 +66,7 @@ wxString mask( wxT("*")); ...@@ -66,7 +66,7 @@ wxString mask( wxT("*"));
if ( FullFileName.IsEmpty() ) return; if ( FullFileName.IsEmpty() ) return;
/* ecriture de la configuration */ /* ecriture de la configuration */
EDA_Appl->WriteProjectConfig(FullFileName, wxT("/general"), CfgParamList); g_EDA_Appl->WriteProjectConfig(FullFileName, wxT("/general"), CfgParamList);
} }
// vim: set tabstop=4 : noexpandtab : // vim: set tabstop=4 : noexpandtab :
...@@ -295,7 +295,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -295,7 +295,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
BASE_SCREEN* screen = panel->m_Parent->GetScreen(); BASE_SCREEN* screen = panel->m_Parent->GetScreen();
EDA_BaseStruct* item; EDA_BaseStruct* item;
wxPoint move_offset; wxPoint move_offset;
MODULE* Currentmodule = EDA_Appl->m_ModuleEditFrame->m_Pcb->m_Modules; MODULE* Currentmodule = g_EDA_Appl->m_ModuleEditFrame->m_Pcb->m_Modules;
PtBlock = &panel->GetScreen()->BlockLocate; PtBlock = &panel->GetScreen()->BlockLocate;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
......
/****************************************************************/ /*****************************************************************************/
/* Routines generales d'affichage des curseurs et des marqueurs */ /* Functions to handle markers used to show somthing (usually a drc problem) */
/****************************************************************/ /*****************************************************************************/
/* fichier curseurs.cpp */ /* file class_marker.cpp */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "class_marker.h"
/* Routines Locales : */ /* Routines Locales : */
/* Forme (bit_map) du marqueur */ /* Default bitmap shape for markers */
static char Default_MarkerBitmap[] = static char Default_MarkerBitmap[] =
{ {
12, 12, /* Dimensions x et y du dessin de marqueurs*/ 12, 12, /* x and y sise of the bitmap */
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* bitmap: 1 = color, 0 = notrace */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* bitmap: 1 = color, 0 = notrace */
1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
...@@ -33,6 +34,96 @@ static char Default_MarkerBitmap[] = ...@@ -33,6 +34,96 @@ static char Default_MarkerBitmap[] =
}; };
/*******************/
/* Classe MARQUEUR */
/*******************/
MARQUEUR::MARQUEUR( BOARD_ITEM* StructFather ) :
BOARD_ITEM( StructFather, TYPEMARQUEUR )
{
m_Bitmap = NULL;
m_Type = 0;
m_Color = RED;
m_Bitmap = Default_MarkerBitmap;
m_Size.x = Default_MarkerBitmap[0];
m_Size.y = Default_MarkerBitmap[1];
}
/* Effacement memoire de la structure */
MARQUEUR:: ~MARQUEUR()
{
}
/* supprime du chainage la structure Struct
* les structures arrieres et avant sont chainees directement
*/
void MARQUEUR::UnLink()
{
/* Modification du chainage arriere */
if( Pback )
{
if( Pback->Type() != TYPEPCB )
{
Pback->Pnext = Pnext;
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
}
}
/* Modification du chainage avant */
if( Pnext )
Pnext->Pback = Pback;
Pnext = Pback = NULL;
}
void MARQUEUR::Display_Infos( WinEDA_DrawFrame* frame )
{
int text_pos;
frame->MsgPanel->EraseMsgBox();
text_pos = 1;
Affiche_1_Parametre( frame, text_pos, _( "Type" ), _("Marker"), DARKCYAN );
text_pos = 12;
Affiche_1_Parametre( frame, text_pos, _( "Marker Error Text" ), m_Diag, RED );
}
/**********************************************/
bool MARQUEUR::HitTest( const wxPoint& refPos )
/**********************************************/
{
// the MARKER is 12 pixels by 12 pixels, but is not resized with zoom, so
// as zoom changes, the effective real size (in user units) of the MARKER changes.
wxSize TrueSize = m_Size;
if ( ActiveScreen )
{
TrueSize.x *= ActiveScreen->GetZoom();
TrueSize.y *= ActiveScreen->GetZoom();
}
int dx = refPos.x - m_Pos.x;
int dy = refPos.y - m_Pos.y;
/* is refPos in the box: Marker size to right an bottom,
or size/2 to left or top */
if( dx <= TrueSize.x && dy <= TrueSize.y &&
dx >= -TrueSize.x/2 && dy >= -TrueSize.y/2 )
return true;
else
return false;
}
/**********************************************************************/ /**********************************************************************/
void MARQUEUR::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode ) void MARQUEUR::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode )
/**********************************************************************/ /**********************************************************************/
...@@ -46,25 +137,24 @@ void MARQUEUR::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode ) ...@@ -46,25 +137,24 @@ void MARQUEUR::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode )
*/ */
{ {
int px, py; int px, py;
int ii, ii_max, jj, jj_max; int ii, jj;
char* pt_bitmap = m_Bitmap; char* pt_bitmap = m_Bitmap;
if( pt_bitmap == NULL ) if( pt_bitmap == NULL ) return;
pt_bitmap = Default_MarkerBitmap;
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
px = GRMapX( m_Pos.x ); px = GRMapX( m_Pos.x );
py = GRMapY( m_Pos.y ); py = GRMapY( m_Pos.y );
/* Lecture des dimensions */ /* Get the bitmap size */
ii_max = *(pt_bitmap++); m_Size.x = *(pt_bitmap++);
jj_max = *(pt_bitmap++); m_Size.y = *(pt_bitmap++);
/* Trace du bitmap */ /* Draw the bitmap */
for( ii = 0; ii < ii_max; ii++ ) for( ii = 0; ii < m_Size.x; ii++ )
{ {
for( jj = 0; jj < jj_max; jj++, pt_bitmap++ ) for( jj = 0; jj < m_Size.y; jj++, pt_bitmap++ )
{ {
if( *pt_bitmap ) if( *pt_bitmap )
GRSPutPixel( &panel->m_ClipBox, DC, GRSPutPixel( &panel->m_ClipBox, DC,
......
/***************************************/
/* Markers: used to show a drc problem */
/***************************************/
#ifndef CLASS_MARKER_H
#define CLASS_MARKER_H
#include "base_struct.h"
class MARQUEUR : public BOARD_ITEM
{
public:
wxPoint m_Pos;
char* m_Bitmap; /* Shape (bitmap) */
int m_Type;
int m_Color; /* color */
wxString m_Diag; /* Associated text (comment) */
wxSize m_Size; /* Size of the graphic symbol */
public:
MARQUEUR( BOARD_ITEM* StructFather );
~MARQUEUR();
void UnLink();
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode );
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param ref_pos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& ref_pos );
};
#endif // end #ifndef CLASS_MARKER_H
...@@ -258,87 +258,6 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos ) ...@@ -258,87 +258,6 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
/*******************/
/* Classe MARQUEUR */
/*******************/
MARQUEUR::MARQUEUR( BOARD_ITEM* StructFather ) :
BOARD_ITEM( StructFather, TYPEMARQUEUR )
{
m_Bitmap = NULL;
m_Type = 0;
m_Color = RED;
}
/* Effacement memoire de la structure */
MARQUEUR:: ~MARQUEUR()
{
}
/* supprime du chainage la structure Struct
* les structures arrieres et avant sont chainees directement
*/
void MARQUEUR::UnLink()
{
/* Modification du chainage arriere */
if( Pback )
{
if( Pback->Type() != TYPEPCB )
{
Pback->Pnext = Pnext;
}
else /* Le chainage arriere pointe sur la structure "Pere" */
{
( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
}
}
/* Modification du chainage avant */
if( Pnext )
Pnext->Pback = Pback;
Pnext = Pback = NULL;
}
void MARQUEUR::Display_Infos( WinEDA_DrawFrame* frame )
{
int text_pos;
frame->MsgPanel->EraseMsgBox();
text_pos = 1;
Affiche_1_Parametre( frame, text_pos, _( "Type" ), _("Marker"), DARKCYAN );
text_pos = 12;
Affiche_1_Parametre( frame, text_pos, _( "Marker Error Text" ), m_Diag, RED );
}
bool MARQUEUR::HitTest( const wxPoint& refPos )
{
// the MARKER is 12 pixels by 12 pixels, but is not resized with zoom, so
// as zoom changes, the effective real size of the MARKER changes.
// @todo: compensate for the zoom. right now it is difficult to select marker when zoomed out.
const int halfSize = 6;
int xCenter = m_Pos.x + halfSize;
int yCenter = m_Pos.y + halfSize;
int dx = refPos.x - xCenter;
int dy = refPos.y - yCenter;
if( ABS(dx) <= halfSize && ABS(dy) <= halfSize )
return true;
else
return false;
}
/**************************************************/ /**************************************************/
/* Class SCREEN: classe de gestion d'un affichage */ /* Class SCREEN: classe de gestion d'un affichage */
/***************************************************/ /***************************************************/
......
...@@ -33,7 +33,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -33,7 +33,7 @@ void RemoteCommand( const char* cmdline )
char* idcmd; char* idcmd;
char* text; char* text;
MODULE* module = 0; MODULE* module = 0;
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame; WinEDA_PcbFrame* frame = g_EDA_Appl->m_PcbFrame;
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
......
...@@ -94,11 +94,11 @@ wxString title; ...@@ -94,11 +94,11 @@ wxString title;
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
title = _("from ") + EDA_Appl->m_CurrentOptionFile; title = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
SetTitle(title); SetTitle(title);
m_ListLibr->InsertItems(g_LibName_List, 0); m_ListLibr->InsertItems(g_LibName_List, 0);
wxString DocModuleFileName = wxString DocModuleFileName =
EDA_Appl->m_EDA_CommonConfig->Read( wxT("module_doc_file"), g_EDA_Appl->m_EDA_CommonConfig->Read( wxT("module_doc_file"),
wxT("pcbnew/footprints.pdf")); wxT("pcbnew/footprints.pdf"));
m_TextHelpModulesFileName->SetValue(DocModuleFileName); m_TextHelpModulesFileName->SetValue(DocModuleFileName);
} }
...@@ -318,7 +318,7 @@ void KiConfigPcbnewFrame::SetNewOptions() ...@@ -318,7 +318,7 @@ void KiConfigPcbnewFrame::SetNewOptions()
/********************************************/ /********************************************/
{ {
g_UserLibDirBuffer = m_TextLibDir->GetValue(); g_UserLibDirBuffer = m_TextLibDir->GetValue();
EDA_Appl->m_EDA_CommonConfig->Write( wxT("module_doc_file"), g_EDA_Appl->m_EDA_CommonConfig->Write( wxT("module_doc_file"),
m_TextHelpModulesFileName->GetValue()); m_TextHelpModulesFileName->GetValue());
SetRealLibraryPath( wxT("modules") ); SetRealLibraryPath( wxT("modules") );
} }
......
...@@ -864,7 +864,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -864,7 +864,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC: case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:
{ {
wxString msg = FindKicadHelpPath(); wxString msg = FindKicadHelpPath();
msg += EDA_Appl->m_EDA_CommonConfig->Read( wxT( "module_doc_file" ), msg += g_EDA_Appl->m_EDA_CommonConfig->Read( wxT( "module_doc_file" ),
wxT( "pcbnew/footprints.pdf" ) ); wxT( "pcbnew/footprints.pdf" ) );
GetAssociatedDocument( this, wxEmptyString, msg ); GetAssociatedDocument( this, wxEmptyString, msg );
} }
......
...@@ -16,7 +16,7 @@ OBJECTS= $(TARGET).o classpcb.o\ ...@@ -16,7 +16,7 @@ OBJECTS= $(TARGET).o classpcb.o\
cross-probing.o\ cross-probing.o\
via_edit.o\ via_edit.o\
wxprint.o \ wxprint.o \
cursors.o\ class_marker.o\
menubarpcb.o \ menubarpcb.o \
menubarmodedit.o \ menubarmodedit.o \
tool_onrightclick.o\ tool_onrightclick.o\
......
...@@ -152,7 +152,7 @@ int ii; ...@@ -152,7 +152,7 @@ int ii;
/* Init des valeurs par defaut */ /* Init des valeurs par defaut */
g_LibName_List.Clear(); g_LibName_List.Clear();
EDA_Appl->ReadProjectConfig( FullFileName, g_EDA_Appl->ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE); GROUP, ParamCfgList, FALSE);
/* Traitement des variables particulieres: */ /* Traitement des variables particulieres: */
...@@ -203,7 +203,7 @@ wxString mask; ...@@ -203,7 +203,7 @@ wxString mask;
Pcbdiv_grille = GetScreen()->m_Diviseur_Grille; Pcbdiv_grille = GetScreen()->m_Diviseur_Grille;
/* ecriture de la configuration */ /* ecriture de la configuration */
EDA_Appl->WriteProjectConfig(FullFileName, wxT("/pcbnew"), ParamCfgList); g_EDA_Appl->WriteProjectConfig(FullFileName, wxT("/pcbnew"), ParamCfgList);
} }
...@@ -34,7 +34,7 @@ bool WinEDA_App::OnInit() ...@@ -34,7 +34,7 @@ bool WinEDA_App::OnInit()
{ {
wxString FFileName; wxString FFileName;
EDA_Appl = this; g_EDA_Appl = this;
InitEDA_Appl( wxT( "pcbnew" ) ); InitEDA_Appl( wxT( "pcbnew" ) );
if( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )
......
...@@ -328,6 +328,14 @@ void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtue ...@@ -328,6 +328,14 @@ void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtue
} }
} }
/***********************************/
int WinEDA_DrawFrame::GetZoom(void)
/***********************************/
/* Return the current zoom level */
{
return m_CurrentScreen->GetZoom();
}
/********************************************************/ /********************************************************/
void WinEDA_DrawFrame::OnMouseEvent( wxMouseEvent& event ) void WinEDA_DrawFrame::OnMouseEvent( wxMouseEvent& event )
......
...@@ -57,11 +57,6 @@ can now identify a marker. To see where the user gets a menu to delete a marker ...@@ -57,11 +57,6 @@ can now identify a marker. To see where the user gets a menu to delete a marker
void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
*** fix MARQUEUR::HitTest():
the MARKER is 12 pixels by 12 pixels, but is not resized with zoom, so
as zoom changes, the effective real size of the MARKER changes.
@todo: compensate for the zoom. right now it is difficult to select marker when zoomed out.
*** Add tooltip text to all non-obvious controls in every dialog window. *** Add tooltip text to all non-obvious controls in every dialog window.
Need to do this using DialogBlocks. Need to do this using DialogBlocks.
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