22#include <wx/clipbrd.h>
29 m_grid->Disconnect( wxEVT_CHAR_HOOK );
34 std::function<
void( wxCommandEvent& )> aAddHandler ) :
37 m_grid->Disconnect( wxEVT_CHAR_HOOK );
45 _(
"Edit options..." ),
46 _(
"Edit options for this library entry" ) );
48 menu.AppendSeparator();
50 bool showActivate =
false;
51 bool showDeactivate =
false;
52 bool showSetVisible =
false;
53 bool showUnsetVisible =
false;
62 showDeactivate =
true;
67 showUnsetVisible =
true;
69 showSetVisible =
true;
71 if( showActivate && showDeactivate && showSetVisible && showUnsetVisible )
86 if( showUnsetVisible )
90 bool showSettings =
false;
96 wxString::Format(
_(
"Library settings for %s..." ),
100 if( showActivate || showDeactivate || showSetVisible || showUnsetVisible || showSettings )
101 menu.AppendSeparator();
109 int menu_id =
event.GetId();
151 if( ev.GetModifiers() == wxMOD_CONTROL && ev.GetKeyCode() ==
'V' &&
m_grid->IsCellEditControlShown() )
155 if( wxTheClipboard->Open() )
157 if( wxTheClipboard->IsSupported( wxDF_TEXT ) || wxTheClipboard->IsSupported( wxDF_UNICODETEXT ) )
159 wxTextDataObject data;
160 wxTheClipboard->GetData( data );
162 wxString
text = data.GetText();
164 if( !
text.Contains(
'\t' ) &&
text.Contains(
',' ) )
165 text.Replace(
',',
'\t' );
167 if(
text.Contains(
'\t' ) ||
text.Contains(
'\n' ) ||
text.Contains(
'\r' ) )
169 m_grid->CancelPendingChanges();
170 int row =
m_grid->GetGridCursorRow();
174 if(
table && row >= 0 && row < table->GetNumberRows() )
178 if( !nickname.IsEmpty() )
181 wxTheClipboard->Close();
189 m_grid->SetGridCursor( row, 0 );
192 wxTheClipboard->Close();
198 wxTheClipboard->Close();
virtual void paste_text(const wxString &cb_text)
void getSelectedArea()
Puts the selected area into a sensible rectangle of m_sel_{row,col}_{start,count} above.
GRID_TRICKS(WX_GRID *aGrid)
virtual void doPopupSelection(wxCommandEvent &event)
virtual void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent)
WX_GRID * m_grid
I don't own the grid, but he owns me.
void onCharHook(wxKeyEvent &event)
bool handleDoubleClick(wxGridEvent &aEvent) override
LIB_TABLE_GRID_TRICKS(WX_GRID *aGrid)
virtual void optionsEditor(int aRow)=0
virtual bool supportsVisibilityColumn()
void doPopupSelection(wxCommandEvent &event) override
void onCharHook(wxKeyEvent &ev)
@ LIB_TABLE_GRID_TRICKS_ACTIVATE_SELECTED
@ LIB_TABLE_GRID_TRICKS_OPTIONS_EDITOR
@ LIB_TABLE_GRID_TRICKS_SET_VISIBLE
@ LIB_TABLE_GRID_TRICKS_LIBRARY_SETTINGS
@ LIB_TABLE_GRID_TRICKS_DEACTIVATE_SELECTED
@ LIB_TABLE_GRID_TRICKS_UNSET_VISIBLE
void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent) override
This abstract base class mixes any object derived from LIB_TABLE into wxGridTableBase so the result c...
void SetValueAsBool(int aRow, int aCol, bool aValue) override
wxString GetValue(int aRow, int aCol) override
LIB_TABLE_ROW * At(size_t aIndex)
bool GetValueAsBool(int aRow, int aCol) override
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
virtual void ShowSettingsDialog(wxWindow *aParent) const
virtual bool SupportsSettingsDialog() const