mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 12:40:43 +00:00
Added Screenshot Capability
This commit is contained in:
parent
ead5846226
commit
ca063d002d
@ -54,6 +54,13 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons
|
||||
|
||||
menubar->Append( ViewMenu, _("&View") );
|
||||
|
||||
ToolsMenu = new wxMenu();
|
||||
wxMenuItem* ToolsMenuScreenshot;
|
||||
ToolsMenuScreenshot = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("Screenshot") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
ToolsMenu->Append( ToolsMenuScreenshot );
|
||||
|
||||
menubar->Append( ToolsMenu, _("Tools") );
|
||||
|
||||
HelpMenu = new wxMenu();
|
||||
wxMenuItem* HelpMenuAbout;
|
||||
HelpMenuAbout = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("&About") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
@ -78,6 +85,7 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons
|
||||
this->Connect( FileMenuExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnQuit ) );
|
||||
this->Connect( ViewMenuSummary->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnViewMenuSummary ) );
|
||||
this->Connect( ViewMenuDaily->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnViewMenuDaily ) );
|
||||
this->Connect( ToolsMenuScreenshot->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnScreenshot ) );
|
||||
this->Connect( HelpMenuAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnAbout ) );
|
||||
}
|
||||
|
||||
@ -90,6 +98,7 @@ GUIFrame::~GUIFrame()
|
||||
this->Disconnect( wxID_QUIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnQuit ) );
|
||||
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnViewMenuSummary ) );
|
||||
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnViewMenuDaily ) );
|
||||
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnScreenshot ) );
|
||||
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnAbout ) );
|
||||
|
||||
m_mgr.UnInit();
|
||||
|
@ -44,6 +44,7 @@ class GUIFrame : public wxFrame
|
||||
wxMenuBar* menubar;
|
||||
wxMenu* FileMenu;
|
||||
wxMenu* ViewMenu;
|
||||
wxMenu* ToolsMenu;
|
||||
wxMenu* HelpMenu;
|
||||
wxStatusBar* statusBar;
|
||||
|
||||
@ -54,6 +55,7 @@ class GUIFrame : public wxFrame
|
||||
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnViewMenuSummary( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnViewMenuDaily( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnScreenshot( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnAbout( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
@ -7785,12 +7785,12 @@
|
||||
"wx/progdlg.h"
|
||||
"wx/dialog.h"
|
||||
|
||||
1306390268 source:/home/mark/projects/git/sleepyhead/GUIFrame.cpp
|
||||
1306463640 source:/home/mark/projects/git/sleepyhead/GUIFrame.cpp
|
||||
"wx/wxprec.h"
|
||||
<wx/wx.h>
|
||||
"GUIFrame.h"
|
||||
|
||||
1306384009 /home/mark/projects/git/sleepyhead/GUIFrame.h
|
||||
1306463640 /home/mark/projects/git/sleepyhead/GUIFrame.h
|
||||
<wx/intl.h>
|
||||
<wx/string.h>
|
||||
<wx/bitmap.h>
|
||||
@ -7826,7 +7826,7 @@
|
||||
1305881106 /home/mark/projects/git/sleepyhead/SleepyHeadApp.h
|
||||
<wx/app.h>
|
||||
|
||||
1306414968 /home/mark/projects/git/sleepyhead/SleepyHeadMain.h
|
||||
1306468775 /home/mark/projects/git/sleepyhead/SleepyHeadMain.h
|
||||
"SleepyHeadApp.h"
|
||||
"GUIFrame.h"
|
||||
"sleeplib/machine.h"
|
||||
@ -7870,7 +7870,7 @@
|
||||
<sleeplib/machine.h>
|
||||
<list>
|
||||
|
||||
1306410340 /home/mark/projects/git/sleepyhead/version.h
|
||||
1306469484 /home/mark/projects/git/sleepyhead/version.h
|
||||
|
||||
1306415077 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h
|
||||
"machine.h"
|
||||
@ -7887,13 +7887,17 @@
|
||||
"preferences.h"
|
||||
"tinyxml/tinyxml.h"
|
||||
|
||||
1306414968 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
|
||||
1306469522 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
|
||||
"wx_pch.h"
|
||||
"version.h"
|
||||
<wx/app.h>
|
||||
<wx/msgdlg.h>
|
||||
<wx/dirdlg.h>
|
||||
<wx/progdlg.h>
|
||||
<wx/bitmap.h>
|
||||
<wx/log.h>
|
||||
<wx/dcscreen.h>
|
||||
<wx/dcmemory.h>
|
||||
"SleepyHeadMain.h"
|
||||
"sleeplib/profiles.h"
|
||||
|
||||
|
@ -20,7 +20,10 @@
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/dirdlg.h>
|
||||
#include <wx/progdlg.h>
|
||||
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/dcscreen.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include "SleepyHeadMain.h"
|
||||
#include "sleeplib/profiles.h"
|
||||
//#include "graphs/sleepflagsgraph.h"
|
||||
@ -57,11 +60,47 @@ wxString wxbuildinfo(wxbuildinfoformat format)
|
||||
|
||||
return wxbuild;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SleepyHeadFrame::DoScreenshot( wxCommandEvent &event )
|
||||
{
|
||||
wxRect r=GetRect();
|
||||
|
||||
#if defined(__UNIX__)
|
||||
/*int cx, cy;
|
||||
ClientToScreen(&cx,&cy);
|
||||
int border_width = cx - r.x;
|
||||
int title_bar_height = cy - r.y;
|
||||
r.width += (border_width * 2);
|
||||
r.height += title_bar_height + border_width; */
|
||||
#endif
|
||||
int x=r.x;
|
||||
int y=r.y;
|
||||
int w=r.width;
|
||||
int h=r.height;
|
||||
|
||||
wxScreenDC sdc;
|
||||
wxMemoryDC mdc;
|
||||
|
||||
wxBitmap bmp(r.width, r.height,-1);
|
||||
//wxBitMap *bmp=wxEmptyImage(r.width,r.height);
|
||||
mdc.SelectObject(bmp);
|
||||
|
||||
mdc.Blit((wxCoord)0, (wxCoord)0, (wxCoord)r.width, (wxCoord)r.height, &sdc, (wxCoord)r.x, (wxCoord)r.y);
|
||||
|
||||
mdc.SelectObject(wxNullBitmap);
|
||||
|
||||
wxString fileName = wxT("myImage.png");
|
||||
wxImage img=bmp.ConvertToImage();
|
||||
if (!img.SaveFile(fileName, wxBITMAP_TYPE_PNG)) {
|
||||
wxLogError(wxT("Couldn't save screenshot ")+fileName);
|
||||
}
|
||||
}
|
||||
|
||||
SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame)
|
||||
: GUIFrame(frame)
|
||||
{
|
||||
wxInitAllImageHandlers();
|
||||
loader_progress=new wxProgressDialog(wxT("SleepyHead"),wxT("Please Wait..."),100,this, wxPD_APP_MODAL|wxPD_AUTO_HIDE|wxPD_SMOOTH);
|
||||
loader_progress->Hide();
|
||||
wxString title=wxTheApp->GetAppName()+wxT(" v")+wxString(AutoVersion::FULLVERSION_STRING,wxConvUTF8);
|
||||
@ -71,6 +110,9 @@ SleepyHeadFrame::SleepyHeadFrame(wxFrame *frame)
|
||||
wxCommandEvent dummy;
|
||||
OnViewMenuSummary(dummy); // Summary Page
|
||||
OnViewMenuDaily(dummy); // Daily Page
|
||||
|
||||
this->Connect(wxID_ANY, wxEVT_DO_SCREENSHOT, wxCommandEventHandler(SleepyHeadFrame::DoScreenshot));
|
||||
//this->Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SleepyHeadFrame::DoScreenshot));
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
//statusBar->SetStatusText(_("Hello!"), 0);
|
||||
@ -95,7 +137,13 @@ void SleepyHeadFrame::OnClose(wxCloseEvent &event)
|
||||
void SleepyHeadFrame::OnQuit(wxCommandEvent &event)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void SleepyHeadFrame::OnScreenshot(wxCommandEvent& event)
|
||||
{
|
||||
wxCommandEvent MyEvent( wxEVT_DO_SCREENSHOT);
|
||||
wxPostEvent(this, MyEvent);
|
||||
}
|
||||
|
||||
void SleepyHeadFrame::OnAbout(wxCommandEvent &event)
|
||||
{
|
||||
@ -205,6 +253,7 @@ void Summary::RefreshData()
|
||||
if (machine->properties.find(wxT("SubModel"))!=machine->properties.end())
|
||||
submodel=wxT(" <br>\n ")+machine->properties[wxT("SubModel")];
|
||||
html=html+wxT("<tr><td colspan=2 align=center><b>")+machine->properties[wxT("Brand")]+wxT("</b> <br/>")+machine->properties[wxT("Model")]+wxT(" ")+machine->properties[wxT("ModelNumber")]+submodel+wxT("</td></tr>\n");
|
||||
//html=html+wxT("<tr><td colspan=2 align=center>")+_("Serial")+wxT(" ")+machine->properties[wxT("Serial")]+wxT("</td></tr>");
|
||||
html=html+wxT("<tr><td> </td><td> </td></tr>\n");
|
||||
html=html+wxT("<tr><td colspan=2 align=left><i>")+_("Indice Averages")+wxT("</i></td></tr>\n");
|
||||
html=html+wxT("<tr><td><b>")+_("AHI")+wxT("</b></td><td>")+wxString::Format(wxT("%0.2f"),ahi)+wxT("</td></tr>\n");
|
||||
|
@ -55,6 +55,8 @@ protected:
|
||||
|
||||
list<gPointData *> Data;
|
||||
};
|
||||
|
||||
const wxEventType wxEVT_DO_SCREENSHOT = wxNewEventType();
|
||||
|
||||
class SleepyHeadFrame: public GUIFrame
|
||||
{
|
||||
@ -65,6 +67,8 @@ class SleepyHeadFrame: public GUIFrame
|
||||
virtual void OnClose(wxCloseEvent& event);
|
||||
virtual void OnQuit(wxCommandEvent& event);
|
||||
virtual void OnAbout(wxCommandEvent& event);
|
||||
virtual void OnScreenshot(wxCommandEvent& event);
|
||||
virtual void DoScreenshot(wxCommandEvent& event);
|
||||
virtual void OnImportSD(wxCommandEvent& event);
|
||||
virtual void OnViewMenuDaily(wxCommandEvent& event);
|
||||
virtual void OnViewMenuSummary(wxCommandEvent& event);
|
||||
|
@ -286,6 +286,26 @@
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="wxMenu" expanded="1">
|
||||
<property name="label">Tools</property>
|
||||
<property name="name">ToolsMenu</property>
|
||||
<property name="permission">protected</property>
|
||||
<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_NORMAL</property>
|
||||
<property name="label">Screenshot</property>
|
||||
<property name="name">ToolsMenuScreenshot</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="shortcut"></property>
|
||||
<property name="unchecked_bitmap"></property>
|
||||
<event name="OnMenuSelection">OnScreenshot</event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="wxMenu" expanded="1">
|
||||
<property name="label">&Help</property>
|
||||
<property name="name">HelpMenu</property>
|
||||
|
14
version.h
14
version.h
@ -4,7 +4,7 @@
|
||||
namespace AutoVersion{
|
||||
|
||||
//Date Version Types
|
||||
static const char DATE[] = "26";
|
||||
static const char DATE[] = "27";
|
||||
static const char MONTH[] = "05";
|
||||
static const char YEAR[] = "2011";
|
||||
static const char UBUNTU_VERSION_STYLE[] = "11.05";
|
||||
@ -16,14 +16,14 @@ namespace AutoVersion{
|
||||
//Standard Version Type
|
||||
static const long MAJOR = 0;
|
||||
static const long MINOR = 7;
|
||||
static const long BUILD = 1190;
|
||||
static const long REVISION = 940;
|
||||
static const long BUILD = 1244;
|
||||
static const long REVISION = 1258;
|
||||
|
||||
//Miscellaneous Version Types
|
||||
static const long BUILDS_COUNT = 4690;
|
||||
#define RC_FILEVERSION 0,7,1190,940
|
||||
#define RC_FILEVERSION_STRING "0, 7, 1190, 940\0"
|
||||
static const char FULLVERSION_STRING[] = "0.7.1190.940";
|
||||
static const long BUILDS_COUNT = 4784;
|
||||
#define RC_FILEVERSION 0,7,1244,1258
|
||||
#define RC_FILEVERSION_STRING "0, 7, 1244, 1258\0"
|
||||
static const char FULLVERSION_STRING[] = "0.7.1244.1258";
|
||||
|
||||
//These values are to keep track of your versioning state, don't modify them.
|
||||
static const long BUILD_HISTORY = 62;
|
||||
|
Loading…
Reference in New Issue
Block a user