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
41a643c1
Commit
41a643c1
authored
Nov 11, 2007
by
g_harland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"Colors" dialog box has been enhanced
parent
b78ccb72
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
58 deletions
+49
-58
change_log.txt
change_log.txt
+5
-0
selcolor.cpp
common/selcolor.cpp
+44
-58
No files found.
change_log.txt
View file @
41a643c1
...
@@ -6,6 +6,11 @@ email address.
...
@@ -6,6 +6,11 @@ email address.
2007-Nov-11 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
2007-Nov-11 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
================================================================================
+ eeschema & pcbnew & gerbview
* The "Colors" dialog box has been enhanced; the distance between adjacent
controls now increases (and in both horizontal and vertical directions)
when that dialog is resized. And the "Cancel" button is no longer centre-
justified; it is now right-justifed instead.
+ eeschema
+ eeschema
* A wxStdDialogButtonSizer is now used within the "EESchema Colors" dialog box,
* A wxStdDialogButtonSizer is now used within the "EESchema Colors" dialog box,
meaning that the sequence of the "OK", "Cancel", and "Apply" buttons within
meaning that the sequence of the "OK", "Cancel", and "Apply" buttons within
...
...
common/selcolor.cpp
View file @
41a643c1
/****************/
/****************/
/* SE
T
COLOR.CPP */
/* SE
L
COLOR.CPP */
/****************/
/****************/
/* Affichage et selection de la palette des couleurs disponibles
/* Affichage et selection de la palette des couleurs disponibles
* dans une frame
* dans une frame
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
enum
colors_id
{
enum
colors_id
{
ID_COLOR_BLACK
=
2000
,
// ID_COLOR_ = ID_COLOR_BLACK a ID_COLOR_BLACK + 31
ID_COLOR_BLACK
=
2000
// ID_COLOR_ = ID_COLOR_BLACK a ID_COLOR_BLACK + 31
};
};
...
@@ -73,45 +73,51 @@ int color;
...
@@ -73,45 +73,51 @@ int color;
WinEDA_SelColorFrame
::
WinEDA_SelColorFrame
(
wxWindow
*
parent
,
WinEDA_SelColorFrame
::
WinEDA_SelColorFrame
(
wxWindow
*
parent
,
const
wxPoint
&
framepos
,
int
OldColor
)
:
const
wxPoint
&
framepos
,
int
OldColor
)
:
wxDialog
(
parent
,
-
1
,
_
(
"Colors"
),
framepos
,
wxDefaultSize
,
wxDialog
(
parent
,
-
1
,
_
(
"Colors"
),
framepos
,
wxDefaultSize
,
DIALOG_STYLE
)
wxDEFAULT_DIALOG_STYLE
|
MAYBE_RESIZE_BORDER
)
/*******************************************************************/
/*******************************************************************/
{
{
wxBoxSizer
*
OuterBoxSizer
=
NULL
;
wxBoxSizer
*
OuterBoxSizer
=
NULL
;
wxBoxSizer
*
MainBoxSizer
=
NULL
;
wxBoxSizer
*
MainBoxSizer
=
NULL
;
wxBoxSizer
*
ColumnBoxSizer
=
NULL
;
wxFlexGridSizer
*
FlexColumnBoxSizer
=
NULL
;
wxBoxSizer
*
RowBoxSizer
=
NULL
;
wxBitmapButton
*
BitmapButton
=
NULL
;
wxBitmapButton
*
BitmapButton
=
NULL
;
wxStaticText
*
Label
=
NULL
;
wxStaticText
*
text
=
NULL
;
wxStaticLine
*
Line
=
NULL
;
wxStaticLine
*
line
=
NULL
;
wxStdDialogButtonSizer
*
StdDialogButtonSizer
=
NULL
;
wxButton
*
Button
=
NULL
;
wxButton
*
Button
=
NULL
;
int
ii
,
butt_ID
,
buttcolor
;
int
w
=
20
,
h
=
20
;
int
ii
,
butt_ID
,
buttcolor
;
bool
ColorFound
=
false
;
int
w
=
20
,
h
=
20
;
bool
ColorFound
=
false
;
SetFont
(
*
g_DialogFont
);
SetFont
(
*
g_DialogFont
);
SetReturnCode
(
-
1
);
SetReturnCode
(
-
1
);
OuterBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
OuterBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
SetSizer
(
OuterBoxSizer
);
SetSizer
(
OuterBoxSizer
);
MainBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
MainBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
OuterBoxSizer
->
Add
(
MainBoxSizer
,
0
,
wxALIGN_CENTER_HORIZONTAL
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
OuterBoxSizer
->
Add
(
MainBoxSizer
,
1
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
for
(
ii
=
0
;
ColorRefs
[
ii
].
m_Name
!=
NULL
;
ii
++
)
for
(
ii
=
0
;
ColorRefs
[
ii
].
m_Name
!=
NULL
;
ii
++
)
{
{
// Provide a separate column for every eight buttons (and
// Provide a separate column for every eight buttons (and
their associated text
//
their associated text strings)
//
strings), so provide a FlexGrid Sizer with eight rows and two columns.
if
(
ii
%
8
==
0
)
if
(
ii
%
8
==
0
)
{
{
ColumnBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
FlexColumnBoxSizer
=
new
wxFlexGridSizer
(
8
,
2
,
0
,
0
);
MainBoxSizer
->
Add
(
ColumnBoxSizer
,
0
,
wxALIGN_TOP
|
wxTOP
,
5
);
}
// Specify that all of the rows can be expanded.
for
(
int
ii
=
0
;
ii
<
8
;
ii
++
)
{
FlexColumnBoxSizer
->
AddGrowableRow
(
ii
);
}
// Specify that the second column can also be expanded.
FlexColumnBoxSizer
->
AddGrowableCol
(
1
);
// Provide a sizer for each button and its associated text string
MainBoxSizer
->
Add
(
FlexColumnBoxSizer
,
1
,
wxGROW
|
wxTOP
,
5
);
RowBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
}
ColumnBoxSizer
->
Add
(
RowBoxSizer
,
0
,
wxALIGN_LEFT
,
5
);
butt_ID
=
ID_COLOR_BLACK
+
ii
;
butt_ID
=
ID_COLOR_BLACK
+
ii
;
wxMemoryDC
iconDC
;
wxMemoryDC
iconDC
;
...
@@ -134,7 +140,7 @@ bool ColorFound = false;
...
@@ -134,7 +140,7 @@ bool ColorFound = false;
BitmapButton
=
new
wxBitmapButton
(
this
,
butt_ID
,
ButtBitmap
,
BitmapButton
=
new
wxBitmapButton
(
this
,
butt_ID
,
ButtBitmap
,
wxDefaultPosition
,
wxSize
(
w
,
h
)
);
wxDefaultPosition
,
wxSize
(
w
,
h
)
);
RowBoxSizer
->
Add
(
BitmapButton
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxLEFT
|
wxBOTTOM
,
5
);
FlexColumnBoxSizer
->
Add
(
BitmapButton
,
0
,
wxALIGN_LEFT
|
wxALIGN_CENTER_VERTICAL
|
wxLEFT
|
wxBOTTOM
,
5
);
// Set focus to this button if its color matches the
// Set focus to this button if its color matches the
// color which had been selected previously (for
// color which had been selected previously (for
...
@@ -145,9 +151,9 @@ bool ColorFound = false;
...
@@ -145,9 +151,9 @@ bool ColorFound = false;
BitmapButton
->
SetFocus
();
BitmapButton
->
SetFocus
();
}
}
text
=
new
wxStaticText
(
this
,
-
1
,
ColorRefs
[
ii
].
m_Name
,
Label
=
new
wxStaticText
(
this
,
-
1
,
ColorRefs
[
ii
].
m_Name
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
wxDefaultPosition
,
wxDefaultSize
,
0
);
RowBoxSizer
->
Add
(
text
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
FlexColumnBoxSizer
->
Add
(
Label
,
1
,
wxALIGN_LEFT
|
wxALIGN_CENTER_VERTICAL
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
}
}
// Provide a Cancel button as well, so that this dialog
// Provide a Cancel button as well, so that this dialog
...
@@ -155,37 +161,17 @@ bool ColorFound = false;
...
@@ -155,37 +161,17 @@ bool ColorFound = false;
// (and also provide a horizontal static line to separate
// (and also provide a horizontal static line to separate
// that button from all of the other buttons).
// that button from all of the other buttons).
line
=
new
wxStaticLine
(
this
,
-
1
,
wxDefaultPosition
,
wxDefaultSize
,
wxLI_HORIZONTAL
);
Line
=
new
wxStaticLine
(
this
,
-
1
,
wxDefaultPosition
,
wxDefaultSize
,
wxLI_HORIZONTAL
);
OuterBoxSizer
->
Add
(
line
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
OuterBoxSizer
->
Add
(
Line
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
#if 0
BottomBoxSizer = new wxBoxSizer(wxHORIZONTAL);
OuterBoxSizer->Add(BottomBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
Button = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition, wxDefaultSize, 0 );
StdDialogButtonSizer
=
new
wxStdDialogButtonSizer
;
Button->SetForegroundColour( *wxRED );
OuterBoxSizer
->
Add
(
StdDialogButtonSizer
,
0
,
wxGROW
|
wxALL
,
10
);
BottomBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
Button = new wxButton( this, wxID_CANCEL, _(
"Cancel"
), wxDefaultPosition, wxDefaultSize, 0 );
Button
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Cancel"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
Button
->
SetForegroundColour
(
*
wxBLUE
);
Button
->
SetForegroundColour
(
*
wxBLUE
);
BottomBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
StdDialogButtonSizer
->
AddButton
(
Button
);
// Dialog boxes usually contain both an "OK" button and a "Cancel" button (and sometimes
StdDialogButtonSizer
->
Realize
();
// also contain an "Apply" button). The previous code implements an additional sizer
// (to contain such buttons), then installs that sizer into the outermost sizer, then
// implements "OK" and "Cancel" buttons, and then installs those buttons into that sizer.
//
// However, as this particular dialog does not contain an "OK" button (nor an "Apply"
// button), it is not necessary to provide an additional sizer to contain (just) a
// "Cancel" button; that button can be installed directly into the outermost sizer
// instead. (Note that a value of 10 has been specified for the margin surrounding that
// button; that provides the same outcome as specifying the customary value of 5 for both
// that button, and the BottomBoxSizer that it would otherwise be installed within.)
#endif
Button
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Cancel"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
Button
->
SetForegroundColour
(
*
wxBLUE
);
OuterBoxSizer
->
Add
(
Button
,
0
,
wxALIGN_CENTER_HORIZONTAL
|
wxALL
,
10
);
// Set focus to the Cancel button if the currently selected color
// Set focus to the Cancel button if the currently selected color
// does not match any of the colors provided by this dialog box.
// does not match any of the colors provided by this dialog box.
...
@@ -194,7 +180,7 @@ bool ColorFound = false;
...
@@ -194,7 +180,7 @@ bool ColorFound = false;
Button
->
SetFocus
();
Button
->
SetFocus
();
// Resize the dialog
// Resize the dialog
if
(
GetSizer
()
)
if
(
GetSizer
()
)
{
{
GetSizer
()
->
SetSizeHints
(
this
);
GetSizer
()
->
SetSizeHints
(
this
);
}
}
...
@@ -210,7 +196,7 @@ void WinEDA_SelColorFrame::OnCancel(wxCommandEvent& WXUNUSED(event))
...
@@ -210,7 +196,7 @@ void WinEDA_SelColorFrame::OnCancel(wxCommandEvent& WXUNUSED(event))
// Setting the return value to -1 indicates that the
// Setting the return value to -1 indicates that the
// dialog box has been cancelled (and thus that the
// dialog box has been cancelled (and thus that the
// previously selected color is to be retained).
// previously selected color is to be retained).
EndModal
(
-
1
);
EndModal
(
-
1
);
}
}
...
...
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