Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
d5ecafd5
Commit
d5ecafd5
authored
Sep 21, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some minor issues in hotkey dialogs
parent
3053d45b
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
449 additions
and
317 deletions
+449
-317
dialog_hotkeys_editor.cpp
common/dialogs/dialog_hotkeys_editor.cpp
+4
-4
dialog_hotkeys_editor_base.cpp
common/dialogs/dialog_hotkeys_editor_base.cpp
+4
-2
dialog_hotkeys_editor_base.fbp
common/dialogs/dialog_hotkeys_editor_base.fbp
+376
-249
dialog_hotkeys_editor_base.h
common/dialogs/dialog_hotkeys_editor_base.h
+10
-6
hotkey_grid_table.cpp
common/hotkey_grid_table.cpp
+44
-44
hotkeys_basic.cpp
common/hotkeys_basic.cpp
+6
-7
dialog_hotkeys_editor.h
include/dialog_hotkeys_editor.h
+1
-1
hotkey_grid_table.h
include/hotkey_grid_table.h
+4
-4
No files found.
common/dialogs/dialog_hotkeys_editor.cpp
View file @
d5ecafd5
...
...
@@ -54,7 +54,7 @@ HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent,
m_hotkeys
=
hotkeys
;
m_curEditingRow
=
-
1
;
m_table
=
new
H
otkeyGridTable
(
hotkeys
);
m_table
=
new
H
OTKEY_EDITOR_GRID_TABLE
(
hotkeys
);
m_hotkeyGrid
->
SetTable
(
m_table
,
true
);
m_hotkeyGrid
->
AutoSizeColumn
(
0
);
...
...
@@ -76,7 +76,7 @@ HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent,
void
HOTKEYS_EDITOR_DIALOG
::
OnOKClicked
(
wxCommandEvent
&
event
)
{
/* edit the live hotkey table */
H
otkeyGridTable
::
hotkey_spec_vector
&
hotkey_vec
=
m_table
->
getHotkeys
();
H
OTKEY_EDITOR_GRID_TABLE
::
hotkey_spec_vector
&
hotkey_vec
=
m_table
->
getHotkeys
();
EDA_HOTKEY_CONFIG
*
section
;
...
...
@@ -91,7 +91,7 @@ void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event )
EDA_HOTKEY
*
info
=
*
info_ptr
;
/* find the corresponding hotkey */
H
otkeyGridTable
::
hotkey_spec_vector
::
iterator
i
;
H
OTKEY_EDITOR_GRID_TABLE
::
hotkey_spec_vector
::
iterator
i
;
for
(
i
=
hotkey_vec
.
begin
();
i
!=
hotkey_vec
.
end
();
++
i
)
{
...
...
@@ -158,7 +158,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event )
int
newRow
=
event
.
GetRow
();
if
(
(
event
.
GetCol
()
!=
1
)
||
(
m_table
->
i
sHeader
(
newRow
)
)
)
if
(
(
event
.
GetCol
()
!=
1
)
||
(
m_table
->
I
sHeader
(
newRow
)
)
)
{
m_curEditingRow
=
-
1
;
}
...
...
common/dialogs/dialog_hotkeys_editor_base.cpp
View file @
d5ecafd5
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Sep 8 2010
)
// C++ code generated with wxFormBuilder (version
Oct 8 2012
)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
...
...
@@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
HOTKEYS_EDITOR_DIALOG_BASE
::
HOTKEYS_EDITOR_DIALOG_BASE
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
:
wxDialog
(
parent
,
id
,
title
,
pos
,
size
,
style
)
HOTKEYS_EDITOR_DIALOG_BASE
::
HOTKEYS_EDITOR_DIALOG_BASE
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
:
DIALOG_SHIM
(
parent
,
id
,
title
,
pos
,
size
,
style
)
{
this
->
SetSizeHints
(
wxDefaultSize
,
wxDefaultSize
);
...
...
@@ -55,8 +55,10 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
m_undoButton
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Undo"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
b_buttonsSizer
->
Add
(
m_undoButton
,
0
,
wxALL
|
wxEXPAND
,
5
);
bMainSizer
->
Add
(
b_buttonsSizer
,
0
,
wxALIGN_CENTER_VERTICAL
,
5
);
this
->
SetSizer
(
bMainSizer
);
this
->
Layout
();
...
...
common/dialogs/dialog_hotkeys_editor_base.fbp
View file @
d5ecafd5
This diff is collapsed.
Click to expand it.
common/dialogs/dialog_hotkeys_editor_base.h
View file @
d5ecafd5
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Sep 8 2010
)
// C++ code generated with wxFormBuilder (version
Oct 8 2012
)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __
dialog_hotkeys_editor_base
__
#define __
dialog_hotkeys_editor_base
__
#ifndef __
DIALOG_HOTKEYS_EDITOR_BASE_H
__
#define __
DIALOG_HOTKEYS_EDITOR_BASE_H
__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class
DIALOG_SHIM
;
#include "dialog_shim.h"
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
...
...
@@ -26,7 +30,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class HOTKEYS_EDITOR_DIALOG_BASE
///////////////////////////////////////////////////////////////////////////////
class
HOTKEYS_EDITOR_DIALOG_BASE
:
public
wxDialog
class
HOTKEYS_EDITOR_DIALOG_BASE
:
public
DIALOG_SHIM
{
private
:
...
...
@@ -52,4 +56,4 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public wxDialog
};
#endif //__
dialog_hotkeys_editor_base
__
#endif //__
DIALOG_HOTKEYS_EDITOR_BASE_H
__
common/hotkey_grid_table.cpp
View file @
d5ecafd5
...
...
@@ -4,174 +4,179 @@
* Reads the hotkey table from its stored format into a format suitable
* for a wxGrid.
*/
HotkeyGridTable
::
HotkeyGridTable
(
struct
EDA_HOTKEY_CONFIG
*
origin
)
:
wxGridTableBase
(),
m_hotkeys
()
HOTKEY_EDITOR_GRID_TABLE
::
HOTKEY_EDITOR_GRID_TABLE
(
struct
EDA_HOTKEY_CONFIG
*
origin
)
:
wxGridTableBase
(),
m_hotkeys
()
{
EDA_HOTKEY_CONFIG
*
section
;
for
(
section
=
origin
;
section
->
m_HK_InfoList
;
section
++
)
{
hotkey_spec
spec
(
*
section
->
m_SectionTag
,
new
EDA_HOTKEY
(
NULL
,
0
,
0
)
);
// Add a dummy hotkey_spec which is a header before each hotkey list
hotkey_spec
spec
(
*
section
->
m_SectionTag
,
NULL
);
m_hotkeys
.
push_back
(
spec
);
EDA_HOTKEY
**
info_ptr
;
EDA_HOTKEY
**
hotkey_descr_list
;
for
(
info_ptr
=
section
->
m_HK_InfoList
;
*
info_ptr
;
info_ptr
++
)
// Add hotkeys descr
for
(
hotkey_descr_list
=
section
->
m_HK_InfoList
;
*
hotkey_descr_list
;
hotkey_descr_list
++
)
{
EDA_HOTKEY
*
info
=
*
info_ptr
;
hotkey_spec
spec
(
*
section
->
m_SectionTag
,
new
EDA_HOTKEY
(
info
)
);
EDA_HOTKEY
*
hotkey_descr
=
*
hotkey_descr_list
;
hotkey_spec
spec
(
*
section
->
m_SectionTag
,
new
EDA_HOTKEY
(
hotkey_descr
)
);
m_hotkeys
.
push_back
(
spec
);
}
}
}
H
otkeyGridTable
::
hotkey_spec_vector
&
HotkeyGridTable
::
getHotkeys
()
H
OTKEY_EDITOR_GRID_TABLE
::
hotkey_spec_vector
&
HOTKEY_EDITOR_GRID_TABLE
::
getHotkeys
()
{
return
m_hotkeys
;
}
int
H
otkeyGridTable
::
GetNumberRows
()
int
H
OTKEY_EDITOR_GRID_TABLE
::
GetNumberRows
()
{
return
m_hotkeys
.
size
();
}
int
H
otkeyGridTable
::
GetNumberCols
()
int
H
OTKEY_EDITOR_GRID_TABLE
::
GetNumberCols
()
{
return
2
;
}
bool
H
otkeyGridTable
::
IsEmptyCell
(
int
row
,
int
col
)
bool
H
OTKEY_EDITOR_GRID_TABLE
::
IsEmptyCell
(
int
row
,
int
col
)
{
return
col
==
1
&&
m_hotkeys
[
row
].
second
==
0
;
return
col
==
1
&&
m_hotkeys
[
row
].
second
==
NULL
;
}
wxString
H
otkeyGridTable
::
GetValue
(
int
row
,
int
col
)
wxString
H
OTKEY_EDITOR_GRID_TABLE
::
GetValue
(
int
row
,
int
col
)
{
EDA_HOTKEY
*
hotkey_descr
=
m_hotkeys
[
row
].
second
;
if
(
col
==
0
)
{
if
(
m_hotkeys
[
row
].
second
==
0
)
if
(
hotkey_descr
==
NULL
)
{
// section header
return
m_hotkeys
[
row
].
first
;
}
else
{
return
m_hotkeys
[
row
].
second
->
m_InfoMsg
;
return
hotkey_descr
->
m_InfoMsg
;
}
}
else
{
if
(
m_hotkeys
[
row
].
second
==
0
)
if
(
hotkey_descr
==
NULL
)
{
return
wxString
();
// section header
return
wxEmptyString
;
}
else
{
return
ReturnKeyNameFromKeyCode
(
m_hotkeys
[
row
].
second
->
m_KeyCode
);
return
ReturnKeyNameFromKeyCode
(
hotkey_descr
->
m_KeyCode
);
}
}
}
void
H
otkeyGridTable
::
SetValue
(
int
row
,
int
col
,
const
wxString
&
value
)
void
H
OTKEY_EDITOR_GRID_TABLE
::
SetValue
(
int
row
,
int
col
,
const
wxString
&
value
)
{
}
wxString
H
otkeyGridTable
::
GetTypeName
(
int
row
,
int
col
)
wxString
H
OTKEY_EDITOR_GRID_TABLE
::
GetTypeName
(
int
row
,
int
col
)
{
return
wxGRID_VALUE_STRING
;
}
bool
H
otkeyGridTable
::
CanGetValueAs
(
int
row
,
int
col
,
const
wxString
&
typeName
)
bool
H
OTKEY_EDITOR_GRID_TABLE
::
CanGetValueAs
(
int
row
,
int
col
,
const
wxString
&
typeName
)
{
return
typeName
==
wxGRID_VALUE_STRING
&&
col
==
2
;
}
bool
H
otkeyGridTable
::
CanSetValueAs
(
int
row
,
int
col
,
const
wxString
&
typeName
)
bool
H
OTKEY_EDITOR_GRID_TABLE
::
CanSetValueAs
(
int
row
,
int
col
,
const
wxString
&
typeName
)
{
return
false
;
}
long
H
otkeyGridTable
::
GetValueAsLong
(
int
row
,
int
col
)
long
H
OTKEY_EDITOR_GRID_TABLE
::
GetValueAsLong
(
int
row
,
int
col
)
{
return
-
1L
;
}
double
H
otkeyGridTable
::
GetValueAsDouble
(
int
row
,
int
col
)
double
H
OTKEY_EDITOR_GRID_TABLE
::
GetValueAsDouble
(
int
row
,
int
col
)
{
return
0.0
;
}
bool
H
otkeyGridTable
::
GetValueAsBool
(
int
row
,
int
col
)
bool
H
OTKEY_EDITOR_GRID_TABLE
::
GetValueAsBool
(
int
row
,
int
col
)
{
return
false
;
}
void
H
otkeyGridTable
::
SetValueAsLong
(
int
row
,
int
col
,
long
value
)
void
H
OTKEY_EDITOR_GRID_TABLE
::
SetValueAsLong
(
int
row
,
int
col
,
long
value
)
{
}
void
H
otkeyGridTable
::
SetValueAsDouble
(
int
row
,
int
col
,
double
value
)
void
H
OTKEY_EDITOR_GRID_TABLE
::
SetValueAsDouble
(
int
row
,
int
col
,
double
value
)
{
}
void
H
otkeyGridTable
::
SetValueAsBool
(
int
row
,
int
col
,
bool
value
)
void
H
OTKEY_EDITOR_GRID_TABLE
::
SetValueAsBool
(
int
row
,
int
col
,
bool
value
)
{
}
void
*
H
otkeyGridTable
::
GetValueAsCustom
(
int
row
,
int
col
)
void
*
H
OTKEY_EDITOR_GRID_TABLE
::
GetValueAsCustom
(
int
row
,
int
col
)
{
return
0
;
}
void
H
otkeyGridTable
::
SetValueAsCustom
(
int
row
,
int
col
,
void
*
value
)
void
H
OTKEY_EDITOR_GRID_TABLE
::
SetValueAsCustom
(
int
row
,
int
col
,
void
*
value
)
{
}
wxString
H
otkeyGridTable
::
GetColLabelValue
(
int
col
)
wxString
H
OTKEY_EDITOR_GRID_TABLE
::
GetColLabelValue
(
int
col
)
{
return
col
==
0
?
_
(
"Command"
)
:
_
(
"Hotkey"
);
}
bool
H
otkeyGridTable
::
i
sHeader
(
int
row
)
bool
H
OTKEY_EDITOR_GRID_TABLE
::
I
sHeader
(
int
row
)
{
return
m_hotkeys
[
row
].
second
==
0
;
return
m_hotkeys
[
row
].
second
==
NULL
;
}
void
H
otkeyGridTable
::
SetKeyCode
(
int
row
,
long
key
)
void
H
OTKEY_EDITOR_GRID_TABLE
::
SetKeyCode
(
int
row
,
long
key
)
{
m_hotkeys
[
row
].
second
->
m_KeyCode
=
key
;
}
void
H
otkeyGridTable
::
RestoreFrom
(
struct
EDA_HOTKEY_CONFIG
*
origin
)
void
H
OTKEY_EDITOR_GRID_TABLE
::
RestoreFrom
(
struct
EDA_HOTKEY_CONFIG
*
origin
)
{
int
row
=
0
;
EDA_HOTKEY_CONFIG
*
section
;
for
(
section
=
origin
;
section
->
m_HK_InfoList
;
section
++
)
{
++
row
;
++
row
;
// Skip header
EDA_HOTKEY
**
info_ptr
;
for
(
info_ptr
=
section
->
m_HK_InfoList
;
*
info_ptr
;
info_ptr
++
)
...
...
@@ -183,15 +188,10 @@ void HotkeyGridTable::RestoreFrom( struct EDA_HOTKEY_CONFIG* origin )
}
H
otkeyGridTable
::~
HotkeyGridTable
()
H
OTKEY_EDITOR_GRID_TABLE
::~
HOTKEY_EDITOR_GRID_TABLE
()
{
hotkey_spec_vector
::
iterator
i
;
for
(
i
=
m_hotkeys
.
begin
();
i
!=
m_hotkeys
.
end
();
++
i
)
{
if
(
i
->
second
)
{
delete
i
->
second
;
}
}
}
common/hotkeys_basic.cpp
View file @
d5ecafd5
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 20
07 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 20
13 Jean-Pierre Charras, j-p.charras at wanadoo.fr
* Copyright (C) 2010-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
...
...
@@ -212,17 +212,12 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
*/
static
void
AddModifierToKey
(
wxString
&
aFullKey
,
const
wxString
&
aKey
)
{
#if 0 // set to 0 for new behavior, 1 for old
aFullKey << wxT( " <" ) << aKey << wxT( ">" );
#else
if
(
(
aKey
.
Length
()
==
1
)
&&
(
aKey
[
0
]
>=
'A'
)
&&
(
aKey
[
0
]
<=
'Z'
))
// We can use Shift+<key> as accelerator an
s
<key> for hot key
// We can use Shift+<key> as accelerator an
d
<key> for hot key
aFullKey
<<
wxT
(
"
\t
"
)
<<
MODIFIER_SHIFT
<<
aKey
;
else
// We must use Alt+<key> as accelerator ans <key> for hot key
aFullKey
<<
wxT
(
"
\t
"
)
<<
MODIFIER_ALT
<<
aKey
;
#endif
}
/* AddHotkeyName
...
...
@@ -430,6 +425,10 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescL
if
(
!
hk_decr
->
m_InfoMsg
.
Contains
(
wxT
(
"Macros"
)
)
)
{
keyname
=
ReturnKeyNameFromKeyCode
(
hk_decr
->
m_KeyCode
);
// Some chars should be modified, using html encoding, to be
// displayed by DisplayHtmlInfoMessage()
keyname
.
Replace
(
wxT
(
"<"
),
wxT
(
"<"
)
);
keyname
.
Replace
(
wxT
(
">"
),
wxT
(
">"
)
);
msg
+=
wxT
(
"<tr><td>"
)
+
hk_decr
->
m_InfoMsg
+
wxT
(
"</td>"
);
msg
+=
wxT
(
"<td><b> "
)
+
keyname
+
wxT
(
"</b></td></tr>"
);
}
...
...
include/dialog_hotkeys_editor.h
View file @
d5ecafd5
...
...
@@ -26,7 +26,7 @@ class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE
protected
:
EDA_DRAW_FRAME
*
m_parent
;
struct
EDA_HOTKEY_CONFIG
*
m_hotkeys
;
H
otkeyGridTable
*
m_table
;
H
OTKEY_EDITOR_GRID_TABLE
*
m_table
;
int
m_curEditingRow
;
...
...
include/hotkey_grid_table.h
View file @
d5ecafd5
...
...
@@ -14,15 +14,15 @@
#include <common.h>
#include <hotkeys_basic.h>
class
H
otkeyGridTable
:
public
wxGridTableBase
class
H
OTKEY_EDITOR_GRID_TABLE
:
public
wxGridTableBase
{
public
:
typedef
std
::
pair
<
wxString
,
EDA_HOTKEY
*
>
hotkey_spec
;
typedef
std
::
vector
<
hotkey_spec
>
hotkey_spec_vector
;
H
otkeyGridTable
(
struct
EDA_HOTKEY_CONFIG
*
origin
);
virtual
~
H
otkeyGridTable
();
H
OTKEY_EDITOR_GRID_TABLE
(
struct
EDA_HOTKEY_CONFIG
*
origin
);
virtual
~
H
OTKEY_EDITOR_GRID_TABLE
();
hotkey_spec_vector
&
getHotkeys
();
private
:
...
...
@@ -45,7 +45,7 @@ private:
virtual
wxString
GetColLabelValue
(
int
col
);
public
:
virtual
bool
i
sHeader
(
int
row
);
virtual
bool
I
sHeader
(
int
row
);
virtual
void
SetKeyCode
(
int
row
,
long
key
);
virtual
void
RestoreFrom
(
struct
EDA_HOTKEY_CONFIG
*
origin
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment