Commit c4d29b42 authored by Dick Hollenbeck's avatar Dick Hollenbeck

Grab pending (unsaved) wxGridCellEditor cell text and stuff into fp_lib_table.

parent 58623062
...@@ -83,8 +83,10 @@ if( CMAKE_COMPILER_IS_GNUCXX ) ...@@ -83,8 +83,10 @@ if( CMAKE_COMPILER_IS_GNUCXX )
OUTPUT_VARIABLE GCC_VERSION OUTPUT_VARIABLE GCC_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE ) OUTPUT_STRIP_TRAILING_WHITESPACE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" ) # Establish -Wall early, so specialized relaxations of this may come
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" ) # subsequently on the command line, such as in pcbnew/github/CMakeLists.txt
set( CMAKE_C_FLAGS "-Wall" )
set( CMAKE_CXX_FLAGS "-Wall" )
# The optimization level is -O1 instead of the usual -O2 level because # The optimization level is -O1 instead of the usual -O2 level because
# boost::polygon has a function (inflate polygon) broken by the -O2 level # boost::polygon has a function (inflate polygon) broken by the -O2 level
...@@ -94,17 +96,17 @@ if( CMAKE_COMPILER_IS_GNUCXX ) ...@@ -94,17 +96,17 @@ if( CMAKE_COMPILER_IS_GNUCXX )
# https://bugs.launchpad.net/kicad/+bug/1056926 # https://bugs.launchpad.net/kicad/+bug/1056926
# https://svn.boost.org/trac/boost/ticket/7983 # https://svn.boost.org/trac/boost/ticket/7983
if( GCC_VERSION VERSION_EQUAL 4.7.0 OR ( GCC_VERSION VERSION_GREATER 4.7.0 AND GCC_VERSION VERSION_LESS 4.7.3 ) ) if( GCC_VERSION VERSION_EQUAL 4.7.0 OR ( GCC_VERSION VERSION_GREATER 4.7.0 AND GCC_VERSION VERSION_LESS 4.7.3 ) )
set( CMAKE_C_FLAGS_RELEASE "-O1" ) set( CMAKE_C_FLAGS_RELEASE "-O1" )
set( CMAKE_CXX_FLAGS_RELEASE "-O1" ) set( CMAKE_CXX_FLAGS_RELEASE "-O1" )
else() else()
set( CMAKE_C_FLAGS_RELEASE "-O2" ) set( CMAKE_C_FLAGS_RELEASE "-O2" )
set( CMAKE_CXX_FLAGS_RELEASE "-O2" ) set( CMAKE_CXX_FLAGS_RELEASE "-O2" )
endif() endif()
set( CMAKE_C_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" ) set( CMAKE_C_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" ) set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3 -DDEBUG" )
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG" ) set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG" )
if( MINGW ) if( MINGW )
...@@ -121,7 +123,7 @@ if( CMAKE_COMPILER_IS_GNUCXX ) ...@@ -121,7 +123,7 @@ if( CMAKE_COMPILER_IS_GNUCXX )
# empty for Windows. # empty for Windows.
set( PIC_FLAG -fPIC ) set( PIC_FLAG -fPIC )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIC_FLAG}" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIC_FLAG}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIC_FLAG}" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIC_FLAG}" )
# Thou shalt not link vaporware and tell us it's a valid DSO: # Thou shalt not link vaporware and tell us it's a valid DSO:
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
/* TODO: /* TODO:
*) Grab text from any pending ChoiceEditor when OK button pressed.
*) After any change to uri, reparse the environment variables. *) After any change to uri, reparse the environment variables.
*/ */
...@@ -251,17 +250,21 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE ...@@ -251,17 +250,21 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
int selRowCount; int selRowCount;
int selColCount; int selColCount;
/// If the cursor is not on a valid cell, because there are no rows at all, return -1,
/// else return a 0 based column index.
int getCursorCol() const int getCursorCol() const
{ {
return m_cur_grid->GetGridCursorCol(); return m_cur_grid->GetGridCursorCol();
} }
/// If the cursor is not on a valid cell, because there are no rows at all, return -1,
/// else return a 0 based row index.
int getCursorRow() const int getCursorRow() const
{ {
return m_cur_grid->GetGridCursorRow(); return m_cur_grid->GetGridCursorRow();
} }
/// Gets the selected area into a sensible rectangle of sel{Row,Col}{Start,Count} above. /// Puts the selected area into a sensible rectangle of sel{Row,Col}{Start,Count} above.
void getSelectedArea() void getSelectedArea()
{ {
wxGridCellCoordsArray topLeft = m_cur_grid->GetSelectionBlockTopLeft(); wxGridCellCoordsArray topLeft = m_cur_grid->GetSelectionBlockTopLeft();
...@@ -374,6 +377,7 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE ...@@ -374,6 +377,7 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
} }
} }
/** /**
* Function verifyTables * Function verifyTables
* trims important fields, removes blank row entries, and checks for duplicates. * trims important fields, removes blank row entries, and checks for duplicates.
...@@ -617,6 +621,9 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE ...@@ -617,6 +621,9 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
{ {
int dialogRet = 0; int dialogRet = 0;
// stuff any pending cell editor text into the table.
m_cur_grid->SaveEditControlValue();
if( verifyTables() ) if( verifyTables() )
{ {
if( m_global_model != *m_global ) if( m_global_model != *m_global )
...@@ -893,8 +900,8 @@ void DIALOG_FP_LIB_TABLE::paste() ...@@ -893,8 +900,8 @@ void DIALOG_FP_LIB_TABLE::paste()
} }
else else
{ {
const int cur_row = getCursorRow(); // -1 is ok const int cur_row = std::max( getCursorRow(), 0 ); // no -1
const int cur_col = std::max( getCursorCol(), 0 ); // no -1 const int cur_col = std::max( getCursorCol(), 0 );
wxStringTokenizer rows( cb_text, ROW_SEP, wxTOKEN_RET_EMPTY ); wxStringTokenizer rows( cb_text, ROW_SEP, wxTOKEN_RET_EMPTY );
...@@ -912,7 +919,7 @@ void DIALOG_FP_LIB_TABLE::paste() ...@@ -912,7 +919,7 @@ void DIALOG_FP_LIB_TABLE::paste()
wxStringTokenizer cols( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY ); wxStringTokenizer cols( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY );
for( int col = cur_col; cols.HasMoreTokens(); ++col ) for( int col = cur_col; cols.HasMoreTokens(); ++col )
{ {
wxString cellTxt = cols.GetNextToken(); wxString cellTxt = cols.GetNextToken();
tbl->SetValue( row, col, cellTxt ); tbl->SetValue( row, col, cellTxt );
......
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