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
Please add newer entries at the top, list the date and your name with
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>
================================================================================
+ cvpcb
......
......@@ -147,8 +147,8 @@ bool success = FALSE;
}
/* Try to launch some browser (usefull under linux) */
EDA_Appl->ReadPdfBrowserInfos();
if ( EDA_Appl->m_PdfBrowserIsDefault )
g_EDA_Appl->ReadPdfBrowserInfos();
if ( g_EDA_Appl->m_PdfBrowserIsDefault )
{
wxFileType * filetype;
wxFileName CurrentFileName(fullfilename);
......@@ -205,7 +205,7 @@ bool success = FALSE;
else
{
command = EDA_Appl->m_PdfBrowser;
command = g_EDA_Appl->m_PdfBrowser;
if ( wxFileExists(command) )
{
success = TRUE;
......
......@@ -76,7 +76,7 @@ static wxString s_KicadBinaryPathList[] = {
#endif
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()
bool PathFound = FALSE;
/* find kicad/help/ */
tmp = EDA_Appl->m_BinDir;
tmp = g_EDA_Appl->m_BinDir;
if( tmp.Last() == '/' )
tmp.RemoveLast();
FullPath = tmp.BeforeLast( '/' ); // Idem cd ..
FullPath += wxT( "/help/" );
LocaleString = EDA_Appl->m_Locale->GetCanonicalName();
LocaleString = g_EDA_Appl->m_Locale->GetCanonicalName();
wxString path_tmp = FullPath;
#ifdef __WINDOWS__
......@@ -357,9 +357,9 @@ wxString FindKicadHelpPath()
}
/* 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 ) )
PathFound = TRUE;
}
......@@ -424,15 +424,15 @@ wxString FindKicadFile( const wxString& shortname )
/* test de la presence du fichier shortname dans le repertoire de
* des binaires de kicad */
FullFileName = EDA_Appl->m_BinDir + shortname;
FullFileName = g_EDA_Appl->m_BinDir + shortname;
if( wxFileExists( FullFileName ) )
return FullFileName;
/* test de la presence du fichier shortname dans le repertoire
* 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 ) )
return FullFileName;
}
......@@ -519,7 +519,7 @@ void SetRealLibraryPath( const wxString& shortlibname )
else
{
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;
}
......@@ -552,22 +552,22 @@ wxString ReturnKicadDatasPath()
bool PathFound = FALSE;
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;
}
else // Chemin cherche par le chemin des executables
{
// le chemin est bindir../
wxString tmp = EDA_Appl->m_BinDir;
wxString tmp = g_EDA_Appl->m_BinDir;
#ifdef __WINDOWS__
tmp.MakeLower();
#endif
if( tmp.Contains( wxT( "kicad" ) ) )
{
#ifdef __WINDOWS__
tmp = EDA_Appl->m_BinDir;
tmp = g_EDA_Appl->m_BinDir;
#endif
if( tmp.Last() == '/' )
tmp.RemoveLast();
......@@ -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;
EDA_Appl->m_EDA_CommonConfig->Write( wxT( "Editor" ), g_EditorName );
g_EDA_Appl->m_EDA_CommonConfig->Write( wxT( "Editor" ), g_EditorName );
}
return g_EditorName;
}
......@@ -651,11 +651,11 @@ void OpenPDF( const wxString& file )
wxString filename = file;
wxString type;
EDA_Appl->ReadPdfBrowserInfos();
if( !EDA_Appl->m_PdfBrowserIsDefault )
g_EDA_Appl->ReadPdfBrowserInfos();
if( !g_EDA_Appl->m_PdfBrowserIsDefault )
{
AddDelimiterString( filename );
command = EDA_Appl->m_PdfBrowser + filename;
command = g_EDA_Appl->m_PdfBrowser + filename;
}
else
{
......
......@@ -207,8 +207,8 @@ bool WinEDA_App::ReadProjectConfig(const wxString & local_config_filename,
return:
TRUE si lue.
Met a jour en plus:
EDA_Appl->m_CurrentOptionFileDateAndTime
EDA_Appl->m_CurrentOptionFile
g_EDA_Appl->m_CurrentOptionFileDateAndTime
g_EDA_Appl->m_CurrentOptionFile
*/
{
const PARAM_CFG_BASE * pt_cfg;
......@@ -221,22 +221,22 @@ wxString timestamp;
g_Prj_Config->SetPath(UNIX_STRING_DIR_SEP);
timestamp = g_Prj_Config->Read( wxT("update") );
if ( Load_Only_if_New && ( !timestamp.IsEmpty() ) &&
(timestamp == EDA_Appl->m_CurrentOptionFileDateAndTime) )
(timestamp == g_EDA_Appl->m_CurrentOptionFileDateAndTime) )
{
return FALSE;
}
EDA_Appl->m_CurrentOptionFileDateAndTime = timestamp;
g_EDA_Appl->m_CurrentOptionFileDateAndTime = timestamp;
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
{
if ( wxPathOnly(g_Prj_Config_LocalFilename).IsEmpty() )
EDA_Appl->m_CurrentOptionFile =
g_EDA_Appl->m_CurrentOptionFile =
wxGetCwd() + STRING_DIR_SEP + g_Prj_Config_LocalFilename;
else
EDA_Appl->m_CurrentOptionFile = g_Prj_Config_LocalFilename;
g_EDA_Appl->m_CurrentOptionFile = g_Prj_Config_LocalFilename;
}
for( ; *List != NULL ; List++)
......
......@@ -35,7 +35,7 @@ wxString FullFileName = FileName ;
g_LibName_List.Clear();
g_ListName_Equ.Clear();
EDA_Appl->ReadProjectConfig(FullFileName,
g_EDA_Appl->ReadProjectConfig(FullFileName,
GROUP, ParamCfgList, FALSE);
if ( PkgInExtBuffer.IsEmpty() ) PkgInExtBuffer = wxT(".pkg");
......@@ -80,6 +80,6 @@ wxString mask( wxT("*"));
if ( FullFileName.IsEmpty()) return;
/* 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()
wxString msg;
wxString currCWD = wxGetCwd();
EDA_Appl = this;
g_EDA_Appl = this;
InitEDA_Appl( wxT("cvpcb") );
if ( m_Checker && m_Checker->IsAnotherRunning() )
......
......@@ -73,7 +73,7 @@ wxString title;
m_Parent = parent;
m_DoUpdate = TRUE;
title = _("from ") + EDA_Appl->m_CurrentOptionFile;
title = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
SetTitle(title);
Create(parent, id, caption, pos, size, style);
}
......
......@@ -86,7 +86,7 @@ void KiConfigCvpcbFrame::SetDialogDatas()
m_PkgExtBoxSizer, wxDefaultSize);
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,
_("Module Doc File:"), DocModuleFileName,
m_RightBoxSizer, wxDefaultSize);
......@@ -132,7 +132,7 @@ wxString msg;
if ( ! m_DoUpdate ) return;
NetInExtBuffer = m_NetInputExtCtrl->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());
msg = m_LibDirCtrl->GetValue();
......
......@@ -681,7 +681,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
MirrorYPoint( px, Center );
px.x -= dx;
EDA_Appl->m_SchematicFrame->PutOnGrid( &px );
g_EDA_Appl->m_SchematicFrame->PutOnGrid( &px );
DrawText->m_Pos.x = px.x;
break;
......@@ -696,14 +696,14 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
px = DrawText->m_Pos;
MirrorYPoint( px, Center );
EDA_Appl->m_SchematicFrame->PutOnGrid( &px );
g_EDA_Appl->m_SchematicFrame->PutOnGrid( &px );
DrawText->m_Pos.x = px.x;
break;
case DRAW_LIB_ITEM_STRUCT_TYPE:
DrawLibItem = (EDA_SchComponentStruct*) DrawStruct;
dx = DrawLibItem->m_Pos.x;
EDA_Appl->m_SchematicFrame->CmpRotationMiroir( DrawLibItem,
g_EDA_Appl->m_SchematicFrame->CmpRotationMiroir( DrawLibItem,
NULL, CMP_MIROIR_Y );
MirrorYPoint( DrawLibItem->m_Pos, Center );
dx -= DrawLibItem->m_Pos.x;
......
......@@ -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;
}
......
......@@ -36,7 +36,7 @@ void RemoteCommand( const char* cmdline )
char line[1024];
char* idcmd;
char* text;
WinEDA_SchematicFrame* frame = EDA_Appl->m_SchematicFrame;
WinEDA_SchematicFrame* frame = g_EDA_Appl->m_SchematicFrame;
wxString part_ref, msg;
strncpy( line, cmdline, sizeof(line) - 1 );
......
......@@ -24,7 +24,7 @@ void DeleteSubHierarchy(DrawSheetStruct * FirstSheet, bool confirm_deletion)
{
EDA_BaseStruct *DrawStruct;
EDA_BaseStruct *EEDrawList;
WinEDA_SchematicFrame * frame = EDA_Appl->m_SchematicFrame;
WinEDA_SchematicFrame * frame = g_EDA_Appl->m_SchematicFrame;
wxString msg;
if( FirstSheet == NULL ) return;
......
......@@ -102,7 +102,7 @@ wxString msg;
Create(parent, id, caption, pos, size, style);
msg = _("from ") + EDA_Appl->m_CurrentOptionFile;
msg = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
SetTitle(msg);
SetFormatsNetListes();
m_ListLibr->InsertItems(g_LibName_List, 0);
......
......@@ -142,7 +142,7 @@ wxArrayString liblist_tmp = g_LibName_List;
else FullFileName = CfgFileName;
g_LibName_List.Clear();
if ( ! EDA_Appl->ReadProjectConfig(FullFileName,
if ( ! g_EDA_Appl->ReadProjectConfig(FullFileName,
GROUP, ParamCfgList, ForceRereadConfig ? FALSE : TRUE) ) // Config non lue
{
g_LibName_List = liblist_tmp;
......@@ -159,13 +159,13 @@ wxArrayString liblist_tmp = g_LibName_List;
g_LibName_List.Add( wxT("device") );
}
if ( EDA_Appl->m_SchematicFrame )
if ( g_EDA_Appl->m_SchematicFrame )
{
EDA_Appl->m_SchematicFrame->SetDrawBgColor(g_DrawBgColor);
EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid;
g_EDA_Appl->m_SchematicFrame->SetDrawBgColor(g_DrawBgColor);
g_EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid;
}
LoadLibraries(EDA_Appl->m_SchematicFrame);
LoadLibraries(g_EDA_Appl->m_SchematicFrame);
return IsRead;
}
......@@ -197,6 +197,6 @@ wxString mask( wxT("*") );
if ( FullFileName.IsEmpty() ) return;
/* 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()
{
wxString FFileName;
EDA_Appl = this;
g_EDA_Appl = this;
g_DebugLevel = 0; // Debug level */
......
......@@ -329,7 +329,7 @@ void WinEDA_NetlistFrame::SetupPlugin(wxCommandEvent& event)
{
wxString FullFileName, Mask, Path;
Mask = wxT("*");
Path = EDA_Appl->m_BinDir;
Path = g_EDA_Appl->m_BinDir;
FullFileName = EDA_FileSelector( _("Plugin files:"),
Path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */
......
......@@ -793,7 +793,7 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
wxString msg;
angle = DrawItem->t2 - DrawItem->t1;
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 )
{
......
......@@ -26,7 +26,7 @@ bool WinEDA_App::OnInit()
{
wxString FFileName;
EDA_Appl = this;
g_EDA_Appl = this;
InitEDA_Appl( wxT("gerbview") );
if(argc > 1) FFileName = MakeFileName(wxEmptyString, argv[1], g_PhotoFilenameExt);
......
......@@ -91,7 +91,7 @@ bool Read_Config()
*/
{
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 */
if( ScreenPcb )
......@@ -137,7 +137,7 @@ void WinEDA_GerberFrame::Update_config()
return;
/* ecriture de la configuration */
EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
g_EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
}
......
......@@ -22,7 +22,7 @@ OBJECTS= \
drawpanel.o\
set_color.o \
gerbview_config.o \
cursors.o \
class_marker.o \
affiche.o \
tracepcb.o \
class_pcb_text.o\
......@@ -65,7 +65,7 @@ set_color.o: set_color.cpp set_color.h $(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
sel_layer.o: ../pcbnew/sel_layer.cpp $(COMMON)
......
......@@ -95,7 +95,7 @@ wxString title;
m_Parent = parent;
SetFont(* g_DialogFont);
title = _("from ") + EDA_Appl->m_CurrentOptionFile;
title = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
SetTitle(title);
LibModified = FALSE;
......
......@@ -18,8 +18,6 @@
/**********************************************/
/* Class representing the entire Application */
/**********************************************/
eda_global WinEDA_App* EDA_Appl; /* application representant le programme */
class WinEDA_App : public wxApp
{
......
......@@ -264,6 +264,9 @@ COMMON_GLOBL wxString g_ProductName
#endif
;
COMMON_GLOBL WinEDA_App* g_EDA_Appl; /* this is the main application */
/* Gestion des librairies */
COMMON_GLOBL wxString g_RealLibDirBuffer; // Chemin reel des librairies de module
// = UserLibDirBuffer si non vide
......
......@@ -16,7 +16,7 @@
/* define default path for config key file */
#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 */
#define HOTKEY_CFG_PATH_OPT wxT( "HotkeyPathOption" )
......
......@@ -339,14 +339,14 @@ public:
BOARD_ITEM* GetCurItem() const { return (BOARD_ITEM*) BASE_SCREEN::GetCurItem(); }
};
/***************************/
/* Description des Modules */
/***************************/
#include "class_pad.h" /* Description des Pastilles :*/
#include "class_edge_mod.h"
#include "class_text_mod.h"
#include "class_module.h"
/**********************************/
/* Module (Footprint) description */
/**********************************/
#include "class_pad.h" // class for pads
#include "class_edge_mod.h" // Class for footprint graphic elements
#include "class_text_mod.h" // Class for footprint fields
#include "class_module.h" // Class for the footprint
#include "class_equipot.h"
......@@ -413,6 +413,7 @@ public:
#include "class_cotation.h"
#include "class_mire.h"
#include "class_track.h"
#include "class_marker.h"
/*******************/
/* class EDGE_ZONE */
......@@ -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
{
......
......@@ -286,6 +286,9 @@ public:
/* Return the zoom level which displays the full page on screen */
virtual int BestZoom() = 0;
/* Return the current zoom level */
int GetZoom(void);
void ToPrinter( wxCommandEvent& event );
void SVG_Print( wxCommandEvent& event );
......
......@@ -170,7 +170,7 @@ void WinEDA_MainFrame::ReCreateMenuBar()
SETBITMAPS(datasheet_xpm);
SubMenuPdfBrowserChoice->Append(item);
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,
_("Favourite Pdf Viewer"), _("Use your favourite PDF viewer used to browse datasheets"),
wxITEM_CHECK);
......@@ -178,7 +178,7 @@ void WinEDA_MainFrame::ReCreateMenuBar()
SubMenuPdfBrowserChoice->Append(item);
SubMenuPdfBrowserChoice->AppendSeparator();
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,
_("Select Pdf Viewer"), _("Select your favourite PDF viewer used to browse datasheets"));
item->SetBitmap(datasheet_xpm);
......
......@@ -144,7 +144,7 @@ static void Create_NewPrj_Config( const wxString PrjFullFileName )
g_BoardFileName = wxFileNameFromPath( PrjFullFileName );
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()
bool WinEDA_App::OnInit()
{
EDA_Appl = this;
g_EDA_Appl = this;
InitEDA_Appl( wxT("kicad"));
/* init kicad */
......
......@@ -28,8 +28,8 @@ wxString mask(wxT("*"));
mask += wxT(".exe");
#endif
EDA_Appl->ReadPdfBrowserInfos();
wxString FullFileName = EDA_Appl->m_PdfBrowser;
g_EDA_Appl->ReadPdfBrowserInfos();
wxString FullFileName = g_EDA_Appl->m_PdfBrowser;
FullFileName = EDA_FileSelector( _("Prefered Pdf Browser:"),
wxPathOnly(FullFileName), /* Default path */
FullFileName, /* default filename */
......@@ -39,10 +39,10 @@ mask += wxT(".exe");
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
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;
EDA_Appl->WritePdfBrowserInfos();
g_EDA_Appl->m_PdfBrowser = FullFileName;
g_EDA_Appl->WritePdfBrowserInfos();
return TRUE;
}
return FALSE;
......@@ -62,31 +62,31 @@ mask += wxT(".exe");
switch (id)
{
case ID_SELECT_DEFAULT_PDF_BROWSER:
EDA_Appl->m_PdfBrowserIsDefault = TRUE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, EDA_Appl->m_PdfBrowserIsDefault);
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, !EDA_Appl->m_PdfBrowserIsDefault);
EDA_Appl->WritePdfBrowserInfos();
g_EDA_Appl->m_PdfBrowserIsDefault = TRUE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, g_EDA_Appl->m_PdfBrowserIsDefault);
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, !g_EDA_Appl->m_PdfBrowserIsDefault);
g_EDA_Appl->WritePdfBrowserInfos();
break;
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"));
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_PREFERED_PDF_BROWSER, FALSE);
}
else
{
EDA_Appl->m_PdfBrowserIsDefault = FALSE;
g_EDA_Appl->m_PdfBrowserIsDefault = FALSE;
GetMenuBar()->Check(ID_SELECT_DEFAULT_PDF_BROWSER, FALSE);
GetMenuBar()->Check(ID_SELECT_PREFERED_PDF_BROWSER, TRUE);
}
EDA_Appl->WritePdfBrowserInfos();
g_EDA_Appl->WritePdfBrowserInfos();
break;
case ID_SELECT_PREFERED_PDF_BROWSER_NAME:
......@@ -103,10 +103,10 @@ mask += wxT(".exe");
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
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;
EDA_Appl->m_EDA_CommonConfig->Write(wxT("Editor"), g_EditorName);
g_EDA_Appl->m_EDA_CommonConfig->Write(wxT("Editor"), g_EditorName);
}
break;
......
......@@ -66,7 +66,7 @@ wxString mask( wxT("*"));
if ( FullFileName.IsEmpty() ) return;
/* ecriture de la configuration */
EDA_Appl->WriteProjectConfig(FullFileName, wxT("/general"), CfgParamList);
g_EDA_Appl->WriteProjectConfig(FullFileName, wxT("/general"), CfgParamList);
}
// vim: set tabstop=4 : noexpandtab :
......@@ -295,7 +295,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
BASE_SCREEN* screen = panel->m_Parent->GetScreen();
EDA_BaseStruct* item;
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;
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 "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
#include "class_marker.h"
/* Routines Locales : */
/* Forme (bit_map) du marqueur */
/* Default bitmap shape for markers */
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, 0, 1, 0, 1, 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[] =
};
/*******************/
/* 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 )
/**********************************************************************/
......@@ -46,25 +137,24 @@ void MARQUEUR::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int DrawMode )
*/
{
int px, py;
int ii, ii_max, jj, jj_max;
int ii, jj;
char* pt_bitmap = m_Bitmap;
if( pt_bitmap == NULL )
pt_bitmap = Default_MarkerBitmap;
if( pt_bitmap == NULL ) return;
GRSetDrawMode( DC, DrawMode );
px = GRMapX( m_Pos.x );
py = GRMapY( m_Pos.y );
/* Lecture des dimensions */
ii_max = *(pt_bitmap++);
jj_max = *(pt_bitmap++);
/* Get the bitmap size */
m_Size.x = *(pt_bitmap++);
m_Size.y = *(pt_bitmap++);
/* Trace du bitmap */
for( ii = 0; ii < ii_max; ii++ )
/* Draw the bitmap */
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 )
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 )
/*******************/
/* 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 */
/***************************************************/
......
......@@ -33,7 +33,7 @@ void RemoteCommand( const char* cmdline )
char* idcmd;
char* text;
MODULE* module = 0;
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
WinEDA_PcbFrame* frame = g_EDA_Appl->m_PcbFrame;
strncpy( line, cmdline, sizeof(line) - 1 );
......
......@@ -94,11 +94,11 @@ wxString title;
Create(parent, id, caption, pos, size, style);
title = _("from ") + EDA_Appl->m_CurrentOptionFile;
title = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
SetTitle(title);
m_ListLibr->InsertItems(g_LibName_List, 0);
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"));
m_TextHelpModulesFileName->SetValue(DocModuleFileName);
}
......@@ -318,7 +318,7 @@ void KiConfigPcbnewFrame::SetNewOptions()
/********************************************/
{
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());
SetRealLibraryPath( wxT("modules") );
}
......
......@@ -864,7 +864,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:
{
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" ) );
GetAssociatedDocument( this, wxEmptyString, msg );
}
......
......@@ -16,7 +16,7 @@ OBJECTS= $(TARGET).o classpcb.o\
cross-probing.o\
via_edit.o\
wxprint.o \
cursors.o\
class_marker.o\
menubarpcb.o \
menubarmodedit.o \
tool_onrightclick.o\
......
......@@ -152,7 +152,7 @@ int ii;
/* Init des valeurs par defaut */
g_LibName_List.Clear();
EDA_Appl->ReadProjectConfig( FullFileName,
g_EDA_Appl->ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, FALSE);
/* Traitement des variables particulieres: */
......@@ -203,7 +203,7 @@ wxString mask;
Pcbdiv_grille = GetScreen()->m_Diviseur_Grille;
/* 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()
{
wxString FFileName;
EDA_Appl = this;
g_EDA_Appl = this;
InitEDA_Appl( wxT( "pcbnew" ) );
if( m_Checker && m_Checker->IsAnotherRunning() )
......
......@@ -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 )
......
......@@ -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 )
*** 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.
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