Commit 5ce9c9a9 authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

Open file dialog fixes and minor code cleaning.

* Fix a minor problem with wxFileDialog to open a file that no longer
  exists in PCBNew.
* Make GerbView open file behavior the same as PCBNew.
* Remove redundant PCB file wild card definition.
* Add open file refactor task to the todo list.
* Fix some minor code formatting issues.
parent 6fba09e1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@ Common
* List auto up and down scrolling.
* Integer/long/double input boxes should handle comma and dot separated values,
  not only comma.

* Push file open semantics down to one of the base frame classes ( likely candidate is
  WinEDA_BasicFrame ) so that file open behavior is consistent across all applications.

ANYONE:
C2) Write a tool to generate DSNLEXER keyword tables (and enums) as *.cpp and
+2 −2
Original line number Diff line number Diff line
@@ -55,17 +55,17 @@ Ki_PageDescr* g_SheetSizeList[NB_ITEMS + 1] =
 * that they cannot be changed. */
const wxString ProjectFileExtension( wxT( "pro" ) );
const wxString SchematicFileExtension( wxT( "sch" ) );
const wxString BoardFileExtension( wxT( "brd" ) );
const wxString NetlistFileExtension( wxT( "net" ) );
const wxString GerberFileExtension( wxT( "pho" ) );
const wxString PcbFileExtension( wxT( "brd" ) );
const wxString PdfFileExtension( wxT( "pdf" ) );

/* Proper wxFileDialog wild card definitions. */
const wxString ProjectFileWildcard( _( "Kicad project files (*.pro)|*.pro" ) );
const wxString BoardFileWildcard( _( "Kicad PCB files (*.brd)|*.brd" ) );
const wxString SchematicFileWildcard( _( "Kicad schematic files (*.sch)|*.sch" ) );
const wxString NetlistFileWildcard( _( "Kicad netlist files (*.net)|*.net" ) );
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
const wxString PcbFileWildcard( _( "Kicad printed circuit board files (*.brd)|*.brd" ) );
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );
const wxString AllFilesWildcard( _( "All files (*)|*" ) );

+1 −6
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ wxArrayString g_LibName_List; // library list to load
DISPLAY_OPTIONS DisplayOpt;      /* Display options for board items */

/* PCB file name extension definitions. */
wxString PcbExtBuffer( wxT( "brd" ) );
wxString g_SaveFileName( wxT( "$savepcb" ) );
wxString NetExtBuffer( wxT( "net" ) );
wxString NetCmpExtBuffer( wxT( "cmp" ) );
@@ -80,11 +79,7 @@ wxString g_Shapes3DExtBuffer( wxT( "wrl" ) );
const wxString ModuleFileExtension( wxT( "mod" ) );

/* PCB file name wild card definitions. */
const wxString ModuleFileWildcard(
    _( "Kicad footprint library files (*.mod)|*.mod" )
);
const wxString PcbFileWildcard(
    _( "Printed circuit board files (*.brd)|*.brd" ) );
const wxString ModuleFileWildcard( _( "Kicad footprint library files (*.mod)|*.mod" ) );

int g_CurrentVersionPCB = 1;

+5 −7
Original line number Diff line number Diff line
@@ -281,8 +281,7 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
                m_modified = false;
            else if( diag == 0 )
            {
                if( !IsOK( this,
                           _( "Problem when saving files, exit anyway ?" ) ) )
                if( !IsOK( this, _( "Problem when saving files, exit anyway ?" ) ) )
                {
                    Event.Veto();
                    return;
@@ -346,7 +345,8 @@ void WinEDA_CvpcbFrame::ToFirstNA( wxCommandEvent& event )
    if( selection < 0 )
        selection = 0;

    BOOST_FOREACH( COMPONENT & component, m_components ) {
    BOOST_FOREACH( COMPONENT & component, m_components )
    {
        if( component.m_Module.IsEmpty() && ii > selection )
        {
            m_ListCmp->SetSelection( ii );
@@ -444,10 +444,8 @@ void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event )
    }
    else
    {
        newFileName = wxFileName( wxGetCwd(), _( "unnamed" ), wxT( "net" ) );

        wxFileDialog dlg( this, _( "Open Net List" ), newFileName.GetPath(),
                          newFileName.GetFullName(), NetlistFileWildcard,
        wxFileDialog dlg( this, _( "Open Net List" ), wxGetCwd(),
                          wxEmptyString, NetlistFileWildcard,
                          wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );

        if( dlg.ShowModal() == wxID_CANCEL )
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ bool WinEDA_App::OnInit()
        wxSetWorkingDirectory( filename.GetPath() );

        if( frame->DrawPanel
            && frame->LoadOneEEProject( filename.GetFullPath(), false ) <= 0 )
            && frame->LoadOneEEProject( filename.GetFullPath(), false ) )
            frame->DrawPanel->Refresh( true );
    }
    else
Loading