AntiAliasing support (toggled in View Menu)

This commit is contained in:
Mark Watkins 2011-06-10 22:28:20 +10:00
parent 1421d12199
commit c84b116a7a
8 changed files with 58 additions and 17 deletions

View File

@ -4134,7 +4134,7 @@
"sleeplib/machine.h"
"graph.h"
1305215599 /usr/include/wx-2.9/wx/dcgraph.h
1307528666 /usr/include/wx-2.9/wx/dcgraph.h
"wx/dc.h"
"wx/geometry.h"
"wx/graphics.h"
@ -4145,7 +4145,7 @@
"wx/gdicmn.h"
"wx/math.h"
1305215599 /usr/include/wx-2.9/wx/graphics.h
1307528666 /usr/include/wx-2.9/wx/graphics.h
"wx/defs.h"
"wx/geometry.h"
"wx/dynarray.h"
@ -8210,12 +8210,12 @@
"wx/treebase.h"
"wx/hashmap.h"
1307618682 source:/home/mark/projects/git/sleepyhead/src/GUIFrame.cpp
1307708368 source:/home/mark/projects/git/sleepyhead/src/GUIFrame.cpp
"wx/wxprec.h"
<wx/wx.h>
"GUIFrame.h"
1307618682 /home/mark/projects/git/sleepyhead/src/GUIFrame.h
1307708368 /home/mark/projects/git/sleepyhead/src/GUIFrame.h
<wx/intl.h>
<wx/string.h>
<wx/bitmap.h>
@ -8258,7 +8258,7 @@
1307418393 /home/mark/projects/git/sleepyhead/src/SleepyHeadApp.h
<wx/app.h>
1307618623 /home/mark/projects/git/sleepyhead/src/SleepyHeadMain.h
1307708712 /home/mark/projects/git/sleepyhead/src/SleepyHeadMain.h
<wx/listbox.h>
<wx/treectrl.h>
"SleepyHeadApp.h"
@ -8304,7 +8304,7 @@
<sleeplib/machine.h>
<list>
1307704847 /home/mark/projects/git/sleepyhead/src/version.h
1307708812 /home/mark/projects/git/sleepyhead/src/version.h
1307627540 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/prs1_loader.h
"machine.h"
@ -8322,7 +8322,7 @@
"preferences.h"
"tinyxml/tinyxml.h"
1307698043 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
1307708727 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
"wx_pch.h"
"version.h"
<wx/app.h>
@ -8342,10 +8342,11 @@
"sleeplib/profiles.h"
"sleeplib/machine_loader.h"
1307704772 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
1307708472 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
<wx/settings.h>
<wx/dcbuffer.h>
<wx/log.h>
<wx/dcgraph.h>
<math.h>
"graph.h"
"sleeplib/profiles.h"

View File

@ -64,6 +64,9 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons
ViewMenuFruitsalad = new wxMenuItem( ViewMenu, wxID_ANY, wxString( _("Fruit Salad") ) , wxEmptyString, wxITEM_CHECK );
ViewMenu->Append( ViewMenuFruitsalad );
ViewMenuAntiAliasing = new wxMenuItem( ViewMenu, wxID_ANY, wxString( _("Try Anti-Aliasing") ) , wxEmptyString, wxITEM_CHECK );
ViewMenu->Append( ViewMenuAntiAliasing );
wxMenuItem* m_separator2;
m_separator2 = ViewMenu->AppendSeparator();
@ -110,6 +113,7 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons
this->Connect( ViewMenuSerial->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnShowSerial ) );
this->Connect( ViewMenuLinkGraph->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnLinkGraphs ) );
this->Connect( ViewMenuFruitsalad->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnFruitsalad ) );
this->Connect( ViewMenuAntiAliasing->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnAntiAliasing ) );
this->Connect( ViewMenuFullscreen->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnFullscreen ) );
this->Connect( ToolsMenuScreenshot->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnScreenshot ) );
this->Connect( HelpMenuAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnAbout ) );
@ -127,6 +131,7 @@ GUIFrame::~GUIFrame()
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnShowSerial ) );
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnLinkGraphs ) );
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnFruitsalad ) );
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnAntiAliasing ) );
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnFullscreen ) );
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnScreenshot ) );
this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnAbout ) );

View File

@ -50,6 +50,7 @@ class GUIFrame : public wxFrame
wxMenuItem* ViewMenuSerial;
wxMenuItem* ViewMenuLinkGraph;
wxMenuItem* ViewMenuFruitsalad;
wxMenuItem* ViewMenuAntiAliasing;
wxMenu* ProfileMenu;
wxMenu* ToolsMenu;
wxMenu* HelpMenu;
@ -65,6 +66,7 @@ class GUIFrame : public wxFrame
virtual void OnShowSerial( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLinkGraphs( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFruitsalad( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAntiAliasing( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFullscreen( wxCommandEvent& event ) { event.Skip(); }
virtual void OnScreenshot( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAbout( wxCommandEvent& event ) { event.Skip(); }

View File

@ -85,6 +85,7 @@ SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame)
if (!pref.Exists("ShowSerialNumbers")) pref["ShowSerialNumbers"]=false;
if (!pref.Exists("fruitsalad")) pref["fruitsalad"]=true;
if (!pref.Exists("LinkGraphMovement")) pref["LinkGraphMovement"]=true;
if (!pref.Exists("UseAntiAliasing")) pref["UseAntiAliasing"]=false;
if (!pref.Exists("ProfileVersion")) pref["ProfileVersion"]=(long)0;
if (pref["ProfileVersion"].GetInteger()<profile_version) {
@ -100,6 +101,7 @@ SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame)
ViewMenuSerial->Check(pref["ShowSerialNumbers"]);
ViewMenuFruitsalad->Check(pref["fruitsalad"]);
ViewMenuLinkGraph->Check(pref["LinkGraphMovement"]);
ViewMenuAntiAliasing->Check(pref["UseAntiAliasing"]);
// wxDisableAsserts();
@ -268,6 +270,13 @@ void SleepyHeadFrame::OnShowSerial(wxCommandEvent& event)
void SleepyHeadFrame::OnFruitsalad(wxCommandEvent& event)
{
pref["fruitsalad"]=event.IsChecked();
Refresh();
}
void SleepyHeadFrame::OnAntiAliasing( wxCommandEvent& event )
{
pref["UseAntiAliasing"]=event.IsChecked();
Refresh();
}
void SleepyHeadFrame::OnAbout(wxCommandEvent &event)

View File

@ -111,6 +111,7 @@ class SleepyHeadFrame: public GUIFrame
virtual void OnProfileSelected(wxCommandEvent& event);
virtual void OnFruitsalad(wxCommandEvent& event);
virtual void OnLinkGraphs( wxCommandEvent& event );
virtual void OnAntiAliasing( wxCommandEvent& event );
virtual void UpdateProfiles();

View File

@ -335,6 +335,21 @@
<event name="OnMenuSelection">OnFruitsalad</event>
<event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="1">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_CHECK</property>
<property name="label">Try Anti-Aliasing</property>
<property name="name">ViewMenuAntiAliasing</property>
<property name="permission">protected</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnAntiAliasing</event>
<event name="OnUpdateUI"></event>
</object>
<object class="separator" expanded="1">
<property name="name">m_separator2</property>
<property name="permission">none</property>

View File

@ -8,6 +8,7 @@ License: LGPL
#include <wx/settings.h>
#include <wx/dcbuffer.h>
#include <wx/log.h>
#include <wx/dcgraph.h>
#include <math.h>
#include "graph.h"
#include "sleeplib/profiles.h"
@ -634,11 +635,18 @@ wxBitmap * gGraphWindow::RenderBitmap(int width,int height)
void gGraphWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxDC *pdc;
if (pref["UseAntiAliasing"]) {
pdc=new wxGCDC(this);
} else {
#if defined(__WXMSW__)
wxAutoBufferedPaintDC dc(this);
pdc=new wxAutoBufferedPaintDC(this);
#else
wxPaintDC dc(this);
pdc=new wxPaintDC(this);
#endif
}
wxDC &dc=*pdc;
GetClientSize(&m_scrX, &m_scrY);
dc.SetPen( *wxTRANSPARENT_PEN );
@ -677,7 +685,7 @@ void gGraphWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
if (m_mouseRBrect.width>0)
dc.DrawRectangle(m_mouseRBrect);
}
delete pdc;
}
void gGraphWindow::OnSize(wxSizeEvent& event)
{

View File

@ -16,14 +16,14 @@ namespace AutoVersion{
//Standard Version Type
static const long MAJOR = 0;
static const long MINOR = 7;
static const long BUILD = 4393;
static const long REVISION = 7184;
static const long BUILD = 4416;
static const long REVISION = 7311;
//Miscellaneous Version Types
static const long BUILDS_COUNT = 3052;
#define RC_FILEVERSION 0,7,4393,7184
#define RC_FILEVERSION_STRING "0, 7, 4393, 7184\0"
static const char FULLVERSION_STRING[] = "0.7.4393.7184";
static const long BUILDS_COUNT = 3112;
#define RC_FILEVERSION 0,7,4416,7311
#define RC_FILEVERSION_STRING "0, 7, 4416, 7311\0"
static const char FULLVERSION_STRING[] = "0.7.4416.7311";
//These values are to keep track of your versioning state, don't modify them.
static const long BUILD_HISTORY = 0;