Commit 651a92a8 authored by Mark Roszko's avatar Mark Roszko
Browse files

Hotkey Editor Polishing

Refactor hotkey editor to use tab control instead of one giant list.
Each tab is a separate hotkey section.
Modify EDA_HOTKEY_CONFIG to change the m_Comment member to m_Title for a new purpose.
We want a pretty title in the hotkey editor. We use m_Title for the key export comment which
still conveys the purpose just as easily.
Refactored usage of wxGrid into wxListCtrl which allows capturing navigation characters
and also works better (single selection is built in).
Add hotkey overwrite prompts that are paired with "Common" section. It will check if a hotkey
overlaps with the proper sections. i.e. Common with the all other sections; or Section 1 with just Common.
Right-click menu removed due to wxListCtrl being able to catch the special keys properly.
parent 753d8340
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -179,7 +179,6 @@ set( COMMON_SRCS
    grid_tricks.cpp
    grid_tricks.cpp
    gr_basic.cpp
    gr_basic.cpp
    hotkeys_basic.cpp
    hotkeys_basic.cpp
    hotkey_grid_table.cpp
    html_messagebox.cpp
    html_messagebox.cpp
    kiface_i.cpp
    kiface_i.cpp
    kiway.cpp
    kiway.cpp
+267 −156
Original line number Original line Diff line number Diff line
@@ -30,243 +30,354 @@
#include <fctsys.h>
#include <fctsys.h>
#include <pgm_base.h>
#include <pgm_base.h>
#include <common.h>
#include <common.h>
#include <confirm.h>


#include <dialog_hotkeys_editor.h>
#include <dialog_hotkeys_editor.h>


void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys )

HOTKEY_LIST_CTRL::HOTKEY_LIST_CTRL( wxWindow *aParent, struct EDA_HOTKEY_CONFIG* aSection ) :
    wxListCtrl( aParent, wxID_ANY, wxDefaultPosition,
                 wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VIRTUAL )
{
{
    HOTKEYS_EDITOR_DIALOG dialog( parent, hotkeys );
    m_sectionTag = aSection->m_SectionTag;
    m_curEditingRow = -1;


    int diag = dialog.ShowModal();
    InsertColumn( 0, _( "Command" ) );
    if( diag == wxID_OK )
    InsertColumn( 1, _( "Hotkey" ) );

    // Add a dummy hotkey_spec which is a header before each hotkey list
    EDA_HOTKEY** hotkey_descr_list;

    // Add a copy of hotkeys to our list
    for( hotkey_descr_list = aSection->m_HK_InfoList; *hotkey_descr_list;
         hotkey_descr_list++ )
    {
    {
        parent->ReCreateMenuBar();
        EDA_HOTKEY* hotkey_descr = *hotkey_descr_list;
        parent->Refresh();
        m_hotkeys.push_back( new EDA_HOTKEY( hotkey_descr ) );
    }
    }

    // Set item count to hotkey size, this gets it to autoload the entries
    SetItemCount( m_hotkeys.size() );

    SetColumnWidth( 0, wxLIST_AUTOSIZE );
    SetColumnWidth( 1, wxLIST_AUTOSIZE );

    Bind( wxEVT_CHAR, &HOTKEY_LIST_CTRL::OnChar, this );
    Bind( wxEVT_LIST_ITEM_SELECTED, &HOTKEY_LIST_CTRL::OnListItemSelected, this );
    Bind( wxEVT_SIZE, &HOTKEY_LIST_CTRL::OnSize, this );
}
}




HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME*    parent,
void HOTKEY_LIST_CTRL::OnSize( wxSizeEvent& aEvent )
                                              EDA_HOTKEY_CONFIG* hotkeys ) :
    HOTKEYS_EDITOR_DIALOG_BASE( parent )
{
{
    m_parent  = parent;
    float totalLength = 0;
    m_hotkeys = hotkeys;
    float scale = 0;
    m_curEditingRow = -1;

    m_table = new HOTKEY_EDITOR_GRID_TABLE( hotkeys );
    m_hotkeyGrid->SetTable( m_table, true );


    m_hotkeyGrid->AutoSizeColumn( 0 );
    // Find max character length of first column
    m_hotkeyGrid->EnableDragGridSize( false );
    int maxInfoMsgLength = 0;
    for( int i = 0; i < GetItemCount(); i++ )
    {
        int length = GetItemText( i, 0 ).Length();
        if( length > maxInfoMsgLength )
            maxInfoMsgLength = length;
    }


    for( int i = 0; i < m_hotkeyGrid->GetNumberRows(); ++i )
    // Find max character length of second column
    int maxKeyCodeLength = 0;
    for( int i = 0; i < GetItemCount(); i++ )
    {
    {
        m_hotkeyGrid->SetReadOnly( i, 0, true );
        int length = GetItemText( i, 1 ).Length();
        m_hotkeyGrid->SetReadOnly( i, 1, true );
        if( length > maxKeyCodeLength )
            maxKeyCodeLength = length;
    }
    }


    m_OKButton->SetDefault();
    // Use the lengths of column texts to create a scale of the max list width
    m_hotkeyGrid->SetFocus();
    // to set the column widths
    GetSizer()->SetSizeHints( this );
    totalLength = maxInfoMsgLength + maxKeyCodeLength;
    Center();

    scale = (float) GetClientSize().x / totalLength;

    SetColumnWidth( 0, int( maxInfoMsgLength*scale ) - 2 );
    SetColumnWidth( 1, int( maxKeyCodeLength*scale ) );

    aEvent.Skip();
}
}




void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event )
void HOTKEY_LIST_CTRL::OnListItemSelected( wxListEvent& aEvent )
{
{
    /* edit the live hotkey table */
    m_curEditingRow = aEvent.GetIndex();
    HOTKEY_EDITOR_GRID_TABLE::hotkey_spec_vector& hotkey_vec = m_table->getHotkeys();
}


    EDA_HOTKEY_CONFIG*      section;


    for( section = m_hotkeys; section->m_HK_InfoList; section++ )
void HOTKEY_LIST_CTRL::DeselectRow( int aRow )
{
{
        wxString     sectionTag = *section->m_SectionTag;
    SetItemState( aRow, 0, wxLIST_STATE_SELECTED );
}


        EDA_HOTKEY** info_ptr;


        for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ )
wxString HOTKEY_LIST_CTRL::OnGetItemText( long aRow, long aColumn ) const
{
{
            EDA_HOTKEY* info = *info_ptr;
    EDA_HOTKEY* hotkey_descr = m_hotkeys[aRow];


            /* find the corresponding hotkey */
    if( aColumn == 0 )
            HOTKEY_EDITOR_GRID_TABLE::hotkey_spec_vector::iterator i;
    {
        return hotkey_descr->m_InfoMsg;
    }
    else
    {
        return KeyNameFromKeyCode( hotkey_descr->m_KeyCode );
    }
}


            for( i = hotkey_vec.begin(); i != hotkey_vec.end(); ++i )

void HOTKEY_LIST_CTRL::OnChar( wxKeyEvent& aEvent )
{
    if( m_curEditingRow != -1 )
    {
    {
                if( i->first == sectionTag
        long key = aEvent.GetKeyCode();
                    && i->second

                    && i->second->m_Idcommand == info->m_Idcommand )
        switch( key )
        {
        {
                    info->m_KeyCode = i->second->m_KeyCode;
        case WXK_ESCAPE:
            // Remove selection
            DeselectRow( m_curEditingRow );
            m_curEditingRow = -1;
            break;
            break;

        default:
            if( aEvent.ControlDown() )
                key |= GR_KB_CTRL;

            if( aEvent.AltDown() )
                key |= GR_KB_ALT;

            if( aEvent.ShiftDown() && (key > 256) )
                key |= GR_KB_SHIFT;

            // Remap Ctrl A (=1+GR_KB_CTRL) to Ctrl Z(=26+GR_KB_CTRL)
            // to GR_KB_CTRL+'A' .. GR_KB_CTRL+'Z'
            if( (key > GR_KB_CTRL) && (key <= GR_KB_CTRL+26) )
                key += ('A' - 1);

            if( key >= 'a' && key <= 'z' ) // convert to uppercase
                key = key + ('A' - 'a');

            // See if this key code is handled in hotkeys names list
            bool exists;
            KeyNameFromKeyCode( key, &exists );

            if( exists && m_hotkeys[m_curEditingRow]->m_KeyCode != key )
            {
                bool canUpdate = ((HOTKEY_SECTION_PAGE *)m_parent)->GetDialog()->CanSetKey( key, m_sectionTag );

                if( canUpdate )
                {
                    m_hotkeys[m_curEditingRow]->m_KeyCode = key;
                }
                }

                // Remove selection
                DeselectRow( m_curEditingRow );
                m_curEditingRow = -1;
            }


            break;
        }
        }
    }
    }
    RefreshItems(0,m_hotkeys.size()-1);
}
}


    /* save the hotkeys */
    m_parent->WriteHotkeyConfig( m_hotkeys );


    EndModal( wxID_OK );
void HOTKEY_LIST_CTRL::RestoreFrom( struct EDA_HOTKEY_CONFIG* aSection )
}
{
    int row = 0;


    EDA_HOTKEY** info_ptr;


void HOTKEYS_EDITOR_DIALOG::CancelClicked( wxCommandEvent& event )
    for( info_ptr = aSection->m_HK_InfoList; *info_ptr; info_ptr++ )
    {
    {
    EndModal( wxID_CANCEL );
        EDA_HOTKEY* info = *info_ptr;
        m_hotkeys[row++]->m_KeyCode = info->m_KeyCode;
    }
    }


    // Remove selection
    DeselectRow( m_curEditingRow );
    m_curEditingRow = -1;


/* Reinit the hotkeys to the initial state (remove all pending changes
    RefreshItems( 0, m_hotkeys.size()-1 );
 */
}
void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& event )


HOTKEY_SECTION_PAGE::HOTKEY_SECTION_PAGE( HOTKEYS_EDITOR_DIALOG* aDialog,
                                          wxNotebook*     aParent,
                                          const wxString& aTitle,
                                          EDA_HOTKEY_CONFIG* aSection ) :
    wxPanel( aParent, -1, wxDefaultPosition, wxDefaultSize,
             wxTAB_TRAVERSAL | wxBORDER_SUNKEN ),
    m_hotkeySection( aSection ),
    m_dialog( aDialog )
{
{
    m_table->RestoreFrom( m_hotkeys );
    aParent->AddPage( this, aTitle );
    m_curEditingRow = -1;

	wxBoxSizer* bMainSizer = new wxBoxSizer( wxVERTICAL );


    for( int i = 0; i < m_hotkeyGrid->GetNumberRows(); ++i )
	this->SetSizer( bMainSizer );
        SetHotkeyCellState( i, false );

	m_hotkeyList = new HOTKEY_LIST_CTRL( this, aSection );
	bMainSizer->Add( m_hotkeyList, 1, wxALL|wxEXPAND, 5 );
}


void HOTKEY_SECTION_PAGE::Restore()
{
    m_hotkeyList->RestoreFrom( m_hotkeySection );


    m_hotkeyGrid->Refresh();
    Update();
    Update();
}
}




void HOTKEYS_EDITOR_DIALOG::SetHotkeyCellState( int aRow, bool aHightlight )
void InstallHotkeyFrame( EDA_DRAW_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys )
{
{
    if( aHightlight )
    HOTKEYS_EDITOR_DIALOG dialog( aParent, aHotkeys );

    int diag = dialog.ShowModal();
    if( diag == wxID_OK )
    {
    {
        m_hotkeyGrid->SetCellTextColour( aRow, 1, *wxRED );
        aParent->ReCreateMenuBar();
        wxFont bold_font(m_hotkeyGrid->GetDefaultCellFont() );
        aParent->Refresh();
        bold_font.SetWeight(wxFONTWEIGHT_BOLD);
        m_hotkeyGrid->SetCellFont( aRow, 1, bold_font );
    }
    }
    else
}


HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME*    aParent,
                                              EDA_HOTKEY_CONFIG* aHotkeys ) :
    HOTKEYS_EDITOR_DIALOG_BASE( aParent ),
    m_parent( aParent ),
    m_hotkeys( aHotkeys )
{
    EDA_HOTKEY_CONFIG* section;

    for( section = m_hotkeys; section->m_HK_InfoList; section++ )
    {
    {
        m_hotkeyGrid->SetCellTextColour( aRow, 1, m_hotkeyGrid->GetDefaultCellTextColour() );
        m_hotkeySectionPages.push_back(new HOTKEY_SECTION_PAGE( this, m_hotkeySections, _( *section->m_Title ), section ));
        m_hotkeyGrid->SetCellFont( aRow, 1, m_hotkeyGrid->GetDefaultCellFont() );
    }
    }

    m_OKButton->SetDefault();
    Center();
}
}




void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event )
void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event )
{
{
    if( m_curEditingRow != -1 )
    std::vector<HOTKEY_SECTION_PAGE*>::iterator i;
        SetHotkeyCellState( m_curEditingRow, false );


    int newRow = event.GetRow();
    for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i )
    {
        std::vector<EDA_HOTKEY*>& hotkey_vec = (*i)->GetHotkeys();
        EDA_HOTKEY_CONFIG* section = (*i)->GetHotkeySection();

        EDA_HOTKEY** info_ptr;


    if( ( event.GetCol() != 1 ) || ( m_table->IsHeader( newRow ) ) )
        for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ )
        {
        {
        m_curEditingRow = -1;
            EDA_HOTKEY* info = *info_ptr;
    }

    else
            /* find the corresponding hotkey */
            std::vector<EDA_HOTKEY*>::iterator j;

            for( j = hotkey_vec.begin(); j != hotkey_vec.end(); ++j )
            {
                if( (*j) && (*j)->m_Idcommand == info->m_Idcommand )
                {
                {
        m_curEditingRow = newRow;
                    info->m_KeyCode = (*j)->m_KeyCode;
        SetHotkeyCellState( m_curEditingRow, true );
                    break;
                }
            }
        }
        }
    m_hotkeyGrid->Refresh();
    Update();
    }
    }




/** OnRightClickOnCell
    /* save the hotkeys */
 * If a cell is selected, display a list of keys for selection
    m_parent->WriteHotkeyConfig( m_hotkeys );
 * The list is restricted to keys that cannot be entered:

 * tab, home, return ... because these keys have special functions in dialogs
    EndModal( wxID_OK );
 */
void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event )
{
    // Select the new cell if needed
    OnClickOnCell(event);

    if( m_curEditingRow == -1 )
        return;

    // Do not translate these key names. They are internally used.
    // See hotkeys_basic.cpp
    #define C_COUNT 9
    wxString choices[C_COUNT] =
    {
        wxT("End")
        wxT("Tab"),
        wxT("Ctrl+Tab"),
        wxT("Alt+Tab"),
        wxT("Home"),
        wxT("Space"),
        wxT("Ctrl+Space"),
        wxT("Alt+Space"),
        wxT("Return")
    };

    wxString keyname = wxGetSingleChoice( _( "Special keys only. For others keys, use keyboard" ),
                                          _( "Select a key" ), C_COUNT, choices, this );
    int key = KeyCodeFromKeyName( keyname );

    if( key == 0 )
        return;

    m_table->SetKeyCode( m_curEditingRow, key );
    m_hotkeyGrid->Refresh();
    Update();
}
}




void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event )
void HOTKEYS_EDITOR_DIALOG::CancelClicked( wxCommandEvent& event )
{
{
    if( m_curEditingRow != -1 )
    EndModal( wxID_CANCEL );
}


/**
 * Function UndoClicked
 * Reinit the hotkeys to the initial state (remove all pending changes
 *
 * @param aEvent is the button press event, unused
 */
void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& aEvent )
{
{
        long key = event.GetKeyCode();
    std::vector<HOTKEY_SECTION_PAGE*>::iterator i;


        switch( key )
    for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i )
    {
    {
        case WXK_ESCAPE:
        (*i)->Restore();
            SetHotkeyCellState( m_curEditingRow, false );
    }
            m_curEditingRow = -1;
}
            break;


        default:
            if( event.ControlDown() )
                key |= GR_KB_CTRL;


            if( event.AltDown() )
bool HOTKEYS_EDITOR_DIALOG::CanSetKey( long aKey, const wxString* sectionTag )
                key |= GR_KB_ALT;
{
    std::vector<HOTKEY_SECTION_PAGE*>::iterator i;


            if( event.ShiftDown() && (key > 256) )
    EDA_HOTKEY* conflictingKey = NULL;
                key |= GR_KB_SHIFT;
    HOTKEY_SECTION_PAGE* conflictingSection = NULL;


            // Remap Ctrl A (=1+GR_KB_CTRL) to Ctrl Z(=26+GR_KB_CTRL)
    for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i )
            // to GR_KB_CTRL+'A' .. GR_KB_CTRL+'Z'
    {
            if( (key > GR_KB_CTRL) && (key <= GR_KB_CTRL+26) )
        // Any non Common section can only conflict with itself and Common
                key += ('A' - 1);
        if( *sectionTag != g_CommonSectionTag
                 && *((*i)->GetHotkeySection()->m_SectionTag) != g_CommonSectionTag
                 && *((*i)->GetHotkeySection()->m_SectionTag) != *sectionTag )
            continue;


            if( key >= 'a' && key <= 'z' ) // convert to uppercase
        std::vector<EDA_HOTKEY*>& hotkey_vec = (*i)->GetHotkeys();
                key = key + ('A' - 'a');
        /* find the corresponding hotkey */
        std::vector<EDA_HOTKEY*>::iterator j;


#if 0       // For debug only
        for( j = hotkey_vec.begin(); j != hotkey_vec.end(); ++j )
            wxString msg;
        {
            msg.Printf(wxT("key %X, keycode %X"),event.GetKeyCode(), key);
            if( aKey == (*j)->m_KeyCode )
            wxMessageBox(msg);
            {
#endif
                conflictingKey = (*j);
            // See if this key code is handled in hotkeys names list
                conflictingSection = (*i);
            bool exists;
            KeyNameFromKeyCode( key, &exists );


            if( !exists )   // not handled, see hotkeys_basic.cpp
                break;
            }
        }
    }

    if( conflictingKey != NULL )
    {
        wxString msg = wxString::Format(
            _( "<%s> is already assigned to \"%s\" in section \"%s\". Are you sure you want to change its assignment?" ),
            KeyNameFromKeyCode( aKey ), conflictingKey->m_InfoMsg, *(conflictingSection->GetHotkeySection()->m_Title)
            );

        wxMessageDialog dlg( this, msg, _( "Confirm change" ), wxYES_NO | wxNO_DEFAULT );

        if( dlg.ShowModal() == wxID_YES )
        {
        {
                wxMessageBox( _( "Hotkey code not handled" ) );
            conflictingKey->m_KeyCode = 0;
            return true;
        }
        }
        else
        else
        {
        {
                m_table->SetKeyCode( m_curEditingRow, key );
            return false;
            }

            break;
        }
        }
    }
    }


    m_hotkeyGrid->Refresh();
    return true;
    Update();
}
}
+9 −34
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct  8 2012)
// C++ code generated with wxFormBuilder (version Jun  6 2014)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -14,37 +14,18 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	
	wxBoxSizer* bMainSizer;
	wxBoxSizer* bMainSizer;
	bMainSizer = new wxBoxSizer( wxHORIZONTAL );
	bMainSizer = new wxBoxSizer( wxVERTICAL );
	
	
	m_hotkeyGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER|wxTAB_TRAVERSAL|wxWANTS_CHARS );
	m_staticText1 = new wxStaticText( this, wxID_ANY, _("Select a row and press a new key combination to alter the binding."), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText1->Wrap( 400 );
	bMainSizer->Add( m_staticText1, 0, wxALL|wxEXPAND, 5 );
	
	
	// Grid
	m_hotkeySections = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
	m_hotkeyGrid->CreateGrid( 1, 2 );
	m_hotkeyGrid->EnableEditing( false );
	m_hotkeyGrid->EnableGridLines( true );
	m_hotkeyGrid->EnableDragGridSize( false );
	m_hotkeyGrid->SetMargins( 0, 0 );
	
	
	// Columns
	bMainSizer->Add( m_hotkeySections, 1, wxEXPAND | wxALL, 5 );
	m_hotkeyGrid->AutoSizeColumns();
	m_hotkeyGrid->EnableDragColMove( false );
	m_hotkeyGrid->EnableDragColSize( true );
	m_hotkeyGrid->SetColLabelSize( 30 );
	m_hotkeyGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
	
	// Rows
	m_hotkeyGrid->EnableDragRowSize( true );
	m_hotkeyGrid->SetRowLabelSize( 0 );
	m_hotkeyGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
	
	// Label Appearance
	
	// Cell Defaults
	m_hotkeyGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
	bMainSizer->Add( m_hotkeyGrid, 1, wxALL|wxEXPAND, 5 );
	
	
	wxBoxSizer* b_buttonsSizer;
	wxBoxSizer* b_buttonsSizer;
	b_buttonsSizer = new wxBoxSizer( wxVERTICAL );
	b_buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
	
	
	m_OKButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
	m_OKButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
	b_buttonsSizer->Add( m_OKButton, 0, wxALL|wxEXPAND, 5 );
	b_buttonsSizer->Add( m_OKButton, 0, wxALL|wxEXPAND, 5 );
@@ -56,16 +37,13 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
	b_buttonsSizer->Add( m_undoButton, 0, wxALL|wxEXPAND, 5 );
	b_buttonsSizer->Add( m_undoButton, 0, wxALL|wxEXPAND, 5 );
	
	
	
	
	bMainSizer->Add( b_buttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
	bMainSizer->Add( b_buttonsSizer, 0, wxALIGN_CENTER|wxALIGN_RIGHT, 5 );
	
	
	
	
	this->SetSizer( bMainSizer );
	this->SetSizer( bMainSizer );
	this->Layout();
	this->Layout();
	
	
	// Connect Events
	// Connect Events
	m_hotkeyGrid->Connect( wxEVT_CHAR, wxKeyEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnKeyPressed ), NULL, this );
	m_hotkeyGrid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnRightClickOnCell ), NULL, this );
	m_hotkeyGrid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnClickOnCell ), NULL, this );
	m_OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnOKClicked ), NULL, this );
	m_OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnOKClicked ), NULL, this );
	 m_cancelButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::CancelClicked ), NULL, this );
	 m_cancelButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::CancelClicked ), NULL, this );
	m_undoButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::UndoClicked ), NULL, this );
	m_undoButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::UndoClicked ), NULL, this );
@@ -74,9 +52,6 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
HOTKEYS_EDITOR_DIALOG_BASE::~HOTKEYS_EDITOR_DIALOG_BASE()
HOTKEYS_EDITOR_DIALOG_BASE::~HOTKEYS_EDITOR_DIALOG_BASE()
{
{
	// Disconnect Events
	// Disconnect Events
	m_hotkeyGrid->Disconnect( wxEVT_CHAR, wxKeyEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnKeyPressed ), NULL, this );
	m_hotkeyGrid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnRightClickOnCell ), NULL, this );
	m_hotkeyGrid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnClickOnCell ), NULL, this );
	m_OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnOKClicked ), NULL, this );
	m_OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnOKClicked ), NULL, this );
	 m_cancelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::CancelClicked ), NULL, this );
	 m_cancelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::CancelClicked ), NULL, this );
	m_undoButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::UndoClicked ), NULL, this );
	m_undoButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::UndoClicked ), NULL, this );
+105 −79

File changed.

Preview size limit exceeded, changes collapsed.

+9 −10
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct  8 2012)
// C++ code generated with wxFormBuilder (version Jun  6 2014)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -14,12 +14,13 @@
class DIALOG_SHIM;
class DIALOG_SHIM;


#include "dialog_shim.h"
#include "dialog_shim.h"
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/string.h>
#include <wx/font.h>
#include <wx/stattext.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/notebook.h>
#include <wx/button.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/sizer.h>
#include <wx/dialog.h>
#include <wx/dialog.h>
@@ -35,15 +36,13 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public DIALOG_SHIM
	private:
	private:
	
	
	protected:
	protected:
		wxGrid* m_hotkeyGrid;
		wxStaticText* m_staticText1;
		wxNotebook* m_hotkeySections;
		wxButton* m_OKButton;
		wxButton* m_OKButton;
		wxButton*  m_cancelButton;
		wxButton*  m_cancelButton;
		wxButton* m_undoButton;
		wxButton* m_undoButton;
		
		
		// Virtual event handlers, overide them in your derived class
		// Virtual event handlers, overide them in your derived class
		virtual void OnKeyPressed( wxKeyEvent& event ) { event.Skip(); }
		virtual void OnRightClickOnCell( wxGridEvent& event ) { event.Skip(); }
		virtual void OnClickOnCell( wxGridEvent& event ) { event.Skip(); }
		virtual void OnOKClicked( wxCommandEvent& event ) { event.Skip(); }
		virtual void OnOKClicked( wxCommandEvent& event ) { event.Skip(); }
		virtual void CancelClicked( wxCommandEvent& event ) { event.Skip(); }
		virtual void CancelClicked( wxCommandEvent& event ) { event.Skip(); }
		virtual void UndoClicked( wxCommandEvent& event ) { event.Skip(); }
		virtual void UndoClicked( wxCommandEvent& event ) { event.Skip(); }
@@ -51,7 +50,7 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public DIALOG_SHIM
	
	
	public:
	public:
		
		
		HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 304,235 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); 
		HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 450,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); 
		~HOTKEYS_EDITOR_DIALOG_BASE();
		~HOTKEYS_EDITOR_DIALOG_BASE();
	
	
};
};
Loading