From 6ab5ad27f57a7ee3e32b53b5b42e9c9dac96b6bc Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Mon, 28 Jan 2008 05:49:15 +0000 Subject: [PATCH] Wayne Stambaugh's patch which allows infospgm.cpp to be compiled once rather than for each program --- CMakeLists.txt | 6 +++++- common/CMakeLists.txt | 3 ++- common/basicframe.cpp | 2 +- common/pyhandler.cpp | 14 +++++++------- cvpcb/CMakeLists.txt | 1 - cvpcb/cvframe.cpp | 1 + eeschema/CMakeLists.txt | 1 - eeschema/schframe.cpp | 1 + gerbview/CMakeLists.txt | 3 +-- gerbview/gerberframe.cpp | 2 +- include/common.h | 8 +++++++- include/wxstruct.h | 1 + kicad/CMakeLists.txt | 3 --- kicad/kicad.cpp | 4 ++-- kicad/mainframe.cpp | 2 +- kicad/minizip/CMakeLists.txt | 5 ++++- pcbnew/CMakeLists.txt | 3 +-- pcbnew/pcbframe.cpp | 1 + pcbnew/specctra.h | 3 +++ share/infospgm.cpp | 33 ++++++++++----------------------- 20 files changed, 49 insertions(+), 48 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bd9530ed0..1aae0c46b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,12 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR) # Path to local CMake modules SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) +# Command line option to enable or disable building minizip. Minizip +# is building is enabled by defaut. Use -DKICAD_MINZIP=OFF to disable +# building minizip. +OPTION(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON) # Comment this out if you don't want to build minizip. -SET(KICAD_MINIZIP ON CACHE BOOL "Build minizip?") +#SET(KICAD_MINIZIP ON CACHE BOOL "Build minizip?") # Comment this out if you don't want to build with Python support. # SET(KICAD_PYTHON ON CACHE BOOL "Build with Python support?") diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 25e6eb23e9..47e7162f23 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -31,6 +31,7 @@ SET(COMMON_SRCS toolbars.cpp trigo.cpp worksheet.cpp - wxwineda.cpp) + wxwineda.cpp + ../share/infospgm.cpp) ADD_LIBRARY(common ${COMMON_SRCS}) diff --git a/common/basicframe.cpp b/common/basicframe.cpp index ee50d0a16d..3a34f191e2 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -222,7 +222,7 @@ void WinEDA_BasicFrame::GetKicadHelp(wxCommandEvent& event) void WinEDA_BasicFrame::GetKicadAbout(wxCommandEvent& event) /**********************************************************/ { - Print_Kicad_Infos(this); + Print_Kicad_Infos(this, m_AboutTitle); } /********************************************************************/ diff --git a/common/pyhandler.cpp b/common/pyhandler.cpp index d0a0919bf0..4bc211c67b 100644 --- a/common/pyhandler.cpp +++ b/common/pyhandler.cpp @@ -140,7 +140,7 @@ void PyHandler::DoInitModules() for ( unsigned int i = 0; i < m_ModuleRegistry.size(); i ++ ) { - detail::init_module( m_ModuleRegistry[i].name.fn_str(), &InitPyModules ); + detail::init_module( m_ModuleRegistry[i].name.mb_str(), &InitPyModules ); } } @@ -244,14 +244,14 @@ bool PyHandler::RunScript( const wxString & name ) object ns = module.attr( "__dict__" ); bool ret = true; - FILE * file = fopen( name.fn_str(), "r" ); + FILE * file = fopen( name.mb_str(), "r" ); wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ( !file ) { // do something - std::cout << "Unable to Load " << name.fn_str() << "\n"; + std::cout << "Unable to Load " << name.mb_str() << "\n"; ret = false; } else @@ -265,7 +265,7 @@ bool PyHandler::RunScript( const wxString & name ) try { ns["currentScript"] = Convert( name ); - handle<> ignored( PyRun_File( file, name.fn_str(), Py_file_input, ns.ptr(), ns.ptr() ) ); + handle<> ignored( PyRun_File( file, name.mb_str(), Py_file_input, ns.ptr(), ns.ptr() ) ); } catch ( error_already_set ) { @@ -286,7 +286,7 @@ bool PyHandler::RunSimpleString( const wxString & code ) wxPyBlock_t blocked = wxPyBeginBlockThreads(); try { - PyRun_SimpleString( code.fn_str() ); + PyRun_SimpleString( code.mb_str() ); } catch ( error_already_set ) { @@ -346,7 +346,7 @@ void PyHandler::TriggerEvent( const wxString & key, const object & param ) } catch (error_already_set) { - std::cout << "Error in event " << key.fn_str() << " callback" << std::endl; + std::cout << "Error in event " << key.mb_str() << " callback" << std::endl; PyErr_Print(); } } @@ -378,6 +378,6 @@ void PyHandler::UnRegisterCallback( const wxString & key, const object & callbac wxString PyHandler::MakeStr( const object & objStr ) { return wxString( extract( objStr ), wxConvLocal ); } -object PyHandler::Convert( const wxString & wxStr ) { return str( std::string( wxStr.fn_str() ).c_str() ); } +object PyHandler::Convert( const wxString & wxStr ) { return str( std::string( wxStr.mb_str() ).c_str() ); } // vim: set tabstop=4 : diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index bfc44e43a2..b40b944741 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -54,7 +54,6 @@ SET(CVPCB_EXTRA_SRCS ../share/drawframe.cpp ../share/drawpanel.cpp - ../share/infospgm.cpp ../share/zoom.cpp) IF(WIN32) diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index 9a3e40ed62..6426a62409 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -25,6 +25,7 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( WinEDA_App* parent, const wxString& title, WinEDA_BasicFrame( NULL, CVPCB_FRAME, parent, title, wxDefaultPosition, wxDefaultSize, style ) { m_FrameName = wxT( "CvpcbFrame" ); + m_AboutTitle = g_CvpcbAboutTitle; m_ListCmp = NULL; m_FootprintList = NULL; DrawFrame = NULL; diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index aa048f61eb..01936e4a75 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -97,7 +97,6 @@ SET(EESCHEMA_SRCS SET(EESCHEMA_EXTRA_SRCS ../share/drawframe.cpp ../share/drawpanel.cpp - ../share/infospgm.cpp ../share/setpage.cpp ../share/svg_print.cpp ../share/wxprint.cpp diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 587da31fc5..eaad756f60 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -120,6 +120,7 @@ WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *par WinEDA_DrawFrame(father, SCHEMATIC_FRAME, parent, title, pos, size, style) { m_FrameName = wxT("SchematicFrame"); + m_AboutTitle = g_EeschemaAboutTitle; m_Draw_Axis = FALSE; // TRUE to show axis m_Draw_Grid = g_ShowGrid; // TRUE to show a grid m_Draw_Sheet_Ref = TRUE; // TRUE to show sheet references diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt index 233db7536e..9a71fd51b9 100644 --- a/gerbview/CMakeLists.txt +++ b/gerbview/CMakeLists.txt @@ -29,7 +29,7 @@ SET(GERBVIEW_SRCS # pcbtexte.cpp # process_config.cpp readgerb.cpp - reglage.cpp + reglage.cpp rs274d.cpp rs274x.cpp select_layers_to_pcb.cpp @@ -54,7 +54,6 @@ SET(GERBVIEW_EXTRA_SRCS ../share/drawframe.cpp ../share/drawpanel.cpp - ../share/infospgm.cpp ../share/setpage.cpp ../share/wxprint.cpp ../share/zoom.cpp) diff --git a/gerbview/gerberframe.cpp b/gerbview/gerberframe.cpp index 27ab58177e..26be957edc 100644 --- a/gerbview/gerberframe.cpp +++ b/gerbview/gerberframe.cpp @@ -128,6 +128,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame(wxWindow * father, WinEDA_App *parent, WinEDA_BasePcbFrame(father, parent, GERBER_FRAME, title, pos, size, style) { m_FrameName = wxT("GerberFrame"); + m_AboutTitle = g_GerbviewAboutTitle; m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessiné @@ -313,4 +314,3 @@ wxSize size; return(bestzoom); } - diff --git a/include/common.h b/include/common.h index 4fbdb7aebc..aee16ac553 100644 --- a/include/common.h +++ b/include/common.h @@ -554,7 +554,13 @@ char* to_point( char* Text ); /****************/ /* infospgm.cpp */ /****************/ -void Print_Kicad_Infos( wxWindow* frame ); +extern wxString g_KicadAboutTitle; +extern wxString g_CvpcbAboutTitle; +extern wxString g_EeschemaAboutTitle; +extern wxString g_PcbnewAboutTitle; +extern wxString g_GerbviewAboutTitle; + +void Print_Kicad_Infos( wxWindow* frame, const wxString& title ); /**************/ /* common.cpp */ diff --git a/include/wxstruct.h b/include/wxstruct.h index 9533b4dd8a..a906fc9479 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -146,6 +146,7 @@ public: bool m_FrameIsActive; wxString m_FrameName; // name used for writting and reading setup // It is "SchematicFrame", "PcbFrame" .... + wxString m_AboutTitle; // Name of program displayed in About. public: diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt index 2d3988fd83..b0e91e2b58 100644 --- a/kicad/CMakeLists.txt +++ b/kicad/CMakeLists.txt @@ -13,9 +13,6 @@ SET(KICAD_SRCS treeprj_datas.cpp treeprj_frame.cpp) -SET(KICAD_EXTRA_SRCS - ../share/infospgm.cpp) - IF(WIN32) IF(MINGW) # resource compilation for mingw (http://www.cmake.org/Bug/view.php?id=4068) diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index 739241b814..d0ba2650da 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -63,8 +63,8 @@ WinEDA_PrjFrame* WinEDA_MainFrame::GetTree() const { return m_LeftWin; void WinEDA_MainFrame::AddFastLaunchPy( object & button ) { - wxButton * btn; - bool success = wxPyConvertSwigPtr( button.ptr(), (void**)&btn, _T("wxButton")); + wxBitmapButton * btn; + bool success = wxPyConvertSwigPtr( button.ptr(), (void**)&btn, _T("wxBitmapButton")); if ( !success ) return; Py_INCREF( button.ptr() ); diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index 7f742bd9a3..a3e7f1e135 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -34,6 +34,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app, wxSize clientsize; m_FrameName = wxT( "KicadFrame" ); + m_AboutTitle = g_KicadAboutTitle; m_VToolBar = NULL; m_LeftWin = NULL; m_BottomWin = NULL; @@ -393,7 +394,6 @@ void WinEDA_MainFrame::ClearMsg() m_DialogWin->Clear(); } - #ifdef KICAD_PYTHON void WinEDA_MainFrame::OnRefreshPy() { diff --git a/kicad/minizip/CMakeLists.txt b/kicad/minizip/CMakeLists.txt index 241394eb81..f6b3c0c451 100644 --- a/kicad/minizip/CMakeLists.txt +++ b/kicad/minizip/CMakeLists.txt @@ -3,7 +3,10 @@ IF(ZLIB_FOUND) MESSAGE(STATUS "Check for installed ZLIB -- found") ELSE(ZLIB_FOUND) MESSAGE(STATUS "Check for installed zlib -- not found") - MESSAGE(FATAL_ERROR "zlib was not found - it is required to build KiCad") + IF (NOT MINGW) + MESSAGE(FATAL_ERROR + "zlib was not found - it is required to build KiCad") + ENDIF (NOT MINGW) ENDIF(ZLIB_FOUND) SET(MINIZIP_SRCS diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 5f6a1fd299..82df4bf3e8 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -4,7 +4,7 @@ FIND_PACKAGE(Boost) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} - ${Boost_INCLUDE_DIRS} + ${Boost_INCLUDE_DIR} bitmaps ../3d-viewer ../polygon) @@ -145,7 +145,6 @@ SET(PCBNEW_SRCS SET(PCBNEW_EXTRA_SRCS ../share/drawframe.cpp ../share/drawpanel.cpp - ../share/infospgm.cpp ../share/setpage.cpp ../share/wxprint.cpp ../share/zoom.cpp) diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 1c51694a02..4529392ae2 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -183,6 +183,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, WinEDA_BasePcbFrame( father, parent, PCB_FRAME, title, pos, size, style ) { m_FrameName = wxT( "PcbFrame" ); + m_AboutTitle = g_PcbnewAboutTitle; m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Grid = g_ShowGrid; // TRUE pour avoir la grille dessinee m_Draw_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche dessine diff --git a/pcbnew/specctra.h b/pcbnew/specctra.h index 8e2295c5df..296690be42 100644 --- a/pcbnew/specctra.h +++ b/pcbnew/specctra.h @@ -2422,6 +2422,9 @@ public: class CONNECT : public ELEM { +public: + CONNECT( ELEM* parent ) : + ELEM( T_connect, parent ) {} }; diff --git a/share/infospgm.cpp b/share/infospgm.cpp index 33be2f590b..76e4bb2d9d 100644 --- a/share/infospgm.cpp +++ b/share/infospgm.cpp @@ -14,36 +14,23 @@ // Import: extern wxString g_Main_Title; -// Local -#ifdef GERBVIEW -static wxString MsgInfos(wxT("** GERBVIEW (jul 2001 .. 2008) **")); -#else -#ifdef PCBNEW -static wxString MsgInfos(wxT("** PCBNEW (sept 1992 .. 2008) **")); -#endif -#endif - -#ifdef CVPCB -static wxString MsgInfos(wxT("** CVPCB (sept 1992 .. 2008) **")); -#endif - -#ifdef KICAD -static wxString MsgInfos(wxT("** KICAD (jul 2000 .. 2008) **")); -#endif - -#ifdef EESCHEMA -static wxString MsgInfos(wxT("** EESCHEMA (sept 1994 .. 2008) **")); -#endif +/* Program title strings used in about dialog. They are kept hear to make + * it easy to update the copyright dates. */ +wxString g_KicadAboutTitle = wxT("** KICAD (jul 2000 .. 2008) **"); +wxString g_CvpcbAboutTitle = wxT("** CVPCB (sept 1992 .. 2008) **"); +wxString g_EeschemaAboutTitle = wxT("** EESCHEMA (sept 1994 .. 2008) **"); +wxString g_PcbnewAboutTitle = wxT("** PCBNEW (sept 1992 .. 2008) **"); +wxString g_GerbviewAboutTitle = wxT("** GERBVIEW (jul 2001 .. 2008) **"); // Routines Locales /*******************************************/ -void Print_Kicad_Infos(wxWindow * frame) +void Print_Kicad_Infos(wxWindow * frame, const wxString& title) /*******************************************/ { -wxString AboutCaption = wxT("About "); + wxString AboutCaption = wxT("About "); + wxString Msg = title; -wxString Msg = MsgInfos; Msg << wxT("\n\n") << _("Build Version:") << wxT("\n") ; Msg << g_Main_Title << wxT(" ") << GetBuildVersion();