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
e4bac0d9
Commit
e4bac0d9
authored
Apr 18, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed resize issue (moved GAL panel into pane).
Tidied up event handlers.
parent
9af45c05
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
22 additions
and
122 deletions
+22
-122
drawframe.cpp
common/drawframe.cpp
+8
-5
drawpanel.cpp
common/drawpanel.cpp
+0
-15
drawpanel_gal.cpp
common/drawpanel_gal.cpp
+2
-3
cairo_gal.cpp
common/gal/cairo/cairo_gal.cpp
+3
-62
graphics_abstraction_layer.cpp
common/gal/graphics_abstraction_layer.cpp
+0
-2
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+0
-8
class_drawpanel.h
include/class_drawpanel.h
+0
-3
class_drawpanel_gal.h
include/class_drawpanel_gal.h
+0
-3
cairo_gal.h
include/gal/cairo/cairo_gal.h
+1
-10
graphics_abstraction_layer.h
include/gal/graphics_abstraction_layer.h
+0
-2
opengl_gal.h
include/gal/opengl/opengl_gal.h
+1
-8
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+3
-1
pcbframe.cpp
pcbnew/pcbframe.cpp
+4
-0
No files found.
common/drawframe.cpp
View file @
e4bac0d9
...
...
@@ -966,20 +966,23 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
view
->
SetCenter
(
VECTOR2D
(
m_canvas
->
GetScreenCenterLogicalPosition
()
)
);
m_galCanvas
->
Show
();
m_galCanvas
->
Refresh
();
// Switch panes
m_auimgr
.
GetPane
(
wxT
(
"DrawFrame"
)
).
Hide
();
m_auimgr
.
GetPane
(
wxT
(
"DrawFrameGal"
)
).
Show
();
m_auimgr
.
Update
();
}
else
{
m_galCanvas
->
Hide
();
double
zoom
=
1
/
(
zoomFactor
*
view
->
GetScale
()
);
m_canvas
->
SetZoom
(
zoom
);
VECTOR2D
center
=
view
->
GetCenter
();
RedrawScreen
(
wxPoint
(
center
.
x
,
center
.
y
),
false
);
m_canvas
->
Show
();
// Switch panes
m_auimgr
.
GetPane
(
wxT
(
"DrawFrameGal"
)
).
Hide
();
m_auimgr
.
GetPane
(
wxT
(
"DrawFrame"
)
).
Show
();
m_auimgr
.
Update
();
}
m_galCanvasActive
=
aEnable
;
...
...
common/drawpanel.cpp
View file @
e4bac0d9
...
...
@@ -75,9 +75,6 @@ BEGIN_EVENT_TABLE( EDA_DRAW_PANEL, wxScrolledWindow )
EVT_ERASE_BACKGROUND
(
EDA_DRAW_PANEL
::
OnEraseBackground
)
EVT_SCROLLWIN
(
EDA_DRAW_PANEL
::
OnScroll
)
EVT_ACTIVATE
(
EDA_DRAW_PANEL
::
OnActivate
)
#ifdef KICAD_GAL
EVT_SIZE
(
EDA_DRAW_PANEL
::
OnSize
)
#endif
EVT_MENU_RANGE
(
ID_PAN_UP
,
ID_PAN_RIGHT
,
EDA_DRAW_PANEL
::
OnPan
)
END_EVENT_TABLE
()
...
...
@@ -1381,18 +1378,6 @@ void EDA_DRAW_PANEL::OnPan( wxCommandEvent& event )
}
#ifdef KICAD_GAL
void
EDA_DRAW_PANEL
::
OnSize
(
wxSizeEvent
&
SizeEv
)
{
if
(
GetParent
()
->
GetGalCanvas
()
!=
NULL
)
{
GetParent
()
->
GetGalCanvas
()
->
SetPosition
(
GetPosition
()
);
GetParent
()
->
GetGalCanvas
()
->
SetSize
(
GetSize
()
);
}
}
#endif
void
EDA_DRAW_PANEL
::
EndMouseCapture
(
int
id
,
int
cursor
,
const
wxString
&
title
,
bool
aCallEndFunc
)
{
...
...
common/drawpanel_gal.cpp
View file @
e4bac0d9
...
...
@@ -44,8 +44,7 @@
EDA_DRAW_PANEL_GAL
::
EDA_DRAW_PANEL_GAL
(
wxWindow
*
aParentWindow
,
wxWindowID
aWindowId
,
const
wxPoint
&
aPosition
,
const
wxSize
&
aSize
,
GalType
aGalType
)
:
wxWindow
(
aParentWindow
,
aWindowId
,
aPosition
,
aSize
),
m_screenSize
(
aSize
.
x
,
aSize
.
y
),
m_parentFrame
(
aParentWindow
)
wxWindow
(
aParentWindow
,
aWindowId
,
aPosition
,
aSize
)
{
m_gal
=
NULL
;
m_view
=
NULL
;
...
...
@@ -78,7 +77,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
m_viewControls
=
new
KiGfx
::
WX_VIEW_CONTROLS
(
m_view
,
this
);
Connect
(
KiGfx
::
EVT_GAL_REDRAW
,
wxPaintEventHandler
(
EDA_DRAW_PANEL_GAL
::
onPaint
),
NULL
,
this
);
Connect
(
wxEVT_PAINT
,
wxPaintEventHandler
(
EDA_DRAW_PANEL_GAL
::
onPaint
),
NULL
,
this
);
Connect
(
wxEVT_SIZE
,
wxSizeEventHandler
(
EDA_DRAW_PANEL_GAL
::
onSize
),
NULL
,
this
);
}
...
...
common/gal/cairo/cairo_gal.cpp
View file @
e4bac0d9
...
...
@@ -52,7 +52,6 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
SetSize
(
aParent
->
GetSize
()
);
// Connecting the event handlers
Connect
(
wxEVT_SIZE
,
wxSizeEventHandler
(
CAIRO_GAL
::
onSize
)
);
Connect
(
wxEVT_PAINT
,
wxPaintEventHandler
(
CAIRO_GAL
::
onPaint
)
);
// Mouse events are skipped to the parent
...
...
@@ -115,15 +114,6 @@ void CAIRO_GAL::ResizeScreen( int aWidth, int aHeight )
allocateBitmaps
();
SetSize
(
wxSize
(
aWidth
,
aHeight
)
);
PostPaint
();
}
void
CAIRO_GAL
::
onSize
(
wxSizeEvent
&
aEvent
)
{
ResizeScreen
(
aEvent
.
GetSize
().
x
,
aEvent
.
GetSize
().
y
);
PostPaint
();
}
...
...
@@ -188,46 +178,6 @@ void CAIRO_GAL::EndDrawing()
// Force remaining objects to be drawn
Flush
();
// FIXME Accelerate support for wxWidgets 2.8.10
#if wxCHECK_VERSION( 2, 9, 0 )
// Copy the cairo image contents to the wxBitmap
wxNativePixelData
pixelData
(
*
wxBitmap_
);
if
(
!
pixelData
)
{
wxLogError
(
wxString
::
FromUTF8
(
"Can't access pixel data!"
)
);
return
;
}
wxNativePixelData
::
Iterator
pixelIterator
(
pixelData
);
int
offset
=
0
;
// Copy the cairo image to the wxDC bitmap
for
(
int
j
=
0
;
j
<
screenSize
.
y
;
j
++
)
{
offset
=
j
*
(
int
)
screenSize
.
x
;
for
(
int
column
=
0
;
column
<
clientRectangle
.
width
;
column
++
)
{
unsigned
int
value
=
bitmapBuffer
[
offset
+
column
];
pixelIterator
.
Red
()
=
value
>>
16
;
pixelIterator
.
Green
()
=
value
>>
8
;
pixelIterator
.
Blue
()
=
value
;
pixelIterator
++
;
}
pixelIterator
.
MoveTo
(
pixelData
,
0
,
j
);
}
// Blit the contents to the screen
wxClientDC
client_dc
(
this
);
wxBufferedDC
dc
(
&
client_dc
);
dc
.
DrawBitmap
(
*
wxBitmap_
,
0
,
0
);
#elif wxCHECK_VERSION( 2, 8, 0 )
// This code was taken from the wxCairo example - it's not the most efficient one
// Here is a good place for optimizations
...
...
@@ -237,12 +187,9 @@ void CAIRO_GAL::EndDrawing()
for
(
size_t
count
=
0
;
count
<
bufferSize
;
count
++
)
{
unsigned
int
value
=
bitmapBuffer
[
count
];
// Red pixel
*
wxOutputPtr
++
=
(
value
>>
16
)
&
0xff
;
// Green pixel
*
wxOutputPtr
++
=
(
value
>>
8
)
&
0xff
;
// Blue pixel
*
wxOutputPtr
++
=
(
value
>>
0
)
&
0xff
;
*
wxOutputPtr
++
=
(
value
>>
16
)
&
0xff
;
// Red pixel
*
wxOutputPtr
++
=
(
value
>>
8
)
&
0xff
;
// Green pixel
*
wxOutputPtr
++
=
value
&
0xff
;
// Blue pixel
}
wxImage
img
(
(
int
)
screenSize
.
x
,
(
int
)
screenSize
.
y
,
(
unsigned
char
*
)
wxOutput
,
true
);
...
...
@@ -252,10 +199,6 @@ void CAIRO_GAL::EndDrawing()
// client_dc.DrawBitmap(bmp, 0, 0, false);
dc
.
Init
(
&
client_dc
,
bmp
);
#else
#error "need wxWidgets-2.8 as a minimum"
#endif
// Destroy Cairo objects
cairo_destroy
(
cairoImage
);
cairo_surface_destroy
(
cairoSurface
);
...
...
@@ -967,7 +910,6 @@ void CAIRO_GAL::allocateBitmaps()
bitmapBuffer
=
new
unsigned
int
[
bufferSize
];
bitmapBufferBackup
=
new
unsigned
int
[
bufferSize
];
wxOutput
=
new
unsigned
char
[
bufferSize
*
4
];
wxBitmap_
=
new
wxBitmap
(
screenSize
.
x
,
screenSize
.
y
,
SCREEN_DEPTH
);
}
...
...
@@ -976,7 +918,6 @@ void CAIRO_GAL::deleteBitmaps()
delete
[]
bitmapBuffer
;
delete
[]
bitmapBufferBackup
;
delete
[]
wxOutput
;
delete
wxBitmap_
;
}
...
...
common/gal/graphics_abstraction_layer.cpp
View file @
e4bac0d9
...
...
@@ -33,8 +33,6 @@
using
namespace
KiGfx
;
const
wxEventType
KiGfx
::
EVT_GAL_REDRAW
=
wxNewEventType
();
GAL
::
GAL
()
{
// Set the default values for the internal variables
...
...
common/gal/opengl/opengl_gal.cpp
View file @
e4bac0d9
...
...
@@ -88,7 +88,6 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
SetGridLineWidth
(
1.0
);
// Connecting the event handlers.
Connect
(
wxEVT_SIZE
,
wxSizeEventHandler
(
OPENGL_GAL
::
onSize
)
);
Connect
(
wxEVT_PAINT
,
wxPaintEventHandler
(
OPENGL_GAL
::
onPaint
)
);
// Mouse events are skipped to the parent
...
...
@@ -147,13 +146,6 @@ void OPENGL_GAL::ResizeScreen( int aWidth, int aHeight )
}
void
OPENGL_GAL
::
onSize
(
wxSizeEvent
&
aEvent
)
{
ResizeScreen
(
aEvent
.
GetSize
().
x
,
aEvent
.
GetSize
().
y
);
PostPaint
();
}
void
OPENGL_GAL
::
skipMouseEvent
(
wxMouseEvent
&
aEvent
)
{
// Post the mouse event to the event listener registered in constructor, if any
...
...
include/class_drawpanel.h
View file @
e4bac0d9
...
...
@@ -258,9 +258,6 @@ public:
void
OnCharHook
(
wxKeyEvent
&
event
);
void
OnPan
(
wxCommandEvent
&
event
);
#ifdef KICAD_GAL
void
OnSize
(
wxSizeEvent
&
event
);
#endif
void
EraseScreen
(
wxDC
*
DC
);
void
OnScrollWin
(
wxCommandEvent
&
event
);
...
...
include/class_drawpanel_gal.h
View file @
e4bac0d9
...
...
@@ -88,9 +88,6 @@ protected:
///< using GAL
KiGfx
::
WX_VIEW_CONTROLS
*
m_viewControls
;
///< Control for VIEW (moving, zooming, etc.)
VECTOR2D
m_screenSize
;
///< Stores current screen size
wxWindow
*
m_parentFrame
;
///< Pointer to the parent frame
std
::
string
m_galShaderPath
;
///< Path to shader files, used in OpenGL mode
};
...
...
include/gal/cairo/cairo_gal.h
View file @
e4bac0d9
...
...
@@ -274,7 +274,7 @@ public:
{
if
(
paintListener
)
{
wx
CommandEvent
redrawEvent
(
EVT_GAL_REDRAW
)
;
wx
PaintEvent
redrawEvent
;
wxPostEvent
(
paintListener
,
redrawEvent
);
}
}
...
...
@@ -361,10 +361,8 @@ private:
cairo_surface_t
*
cairoSurface
;
///< Cairo surface
unsigned
int
*
bitmapBuffer
;
///< Storage of the cairo image
unsigned
int
*
bitmapBufferBackup
;
///< Backup storage of the cairo image
wxBitmap
*
wxBitmap_
;
///< Pointer to the wxWidgets bitmap
int
stride
;
///< Stride value for Cairo
// wxClientDC* clientDC; ///< Pointer to the clientDC
int
screenSizeY
;
///< Vertical size of the actual surface
// Mapping between Cairo and GAL line attributes
std
::
map
<
LineCap
,
cairo_line_cap_t
>
lineCapMap
;
///< Line cap style mapping
...
...
@@ -381,13 +379,6 @@ private:
*/
void
onPaint
(
wxPaintEvent
&
aEvent
);
/**
* @brief Window resizing event handler.
*
* @param aEvent is the resizing event.
*/
void
onSize
(
wxSizeEvent
&
aEvent
);
/**
* @brief Mouse event handler, forwards the event to the child.
*
...
...
include/gal/graphics_abstraction_layer.h
View file @
e4bac0d9
...
...
@@ -38,8 +38,6 @@
namespace
KiGfx
{
// Event declaration
extern
const
wxEventType
EVT_GAL_REDRAW
;
/**
* LineCap: Type definition of the line end point style
...
...
include/gal/opengl/opengl_gal.h
View file @
e4bac0d9
...
...
@@ -292,7 +292,7 @@ public:
{
if
(
paintListener
)
{
wx
CommandEvent
redrawEvent
(
EVT_GAL_REDRAW
)
;
wx
PaintEvent
redrawEvent
;
wxPostEvent
(
paintListener
,
redrawEvent
);
}
}
...
...
@@ -411,13 +411,6 @@ private:
*/
void
onPaint
(
wxPaintEvent
&
aEvent
);
/**
* @brief Window resizing event handler.
*
* @param aEvent is the window resizing event.
*/
void
onSize
(
wxSizeEvent
&
aEvent
);
/**
* @brief Skip the mouse event to the parent.
*
...
...
pcbnew/basepcbframe.cpp
View file @
e4bac0d9
...
...
@@ -134,7 +134,6 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
#ifdef KICAD_GAL
m_galCanvas
=
new
EDA_DRAW_PANEL_GAL
(
this
,
-
1
,
wxPoint
(
0
,
0
),
m_FrameSize
,
EDA_DRAW_PANEL_GAL
::
GAL_TYPE_OPENGL
);
m_galCanvas
->
Hide
();
#endif
/* KICAD_GAL */
m_auxiliaryToolBar
=
NULL
;
...
...
@@ -242,6 +241,9 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
}
view
->
SetTopLayer
(
m_Pcb
->
GetLayer
()
);
if
(
m_galCanvasActive
)
m_galCanvas
->
Refresh
();
}
#endif
}
...
...
pcbnew/pcbframe.cpp
View file @
e4bac0d9
...
...
@@ -416,6 +416,10 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_auimgr
.
AddPane
(
m_canvas
,
wxAuiPaneInfo
().
Name
(
wxT
(
"DrawFrame"
)
).
CentrePane
()
);
if
(
m_galCanvas
)
m_auimgr
.
AddPane
(
m_galCanvas
,
wxAuiPaneInfo
().
Name
(
wxT
(
"DrawFrameGal"
)
).
CentrePane
().
Hide
()
);
if
(
m_messagePanel
)
m_auimgr
.
AddPane
(
m_messagePanel
,
wxAuiPaneInfo
(
mesg
).
Name
(
wxT
(
"MsgPanel"
)
).
Bottom
().
Layer
(
10
)
);
...
...
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