diff --git a/CHANGELOG.txt b/CHANGELOG.txt index accfc50c67..029e8b9402 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -10,13 +10,35 @@ More native OSX changes, this removes some WXMAC defines replaced by wxID macros. These are handled by wxWidgets itself and reduces in-app platform defines. More work needs to be done for CvPCB and Gerbview. -All: +All: Hotkey names in menu's all have tabs, this looks more uniform and pretty. EESschema & PCBNew: Fix about and preferences wxMenu to be more native (remove unneeded WXMAC ) Disable all icons in wxMenu on OSX with macro SETBITMAPS +jp charras: + SETBITMAPS is incorrectly used here. change to SET_BITMAP + +2011-Mar-25 UPDATE Wayne Stambaugh +================================================================================ + EESchema multiple item hit testing and other minor improvements. + + * Add item clarification context menu to EESchema when multiple unresolved + items are found at the current cross hair position. + * Add collector class SCH_COLLECTOR for supporting multiple item hit testing. + * Removed bit wise masked filtering from schematic item hit testing. + * Removed all old hit testing functions and methods scattered about the + EESchema source code. + * Move terminal point test function into SCH_SCREEN object. + * Fixed bug in terminal point test when terminating a bus to a label. + * Define the < operator for sorting schematic items. + * Add area calculation method to EDA_Rect item. + * Add method for returning an item's bitmap for menu display purposes. + * Add method for returning an item's menu text for menu display purposes. + * Changed EDA_ITEMS container from boost::ptr_vector to std::vector. + * Factor coordinate string conversion code from EDA_DRAW_FRAME to function CoordinateToString(). + 2011-Mar-16, UPDATE Jean-Pierre Charras ================================================================================ Gerbview: diff --git a/bitmaps/CMakeLists.txt b/bitmaps/CMakeLists.txt index 5c92ec39c1..51b0c2518c 100644 --- a/bitmaps/CMakeLists.txt +++ b/bitmaps/CMakeLists.txt @@ -416,6 +416,7 @@ set(BITMAP_SRCS Width_Track_Via.xpm Width_Track.xpm Width_Vias.xpm + window_close.xpm zip_tool.xpm zip.xpm zoom.xpm diff --git a/bitmaps/sources/window_close.svg b/bitmaps/sources/window_close.svg new file mode 100644 index 0000000000..4033a8b111 --- /dev/null +++ b/bitmaps/sources/window_close.svg @@ -0,0 +1,306 @@ + + + + + + + + + + + + unsorted + + + + + Open Clip Art Library, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors + + + + + + + + + + + + + + image/svg+xml + + + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bitmaps/window_close.xpm b/bitmaps/window_close.xpm new file mode 100644 index 0000000000..6493afc754 --- /dev/null +++ b/bitmaps/window_close.xpm @@ -0,0 +1,38 @@ +/* XPM */ +const char *window_close_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 16 1", +"O c #DE7070", +"& c #BC9392", +"o c #BF9D9C", +"X c #DC6464", +"* c #CA4545", +"% c #D45051", +"- c #C03433", +"+ c #E88080", +"= c #C43C3C", +". c #C2A6A6", +"; c #BC8684", +": c #B47274", +" c None", +"$ c #BFB0AF", +"@ c #C55A5B", +"# c #DD5A59", +/* pixels */ +" .X. .X. ", +" oO+O. .O+Oo ", +"oOOO+O. .O+OOOo", +"@OXXXOO..OOXXXO@", +".XO#XXOXXOXX#OX.", +" $@O###OO###O@$ ", +" $@X######X@$ ", +" $@X%%%%X@$ ", +" &@%%%%%%@& ", +" &%%******%%& ", +" o*****%%*****o ", +"o**===****===**o", +"==---==.&*=---==", +"&=---=. ;=---=.", +" &---o :--=$ ", +" &-o @* " +}; diff --git a/common/build_version.cpp b/common/build_version.cpp index ae7c43ecf2..95af36f619 100644 --- a/common/build_version.cpp +++ b/common/build_version.cpp @@ -6,7 +6,7 @@ #endif #ifndef KICAD_BUILD_VERSION -#define KICAD_BUILD_VERSION "(2011-04-01)" +#define KICAD_BUILD_VERSION "(2011-04-05)" #endif // uncomment this line only when creating a stable version diff --git a/cvpcb/menubar.cpp b/cvpcb/menubar.cpp index 0537b8aeb2..2c3c578101 100644 --- a/cvpcb/menubar.cpp +++ b/cvpcb/menubar.cpp @@ -74,6 +74,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() _( "Prevent CVPcb from exiting after saving netlist file" ), wxITEM_CHECK ); configmenu->Append( item ); + SETBITMAPS( window_close_xpm ); configmenu->AppendSeparator(); ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 3a836b1881..b9eaf54d0c 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -47,13 +47,13 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New\tCtrl+N" ), _( "New schematic project" ) ); - SETBITMAPS( new_xpm ); + SET_BITMAP( new_xpm ); filesMenu->Append( item ); // Open item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open\tCtrl+O" ), _( "Open an existing schematic project" ) ); - SETBITMAPS( open_document_xpm ); + SET_BITMAP( open_document_xpm ); filesMenu->Append( item ); // Open Recent submenu @@ -70,26 +70,26 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save Whole Schematic Project\tCtrl+S" ), _( "Save all sheets in the schematic project" ) ); - SETBITMAPS( save_project_xpm ); + SET_BITMAP( save_project_xpm ); filesMenu->Append( item ); item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET, _( "Save &Current Sheet Only" ), _( "Save only current schematic sheet" ) ); - SETBITMAPS( save_xpm ); + SET_BITMAP( save_xpm ); filesMenu->Append( item ); // Save as... item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET_AS, _( "Save Current Sheet &as" ), _( "Save current schematic sheet as..." ) ); - SETBITMAPS( save_as_xpm ); + SET_BITMAP( save_as_xpm ); filesMenu->Append( item ); // Print filesMenu->AppendSeparator(); item = new wxMenuItem( filesMenu, wxID_PRINT, _( "P&rint" ), _( "Print schematic" ) ); - SETBITMAPS( print_button ); + SET_BITMAP( print_button ); filesMenu->Append( item ); // Plot submenu @@ -97,25 +97,25 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS, _( "Plot PostScript" ), _( "Plot schematic sheet in PostScript format" ) ); - SETBITMAPS( plot_PS_xpm ); + SET_BITMAP( plot_PS_xpm ); choice_plot_fmt->Append( item ); /* Plot HPGL */ item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_HPGL, _( "Plot HPGL" ), _( "Plot schematic sheet in HPGL format" ) ); - SETBITMAPS( plot_HPG_xpm ); + SET_BITMAP( plot_HPG_xpm ); choice_plot_fmt->Append( item ); // Plot SVG item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_SVG, _( "Plot SVG" ), _( "Plot schematic sheet in SVG format" ) ); - SETBITMAPS( plot_xpm ); + SET_BITMAP( plot_xpm ); choice_plot_fmt->Append( item ); // Plot DXF item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_DXF, _( "Plot DXF" ), _( "Plot schematic sheet in DXF format" ) ); - SETBITMAPS( plot_xpm ); + SET_BITMAP( plot_xpm ); choice_plot_fmt->Append( item ); // Under windows, one can draw to the clipboard @@ -124,7 +124,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD, _( "Plot to Clipboard" ), _( "Export drawings to clipboard" ) ); - SETBITMAPS( copy_button ); + SET_BITMAP( copy_button ); choice_plot_fmt->Append( item ); #endif @@ -137,7 +137,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() filesMenu->AppendSeparator(); item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), _( "Quit EESchema" ) ); - SETBITMAPS( exit_xpm ); + SET_BITMAP( exit_xpm ); filesMenu->Append( item ); // Edit menu @@ -147,21 +147,21 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() text = AddHotkeyName( _( "Undo" ), s_Schematic_Hokeys_Descr, HK_UNDO ); item = new wxMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, wxITEM_NORMAL ); - SETBITMAPS( undo_xpm ); + SET_BITMAP( undo_xpm ); editMenu->Append( item ); /* Redo */ text = AddHotkeyName( _( "Redo" ), s_Schematic_Hokeys_Descr, HK_REDO ); item = new wxMenuItem( editMenu, wxID_REDO, text, HELP_REDO, wxITEM_NORMAL ); - SETBITMAPS( redo_xpm ); + SET_BITMAP( redo_xpm ); editMenu->Append( item ); /* Delete */ editMenu->AppendSeparator(); item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT, _( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL ); - SETBITMAPS( delete_body_xpm ); + SET_BITMAP( delete_body_xpm ); editMenu->Append( item ); /* Separator */ @@ -170,7 +170,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() /* Find */ text = AddHotkeyName( _( "&Find" ), s_Schematic_Hokeys_Descr, HK_FIND_ITEM ); item = new wxMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND, wxITEM_NORMAL ); - SETBITMAPS( find_xpm ); + SET_BITMAP( find_xpm ); editMenu->Append( item ); /* Separator */ @@ -180,7 +180,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( editMenu, ID_BACKANNO_ITEMS, _( "Backannotate" ), _( "Back annotated footprint fields" ), wxITEM_NORMAL ); - SETBITMAPS( backanno_xpm ); + SET_BITMAP( backanno_xpm ); editMenu->Append( item ); @@ -204,20 +204,20 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() text = AddHotkeyName( _( "Zoom In" ), s_Schematic_Hokeys_Descr, ID_ZOOM_IN, false ); // add comment, not a shortcut item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL ); - SETBITMAPS( zoom_in_xpm ); + SET_BITMAP( zoom_in_xpm ); viewMenu->Append( item ); /* Zoom out */ text = AddHotkeyName( _( "Zoom Out" ), s_Schematic_Hokeys_Descr, ID_ZOOM_OUT, false ); // add comment, not a shortcut item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL ); - SETBITMAPS( zoom_out_xpm ); + SET_BITMAP( zoom_out_xpm ); viewMenu->Append( item ); /* Fit on screen */ text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, wxITEM_NORMAL ); - SETBITMAPS( zoom_fit_in_page_xpm ); + SET_BITMAP( zoom_fit_in_page_xpm ); viewMenu->Append( item ); viewMenu->AppendSeparator(); @@ -225,7 +225,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() /* Redraw view */ text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, wxITEM_NORMAL ); - SETBITMAPS( zoom_redraw_xpm ); + SET_BITMAP( zoom_redraw_xpm ); viewMenu->Append( item ); @@ -240,7 +240,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text, HELP_PLACE_COMPONENTS, wxITEM_NORMAL ); - SETBITMAPS( add_component_xpm ); + SET_BITMAP( add_component_xpm ); placeMenu->Append( item ); /* Power port */ @@ -248,7 +248,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_NEW_POWER, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text, HELP_PLACE_POWERPORT, wxITEM_NORMAL ); - SETBITMAPS( add_power_xpm ); + SET_BITMAP( add_power_xpm ); placeMenu->Append( item ); /* Wire */ @@ -256,7 +256,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_BEGIN_WIRE, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, text, HELP_PLACE_WIRE, wxITEM_NORMAL ); - SETBITMAPS( add_line_xpm ); + SET_BITMAP( add_line_xpm ); placeMenu->Append( item ); /* Bus */ @@ -264,7 +264,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_BEGIN_BUS, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_BUS_BUTT, text, HELP_PLACE_BUS, wxITEM_NORMAL ); - SETBITMAPS( add_bus_xpm ); + SET_BITMAP( add_bus_xpm ); placeMenu->Append( item ); /* Wire to Bus entry */ @@ -272,7 +272,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_WIRE_ENTRY, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text, HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_NORMAL ); - SETBITMAPS( add_line2bus_xpm ); + SET_BITMAP( add_line2bus_xpm ); placeMenu->Append( item ); /* Bus to Bus entry */ @@ -280,14 +280,14 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_BUS_ENTRY, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text, HELP_PLACE_BUS2BUS_ENTRY, wxITEM_NORMAL ); - SETBITMAPS( add_bus2bus_xpm ); + SET_BITMAP( add_bus2bus_xpm ); placeMenu->Append( item ); /* No connect flag */ text = AddHotkeyName( _( "No connect flag" ), s_Schematic_Hokeys_Descr, HK_ADD_NOCONN_FLAG, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, wxITEM_NORMAL ); - SETBITMAPS( noconn_button ); + SET_BITMAP( noconn_button ); placeMenu->Append( item ); /* Net name */ @@ -295,7 +295,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_LABEL, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_LABEL_BUTT, text, HELP_PLACE_NETLABEL, wxITEM_NORMAL ); - SETBITMAPS( add_line_label_xpm ); + SET_BITMAP( add_line_label_xpm ); placeMenu->Append( item ); /* Global label */ @@ -303,7 +303,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_GLABEL, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, text, HELP_PLACE_GLOBALLABEL, wxITEM_NORMAL ); - SETBITMAPS( add_glabel_xpm ); + SET_BITMAP( add_glabel_xpm ); placeMenu->Append( item ); /* Junction */ @@ -311,7 +311,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_JUNCTION, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, text, HELP_PLACE_JUNCTION, wxITEM_NORMAL ); - SETBITMAPS( add_junction_xpm ); + SET_BITMAP( add_junction_xpm ); placeMenu->Append( item ); /* Separator */ @@ -322,7 +322,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_HLABEL, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT, text, HELP_PLACE_HIER_LABEL, wxITEM_NORMAL ); - SETBITMAPS( add_hierarchical_label_xpm ); + SET_BITMAP( add_hierarchical_label_xpm ); placeMenu->Append( item ); /* Hierarchical sheet */ @@ -330,19 +330,19 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_HIER_SHEET, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text, HELP_PLACE_SHEET, wxITEM_NORMAL ); - SETBITMAPS( add_hierarchical_subsheet_xpm ); + SET_BITMAP( add_hierarchical_subsheet_xpm ); placeMenu->Append( item ); /* Import hierarchical sheet */ item = new wxMenuItem( placeMenu, ID_IMPORT_HLABEL_BUTT, _( "Import Hierarchical Label" ), HELP_IMPORT_SHEETPIN, wxITEM_NORMAL ); - SETBITMAPS( import_hierarchical_label_xpm ); + SET_BITMAP( import_hierarchical_label_xpm ); placeMenu->Append( item ); /* Add hierarchical Pin to Sheet */ item = new wxMenuItem( placeMenu, ID_SHEET_PIN_BUTT, _( "Add Hierarchical Pin to Sheet" ), HELP_PLACE_SHEETPIN, wxITEM_NORMAL ); - SETBITMAPS( add_hierar_pin_xpm ); + SET_BITMAP( add_hierar_pin_xpm ); placeMenu->Append( item ); /* Separator */ @@ -353,7 +353,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_GRAPHIC_POLYLINE, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text, HELP_PLACE_GRAPHICLINES, wxITEM_NORMAL ); - SETBITMAPS( add_dashed_line_xpm ); + SET_BITMAP( add_dashed_line_xpm ); placeMenu->Append( item ); /* Graphic text */ @@ -361,7 +361,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() HK_ADD_GRAPHIC_TEXT, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text, HELP_PLACE_GRAPHICTEXTS, wxITEM_NORMAL ); - SETBITMAPS( add_text_xpm ); + SET_BITMAP( add_text_xpm ); placeMenu->Append( item ); @@ -371,13 +371,13 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() /* Library */ item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ), _( "Library preferences" ) ); - SETBITMAPS( library_xpm ); + SET_BITMAP( library_xpm ); configmenu->Append( item ); /* Colors */ item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ), _( "Color preferences" ) ); - SETBITMAPS( palette_xpm ); + SET_BITMAP( palette_xpm ); configmenu->Append( item ); /* Options */ @@ -390,7 +390,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() #endif _( "EESchema preferences" ) ); - SETBITMAPS( preference_xpm ); + SET_BITMAP( preference_xpm ); configmenu->Append( item ); /* Language submenu */ @@ -405,13 +405,13 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() /* Save preferences */ item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ), _( "Save application preferences" ) ); - SETBITMAPS( save_setup_xpm ); + SET_BITMAP( save_setup_xpm ); configmenu->Append( item ); /* Read preferences */ item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ), _( "Read application preferences" ) ); - SETBITMAPS( read_setup_xpm ); + SET_BITMAP( read_setup_xpm ); configmenu->Append( item ); @@ -422,13 +422,13 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), _( "Open the eeschema manual" ) ); - SETBITMAPS( online_help_xpm ); + SET_BITMAP( online_help_xpm ); helpMenu->Append( item ); /* About on all platforms except WXMAC */ item = new wxMenuItem( helpMenu, wxID_ABOUT, _( "&About" ), _( "About eeschema schematic designer" ) ); - SETBITMAPS( info_xpm ); + SET_BITMAP( info_xpm ); helpMenu->Append( item ); // Create the menubar and append all submenus diff --git a/gerbview/class_GERBER.cpp b/gerbview/class_GERBER.cpp index 540c259016..31ea8aca3a 100644 --- a/gerbview/class_GERBER.cpp +++ b/gerbview/class_GERBER.cpp @@ -147,6 +147,7 @@ APERTURE_MACRO* GERBER_IMAGE::FindApertureMacro( const APERTURE_MACRO& aLookup ) void GERBER_IMAGE::ResetDefaultValues() { + m_InUse = false; m_GBRLayerParams.ResetDefaultValues(); m_FileName.Empty(); m_ImageName = wxT( "no name" ); // Image name from the IN command diff --git a/gerbview/class_GERBER.h b/gerbview/class_GERBER.h index 396bcabf69..7302000c21 100644 --- a/gerbview/class_GERBER.h +++ b/gerbview/class_GERBER.h @@ -82,6 +82,8 @@ class GERBER_IMAGE GERBER_LAYER m_GBRLayerParams; // hold params for the current gerber layer public: + bool m_InUse; // true if this image is currently in use + // (a file is loaded in it) wxString m_FileName; // Full File Name for this layer wxString m_ImageName; // Image name, from IN * command int m_GraphicLayer; // Graphic layer Number diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index f9685bd6f0..4a1b6bc410 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -33,6 +33,7 @@ #include "class_drawpanel.h" #include "pcbstruct.h" #include "gerbview.h" +#include "class_GERBER.h" #include "layer_widget.h" #include "class_gerbview_layer_widget.h" @@ -238,4 +239,37 @@ void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) //----------------------------------------------- +/* + * Virtual Function useAlternateBitmap + * return true if bitmaps shown in Render layer list + * must be alternate bitmaps, or false to use "normal" bitmaps + */ +bool GERBER_LAYER_WIDGET::useAlternateBitmap(int aRow) +{ + bool inUse = false; + GERBER_IMAGE* gerber = g_GERBER_List[aRow]; + if( gerber != NULL && gerber->m_InUse ) + inUse = true; + return inUse; +} +/** + * Function UpdateLayerIcons + * Update the layer manager icons (layers only) + * Useful when loading a file or clearing a layer because they change + */ +void GERBER_LAYER_WIDGET::UpdateLayerIcons() +{ + int row_count = GetLayerRowCount(); + for( int row = 0; row < row_count ; row++ ) + { + wxStaticBitmap* bm = (wxStaticBitmap*) getLayerComp( row, 0 ); + if( bm == NULL) + continue; + + if( row == m_CurrentRow ) + bm->SetBitmap( useAlternateBitmap(row) ? *m_RightArrowAlternateBitmap : *m_RightArrowBitmap ); + else + bm->SetBitmap( useAlternateBitmap(row) ? *m_BlankAlternateBitmap : *m_BlankBitmap ); + } +} diff --git a/gerbview/class_gerbview_layer_widget.h b/gerbview/class_gerbview_layer_widget.h index 3bb6ea57c6..ff8c4697b1 100644 --- a/gerbview/class_gerbview_layer_widget.h +++ b/gerbview/class_gerbview_layer_widget.h @@ -59,6 +59,13 @@ class GERBER_LAYER_WIDGET : public LAYER_WIDGET /// on every child control within the layer panel. void installRightLayerClickHandler(); + /** + * Virtual Function useAlternateBitmap + * @return true if bitmaps shown in Render layer list + * are alternate bitmaps, or false if they are "normal" bitmaps + */ + virtual bool useAlternateBitmap(int aRow); + public: /** @@ -86,6 +93,13 @@ public: */ void SetLayersManagerTabsText( ); //--------------- + + /** + * Function UpdateLayerIcons + * Update the layer manager icons (layers only) + * Useful when loading a file or clearing a layer because they change + */ + void UpdateLayerIcons(); }; #endif // _CLASS_GERBER_LAYER_WIDGET_H_ diff --git a/gerbview/files.cpp b/gerbview/files.cpp index af827d79cc..be548a5679 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -183,8 +183,8 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName ) // Synchronize layers tools with actual active layer: setActiveLayer( getActiveLayer() ); + m_LayersManager->UpdateLayerIcons(); syncLayerBox(); - return true; } @@ -268,6 +268,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName ) // Synchronize layers tools with actual active layer: setActiveLayer( getActiveLayer() ); + m_LayersManager->UpdateLayerIcons(); syncLayerBox(); return true; diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp index 751a9014ac..54c6c4bbab 100644 --- a/gerbview/initpcb.cpp +++ b/gerbview/initpcb.cpp @@ -46,6 +46,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) SetScreen( ScreenPcb ); GetScreen()->Init(); setActiveLayer(FIRST_COPPER_LAYER); + m_LayersManager->UpdateLayerIcons(); syncLayerBox(); return TRUE; } @@ -81,5 +82,6 @@ void GERBVIEW_FRAME::Erase_Current_Layer( bool query ) ScreenPcb->SetModify(); DrawPanel->Refresh(); + m_LayersManager->UpdateLayerIcons(); syncLayerBox(); } diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index 561ccfcc75..b479437c4d 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -151,6 +151,8 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName, fclose( gerber->m_Current_File ); SetLocaleTo_Default(); + gerber->m_InUse = true; + // Display errors list if( m_Messages.size() > 0 ) { diff --git a/include/bitmaps.h b/include/bitmaps.h index d67a26fb7c..972887c634 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -412,6 +412,7 @@ extern const char* width_segment_xpm[]; extern const char* width_track_via_xpm[]; extern const char* width_track_xpm[]; extern const char* width_vias_xpm[]; +extern const char* window_close_xpm[]; extern const char* zip_tool_xpm[]; extern const char* zip_xpm[]; extern const char* zoom_area_xpm[]; diff --git a/include/macros.h b/include/macros.h index dc435b0662..4c7dd0da6d 100644 --- a/include/macros.h +++ b/include/macros.h @@ -237,10 +237,18 @@ static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu, #endif +// macro to add a bitmap list to check menus (do not use with normal menus) #ifdef __WINDOWS__ # define SETBITMAPS( icon ) item->SetBitmaps( apply_xpm, (icon) ) #else # define SETBITMAPS( icon ) #endif +// macro to add a bitmap menus (do not use with check menus) +#ifdef __WXMAC__ +# define SET_BITMAP( icon ) +#else +# define SET_BITMAP( icon ) item->SetBitmap( (icon) ) +#endif + #endif /* ifdef MACRO_H */ diff --git a/include/pcbcommon.h b/include/pcbcommon.h index bb71bd778d..dc484ae558 100644 --- a/include/pcbcommon.h +++ b/include/pcbcommon.h @@ -49,8 +49,6 @@ extern PCB_SCREEN* ScreenPcb; extern BOARD* g_ModuleEditor_Pcb; /* Pad editing */ -extern wxString g_Current_PadName; // Last used pad name (pad num) - extern D_PAD g_Pad_Master; #endif /* __PCBCOMMON_H__ */ diff --git a/kicad/minizip/CMakeLists.txt b/kicad/minizip/CMakeLists.txt index ef45db842c..764feb25fc 100644 --- a/kicad/minizip/CMakeLists.txt +++ b/kicad/minizip/CMakeLists.txt @@ -8,10 +8,20 @@ else(ZLIB_FOUND) # include files are in ${wxWidgets_ROOT_DIR}/src/zlib # and the corresponding library is libwxzlib-.a (like libwxzlib-2.8.a) # and we try to use it - # Unfortunately, we have no way to know exactlty the path of zlib.h becuase this file + # Unfortunately, we have no way to know exactlty the path of zlib.h because this file # is in wxWidgets sources, not in wxWidgets include path. - find_path(ZLIB_INCLUDE_DIR zlib.h PATHS ${wxWidgets_ROOT_DIR}/../src/zlib/ ${wxWidgets_ROOT_DIR}/src/zlib/ DOC "location of zlib include files") - find_file(ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.8.a ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.9.a libwxzlib.a PATHS ${wxWidgets_ROOT_DIR}/lib/ PATH_SUFFIXES gcc_dll DOC "location of wxzlib library file") + find_path(ZLIB_INCLUDE_DIR + zlib.h + PATHS ${wxWidgets_ROOT_DIR}/../src/zlib/ ${wxWidgets_ROOT_DIR}/src/zlib/ + DOC "location of zlib include files" + ) + + find_file( + ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.8.a + ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.9.a libwxzlib.a + PATHS ${wxWidgets_ROOT_DIR}/lib/ PATH_SUFFIXES gcc_dll + DOC "location of wxzlib library file" + ) endif(ZLIB_FOUND) include_directories(${CMAKE_CURRENT_SOURCE_DIR} diff --git a/packaging/windows/nsis/install.nsi b/packaging/windows/nsis/install.nsi index 66a3ab3c41..92eebd0b62 100644 --- a/packaging/windows/nsis/install.nsi +++ b/packaging/windows/nsis/install.nsi @@ -17,7 +17,7 @@ ; General Product Description Definitions !define PRODUCT_NAME "KiCad" -!define PRODUCT_VERSION "2011.04.01" +!define PRODUCT_VERSION "2011.04.05" !define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" !define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/" !define COMPANY_NAME "" diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 087dce0499..7c5d9c5963 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -91,6 +91,26 @@ public: } }; +// Helper class to handle hight light nets +class HIGHT_LIGHT_INFO +{ + friend class BOARD; +protected: + int m_netCode; // net selected for hightlight (-1 when no net selected ) + bool m_hightLightOn; // hightlight active + +protected: + void Clear() + { + m_netCode = -1; + m_hightLightOn = false; + } + + HIGHT_LIGHT_INFO() + { + Clear(); + } +}; /** * Class BOARD @@ -109,6 +129,9 @@ private: ZONE_CONTAINERS m_ZoneDescriptorList; ///< edge zone descriptors, owned by pointer LAYER m_Layer[NB_COPPER_LAYERS]; + // if true m_hightLight_NetCode is used + HIGHT_LIGHT_INFO m_hightLight; // current hight light data + HIGHT_LIGHT_INFO m_hightLightPrevious; // a previously stored hight light data public: PCB_BASE_FRAME* m_PcbFrame; // Window of visualization @@ -249,6 +272,67 @@ public: } + /** + * Function ResetHightLight + * Reset all hight light data to the init state + */ + void ResetHightLight() + { + m_hightLight.Clear(); + m_hightLightPrevious.Clear(); + } + + /** + * Function GetHightLightNetCode + * @return netcode of net to hightlight (-1 when no net selected) + */ + int GetHightLightNetCode() { return m_hightLight.m_netCode; } + + /** + * Function SetHightLightNet + * @param aNetCode = netcode of net to hightlight + */ + void SetHightLightNet( int aNetCode) + { + m_hightLight.m_netCode = aNetCode; + } + + + /** + * Function IsHightLightNetON + * @return true if a net is currently hightlighted + */ + bool IsHightLightNetON() { return m_hightLight.m_hightLightOn; } + + /** + * Function HightLightOFF + * Disable hightlight. + */ + void HightLightOFF() { m_hightLight.m_hightLightOn = false; } + + /** + * Function HightLightON + * Enable hightlight. + * if m_hightLight_NetCode >= 0, this net will be hightlighted + */ + void HightLightON() { m_hightLight.m_hightLightOn = true; } + + /** + * Function PushHightLight + * save current hight light info for later use + */ + void PushHightLight() { m_hightLightPrevious = m_hightLight; } + + /** + * Function PopHightLight + * retrieve a previously saved hight light info + */ + void PopHightLight() + { + m_hightLight = m_hightLightPrevious; + m_hightLightPrevious.Clear(); + } + /** * Function GetCopperLayerCount * @return int - The number of copper layers in the BOARD. diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 595118db6a..be0634edec 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -41,6 +41,7 @@ void RemoteCommand( const char* cmdline ) char* text; MODULE* module = 0; PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*)wxGetApp().GetTopWindow(); + BOARD* pcb = frame->GetBoard(); wxPoint pos; strncpy( line, cmdline, sizeof(line) - 1 ); @@ -81,7 +82,7 @@ void RemoteCommand( const char* cmdline ) modName = FROM_UTF8( text ); - module = frame->GetBoard()->FindModuleByReference( modName ); + module = pcb->FindModuleByReference( modName ); if( module ) pad = module->FindPadByName( pinName ); @@ -96,13 +97,13 @@ void RemoteCommand( const char* cmdline ) if( netcode > 0 ) /* highlight the pad net*/ { - g_HighLight_Status = 1; - g_HighLight_NetCode = netcode; + pcb->HightLightON(); + pcb->SetHightLightNet( netcode ); } else { - g_HighLight_Status = 0; - g_HighLight_NetCode = 0; + pcb->HightLightOFF(); + pcb->SetHightLightNet( -1 ); } if( module == NULL ) diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index 2d7b06be92..61d4e64bff 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -81,7 +81,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) { DrawPanel->SetMouseCapture( NULL, NULL ); - if( g_HighLight_Status ) + if( GetBoard()->IsHightLightNetON() ) High_Light( DC ); SetCurItem( NULL ); diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 77c4379863..d119176d32 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -555,7 +555,6 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) return; TransfertDataToPad( &g_Pad_Master, false ); - g_Current_PadName = g_Pad_Master.ReturnStringPadName(); if( m_CurrentPad ) // Set current Pad parameters { diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index dbc0e09e37..4799e2fd4f 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1232,7 +1232,8 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) if( DisplayOpt.DisplayZonesMode != 0 ) DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) ); - if( !g_HighLight_Status && (g_HighLight_NetCode > 0 ) ) + if( !GetBoard()->IsHightLightNetON() && + (GetBoard()->GetHightLightNetCode() > 0 ) ) High_Light( &dc ); break; diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index 92758660ff..2fddf189ca 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -148,7 +148,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) via->m_Flags = IS_NEW; via->m_Shape = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType; via->m_Width = GetBoard()->GetCurrentViaSize(); - via->SetNet( g_HighLight_NetCode ); + via->SetNet( GetBoard()->GetHightLightNetCode() ); via->m_Start = via->m_End = g_CurrentTrackSegment->m_End; // Usual via is from copper to component. // layer pair is LAYER_N_BACK and LAYER_N_FRONT. diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 8a7703acc0..05fc4af2f1 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -22,12 +22,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ); static void ComputeBreakPoint( TRACK* track, int n, wxPoint end ); static void DeleteNullTrackSegments( BOARD* pcb, DLIST& aTrackList ); - static void EnsureEndTrackOnPad( D_PAD* Pad ); - -static int OldNetCodeSurbrillance; -static int OldEtatSurbrillance; static PICKED_ITEMS_LIST s_ItemsListPicker; @@ -37,17 +33,18 @@ static PICKED_ITEMS_LIST s_ItemsListPicker; static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) { PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Panel->GetParent(); + BOARD * pcb = frame->GetBoard(); TRACK* track = (TRACK*) frame->GetCurItem(); if( track && ( track->Type()==TYPE_VIA || track->Type()==TYPE_TRACK ) ) { /* Erase the current drawing */ ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false ); - if( g_HighLight_Status ) + if( pcb->IsHightLightNetON() ) frame->High_Light( DC ); - g_HighLight_NetCode = OldNetCodeSurbrillance; - if( OldEtatSurbrillance ) + pcb->PopHightLight(); + if( pcb->IsHightLightNetON() ) frame->High_Light( DC ); frame->MsgPanel->EraseMsgBox(); @@ -95,17 +92,16 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC ) // necessary, // but... - /* erase old highlight */ - OldNetCodeSurbrillance = g_HighLight_NetCode; - OldEtatSurbrillance = g_HighLight_Status; + GetBoard()->PushHightLight(); - if( g_HighLight_Status ) + // erase old highlight + if( GetBoard()->IsHightLightNetON() ) High_Light( DC ); g_CurrentTrackList.PushBack( new TRACK( GetBoard() ) ); g_CurrentTrackSegment->m_Flags = IS_NEW; - g_HighLight_NetCode = 0; + GetBoard()->SetHightLightNet(0); // Search for a starting point of the new track, a track or pad LockPoint = LocateLockPoint( GetBoard(), pos, masquelayer ); @@ -118,12 +114,12 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC ) /* A pad is found: put the starting point on pad centre */ pos = pt_pad->m_Pos; - g_HighLight_NetCode = pt_pad->GetNet(); + GetBoard()->SetHightLightNet( pt_pad->GetNet() ); } else /* A track segment is found */ { TrackOnStartPoint = (TRACK*) LockPoint; - g_HighLight_NetCode = TrackOnStartPoint->GetNet(); + GetBoard()->SetHightLightNet( TrackOnStartPoint->GetNet() ); CreateLockPoint( GetBoard(), pos, TrackOnStartPoint, &s_ItemsListPicker ); @@ -136,7 +132,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC ) zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()-> m_Active_Layer ); if( zone ) - g_HighLight_NetCode = zone->GetNet(); + GetBoard()->SetHightLightNet( zone->GetNet() ); } D( g_CurrentTrackList.VerifyListIntegrity(); ); @@ -148,7 +144,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC ) High_Light( DC ); // Display info about track Net class, and init track and vias sizes: - g_CurrentTrackSegment->SetNet( g_HighLight_NetCode ); + g_CurrentTrackSegment->SetNet( GetBoard()->GetHightLightNetCode() ); GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() ); g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); @@ -467,7 +463,7 @@ void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC ) * possibly create an anchor. */ { TRACK* adr_buf = (TRACK*) LockPoint; - g_HighLight_NetCode = adr_buf->GetNet(); + GetBoard()->SetHightLightNet( adr_buf->GetNet() ); /* Possible establishment of a hanging point. */ LockPoint = CreateLockPoint( GetBoard(), @@ -529,12 +525,12 @@ void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC ) wxASSERT( g_CurrentTrackSegment==NULL ); wxASSERT( g_CurrentTrackList.GetCount()==0 ); - if( g_HighLight_Status ) + if( GetBoard()->IsHightLightNetON() ) High_Light( DC ); - g_HighLight_NetCode = OldNetCodeSurbrillance; + GetBoard()->PopHightLight(); - if( OldEtatSurbrillance ) + if( GetBoard()->IsHightLightNetON() ) High_Light( DC ); DrawPanel->SetMouseCapture( NULL, NULL ); diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index f3eda1131a..e0cb754923 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -52,7 +52,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) GetScreen()->Init(); GetScreen()->SetGrid( gridsize ); - g_HighLight_Status = 0; + GetBoard()->ResetHightLight(); // Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled) GetBoard()->SetEnabledLayers(ALL_LAYERS); diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index b243f3d47e..f6a27396ed 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -44,7 +44,9 @@ #define BUTT_SIZE_Y 18 #define BUTT_VOID 4 -/* XPM */ +/* XPM + * This bitmap is used for not selected layers + */ static const char * clear_xpm[] = { "10 14 1 1", " c None", @@ -63,11 +65,38 @@ static const char * clear_xpm[] = { " ", " "}; -/* XPM */ -static const char * rightarrow_xpm[] = { -"10 14 5 1", +/* XPM + * This bitmap can be used to show a not selected layer + * with special property (mainly not selected layers not in use in Gerbview) + */ +static const char * clear_alternate_xpm[] = { +"10 14 4 1", +" c None", +"X c #008080", +"o c GREEN", +"O c #00B080", +" ", +" ", +" ", +" ", +" X ", +" XXX ", +" XXXXX ", +" OOOOOOO ", +" ooooo ", +" ooo ", +" o ", +" ", +" ", +" "}; + + +/* XPM + * This bitmap is used for a normale selected layer + */ +static const char * rightarrow_xpm[] = { +"10 14 4 1", " c None", -". c white", "X c #8080ff", "o c BLUE", "O c gray56", @@ -86,6 +115,32 @@ static const char * rightarrow_xpm[] = { " ooO ", " oO "}; +/* XPM + * This bitmap can be used to show the selected layer + * with special property (mainly a layer in use in Gerbview) + */ +static const char * rightarrow_alternate_xpm[] = { +"10 14 5 1", +" c None", +". c #00B000", +"X c #8080ff", +"o c BLUE", +"O c gray56", +"..X ", +"..XX ", +"..XXX ", +"..XXXX ", +"..XXXXX ", +"..XXXXXX ", +"..XXXXXXX ", +"..oooooooO", +"..ooooooO ", +"..oooooO ", +"..ooooO ", +"..oooO ", +"..ooO ", +"..oO "}; + /** * Function makeColorTxt @@ -349,7 +404,8 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) // column 0 col = 0; wxStaticBitmap* sbm = new wxStaticBitmap( m_LayerScrolledWindow, encodeId( col, aSpec.id ), - *m_BlankBitmap, wxDefaultPosition, m_BitmapSize ); + useAlternateBitmap(aRow) ? *m_BlankAlternateBitmap : *m_BlankBitmap, + wxDefaultPosition, m_BitmapSize ); sbm->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this ); m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags ); @@ -502,8 +558,10 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint m_CurrentRow = -1; // hide the arrow initially m_RightArrowBitmap = new wxBitmap( rightarrow_xpm ); + m_RightArrowAlternateBitmap = new wxBitmap( rightarrow_alternate_xpm ); m_BlankBitmap = new wxBitmap( clear_xpm ); // translucent + m_BlankAlternateBitmap = new wxBitmap( clear_alternate_xpm ); m_BitmapSize = wxSize(m_BlankBitmap->GetWidth(), m_BlankBitmap->GetHeight()); // trap the tab changes so that we can call passOnFocus(). @@ -656,12 +714,12 @@ void LAYER_WIDGET::SelectLayerRow( int aRow ) wxStaticBitmap* oldbm = (wxStaticBitmap*) getLayerComp( m_CurrentRow, 0 ); if( oldbm ) - oldbm->SetBitmap( *m_BlankBitmap ); + oldbm->SetBitmap( useAlternateBitmap(m_CurrentRow) ? *m_BlankAlternateBitmap : *m_BlankBitmap ); wxStaticBitmap* newbm = (wxStaticBitmap*) getLayerComp( aRow, 0 ); if( newbm ) { - newbm->SetBitmap( *m_RightArrowBitmap ); + newbm->SetBitmap( useAlternateBitmap(aRow) ? *m_RightArrowAlternateBitmap : *m_RightArrowBitmap ); // Make sure the desired layer row is visible. // It seems that as of 2.8.2, setting the focus does this. diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index 4ab9ecfa14..5d9d395139 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -103,13 +103,25 @@ protected: wxWindow* m_FocusOwner; wxBitmap* m_BlankBitmap; + wxBitmap* m_BlankAlternateBitmap; wxBitmap* m_RightArrowBitmap; + wxBitmap* m_RightArrowAlternateBitmap; wxSize m_BitmapSize; int m_CurrentRow; ///< selected row of layer list int m_PointSize; static wxBitmap makeBitmap( int aColor ); + /** + * Virtual Function useAlternateBitmap + * @return true if bitmaps shown in Render layer list + * are alternate bitmaps, or false if they are "normal" bitmaps + * This is a virtual function because Pcbnew uses normal bitmaps + * but Gerbview uses both bitmaps + * (alternate bitmaps to show layers in use, normal fo others) + */ + virtual bool useAlternateBitmap(int aRow) { return false; } + /** * Function encodeId * is here to allow saving a layer index within a control as its wxControl id, diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index b6a829b491..386c1efb88 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -42,14 +42,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( filesMenu, ID_NEW_BOARD, _( "&New" ), _( "Clear current board and initialize a new one" ) ); - SETBITMAPS( new_xpm ); + SET_BITMAP( new_xpm ); filesMenu->Append( item ); // Open item = new wxMenuItem( filesMenu, ID_LOAD_FILE, _( "&Open\tCtrl+O" ), _( "Delete current board and load new board" ) ); - SETBITMAPS( open_document_xpm ); + SET_BITMAP( open_document_xpm ); filesMenu->Append( item ); // Load Recent submenu @@ -65,7 +65,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( filesMenu, ID_APPEND_FILE, _( "&Append Board" ), _( "Append another PCBNew board to the current loaded board" ) ); - SETBITMAPS( import_xpm ); + SET_BITMAP( import_xpm ); filesMenu->Append( item ); // Separator @@ -75,14 +75,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( filesMenu, ID_SAVE_BOARD, _( "&Save\tCtrl+S" ), _( "Save current board" ) ); - SETBITMAPS( save_xpm ); + SET_BITMAP( save_xpm ); filesMenu->Append( item ); // Save As item = new wxMenuItem( filesMenu, ID_SAVE_BOARD_AS, _( "Save as..." ), _( "Save the current board as.." ) ); - SETBITMAPS( save_as_xpm ); + SET_BITMAP( save_as_xpm ); filesMenu->Append( item ); filesMenu->AppendSeparator(); @@ -90,13 +90,13 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( filesMenu, ID_MENU_READ_LAST_SAVED_VERSION_BOARD, _( "&Revert" ), _( "Clear board and get previous saved version of board" ) ); - SETBITMAPS( jigsaw_xpm ); + SET_BITMAP( jigsaw_xpm ); filesMenu->Append( item ); // Rescue item = new wxMenuItem( filesMenu, ID_MENU_RECOVER_BOARD, _( "&Rescue" ), _( "Clear old board and get last rescue file" ) ); - SETBITMAPS( hammer_xpm ); + SET_BITMAP( hammer_xpm ); filesMenu->Append( item ); filesMenu->AppendSeparator(); @@ -106,27 +106,27 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( fabricationOutputsMenu, ID_PCB_GEN_POS_MODULES_FILE, _( "&Modules Position File" ), _( "Generate modules position file for pick and place" ) ); - SETBITMAPS( post_compo_xpm ); + SET_BITMAP( post_compo_xpm ); fabricationOutputsMenu->Append( item ); item = new wxMenuItem( fabricationOutputsMenu, ID_PCB_GEN_DRILL_FILE, _( "&Drill File" ), _( "Generate excellon2 drill file" ) ); - SETBITMAPS( post_drill_xpm ); + SET_BITMAP( post_drill_xpm ); fabricationOutputsMenu->Append( item ); // Component File item = new wxMenuItem( fabricationOutputsMenu, ID_PCB_GEN_CMP_FILE, _( "&Component File" ), _( "(Re)create components file (*.cmp) for CvPcb" ) ); - SETBITMAPS( create_cmp_file_xpm ); + SET_BITMAP( create_cmp_file_xpm ); fabricationOutputsMenu->Append( item ); // BOM File item = new wxMenuItem( fabricationOutputsMenu, ID_PCB_GEN_BOM_FILE_FROM_BOARD, _( "&BOM File" ), _( "Create a bill of materials from schematic" ) ); - SETBITMAPS( tools_xpm ); + SET_BITMAP( tools_xpm ); fabricationOutputsMenu->Append( item ); // Fabrications Outputs submenu append @@ -144,7 +144,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( submenuImport, ID_GEN_IMPORT_SPECCTRA_SESSION, _( "&Specctra Session" ), _( "Import a routed \"Specctra Session\" (*.ses) file" ) ); - SETBITMAPS( import_xpm ); // @todo need better bitmap + SET_BITMAP( import_xpm ); // @todo need better bitmap submenuImport->Append( item ); ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuImport, @@ -160,27 +160,27 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_SPECCTRA, _( "&Specctra DSN" ), _( "Export the current board to a \"Specctra DSN\" file" ) ); - SETBITMAPS( export_xpm ); + SET_BITMAP( export_xpm ); submenuexport->Append( item ); // GenCAD item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_FILE_GENCADFORMAT, _( "&GenCAD" ), _( "Export GenCAD format" ) ); - SETBITMAPS( export_xpm ); + SET_BITMAP( export_xpm ); submenuexport->Append( item ); // Module Report item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT, _( "&Module Report" ), _( "Create a report of all modules on the current board" ) ); - SETBITMAPS( tools_xpm ); + SET_BITMAP( tools_xpm ); submenuexport->Append( item ); // VRML item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_FILE_VRML, _( "&VRML" ), _( "Export a VRML board representation" ) ); - SETBITMAPS( show_3d_xpm ); + SET_BITMAP( show_3d_xpm ); submenuexport->Append( item ); ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuexport, @@ -193,21 +193,21 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( filesMenu, wxID_PRINT, _( "&Print\tCtrl+P" ), _( "Print board" ) ); - SETBITMAPS( print_button ); + SET_BITMAP( print_button ); filesMenu->Append( item ); // Create SVG file item = new wxMenuItem( filesMenu, ID_GEN_PLOT_SVG, _( "Print S&VG" ), _( "Plot board in Scalable Vector Graphics format" ) ); - SETBITMAPS( print_button ); + SET_BITMAP( print_button ); filesMenu->Append( item ); // Plot item = new wxMenuItem( filesMenu, ID_GEN_PLOT, _( "&Plot" ), _( "Plot board in HPGL, PostScript or Gerber RS-274X format)" ) ); - SETBITMAPS( plot_xpm ); + SET_BITMAP( plot_xpm ); filesMenu->Append( item ); filesMenu->AppendSeparator(); @@ -217,14 +217,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( submenuarchive, ID_MENU_ARCHIVE_NEW_MODULES, _( "Archive New Footprints" ), _( "Archive new footprints only in a library (keep other footprints in this lib)" ) ); - SETBITMAPS( library_update_xpm ); + SET_BITMAP( library_update_xpm ); submenuarchive->Append( item ); // Create FootPrint Archive item = new wxMenuItem( submenuarchive, ID_MENU_ARCHIVE_ALL_MODULES, _( "Create Footprint Archive" ), _( "Archive all footprints in a library (old library will be deleted)" ) ); - SETBITMAPS( library_xpm ); + SET_BITMAP( library_xpm ); submenuarchive->Append( item ); ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, submenuarchive, @@ -236,7 +236,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() /* Quit */ filesMenu->AppendSeparator(); item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), _( "Quit PCBNew" ) ); - SETBITMAPS( exit_xpm ); + SET_BITMAP( exit_xpm ); filesMenu->Append( item ); /** Create Edit menu **/ @@ -246,21 +246,21 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() text = AddHotkeyName( _( "Undo" ), g_Pcbnew_Editor_Hokeys_Descr, HK_UNDO ); item = new wxMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, wxITEM_NORMAL ); - SETBITMAPS( undo_xpm ); + SET_BITMAP( undo_xpm ); editMenu->Append( item ); // Redo text = AddHotkeyName( _( "Redo" ), g_Pcbnew_Editor_Hokeys_Descr, HK_REDO ); item = new wxMenuItem( editMenu, wxID_REDO, text, HELP_REDO, wxITEM_NORMAL ); - SETBITMAPS( redo_xpm ); + SET_BITMAP( redo_xpm ); editMenu->Append( item ); // Delete item = new wxMenuItem( editMenu, ID_PCB_DELETE_ITEM_BUTT, _( "Delete" ), _( "Delete items" ) ); - SETBITMAPS( delete_body_xpm ); + SET_BITMAP( delete_body_xpm ); editMenu->Append( item ); editMenu->AppendSeparator(); @@ -268,7 +268,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() text = AddHotkeyName( _( "&Find" ), g_Pcbnew_Editor_Hokeys_Descr, HK_FIND_ITEM ); item = new wxMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND ); - SETBITMAPS( find_xpm ); + SET_BITMAP( find_xpm ); editMenu->Append( item ); editMenu->AppendSeparator(); @@ -276,21 +276,21 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( editMenu, ID_PCB_GLOBAL_DELETE, _( "Global &Deletions" ), _( "Delete tracks, modules, texts... on board" ) ); - SETBITMAPS( general_deletions_xpm ); + SET_BITMAP( general_deletions_xpm ); editMenu->Append( item ); // Cleanup Tracks and Vias item = new wxMenuItem( editMenu, ID_MENU_PCB_CLEAN, _( "&Cleanup Tracks and Vias" ), _( "Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias" ) ); - SETBITMAPS( delete_body_xpm ); + SET_BITMAP( delete_body_xpm ); editMenu->Append( item ); // Swap Layers item = new wxMenuItem( editMenu, ID_MENU_PCB_SWAP_LAYERS, _( "&Swap Layers" ), _( "Swap tracks on copper layers or drawings on other layers" ) ); - SETBITMAPS( swap_layer_xpm ); + SET_BITMAP( swap_layer_xpm ); editMenu->Append( item ); // Reset module reference sizes @@ -298,7 +298,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES, _( "Reset Module &Reference Sizes" ), _( "Reset text size and width of all module references to current defaults" ) ); - SETBITMAPS( reset_text_xpm ); + SET_BITMAP( reset_text_xpm ); editMenu->Append( item ); // Reset module value sizes @@ -306,7 +306,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES, _( "Reset Module &Value Sizes" ), _( "Reset text size and width of all module values to current defaults" ) ); - SETBITMAPS( reset_text_xpm ); + SET_BITMAP( reset_text_xpm ); editMenu->Append( item ); /** Create View menu **/ @@ -328,7 +328,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() HK_ZOOM_IN, false ); item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL ); - SETBITMAPS( zoom_in_xpm ); + SET_BITMAP( zoom_in_xpm ); viewMenu->Append( item ); // Zoom Out @@ -337,7 +337,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL ); - SETBITMAPS( zoom_out_xpm ); + SET_BITMAP( zoom_out_xpm ); viewMenu->Append( item ); // Fit on Screen @@ -346,7 +346,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, wxITEM_NORMAL ); - SETBITMAPS( zoom_fit_in_page_xpm ); + SET_BITMAP( zoom_fit_in_page_xpm ); viewMenu->Append( item ); viewMenu->AppendSeparator(); @@ -358,7 +358,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, wxITEM_NORMAL ); - SETBITMAPS( zoom_redraw_xpm ); + SET_BITMAP( zoom_redraw_xpm ); viewMenu->Append( item ); viewMenu->AppendSeparator(); @@ -366,14 +366,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, _( "3D Display" ), _( "Show board in 3D viewer" ) ); - SETBITMAPS( show_3d_xpm ); + SET_BITMAP( show_3d_xpm ); viewMenu->Append( item ); // List Nets item = new wxMenuItem( viewMenu, ID_MENU_LIST_NETS, _( "&List Nets" ), _( "View a list of nets with names and id's" ) ); - SETBITMAPS( tools_xpm ); + SET_BITMAP( tools_xpm ); viewMenu->Append( item ); @@ -386,7 +386,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( placeMenu, ID_PCB_MODULE_BUTT, text, _( "Add modules" ), wxITEM_NORMAL ); - SETBITMAPS( module_xpm ); + SET_BITMAP( module_xpm ); placeMenu->Append( item ); // Track @@ -395,42 +395,42 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( placeMenu, ID_TRACK_BUTT, text, _( "Add tracks and vias" ), wxITEM_NORMAL ); - SETBITMAPS( add_tracks_xpm ); + SET_BITMAP( add_tracks_xpm ); placeMenu->Append( item ); // Zone item = new wxMenuItem( placeMenu, ID_PCB_ZONES_BUTT, _( "Zone" ), _( "Add filled zones" )); - SETBITMAPS( add_zone_xpm ); + SET_BITMAP( add_zone_xpm ); placeMenu->Append( item ); // Text item = new wxMenuItem( placeMenu, ID_PCB_ADD_TEXT_BUTT, _( "Text" ), _( "Add text on copper layers or graphic text" ) ); - SETBITMAPS( add_text_xpm ); + SET_BITMAP( add_text_xpm ); placeMenu->Append( item ); // Graphic Arc item = new wxMenuItem( placeMenu, ID_PCB_ARC_BUTT, _( "Arc" ), _( "Add graphic arc" ) ); - SETBITMAPS( add_arc_xpm ); + SET_BITMAP( add_arc_xpm ); placeMenu->Append( item ); // Graphic Circle item = new wxMenuItem( placeMenu, ID_PCB_CIRCLE_BUTT, _( "Circle" ), _( "Add graphic circle" )); - SETBITMAPS( add_circle_xpm ); + SET_BITMAP( add_circle_xpm ); placeMenu->Append( item ); // Line or Polygon item = new wxMenuItem( placeMenu, ID_PCB_ADD_LINE_BUTT, _( "Line or Polygon" ), _( "Add graphic line or polygon" )); - SETBITMAPS( add_dashed_line_xpm ); + SET_BITMAP( add_dashed_line_xpm ); placeMenu->Append( item ); placeMenu->AppendSeparator(); @@ -438,14 +438,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( placeMenu, ID_PCB_DIMENSION_BUTT, _( "Dimension" ), _( "Add dimension" ) ); - SETBITMAPS( add_dimension_xpm ); + SET_BITMAP( add_dimension_xpm ); placeMenu->Append( item ); // Layer alignment target item = new wxMenuItem( placeMenu, ID_PCB_MIRE_BUTT, _( "Layer alignment target" ), _( "Add layer alignment target" )); - SETBITMAPS( add_mires_xpm ); + SET_BITMAP( add_mires_xpm ); placeMenu->Append( item ); placeMenu->AppendSeparator(); @@ -453,14 +453,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( placeMenu, ID_PCB_PLACE_OFFSET_COORD_BUTT, _( "Drill and Place Offset" ), _( "Place the origin point for drill and place files" )); - SETBITMAPS( pcb_offset_xpm ); + SET_BITMAP( pcb_offset_xpm ); placeMenu->Append( item ); // Grid Origin item = new wxMenuItem( placeMenu, ID_PCB_PLACE_GRID_COORD_BUTT, _( "Grid Origin" ), _( "Set the origin point for the grid" )); - SETBITMAPS( grid_select_axis_xpm ); + SET_BITMAP( grid_select_axis_xpm ); placeMenu->Append( item ); @@ -472,7 +472,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ), _( "Setting libraries, directories and others..." ) ); - SETBITMAPS( library_xpm ); + SET_BITMAP( library_xpm ); configmenu->Append( item ); // Colors and Visibility are also handled by the layers manager toolbar @@ -480,7 +480,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() m_show_layer_manager_tools ? _( "Hide &Layers Manager" ) : _("Show &Layers Manager" ), HELP_SHOW_HIDE_LAYERMANAGER ); - SETBITMAPS( layers_manager_xpm ); + SET_BITMAP( layers_manager_xpm ); configmenu->Append( item ); // General @@ -493,14 +493,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() #endif _( "Select general options for PCBnew" ) ); - SETBITMAPS( preference_xpm ); + SET_BITMAP( preference_xpm ); configmenu->Append( item ); // Display item = new wxMenuItem( configmenu, ID_PCB_DISPLAY_OPTIONS_SETUP, _( "&Display" ), _( "Select how items (pads, tracks texts ... ) are displayed" ) ); - SETBITMAPS( display_options_xpm ); + SET_BITMAP( display_options_xpm ); configmenu->Append( item ); // Create Dimensions submenu @@ -510,28 +510,28 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( dimensionsMenu, ID_PCB_USER_GRID_SETUP, _( "Grid" ), _( "Adjust user grid dimensions" ) ); - SETBITMAPS( grid_xpm ); + SET_BITMAP( grid_xpm ); dimensionsMenu->Append( item ); // Text and Drawings item = new wxMenuItem( dimensionsMenu, ID_PCB_DRAWINGS_WIDTHS_SETUP, _( "Texts and Drawings" ), _( "Adjust dimensions for texts and drawings" ) ); - SETBITMAPS( options_text_xpm ); + SET_BITMAP( options_text_xpm ); dimensionsMenu->Append( item ); // Pads item = new wxMenuItem( dimensionsMenu, ID_PCB_PAD_SETUP, _( "Pads" ), _( "Adjust default pad characteristics" ) ); - SETBITMAPS( pad_xpm ); + SET_BITMAP( pad_xpm ); dimensionsMenu->Append( item ); // Pads Mask Clearance item = new wxMenuItem( dimensionsMenu, ID_PCB_MASK_CLEARANCE, _( "Pads Mask Clearance" ), _( "Adjust the global clearance between pads and the solder resist mask" ) ); - SETBITMAPS( pads_mask_layers_xpm ); + SET_BITMAP( pads_mask_layers_xpm ); dimensionsMenu->Append( item ); @@ -540,7 +540,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( dimensionsMenu, ID_CONFIG_SAVE, _( "&Save" ), _( "Save dimension preferences" ) ); - SETBITMAPS( save_xpm ); + SET_BITMAP( save_xpm ); dimensionsMenu->Append( item ); // Append dimension menu to config menu @@ -560,14 +560,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save Preferences" ), _( "Save application preferences" ) ); - SETBITMAPS( save_setup_xpm ); + SET_BITMAP( save_setup_xpm ); configmenu->Append( item ); // Read Preferences item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read Preferences" ), _( "Read application preferences" ) ); - SETBITMAPS( read_setup_xpm ); + SET_BITMAP( read_setup_xpm ); configmenu->Append( item ); @@ -580,14 +580,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( designRulesMenu, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, _( "Design Rules" ), _( "Open the design rules editor" ) ); - SETBITMAPS( hammer_xpm ); + SET_BITMAP( hammer_xpm ); designRulesMenu->Append( item ); // Layers Setup item = new wxMenuItem( configmenu, ID_PCB_LAYERS_SETUP, _( "&Layers Setup" ), _( "Enable and set layer properties" ) ); - SETBITMAPS( copper_layers_setup_xpm ); + SET_BITMAP( copper_layers_setup_xpm ); designRulesMenu->Append( item ); @@ -602,14 +602,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), _( "Open the on line PCBnew documentation" ) ); - SETBITMAPS( online_help_xpm ); + SET_BITMAP( online_help_xpm ); helpMenu->Append( item ); // About item = new wxMenuItem( helpMenu, wxID_ABOUT, _( "&About" ), _( "About PCBnew printed circuit board designer" )); - SETBITMAPS( info_xpm ); + SET_BITMAP( info_xpm ); helpMenu->Append( item ); diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp index c4020da348..d748ef200d 100644 --- a/pcbnew/move-drag_pads.cpp +++ b/pcbnew/move-drag_pads.cpp @@ -184,13 +184,13 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) */ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw ) { - D_PAD* Pad; - int rX, rY; + wxString lastPadName; // Last used pad name (pad num) + lastPadName = g_Pad_Master.ReturnStringPadName(); m_Pcb->m_Status_Pcb = 0; Module->m_LastEdit_Time = time( NULL ); - Pad = new D_PAD( Module ); + D_PAD* Pad = new D_PAD( Module ); /* Add the new pad to end of the module pad list. */ Module->m_Pads.PushBack( Pad ); @@ -201,29 +201,27 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw ) Pad->m_Pos = GetScreen()->GetCrossHairPosition(); - rX = Pad->m_Pos.x - Module->m_Pos.x; - rY = Pad->m_Pos.y - Module->m_Pos.y; + // Set the relative pad position + // ( pad position for module orient, 0, and relative to the module position) + Pad->m_Pos0 = Pad->m_Pos - Module->m_Pos; + RotatePoint( &Pad->m_Pos0, -Module->m_Orient ); - RotatePoint( &rX, &rY, -Module->m_Orient ); - - Pad->m_Pos0.x = rX; - Pad->m_Pos0.y = rY; - - /* Automatically increment the current pad number and name. */ + /* Automatically increment the current pad number. */ long num = 0; int ponder = 1; - while( g_Current_PadName.Len() && g_Current_PadName.Last() >= '0' - && g_Current_PadName.Last() <= '9' ) + while( lastPadName.Len() && lastPadName.Last() >= '0' + && lastPadName.Last() <= '9' ) { - num += ( g_Current_PadName.Last() - '0' ) * ponder; - g_Current_PadName.RemoveLast(); + num += ( lastPadName.Last() - '0' ) * ponder; + lastPadName.RemoveLast(); ponder *= 10; } - num++; - g_Current_PadName << num; - Pad->SetPadName( g_Current_PadName ); + num++; // Use next number for the new pad + lastPadName << num; + Pad->SetPadName( lastPadName ); + g_Pad_Master.SetPadName(lastPadName); Module->Set_Rectangle_Encadrement(); Pad->DisplayInfo( this ); diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 557c24fef7..3d9039f7ed 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -32,8 +32,6 @@ static bool InitialiseDragParameters(); static wxPoint PosInit, s_LastPos; static TRACK* NewTrack; /* New track or track being moved. */ static int NbPtNewTrack; -static int Old_HighLigth_NetCode; -static bool Old_HighLigt_Status; static double s_StartSegmentSlope, s_EndSegmentSlope, s_MovingSegmentSlope, s_StartSegment_Yorg, s_EndSegment_Yorg, @@ -54,6 +52,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) { TRACK* NextS; int ii; + BOARD * pcb = ( (PCB_EDIT_FRAME*) Panel->GetParent() )->GetBoard(); /* Erase the current drawings */ wxPoint oldpos = Panel->GetScreen()->GetCrossHairPosition(); @@ -64,10 +63,8 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true ); Panel->GetScreen()->SetCrossHairPosition( oldpos ); - g_HighLight_Status = false; - ( (PCB_EDIT_FRAME*) Panel->GetParent() )->GetBoard()->DrawHighLight( Panel, - DC, - g_HighLight_NetCode ); + pcb->HightLightOFF(); + pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() ); if( NewTrack ) { @@ -122,11 +119,10 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) // Clear the undo picker list: s_ItemsListPicker.ClearListAndDeleteItems(); - g_HighLight_NetCode = Old_HighLigth_NetCode; - g_HighLight_Status = Old_HighLigt_Status; - if( g_HighLight_Status ) - ( (PCB_EDIT_FRAME*) Panel->GetParent() )->GetBoard()->DrawHighLight( - Panel, DC, g_HighLight_NetCode ); + pcb->PopHightLight(); + + if( pcb->IsHightLightNetON() ) + pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() ); EraseDragList(); Panel->SetMouseCapture( NULL, NULL ); @@ -665,9 +661,9 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com EraseDragList(); /* Change highlighted net: the new one will be highlighted */ - Old_HighLigt_Status = g_HighLight_Status; - Old_HighLigth_NetCode = g_HighLight_NetCode; - if( g_HighLight_Status ) + GetBoard()->PushHightLight(); + + if( GetBoard()->IsHightLightNetON() ) High_Light( DC ); PosInit = GetScreen()->GetCrossHairPosition(); @@ -738,10 +734,10 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com s_LastPos = PosInit; DrawPanel->SetMouseCapture( Show_MoveNode, Abort_MoveTrack ); - g_HighLight_NetCode = track->GetNet(); - g_HighLight_Status = true; + GetBoard()->SetHightLightNet( track->GetNet() ); + GetBoard()->HightLightON(); - GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode ); + GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true ); } @@ -902,9 +898,8 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC s_EndSegmentPresent = false; /* Change high light net: the new one will be highlighted */ - Old_HighLigt_Status = g_HighLight_Status; - Old_HighLigth_NetCode = g_HighLight_NetCode; - if( g_HighLight_Status ) + GetBoard()->PushHightLight(); + if( GetBoard()->IsHightLightNetON() ) High_Light( DC ); EraseDragList(); @@ -938,9 +933,9 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC s_LastPos = GetScreen()->GetCrossHairPosition(); DrawPanel->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack ); - g_HighLight_NetCode = track->GetNet(); - g_HighLight_Status = true; - GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode ); + GetBoard()->SetHightLightNet( track->GetNet() ); + GetBoard()->HightLightON(); + GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() ); // Prepare the Undo command ITEM_PICKER picker( NULL, UR_CHANGED ); diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index d6b21db3a5..1a05bc125f 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -61,7 +61,6 @@ int g_MagneticTrackOption = capture_cursor_in_track_tool; int g_HighLight_NetCode = -1; wxPoint g_Offset_Module; /* Offset de trace du modul en depl */ -wxString g_Current_PadName; // Last used pad name (pad num) // Wildcard for footprint libraries filesnames const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (*.mod)|*.mod" ) ); diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index 4c4ca0b3e1..e1834db907 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -69,14 +69,8 @@ extern bool g_TwoSegmentTrackBuild; extern int g_MagneticPadOption; extern int g_MagneticTrackOption; -/* Variables to handle highlight nets */ -extern bool g_HighLight_Status; -extern int g_HighLight_NetCode; - extern wxPoint g_Offset_Module; /* Offset de trace du modul en depl */ -extern wxString g_Current_PadName; // Last used pad name (pad num) - enum MagneticPadOptionValues { no_effect, diff --git a/pcbnew/surbrill.cpp b/pcbnew/surbrill.cpp index 626f7464bb..e1311ba5d3 100644 --- a/pcbnew/surbrill.cpp +++ b/pcbnew/surbrill.cpp @@ -3,9 +3,7 @@ /*******************/ #include "fctsys.h" -#include "gr_basic.h" #include "class_drawpanel.h" -#include "confirm.h" #include "kicad_string.h" #include "pcbnew.h" @@ -80,10 +78,10 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event ) { INSTALL_UNBUFFERED_DC( dc, DrawPanel ); - if( g_HighLight_Status ) + if( GetBoard()->IsHightLightNetON() ) High_Light( &dc ); - g_HighLight_NetCode = netcode; + GetBoard()->SetHightLightNet( netcode ); High_Light( &dc ); } } @@ -94,7 +92,8 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event ) */ int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC ) { - if( g_HighLight_Status ) + int netcode = -1; + if( GetBoard()->IsHightLightNetON() ) High_Light( DC ); // use this scheme because a pad is a higher priority than a track in the @@ -115,33 +114,35 @@ int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC ) switch( item->Type() ) { case TYPE_PAD: - g_HighLight_NetCode = ( (D_PAD*) item )->GetNet(); - High_Light( DC ); + netcode = ( (D_PAD*) item )->GetNet(); SendMessageToEESCHEMA( item ); - return g_HighLight_NetCode; + break; case TYPE_TRACK: case TYPE_VIA: case TYPE_ZONE: - // since these classes are all derived from TRACK, use a common // GetNet() function: - g_HighLight_NetCode = ( (TRACK*) item )->GetNet(); - High_Light( DC ); - return g_HighLight_NetCode; + netcode = ( (TRACK*) item )->GetNet(); + break; case TYPE_ZONE_CONTAINER: - g_HighLight_NetCode = ( (ZONE_CONTAINER*) item )->GetNet(); - High_Light( DC ); - return g_HighLight_NetCode; + netcode = ( (ZONE_CONTAINER*) item )->GetNet(); + break; default: ; // until somebody changes GENERAL_COLLECTOR::PadsOrTracks, // this should not happen. } } + if( netcode >= 0 ) + { + GetBoard()->SetHightLightNet( netcode ); + High_Light( DC ); + } - return -1; // HitTest() failed. + + return netcode; // HitTest() failed. } @@ -152,7 +153,10 @@ int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC ) */ void PCB_EDIT_FRAME::High_Light( wxDC* DC ) { - g_HighLight_Status = !g_HighLight_Status; + if( GetBoard()->IsHightLightNetON() ) + GetBoard()->HightLightOFF(); + else + GetBoard()->HightLightON(); - GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode ); + GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() ); } diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index ad5be7bcd5..430aa9029c 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -198,8 +198,8 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, } // @todo: this high-light functionality could be built into me. - if( g_HighLight_Status ) - DrawHighLight( aPanel, DC, g_HighLight_NetCode ); + if( IsHightLightNetON() ) + DrawHighLight( aPanel, DC, GetHightLightNetCode() ); // draw the BOARD's markers last, otherwise the high light will erase // any marker on a pad @@ -214,22 +214,11 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode ) { int draw_mode; - if( g_HighLight_Status ) + if( IsHightLightNetON() ) draw_mode = GR_SURBRILL | GR_OR; else draw_mode = GR_AND | GR_SURBRILL; -#if 0 // does not unhighlight properly - // redraw the zones with the aNetCode - for( SEGZONE* zone = m_Zone; zone; zone = zone->Next() ) - { - if( zone->GetNet() == aNetCode ) - { - zone->Draw( aDrawPanel, DC, draw_mode ); - } - } -#endif - // Redraw ZONE_CONTAINERS BOARD::ZONE_CONTAINERS& zones = m_ZoneDescriptorList; for( BOARD::ZONE_CONTAINERS::iterator zc = zones.begin(); zc!=zones.end(); ++zc ) @@ -241,7 +230,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode ) } // Redraw any pads that have aNetCode - for( MODULE* module = m_Modules; module; module = module->Next() ) + for( MODULE* module = m_Modules; module; module = module->Next() ) { for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() ) { diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index f81a40873a..eed524a3fc 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -1,5 +1,4 @@ ///////////////////////////////////////////////////////////////////////////// - // Name: zones_by_polygon.cpp // Licence: GPL License ///////////////////////////////////////////////////////////////////////////// @@ -172,12 +171,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont { if( zone_container->IsOnCopperLayer() ) /* Show the Net */ { - if( g_HighLight_Status && DC ) + if( GetBoard()->IsHightLightNetON() && DC ) { High_Light( DC ); // Remove old hightlight selection } - g_HighLight_NetCode = g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet(); + g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet(); + GetBoard()->SetHightLightNet( zone_container->GetNet() ); if( DC ) High_Light( DC ); } @@ -246,12 +246,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co /* Show the Net */ if( zone_container->IsOnCopperLayer() ) /* Show the Net */ { - if( g_HighLight_Status ) + if( GetBoard()->IsHightLightNetON() ) { High_Light( DC ); // Remove old hightlight selection } - g_HighLight_NetCode = g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet(); + g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet(); + GetBoard()->SetHightLightNet( zone_container->GetNet() ); High_Light( DC ); } @@ -507,9 +508,10 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) DrawPanel->m_IgnoreMouseEvents = TRUE; if( zone->IsOnCopperLayer() ) { // Put a zone on a copper layer - if ( g_HighLight_NetCode ) + if ( GetBoard()->GetHightLightNetCode() > 0 ) { - g_Zone_Default_Setting.m_NetcodeSelection = g_HighLight_NetCode; + g_Zone_Default_Setting.m_NetcodeSelection = GetBoard()->GetHightLightNetCode(); + zone->SetNet( g_Zone_Default_Setting.m_NetcodeSelection ); zone->SetNetNameFromNetCode( ); } @@ -550,12 +552,12 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) { if( s_CurrentZone ) g_Zone_Default_Setting.m_NetcodeSelection = s_CurrentZone->GetNet(); - if( g_HighLight_Status ) + if( GetBoard()->IsHightLightNetON() ) { High_Light( DC ); // Remove old hightlight selection } - g_HighLight_NetCode = g_Zone_Default_Setting.m_NetcodeSelection; + GetBoard()->SetHightLightNet( g_Zone_Default_Setting.m_NetcodeSelection ); High_Light( DC ); } if( !s_AddCutoutToCurrentZone ) diff --git a/version.txt b/version.txt index 1755168516..324fa4ca16 100644 --- a/version.txt +++ b/version.txt @@ -1,4 +1,4 @@ release version: -2011 apr 01 +2011 apr 05 files (.zip,.tgz): -kicad-2011-04-01 +kicad-2011-04-05