// AutoCaptureMechanism
// ----------------------------------------------------------------------------
+void AutoCaptureMechanism::CaptureAll()
+{
+ m_notebook->SetSelection(0);
+ wxYield();
+
+ for(ControlList::iterator it = m_controlList.begin();
+ it != m_controlList.end();
+ ++it)
+ {
+ Control & ctrl = *it;
+
+ if(ctrl.flag == AJ_TurnPage) // Turn to next page
+ {
+ m_notebook->SetSelection(m_notebook->GetSelection() + 1);
+ wxYield();
+ continue;
+ }
+
+ wxBitmap screenshot = Capture(ctrl);
+
+ if(ctrl.flag & AJ_Union)
+ {
+ screenshot = Union(screenshot, Capture(*(++it)));
+ }
+
+ Save(screenshot, ctrl.name);
+ }
+}
+
wxBitmap AutoCaptureMechanism::Capture(Control & ctrl)
{
if(ctrl.name == wxT("")) //no mannual specification for the control name
wxString directory = wxT("screenshots"),
int border = 5)
: m_notebook(notebook), m_dir(directory), m_border(border) {}
+
~AutoCaptureMechanism(){}
/*
m_controlList.push_back(Control(0, wxT(""), AJ_TurnPage));
}
- void CaptureAll()
- {
- m_notebook->SetSelection(0);
- wxYield();
-
- for(ControlList::iterator it = m_controlList.begin();
- it != m_controlList.end();
- ++it)
- {
- Control & ctrl = *it;
-
- if(ctrl.flag == AJ_TurnPage) // Turn to next page
- {
- m_notebook->SetSelection(m_notebook->GetSelection() + 1);
- wxYield();
- continue;
- }
-
- wxBitmap screenshot = Capture(ctrl);
-
- if(ctrl.flag & AJ_Union)
- {
- screenshot = Union(screenshot, Capture(*(++it)));
- }
-
- Save(screenshot, ctrl.name);
- }
- }
+ void CaptureAll();
protected: // internal utils
struct Control
void Capture(wxRect rect, wxString fileName);
void Capture(int x, int y, int width, int height, wxString fileName);
- wxString GetDefaultDirectory(){return m_defaultDir;}
+ wxString GetDefaultDirectory() const
+ { return m_defaultDir; }
+ wxString GetDefaultDirectoryAbsPath() const
+ {
+ wxFileName output = wxFileName::DirName(GetDefaultDirectory());
+ output.MakeAbsolute();
+ return output.GetFullPath();
+ }
private:
// Helper functions
wxLC_LIST|wxLC_VRULES|wxBORDER_THEME);
}
- virtual wxWindow *GetControl() { return this; }
+ virtual wxWindow *GetControl()
+ { return this; }
virtual void SetStringValue( const wxString& s )
{
}
protected:
- int m_value; // current item index
- int m_itemHere; // hot item in popup
+ int m_value; // current item index
+ int m_itemHere; // hot item in popup
private:
DECLARE_EVENT_TABLE()
return wxSize(minWidth, wxMin(80, maxHeight));
}
- virtual wxWindow *GetControl() { return this; }
+ virtual wxWindow *GetControl()
+ { return this; }
// Needed by SetStringValue
wxTreeItemId FindItemByText( wxTreeItemId parent, const wxString& text )
}
protected:
-
- wxTreeItemId m_value; // current item index
- wxTreeItemId m_itemHere; // hot item in popup
+ wxTreeItemId m_value; // current item index
+ wxTreeItemId m_itemHere; // hot item in popup
private:
DECLARE_EVENT_TABLE()
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
- <object class="wxMenuBar" expanded="1">
+ <object class="wxMenuBar" expanded="0">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
- <property name="help">Open the directory where the screenshots generated.</property>
+ <property name="help">Opens the directory where the screenshots are saved.</property>
<property name="id">wxID_ZOOM_IN</property>
<property name="kind">wxITEM_NORMAL</property>
- <property name="label">&View screenshots...</property>
+ <property name="label">&Open screenshots folder...</property>
<property name="name">m_menuSeeScr</property>
<property name="permission">none</property>
<property name="shortcut">Ctrl+O</property>
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
- <property name="help">Quit the application</property>
+ <property name="help">Quits the application.</property>
<property name="id">wxID_EXIT</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">&Quit</property>
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
- <property name="help">Can screenshot be taken properly?</property>
+ <property name="help">Takes a screenshot of the entire screen.</property>
<property name="id">idMenuCapFullScreen</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">&Full Screen</property>
<property name="bitmap">play; Load From Icon Resource [-1; -1]</property>
<property name="checked">0</property>
<property name="enabled">1</property>
- <property name="help">Manually specify rectangular regions</property>
+ <property name="help">Manually specify rectangular regions for the screenshots.</property>
<property name="id">idMenuCapRect</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Regions<Begin></property>
<property name="bitmap">stop; Load From Icon Resource [-1; -1]</property>
<property name="checked">0</property>
<property name="enabled">0</property>
- <property name="help">Stop generating screenshots...</property>
+ <property name="help">Stop manually generating screenshots.</property>
<property name="id">idMenuEndCapRect</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Regions<End></property>
<property name="bitmap">; Load From Resource</property>
<property name="checked">0</property>
<property name="enabled">1</property>
- <property name="help">Take screenshot for all controls autoly.</property>
+ <property name="help">Takes screenshots for all controls automatically.</property>
<property name="id">idMenuCapAll</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Capture All</property>
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
- <property name="help">Show info about this application</property>
+ <property name="help">Shows info about this application.</property>
<property name="id">wxID_ABOUT</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">&About...</property>
</object>
</object>
</object>
- <object class="wxBoxSizer" expanded="1">
+ <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer0</property>
<property name="orient">wxVERTICAL</property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
- <property name="label">Not checked</property>
+ <property name="label">Unchecked</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_checkBox2</property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
- <property name="label">Chosen</property>
+ <property name="label">Checked</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_radioBtn1</property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
- <property name="label">Not chosen</property>
+ <property name="label">Unchecked</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_radioBtn2</property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
- <property name="label">Not Toggled</property>
+ <property name="label">Untoggled</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_toggleBtn1</property>
</object>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
- <property name="label">Choosing Controls</property>
- <property name="select">1</property>
+ <property name="label">Multiple choice Controls</property>
+ <property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
</object>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
- <property name="label">Text Richtext</property>
+ <property name="label">[Rich]Text Controls</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="bg"></property>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Picker Controls</property>
- <property name="select">0</property>
+ <property name="select">1</property>
<object class="wxPanel" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
</object>
<object class="sizeritem" expanded="1">
<property name="border">20</property>
- <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</property>
+ <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxFontPickerCtrl" expanded="1">
<property name="bg"></property>
</object>
<object class="sizeritem" expanded="1">
<property name="border">20</property>
- <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</property>
+ <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxFilePickerCtrl" expanded="1">
<property name="bg"></property>
</object>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
- <property name="label">Drop Down Controls</property>
+ <property name="label">Drop-down Controls</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="bg"></property>
mbar = new wxMenuBar( 0 );
fileMenu = new wxMenu();
wxMenuItem* m_menuSeeScr;
- m_menuSeeScr = new wxMenuItem( fileMenu, wxID_ZOOM_IN, wxString( _("&View screenshots...") ) + wxT('\t') + wxT("Ctrl+O"), _("Open the directory where the screenshots generated."), wxITEM_NORMAL );
+ m_menuSeeScr = new wxMenuItem( fileMenu, wxID_ZOOM_IN, wxString( _("&Open screenshots folder...") ) + wxT('\t') + wxT("Ctrl+O"), _("Opens the directory where the screenshots are saved."), wxITEM_NORMAL );
fileMenu->Append( m_menuSeeScr );
fileMenu->AppendSeparator();
wxMenuItem* m_menuFileQuit;
- m_menuFileQuit = new wxMenuItem( fileMenu, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("Alt+F4"), _("Quit the application"), wxITEM_NORMAL );
+ m_menuFileQuit = new wxMenuItem( fileMenu, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("Alt+F4"), _("Quits the application."), wxITEM_NORMAL );
fileMenu->Append( m_menuFileQuit );
mbar->Append( fileMenu, _("&File") );
captureMenu = new wxMenu();
wxMenuItem* m_menuCapFullScreen;
- m_menuCapFullScreen = new wxMenuItem( captureMenu, idMenuCapFullScreen, wxString( _("&Full Screen") ) + wxT('\t') + wxT("Ctrl+Alt+F"), _("Can screenshot be taken properly?"), wxITEM_NORMAL );
+ m_menuCapFullScreen = new wxMenuItem( captureMenu, idMenuCapFullScreen, wxString( _("&Full Screen") ) + wxT('\t') + wxT("Ctrl+Alt+F"), _("Takes a screenshot of the entire screen."), wxITEM_NORMAL );
captureMenu->Append( m_menuCapFullScreen );
wxMenuItem* m_menuCapRect;
- m_menuCapRect = new wxMenuItem( captureMenu, idMenuCapRect, wxString( _("Regions<Begin>") ) + wxT('\t') + wxT("Ctrl+Alt+R"), _("Manually specify rectangular regions"), wxITEM_NORMAL );
+ m_menuCapRect = new wxMenuItem( captureMenu, idMenuCapRect, wxString( _("Regions<Begin>") ) + wxT('\t') + wxT("Ctrl+Alt+R"), _("Manually specify rectangular regions for the screenshots."), wxITEM_NORMAL );
#ifdef __WXMSW__
m_menuCapRect->SetBitmaps( wxICON( play ) );
#elif defined( __WXGTK__ )
captureMenu->Append( m_menuCapRect );
wxMenuItem* m_menuEndCapRect;
- m_menuEndCapRect = new wxMenuItem( captureMenu, idMenuEndCapRect, wxString( _("Regions<End>") ) + wxT('\t') + wxT("Ctrl+Alt+E"), _("Stop generating screenshots..."), wxITEM_NORMAL );
+ m_menuEndCapRect = new wxMenuItem( captureMenu, idMenuEndCapRect, wxString( _("Regions<End>") ) + wxT('\t') + wxT("Ctrl+Alt+E"), _("Stop manually generating screenshots."), wxITEM_NORMAL );
#ifdef __WXMSW__
m_menuEndCapRect->SetBitmaps( wxICON( stop ) );
#elif defined( __WXGTK__ )
m_menuEndCapRect->Enable( false );
wxMenuItem* m_menuCapAll;
- m_menuCapAll = new wxMenuItem( captureMenu, idMenuCapAll, wxString( _("Capture All") ) + wxT('\t') + wxT("Ctrl+Alt+A"), _("Take screenshot for all controls autoly."), wxITEM_NORMAL );
+ m_menuCapAll = new wxMenuItem( captureMenu, idMenuCapAll, wxString( _("Capture All") ) + wxT('\t') + wxT("Ctrl+Alt+A"), _("Takes screenshots for all controls automatically."), wxITEM_NORMAL );
captureMenu->Append( m_menuCapAll );
mbar->Append( captureMenu, _("&Capture") );
helpMenu = new wxMenu();
wxMenuItem* m_menuHelpAbout;
- m_menuHelpAbout = new wxMenuItem( helpMenu, wxID_ABOUT, wxString( _("&About...") ) + wxT('\t') + wxT("F1"), _("Show info about this application"), wxITEM_NORMAL );
+ m_menuHelpAbout = new wxMenuItem( helpMenu, wxID_ABOUT, wxString( _("&About...") ) + wxT('\t') + wxT("F1"), _("Shows info about this application."), wxITEM_NORMAL );
helpMenu->Append( m_menuHelpAbout );
mbar->Append( helpMenu, _("&Help") );
fgSizer1->Add( m_checkBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
- m_checkBox2 = new wxCheckBox( m_panel1, wxID_ANY, _("Not checked"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_checkBox2 = new wxCheckBox( m_panel1, wxID_ANY, _("Unchecked"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBox2->SetToolTip( _("wxCheckBox") );
fgSizer1->Add( m_checkBox2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 );
- m_radioBtn1 = new wxRadioButton( m_panel1, wxID_ANY, _("Chosen"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_radioBtn1 = new wxRadioButton( m_panel1, wxID_ANY, _("Checked"), wxDefaultPosition, wxDefaultSize, 0 );
m_radioBtn1->SetValue( true );
m_radioBtn1->SetToolTip( _("wxRadioButton") );
fgSizer1->Add( m_radioBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
- m_radioBtn2 = new wxRadioButton( m_panel1, wxID_ANY, _("Not chosen"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_radioBtn2 = new wxRadioButton( m_panel1, wxID_ANY, _("Unchecked"), wxDefaultPosition, wxDefaultSize, 0 );
m_radioBtn2->SetToolTip( _("wxRadioButton") );
fgSizer1->Add( m_radioBtn2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
fgSizer1->Add( m_slider1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
- m_toggleBtn1 = new wxToggleButton( m_panel1, wxID_ANY, _("Not Toggled"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_toggleBtn1 = new wxToggleButton( m_panel1, wxID_ANY, _("Untoggled"), wxDefaultPosition, wxDefaultSize, 0 );
m_toggleBtn1->SetToolTip( _("wxToggleButton") );
fgSizer1->Add( m_toggleBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_panel2->SetSizer( fgSizer2 );
m_panel2->Layout();
fgSizer2->Fit( m_panel2 );
- m_notebook1->AddPage( m_panel2, _("Choosing Controls"), true );
+ m_notebook1->AddPage( m_panel2, _("Multiple choice Controls"), false );
m_panel3 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_panel3->SetSizer( bSizer2 );
m_panel3->Layout();
bSizer2->Fit( m_panel3 );
- m_notebook1->AddPage( m_panel3, _("Text Richtext"), false );
+ m_notebook1->AddPage( m_panel3, _("[Rich]Text Controls"), false );
m_panel4 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxFlexGridSizer* fgSizer5;
fgSizer5 = new wxFlexGridSizer( 2, 2, 10, 10 );
m_fontPicker1->SetMaxPointSize( 100 );
m_fontPicker1->SetToolTip( _("wxFontPickerCtrl") );
- fgSizer5->Add( m_fontPicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
+ fgSizer5->Add( m_fontPicker1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 20 );
m_filePicker1 = new wxFilePickerCtrl( m_panel4, wxID_ANY, wxEmptyString, _("Select a file"), wxT("*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE, wxDefaultValidator, wxT("_FilePickerCtrl") );
m_filePicker1->SetToolTip( _("wxFilePickerCtrl") );
- fgSizer5->Add( m_filePicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
+ fgSizer5->Add( m_filePicker1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 20 );
fgSizer5->Add( 0, 0, 1, wxEXPAND, 5 );
m_panel4->SetSizer( fgSizer5 );
m_panel4->Layout();
fgSizer5->Fit( m_panel4 );
- m_notebook1->AddPage( m_panel4, _("Picker Controls"), false );
+ m_notebook1->AddPage( m_panel4, _("Picker Controls"), true );
m_panel5 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxFlexGridSizer* fgSizer4;
fgSizer4 = new wxFlexGridSizer( 2, 2, 0, 0 );
m_panel5->SetSizer( fgSizer4 );
m_panel5->Layout();
fgSizer4->Fit( m_panel5 );
- m_notebook1->AddPage( m_panel5, _("Drop Down Controls"), false );
+ m_notebook1->AddPage( m_panel5, _("Drop-down Controls"), false );
bSizer0->Add( m_notebook1, 1, wxEXPAND | wxALL, 0 );
#include <wx/dir.h>
#include <wx/aboutdlg.h>
+#include <wx/msgdlg.h>
+#include <wx/dcscreen.h>
+#include <wx/filesys.h>
+#include <wx/utils.h>
#include "screenshot_main.h"
#include "ctrlmaskout.h"
#include "autocapture.h"
-/*
-// Global helper functions
-enum wxBuildInfoFormat
-{
- short_f,
- long_f
-};
-
-wxString wxbuildinfo(wxBuildInfoFormat format)
-{
- wxString wxbuild(wxVERSION_STRING);
-
- if (format == long_f )
- {
- #if defined(__WXMSW__)
- wxbuild << _T("-Windows");
- #elif defined(__WXMAC__)
- wxbuild << _T("-Mac");
- #elif defined(__UNIX__)
- wxbuild << _T("-Linux");
- #endif
-
- #if wxUSE_UNICODE
- wxbuild << _T("-Unicode build");
- #else
- wxbuild << _T("-ANSI build");
- #endif // wxUSE_UNICODE
- }
-
- return wxbuild;
-}*/
-
// ----------------------------------------------------------------------------
// ScreenshotFrame
#endif
{
#if wxUSE_STATUSBAR
- statusBar->SetStatusText(_("Hello wxWidgets user!"), 0);
- // statusBar->SetStatusText(wxbuildinfo(short_f), 1);
+ statusBar->SetStatusText(_("Welcome to the Automatic Screenshot Generator!"), 0);
#endif
- // We will hold one during the whole life time of the main frame
+ // We will hold one ctrlmaskout during the whole life time of the main frame
m_maskout = new CtrlMaskOut();
// At the begining, we are not specifying the rect region
/*
Do some further customization on some controls generated by wxFormBuilder.
- Some controls can only be generated by wxFormBuilder without further
- customization, e.g. unable to load a richtext file in a wxRichtextCtrl
- during initialization.
+ wxFormBuilder does not allow customizations on some controls;
+ e.g. you cannot load a richtext file in a wxRichtextCtrl during initialization.
Those customizations will be done here.
*/
// Add a root and some nodes for wxTreeCtrl
wxTreeItemId root = m_treeCtrl1->AddRoot(_("wxTreeCtrl"));
-
m_treeCtrl1->AppendItem(root, _("Node1"));
-
wxTreeItemId node2 = m_treeCtrl1->AppendItem(root, _("Node2"));
m_treeCtrl1->AppendItem(node2, _("Node3"));
-
m_treeCtrl1->ExpandAll();
// Add items into wxListCtrl
// Load richtext.xml into wxRichtextCtrl
m_richText1->LoadFile(_T("richtext.xml"));
- m_richText1->ShowPosition(335);
+ //m_richText1->ShowPosition(335);
+
+ // select first page in the main notebook ctrl
+ m_notebook1->ChangeSelection(0);
+
+ // set minimum size hints
+ GetSizer()->SetSizeHints(this);
}
wxString defaultDir = m_maskout->GetDefaultDirectory();
// Check if defaultDir already existed
- if(!wxDirExists(defaultDir))
+ if (!wxDirExists(defaultDir))
wxMkdir(defaultDir);
// Use the native file browser to open defaultDir
- #if defined(__WXMSW__)
- wxExecute(_T("explorer ") + defaultDir);
- #elif defined(__UNIX__) // nautilus is the GNOME file browser but works also for KDE
- wxExecute(_T("nautilus ") + defaultDir);
- #elif defined(_WXMAC_)
- wxExecute(_T("open ") + defaultDir);
- #else
- wxMessageBox(_("Sorry, not Implemeted for this platform yet! Please open subdirectory \"")
- + defaultDir
- + _("\" manually.") );
- #endif
+ wxLaunchDefaultBrowser(wxFileSystem::FileNameToURL(defaultDir));
}
void ScreenshotFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
dcScreen.GetSize(&screenWidth, &screenHeight);
m_maskout->Capture(0, 0, screenWidth, screenHeight, _T("fullscreen"));
+
+ // Inform the user
+ wxMessageBox(_("A screenshot of the entire screen was saved as:\n\n ") +
+ m_maskout->GetDefaultDirectoryAbsPath() + wxFileName::GetPathSeparator() + "fullscreen.png",
+ _("Full screen capture"), wxICON_INFORMATION|wxOK, this);
}
void ScreenshotFrame::OnCaptureRect(wxCommandEvent& WXUNUSED(event))
#endif
)
{
- if(!capturingRect)
+ if (!capturingRect)
{
event.Skip();
return;
void ScreenshotFrame::OnCaptureAllControls(wxCommandEvent& WXUNUSED(event))
{
- wxString dir = wxT("screenshots");
+ wxString dir = m_maskout->GetDefaultDirectoryAbsPath();
+ // check if there are other screenshots taken before
if (wxFileName::DirExists(dir))
{
- int choice = wxMessageBox(_("It seems that you have already generated some screenshots.\nClick YES to delete them all(recommended), NO to preserve them\nCANCEL to cancel this auto-capture(so you can save them elsewhere)."),
- _("Do you want to delete the existing screenshots?"),
+ int choice = wxMessageBox(_("It seems that you have already generated some screenshots.\nClick YES to delete them all (recommended) or NO to preserve them.\nClick CANCEL to cancel this auto-capture operation."),
+ _("Delete existing screenshots?"),
wxYES_NO|wxCANCEL|wxICON_QUESTION, this);
switch(choice)
{
- case wxYES :
+ case wxYES:
{
wxArrayString files;
wxDir::GetAllFiles(dir, &files, wxT("*.png"), wxDIR_FILES);
+ // remove all PNG files from the screenshots folder
int n = files.GetCount();
for (int i = 0; i < n; ++i)
wxRemoveFile(files[i]);
}
break;
- case wxNO : break;
- case wxCANCEL : return;
+ case wxNO: break;
+ case wxCANCEL: return;
}
}
+ // proceed with the automatic screenshot capture
+
this->Maximize();
AutoCaptureMechanism auto_cap(m_notebook1);
auto_cap.CaptureAll();
- wxMessageBox(_("All screenshots are generated successfully.\nSelect \"File->See screenshots\" to see them."),
- _("Success"), wxOK, this);
+ wxMessageBox(_("All screenshots were generated successfully in the folder:\n ") + dir,
+ _("Success"), wxOK|wxICON_INFORMATION, this);
}