Simulator fixes for Windows

This commit is contained in:
Maciej Suminski 2016-08-11 14:41:41 +02:00
parent 9acdedcb85
commit 6bfe6342fc
4 changed files with 34 additions and 4 deletions

View File

@ -30,13 +30,15 @@
#include <wx/log.h>
#include <sstream>
// TODO cmake modules to add include directory for ngspice
using namespace std;
NGSPICE::NGSPICE()
{
#ifdef __WINDOWS__
m_dll = new wxDynamicLibrary( "libngspice-0.dll" );
#else
m_dll = new wxDynamicLibrary( "libngspice.so" );
#endif
assert( m_dll );
// Obtain function pointers

View File

@ -124,7 +124,7 @@ void SIM_PLOT_FRAME::NewPlotPanel( SIM_TYPE aSimType )
SIM_PLOT_PANEL* plot = new SIM_PLOT_PANEL( aSimType, m_plotNotebook, wxID_ANY );
m_plotNotebook->AddPage( plot,
wxString::Format( wxT( "Plot%lu" ), m_plotNotebook->GetPageCount() + 1 ), true );
wxString::Format( wxT( "Plot%u" ), (unsigned int) m_plotNotebook->GetPageCount() + 1 ), true );
}

View File

@ -100,6 +100,7 @@ SIM_PLOT_PANEL::SIM_PLOT_PANEL( SIM_TYPE aType, wxWindow* parent, wxWindowID id,
: mpWindow( parent, id, pos, size, style ), m_colorIdx( 0 ),
m_axis_x( nullptr ), m_axis_y1( nullptr ), m_axis_y2( nullptr ), m_type( aType )
{
EnableDoubleBuffer( true );
SetMargins( 10, 10, 10, 10 );
LimitView( true );

View File

@ -39,6 +39,8 @@ void SCH_EDIT_FRAME::OnSimulate( wxCommandEvent& event )
simFrame->SetSchFrame( this );
}
// I apologize for the following lines, but this is more or less what wxWidgets
// authors suggest (http://docs.wxwidgets.org/trunk/classwx_cursor.html)
static const unsigned char cursor_probe[] = {
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x70,
@ -66,4 +68,29 @@ static const unsigned char cursor_probe_mask[] {
0x7c, 0x07, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 };
const wxCursor SCH_EDIT_FRAME::CURSOR_PROBE( (const char*) cursor_probe, 31, 32, 0, 31, (const char*) cursor_probe_mask );
#ifdef __WXMSW__
struct CURSOR_PROBE_INIT
{
public:
static wxImage& GetProbeImage()
{
static wxImage* probe_image = NULL;
if( probe_image == NULL )
{
wxBitmap probe_bitmap( (const char*) cursor_probe, 32, 32 );
wxBitmap probe_mask_bitmap( (const char*) cursor_probe_mask, 32, 32 );
probe_bitmap.SetMask( new wxMask( probe_mask_bitmap ) );
probe_image = new wxImage( probe_bitmap.ConvertToImage() );
probe_image->SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, 0 );
probe_image->SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, 31 );
}
return *probe_image;
}
};
const wxCursor SCH_EDIT_FRAME::CURSOR_PROBE( CURSOR_PROBE_INIT::GetProbeImage() );
#elif defined(__WXGTK__) or defined(__WXMOTIF__)
const wxCursor SCH_EDIT_FRAME::CURSOR_PROBE( (const char*) cursor_probe, 32, 32, 0, 31, (const char*) cursor_probe_mask );
#endif