Commit 311a8186 authored by Dick Hollenbeck's avatar Dick Hollenbeck

sweet editor, compiler warning

parent cd0b2316
...@@ -204,7 +204,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol() ...@@ -204,7 +204,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
try try
{ {
formatter.Print( 0, TO_UTF8( line ) ); formatter.Print( 0, "%s", TO_UTF8( line ) );
m_component->GetReferenceField().Save( formatter ); m_component->GetReferenceField().Save( formatter );
m_component->GetValueField().Save( formatter ); m_component->GetValueField().Save( formatter );
formatter.Print( 0, "DRAW\n" ); formatter.Print( 0, "DRAW\n" );
......
...@@ -176,7 +176,6 @@ else() ...@@ -176,7 +176,6 @@ else()
set( gal_ROOT "${CMAKE_CURRENT_BINARY_DIR}/gal-src" ) set( gal_ROOT "${CMAKE_CURRENT_BINARY_DIR}/gal-src" )
set( gal_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/gal-src/libgal.a" ) set( gal_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/gal-src/libgal.a" )
include( ExternalProject ) include( ExternalProject )
ExternalProject_Add( ki_gal ExternalProject_Add( ki_gal
# skip the install step, build in source, use from source # skip the install step, build in source, use from source
...@@ -197,12 +196,14 @@ include_directories( "${gal_ROOT}" ) ...@@ -197,12 +196,14 @@ include_directories( "${gal_ROOT}" )
find_package( PkgConfig REQUIRED ) find_package( PkgConfig REQUIRED )
# Find cairo. # Find cairo.
pkg_search_module( CAIRO REQUIRED cairo>=1.8.1 ) #pkg_search_module( CAIRO REQUIRED cairo>=1.8.1 )
include_directories( ${CAIRO_INCLUDE_DIRS} ) #include_directories( ${CAIRO_INCLUDE_DIRS} )
# Find the OpenGL libraries (gl and glu) # Find the OpenGL libraries (gl and glu)
find_package( OpenGL ) find_package( OpenGL )
# Find GLEW # Find GLEW
pkg_search_module( GLEW REQUIRED glew>=1.5.0 ) pkg_search_module( GLEW REQUIRED glew>=1.5.0 )
include_directories( ${GLEW_INCLUDE_DIRS} ) include_directories( ${GLEW_INCLUDE_DIRS} )
...@@ -213,12 +214,13 @@ include_directories( ${gal_ROOT} ) ...@@ -213,12 +214,13 @@ include_directories( ${gal_ROOT} )
add_executable( sweet_edit sweet_edit.cpp sweet_editor_panel.cpp sch_canvas.cpp ) add_executable( sweet_edit sweet_edit.cpp sweet_editor_panel.cpp sch_canvas.cpp )
target_link_libraries( sweet_edit target_link_libraries( sweet_edit
${OPENGL_LIBRARIES} sweet
${gal_LIBRARY} ${OPENGL_LIBRARIES}
${wxWidgets_LIBRARIES} ${gal_LIBRARY}
${GLEW_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GLEW_LIBRARIES}
) ${GDI_PLUS_LIBRARIES}
)
#=====<USE_SWIG>============================================================ #=====<USE_SWIG>============================================================
......
...@@ -151,7 +151,7 @@ of the base part as having most if not all the graphical lines for any ...@@ -151,7 +151,7 @@ of the base part as having most if not all the graphical lines for any
derivatives. But we do not need to use the term symbol to describe that derivatives. But we do not need to use the term symbol to describe that
relationship, the term "part" is sufficient.</dd> relationship, the term "part" is sufficient.</dd>
<dt>LPID</dt><dd>This stand for "Logical Part ID", and is a reference to any <dt>LPID</dt><dd>This stands for "Logical Part ID", and is a reference to any
part within any known library. The term "logical" is used because the contained part within any known library. The term "logical" is used because the contained
library name is logical, not a full library name. The LPID consists of 3 main library name is logical, not a full library name. The LPID consists of 3 main
portions: logical library name, part name, and revision number.</dd> portions: logical library name, part name, and revision number.</dd>
......
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
#include "sch_part.h" #include "sch_part.h"
#include <gal/font/newstroke_font.h> #include <gal/font/newstroke_font.h>
#define SWEET_UNIT 50 ///< world units comprizing a sweet grid cell
namespace SCH { namespace SCH {
...@@ -57,26 +62,26 @@ CANVAS::CANVAS( wxWindow* aParent ) : ...@@ -57,26 +62,26 @@ CANVAS::CANVAS( wxWindow* aParent ) :
void CANVAS::onRedraw( wxCommandEvent& event ) void CANVAS::onRedraw( wxCommandEvent& event )
{ {
D(printf( "%s:\n", __FUNCTION__ );)
PaintScene(); PaintScene();
} }
void CANVAS::PaintScene() void CANVAS::PaintScene()
{ {
D(printf("%s:\n", __FUNCTION__ );)
BeginDrawing(); BeginDrawing();
SetBackgroundColor( COLOR4D( 0, 0, 0, 1.0 ) ); SetBackgroundColor( COLOR4D( 0x6c/255.0, 0x53/255.0, 0x53/255.0, 1.0 ) );
ClearScreen(); ClearScreen();
SetLayerDepth( -10 ); SetLayerDepth( -10 );
SetGridSize( VECTOR2D( 50, 50 ) );
SetGridSize( VECTOR2D( SWEET_UNIT, SWEET_UNIT ) );
DrawGrid(); DrawGrid();
PaintRectangle();
SetLayerDepth( 0 ); SetLayerDepth( 0 );
Flush(); Flush();
...@@ -84,4 +89,60 @@ void CANVAS::PaintScene() ...@@ -84,4 +89,60 @@ void CANVAS::PaintScene()
} }
void CANVAS::PaintRectangle()
{
VECTOR2D worldSize = GetSize();
#if 1
SetLineWidth( 1 );
SetIsFill( true );
SetIsStroke( true );
SetFillColor( COLOR4D( 1, 1, 1, 1 ) );
SetStrokeColor( COLOR4D( 0, 0, 0, 1 ) );
DrawRectangle( VECTOR2D( worldSize.x/4, worldSize.y/4 ), VECTOR2D( 3*worldSize.x/4, 3*worldSize.y/4 ) );
#else
D( cout << worldSize << endl; )
int k = 0;
double alpha = 0;
for( double y = 0; y < worldSize.y - worldSize.y / 4; y += worldSize.y / 8 )
{
double index = 1;
double y2 = y;
for( double x = 0; x < worldSize.x - worldSize.x / 4; x += worldSize.x / 8 )
{
SetLineWidth( index + 1 );
SetIsFill( ( k == 1 ) || ( k == 2 ) );
SetIsStroke( ( k == 0 ) || ( k == 2 ) );
SetFillColor( COLOR4D( 1 - alpha, 1, 1, 1 - alpha ) );
SetStrokeColor( COLOR4D( alpha, alpha, 1 - alpha, alpha ) );
DrawRectangle( VECTOR2D( x, y2 ), VECTOR2D( x + index * 10, y2 + index * 10 ) );
x += index * 5;
y2 += index * 5;
index += 1;
}
k = ( k + 1 ) % 3;
alpha += 0.1;
}
#endif
}
} // namespace SCH } // namespace SCH
...@@ -37,13 +37,13 @@ class CANVAS : public OPENGL_GAL ...@@ -37,13 +37,13 @@ class CANVAS : public OPENGL_GAL
{ {
protected: protected:
PART* m_part; ///< which PART to draw PART* m_part; ///< which PART to draw
STROKE_FONT m_font; STROKE_FONT m_font;
void onRedraw( wxCommandEvent& event ); void onRedraw( wxCommandEvent& event );
public: public:
CANVAS( wxWindow* aParent ); CANVAS( wxWindow* aParent );
/** /**
...@@ -58,6 +58,8 @@ public: ...@@ -58,6 +58,8 @@ public:
} }
void PaintScene(); void PaintScene();
void PaintRectangle();
}; };
......
...@@ -33,11 +33,10 @@ ...@@ -33,11 +33,10 @@
// Graphics Abstraction Layer imports // Graphics Abstraction Layer imports
#include <gal/common/definitions.h> #include <gal/common/definitions.h>
#include <gal/common/graphics_abstraction_layer.h> #include <gal/common/graphics_abstraction_layer.h>
#include <gal/cairo/cairo_gal.h>
#include <gal/opengl/opengl_gal.h> #include <gal/opengl/opengl_gal.h>
#include <gal/common/stroke_font.h> #include <gal/common/stroke_font.h>
#include <gal/common/color4d.h> #include <gal/common/color4d.h>
#include "gal/font/newstroke_font.h" #include <gal/font/newstroke_font.h>
#include <math/vector2d.h> #include <math/vector2d.h>
#include <math/matrix3x3.h> #include <math/matrix3x3.h>
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
using namespace SCH; using namespace SCH;
// If LIB_TABLE::Test() is conditioned on DEBUG being defined, build with // If LIB_TABLE::Test() is conditioned on DEBUG being defined, build with
// CMAKE_BUILD_TYPE=Debug, otherwise don't worry about it, because it will work // CMAKE_BUILD_TYPE=Debug, otherwise don't worry about it, because it will work
// on any CMAKE_BUILD_TYPE, including Release. // on any CMAKE_BUILD_TYPE, including Release.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment