Commit 0ee7234c authored by Dick Hollenbeck's avatar Dick Hollenbeck

sweet editor work

parent 8a034512
......@@ -42,9 +42,9 @@ if( 1 )
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
if(APPLE)
find_package(wxWidgets COMPONENTS gl adv html core net base xml QUIET)
find_package(wxWidgets COMPONENTS gl adv html core net base xml QUIET )
else()
find_package(wxWidgets COMPONENTS gl aui adv html core net base xml QUIET)
find_package(wxWidgets COMPONENTS gl adv html core net base xml aui QUIET )
endif()
check_find_package_result( wxWidgets_FOUND "wxWidgets" )
......@@ -168,12 +168,7 @@ if( MINGW )
endif()
target_link_libraries( test_sch_lib_table sweet )
include_directories ("${gal_ROOT}/gal/cairo")
include_directories( "${gal_ROOT}/gal/common" )
include_directories ("${gal_ROOT}/gal/font")
include_directories ("${gal_ROOT}/gal/opengl")
include_directories ("${gal_ROOT}/math")
include_directories ( "${gal_ROOT}" )
# Find pkg-config in order find cairo.
find_package( PkgConfig REQUIRED )
......@@ -192,7 +187,7 @@ include_directories( ${GLEW_INCLUDE_DIRS} )
include_directories( ${gal_ROOT} )
add_executable( sweet_edit sweet_edit.cpp sweet_editor_panel.cpp )
add_executable( sweet_edit sweet_edit.cpp sweet_editor_panel.cpp sch_canvas.cpp )
target_link_libraries( sweet_edit
${OPENGL_LIBRARIES}
......
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "sch_canvas.h"
#include "sch_part.h"
namespace SCH {
CANVAS::CANVAS( wxWindow* aParent ) :
OPENGL_GAL( aParent, wxDefaultSize )
{
// Set the world unit length
SetWorldUnitLength( 0.01 );
SetScreenDPI( 100 );
// SetLookAtPoint( VECTOR2D( size.x / 2, size.y / 2 ) );
ComputeWorldScreenMatrix();
/*
// Compute the world size
m_worldSize = VECTOR2D( m_screenSize.x, m_screenSize.y );
m_isReady = true;
m_isPanning = false;
m_isGroupStarted = true;
m_offset = 0.333;
// Load Font
if( !m_font.LoadNewStrokeFont( newstroke_font, newstroke_font_bufsize ) )
{
cout << "Loading of the font failed." << endl;
}
m_font.SetGraphicsAbstractionLayer( this );
*/
}
void CANVAS::Paint()
{
/*
BeginDrawing();
SetBackgroundColor( COLOR4D( 0, 0, 0, 1.0 ) );
ClearScreen();
SetLayerDepth( -10 );
SetGridSize( VECTOR2D( 50, 50 ) );
DrawGrid();
SetLayerDepth( 0 );
Flush();
EndDrawing();
*/
}
} // namespace SCH
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef SCH_CANVAS_H_
#define SCH_CANVAS_H_
#include <gal/opengl/opengl_gal.h>
namespace SCH {
class PART;
class CANVAS : public OPENGL_GAL
{
protected:
PART* part; ///< which PART to draw
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.
*/
PART* SetPart( PART* aPart )
{
PART* ret = part;
part = aPart;
return ret;
}
};
} // namespace SCH
#endif // SCH_PART_H_
......@@ -293,7 +293,7 @@ void PART::Parse( SWEET_PARSER* aParser , LIB_TABLE* aTable ) throw( IO_ERROR, P
}
bool PART::PropertyDelete( const wxString& aPropertyName )
bool PART::PropDelete( const wxString& aPropertyName )
{
PROPERTIES::iterator it = propertyFind( aPropertyName );
if( it != properties.end() )
......
......@@ -729,11 +729,11 @@ public:
throw( IO_ERROR );
/**
* Function PropertyDelete
* Function PropDelete
* deletes the property with aPropertyName if found and returns true, else false
* if not found.
*/
bool PropertyDelete( const wxString& aPropertyName );
bool PropDelete( const wxString& aPropertyName );
/**
* Function Field
......
......@@ -992,7 +992,7 @@ void SWEET_PARSER::parsePropertyDel( PART* me )
wxString propertyName = FromUTF8();
if( !me->PropertyDelete( propertyName ) )
if( !me->PropDelete( propertyName ) )
{
wxString msg;
msg.Printf( _( "Unable to find property: %s" ), propertyName.GetData() );
......
......@@ -41,7 +41,7 @@ SWEET_EDITOR_PANEL::SWEET_EDITOR_PANEL( wxWindow* parent, wxWindowID id, const w
wxStaticBoxSizer* m_gal_sizer;
m_gal_sizer = new wxStaticBoxSizer( new wxStaticBox( m_gal_scrolled_window, wxID_ANY, _("Visual Part") ), wxVERTICAL );
m_gal = new OPENGL_GAL( m_gal_scrolled_window, size );
m_gal = new SCH::CANVAS( m_gal_scrolled_window );
m_gal_sizer->Add( m_gal, 0, wxALL, 5 );
m_gal_scrolled_window->SetSizer( m_gal_sizer );
......
......@@ -668,12 +668,12 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="class">OPENGL_GAL</property>
<property name="class">SCH::CANVAS</property>
<property name="close_button">1</property>
<property name="construction">m_gal = new OPENGL_GAL( m_gal_scrolled_window, size );</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="declaration">OPENGL_GAL* m_gal;</property>
<property name="declaration">SCH::CANVAS* m_gal;</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
......@@ -685,7 +685,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="include">#include &lt;opengl_gal.h&gt;</property>
<property name="include">#include &lt;sch_canvas.h&gt;</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
......
......@@ -19,7 +19,7 @@
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/scrolwin.h>
#include <opengl_gal.h>
#include <sch_canvas.h>
#include <wx/splitter.h>
#include <wx/panel.h>
#include <wx/html/htmlwin.h>
......@@ -41,7 +41,7 @@ class SWEET_EDITOR_PANEL : public wxPanel
wxScrolledWindow* m_scrolledTextWindow;
wxTextCtrl* m_sweet_scroll_window;
wxScrolledWindow* m_gal_scrolled_window;
OPENGL_GAL* m_gal;
SCH::CANVAS* m_gal;
wxScrolledWindow* m_scrolledWindow3;
wxHtmlWindow* m_htmlWin2;
......
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