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
9bf1f390
Commit
9bf1f390
authored
Nov 01, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sweet editor now shows GAL canvas
parent
8cad403d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
132 additions
and
56 deletions
+132
-56
CMakeLists.txt
new/CMakeLists.txt
+41
-18
sch_canvas.cpp
new/sch_canvas.cpp
+14
-4
sch_canvas.h
new/sch_canvas.h
+3
-6
sweet_edit.cpp
new/sweet_edit.cpp
+59
-13
sweet_editor_panel.cpp
new/sweet_editor_panel.cpp
+2
-2
sweet_editor_panel.fbp
new/sweet_editor_panel.fbp
+13
-13
No files found.
new/CMakeLists.txt
View file @
9bf1f390
...
...
@@ -27,7 +27,7 @@ if( 1 )
project
(
kicad-new
)
cmake_minimum_required
(
VERSION 2.6.4 FATAL_ERROR
)
cmake_minimum_required
(
VERSION 2.8 FATAL_ERROR
)
set
(
PROJECT_SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/../
)
...
...
@@ -49,22 +49,6 @@ if( 1 )
check_find_package_result
(
wxWidgets_FOUND
"wxWidgets"
)
find_library
(
gal_LIBRARY
"libgal.a"
PATHS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../kicad-gal/build"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../kicad-gal/build"
DOC
"Where is the static GAL library"
)
find_path
(
gal_ROOT NAMES
"README.txt"
PATHS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../kicad-gal"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../kicad-gal"
DOC
"Where is the base include directory for the GAL library"
)
# make config.h
include
(
PerformFeatureChecks
)
perform_feature_checks
()
...
...
@@ -168,7 +152,46 @@ if( MINGW )
endif
()
target_link_libraries
(
test_sch_lib_table sweet
)
include_directories
(
"
${
gal_ROOT
}
"
)
if
(
1
)
find_library
(
gal_LIBRARY
"libgal.a"
PATHS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../kicad-gal/build"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../kicad-gal/build"
DOC
"Where is the static GAL library"
)
find_path
(
gal_ROOT NAMES
"README.txt"
PATHS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../kicad-gal"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../kicad-gal"
DOC
"Where is the base include directory for the GAL library"
)
else
()
# we build the GAL library, therefore we know where it is, no need to find_library() it.
set
(
gal_ROOT
"
${
CMAKE_CURRENT_BINARY_DIR
}
/gal-src"
)
set
(
gal_LIBRARY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/gal-src/libgal.a"
)
include
(
ExternalProject
)
ExternalProject_Add
(
ki_gal
# skip the install step, build in source, use from source
SOURCE_DIR
"
${
gal_ROOT
}
"
STAMP_DIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
/gal-stamps"
TIMEOUT 120
DOWNLOAD_COMMAND bzr export
${
gal_ROOT
}
lp:~kicad-testing-committers/kicad/kicad-gal
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
${
gal_ROOT
}
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND
""
)
endif
()
include_directories
(
"
${
gal_ROOT
}
"
)
# Find pkg-config in order find cairo.
find_package
(
PkgConfig REQUIRED
)
...
...
new/sch_canvas.cpp
View file @
9bf1f390
...
...
@@ -31,8 +31,10 @@ namespace SCH {
CANVAS
::
CANVAS
(
wxWindow
*
aParent
)
:
OPENGL_GAL
(
aParent
,
wxDefaultSize
)
OPENGL_GAL
(
aParent
,
NULL
,
this
)
// I am my own PaintListener
{
Connect
(
EVT_GAL_REDRAW
,
wxCommandEventHandler
(
CANVAS
::
onRedraw
)
);
// Set the world unit length
SetWorldUnitLength
(
0.01
);
...
...
@@ -63,9 +65,18 @@ CANVAS::CANVAS( wxWindow* aParent ) :
}
void
CANVAS
::
Paint
(
)
void
CANVAS
::
onRedraw
(
wxCommandEvent
&
event
)
{
/*
D
(
printf
(
"%s:
\n
"
,
__FUNCTION__
);)
PaintScene
();
}
void
CANVAS
::
PaintScene
()
{
D
(
printf
(
"%s:
\n
"
,
__FUNCTION__
);)
BeginDrawing
();
SetBackgroundColor
(
COLOR4D
(
0
,
0
,
0
,
1.0
)
);
...
...
@@ -80,7 +91,6 @@ void CANVAS::Paint()
Flush
();
EndDrawing
();
*/
}
...
...
new/sch_canvas.h
View file @
9bf1f390
...
...
@@ -38,16 +38,11 @@ class CANVAS : public OPENGL_GAL
protected
:
PART
*
part
;
///< which PART to draw
void
onRedraw
(
wxCommandEvent
&
event
);
public
:
CANVAS
(
wxWindow
*
aParent
);
/**
* Function Paint (overloaded)
* redraws the entire window, overloads OPENGL_GAL::Paint()
*/
void
Paint
();
/**
* Function SetPart
* sets the PART to draw, returns the previous PART.
...
...
@@ -58,6 +53,8 @@ public:
part
=
aPart
;
return
ret
;
}
void
PaintScene
();
};
...
...
new/sweet_edit.cpp
View file @
9bf1f390
...
...
@@ -68,30 +68,27 @@ private:
bool
m_isReady
;
bool
m_isPanning
;
GRAPHICS_ABSTRACTION_LAYER
*
m_gal
;
SCH
::
CANVAS
*
m_gal
;
wxSize
m_screenSize
;
VECTOR2D
m_worldSize
;
VECTOR2D
m_startMousePoint
;
VECTOR2D
m_startLookAtPoint
;
/*
double m_alpha;
VECTOR2D m_startMousePoint;
VECTOR2D m_startLookAtPoint;
MATRIX3x3D m_startMatrix;
STROKE_FONT m_font;
*/
// Event handlers
/*
void OnTimerEvent( wxTimerEvent &event );
void
OnMotion
(
wxMouseEvent
&
event
);
void
OnMouseWheel
(
wxMouseEvent
&
event
);
void OnRedraw( wxCommandEvent& event );
void
OnRightDown
(
wxMouseEvent
&
event
);
void
OnRightUp
(
wxMouseEvent
&
event
);
*/
// void OnRedraw( wxCommandEvent& event );
};
...
...
@@ -100,17 +97,24 @@ SWEET_FRAME::SWEET_FRAME( wxWindow* parent, wxWindowID id, const wxString& title
wxFrame
(
parent
,
id
,
title
,
pos
,
size
),
m_screenSize
(
size
.
x
,
size
.
y
)
{
new
SWEET_EDITOR_PANEL
(
this
,
wxID_ANY
,
wxPoint
(
0
,
0
),
wxSize
(
-
1
,
-
1
),
0
)
;
m_isPanning
=
false
;
// Connect( wxEVT_TIMER, wxTimerEventHandler( SWEET_FRAME::OnTimerEvent ) );
SWEET_EDITOR_PANEL
*
panel
=
new
SWEET_EDITOR_PANEL
(
this
,
wxID_ANY
,
wxPoint
(
0
,
0
),
wxSize
(
-
1
,
-
1
),
0
);
m_gal
=
(
SCH
::
CANVAS
*
)
panel
->
FindWindowByName
(
wxT
(
"GLCanvas"
),
panel
);
wxASSERT
(
m_gal
);
m_gal
->
SetMouseListener
(
this
);
/*
Connect( EVT_GAL_REDRAW, wxCommandEventHandler( SWEET_FRAME::OnRedraw ) );
Connect
(
wxEVT_MOTION
,
wxMouseEventHandler
(
SWEET_FRAME
::
OnMotion
)
);
Connect
(
wxEVT_MOUSEWHEEL
,
wxMouseEventHandler
(
SWEET_FRAME
::
OnMouseWheel
)
);
Connect
(
wxEVT_RIGHT_DOWN
,
wxMouseEventHandler
(
SWEET_FRAME
::
OnRightDown
)
);
Connect
(
wxEVT_RIGHT_UP
,
wxMouseEventHandler
(
SWEET_FRAME
::
OnRightUp
)
);
*/
// Connect( EVT_GAL_REDRAW, wxCommandEventHandler( SWEET_FRAME::OnRedraw ) );
/*
// Set the world unit length
...
...
@@ -140,8 +144,50 @@ SWEET_FRAME::~SWEET_FRAME()
}
void
SWEET_FRAME
::
OnMotion
(
wxMouseEvent
&
event
)
{
VECTOR2D
mousePoint
(
event
.
GetX
(),
event
.
GetY
()
);
if
(
event
.
Dragging
()
)
{
if
(
m_isPanning
)
{
MATRIX3x3D
matrix
=
m_gal
->
GetWorldScreenMatrix
().
Inverse
();
VECTOR2D
delta
=
matrix
.
GetScale
().
x
*
(
m_startMousePoint
-
mousePoint
);
m_gal
->
SetLookAtPoint
(
m_startLookAtPoint
+
delta
);
m_gal
->
PaintScene
();
}
}
else
{
m_gal
->
DrawCursor
(
mousePoint
);
}
}
void
SWEET_FRAME
::
OnMouseWheel
(
wxMouseEvent
&
event
)
{
double
zoomScale
=
(
event
.
GetWheelRotation
()
>
0.0
)
?
1.1
:
0.9
;
// void PaintScene();
m_gal
->
SetZoomFactor
(
m_gal
->
GetZoomFactor
()
*
zoomScale
);
m_gal
->
PaintScene
();
}
void
SWEET_FRAME
::
OnRightDown
(
wxMouseEvent
&
event
)
{
m_isPanning
=
true
;
m_startMousePoint
=
VECTOR2D
(
event
.
GetX
(),
event
.
GetY
()
);
m_startLookAtPoint
=
m_gal
->
GetLookAtPoint
();
}
void
SWEET_FRAME
::
OnRightUp
(
wxMouseEvent
&
event
)
{
m_isPanning
=
false
;
}
static
const
wxCmdLineEntryDesc
g_cmdLineDesc
[]
=
{
...
...
new/sweet_editor_panel.cpp
View file @
9bf1f390
...
...
@@ -36,13 +36,13 @@ SWEET_EDITOR_PANEL::SWEET_EDITOR_PANEL( wxWindow* parent, wxWindowID id, const w
m_scrolledTextWindow
->
SetSizer
(
m_scrolledTextSizer
);
m_scrolledTextWindow
->
Layout
();
m_scrolledTextSizer
->
Fit
(
m_scrolledTextWindow
);
m_gal_scrolled_window
=
new
wxScrolledWindow
(
m_splitter3
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxHSCROLL
|
wxVSCROLL
);
m_gal_scrolled_window
=
new
wxScrolledWindow
(
m_splitter3
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wx
FULL_REPAINT_ON_RESIZE
|
wx
HSCROLL
|
wxVSCROLL
);
m_gal_scrolled_window
->
SetScrollRate
(
5
,
5
);
wxStaticBoxSizer
*
m_gal_sizer
;
m_gal_sizer
=
new
wxStaticBoxSizer
(
new
wxStaticBox
(
m_gal_scrolled_window
,
wxID_ANY
,
_
(
"Visual Part"
)
),
wxVERTICAL
);
m_gal
=
new
SCH
::
CANVAS
(
m_gal_scrolled_window
);
m_gal_sizer
->
Add
(
m_gal
,
0
,
wxALL
,
5
);
m_gal_sizer
->
Add
(
m_gal
,
1
,
wxEXPAND
,
5
);
m_gal_scrolled_window
->
SetSizer
(
m_gal_sizer
);
m_gal_scrolled_window
->
Layout
();
...
...
new/sweet_editor_panel.fbp
View file @
9bf1f390
...
...
@@ -462,7 +462,7 @@
<event
name=
"OnSetFocus"
></event>
<event
name=
"OnSize"
></event>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"wxStaticBoxSizer"
expanded=
"
1
"
>
<object
class=
"wxStaticBoxSizer"
expanded=
"
0
"
>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"label"
>
Sweet
</property>
<property
name=
"minimum_size"
></property>
...
...
@@ -470,11 +470,11 @@
<property
name=
"orient"
>
wxVERTICAL
</property>
<property
name=
"permission"
>
none
</property>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"sizeritem"
expanded=
"
1
"
>
<object
class=
"sizeritem"
expanded=
"
0
"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxALL|wxEXPAND
</property>
<property
name=
"proportion"
>
1
</property>
<object
class=
"wxTextCtrl"
expanded=
"
1
"
>
<object
class=
"wxTextCtrl"
expanded=
"
0
"
>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"LeftDockable"
>
1
</property>
<property
name=
"RightDockable"
>
1
</property>
...
...
@@ -564,8 +564,8 @@
</object>
</object>
</object>
<object
class=
"splitteritem"
expanded=
"
1
"
>
<object
class=
"wxScrolledWindow"
expanded=
"
1
"
>
<object
class=
"splitteritem"
expanded=
"
0
"
>
<object
class=
"wxScrolledWindow"
expanded=
"
0
"
>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"LeftDockable"
>
1
</property>
<property
name=
"RightDockable"
>
1
</property>
...
...
@@ -621,7 +621,7 @@
<property
name=
"validator_variable"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
>
wxHSCROLL|wxVSCROLL
</property>
<property
name=
"window_style"
>
wx
FULL_REPAINT_ON_RESIZE|wx
HSCROLL|wxVSCROLL
</property>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
...
...
@@ -645,7 +645,7 @@
<event
name=
"OnSetFocus"
></event>
<event
name=
"OnSize"
></event>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"wxStaticBoxSizer"
expanded=
"
1
"
>
<object
class=
"wxStaticBoxSizer"
expanded=
"
0
"
>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"label"
>
Visual Part
</property>
<property
name=
"minimum_size"
></property>
...
...
@@ -653,11 +653,11 @@
<property
name=
"orient"
>
wxVERTICAL
</property>
<property
name=
"permission"
>
none
</property>
<event
name=
"OnUpdateUI"
></event>
<object
class=
"sizeritem"
expanded=
"
1
"
>
<object
class=
"sizeritem"
expanded=
"
0
"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wx
ALL
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"CustomControl"
expanded=
"
1
"
>
<property
name=
"flag"
>
wx
EXPAND
</property>
<property
name=
"proportion"
>
1
</property>
<object
class=
"CustomControl"
expanded=
"
0
"
>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"LeftDockable"
>
1
</property>
<property
name=
"RightDockable"
>
1
</property>
...
...
@@ -672,7 +672,7 @@
<property
name=
"close_button"
>
1
</property>
<property
name=
"construction"
>
m_gal = new SCH::CANVAS( m_gal_scrolled_window );
</property>
<property
name=
"context_help"
></property>
<property
name=
"context_menu"
>
1
</property>
<property
name=
"context_menu"
>
0
</property>
<property
name=
"declaration"
>
SCH::CANVAS* m_gal;
</property>
<property
name=
"default_pane"
>
0
</property>
<property
name=
"dock"
>
Dock
</property>
...
...
@@ -716,7 +716,7 @@
<property
name=
"validator_variable"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
></property>
<property
name=
"window_style"
>
wxFULL_REPAINT_ON_RESIZE
</property>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
...
...
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