From 60a2264d5dff7d61adc10ea2eded11d563cfe12d Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Mon, 6 Oct 2008 14:08:08 +0000 Subject: [PATCH] other cleanup; adjusted english in the UI git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56121 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/screenshotgen/src/autocapture.cpp | 29 +++++++++ utils/screenshotgen/src/autocapture.h | 30 +-------- utils/screenshotgen/src/ctrlmaskout.h | 9 ++- utils/screenshotgen/src/customcombo.h | 15 ++--- utils/screenshotgen/src/guidesign.fbp | 42 ++++++------- utils/screenshotgen/src/guiframe.cpp | 34 +++++----- utils/screenshotgen/src/screenshot_main.cpp | 98 +++++++++++------------------ 7 files changed, 120 insertions(+), 137 deletions(-) diff --git a/utils/screenshotgen/src/autocapture.cpp b/utils/screenshotgen/src/autocapture.cpp index 382c445..8263e38 100644 --- a/utils/screenshotgen/src/autocapture.cpp +++ b/utils/screenshotgen/src/autocapture.cpp @@ -89,6 +89,35 @@ wxBitmap Capture(wxRect rect) // 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 diff --git a/utils/screenshotgen/src/autocapture.h b/utils/screenshotgen/src/autocapture.h index e07b43f..10ea3c8 100644 --- a/utils/screenshotgen/src/autocapture.h +++ b/utils/screenshotgen/src/autocapture.h @@ -40,6 +40,7 @@ public: wxString directory = wxT("screenshots"), int border = 5) : m_notebook(notebook), m_dir(directory), m_border(border) {} + ~AutoCaptureMechanism(){} /* @@ -62,34 +63,7 @@ public: 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 diff --git a/utils/screenshotgen/src/ctrlmaskout.h b/utils/screenshotgen/src/ctrlmaskout.h index 124788c..660d96d 100644 --- a/utils/screenshotgen/src/ctrlmaskout.h +++ b/utils/screenshotgen/src/ctrlmaskout.h @@ -30,7 +30,14 @@ public: 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 diff --git a/utils/screenshotgen/src/customcombo.h b/utils/screenshotgen/src/customcombo.h index 8902abd..ba3d52a 100644 --- a/utils/screenshotgen/src/customcombo.h +++ b/utils/screenshotgen/src/customcombo.h @@ -60,7 +60,8 @@ public: wxLC_LIST|wxLC_VRULES|wxBORDER_THEME); } - virtual wxWindow *GetControl() { return this; } + virtual wxWindow *GetControl() + { return this; } virtual void SetStringValue( const wxString& s ) { @@ -113,8 +114,8 @@ public: } 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() @@ -158,7 +159,8 @@ public: 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 ) @@ -236,9 +238,8 @@ public: } 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() diff --git a/utils/screenshotgen/src/guidesign.fbp b/utils/screenshotgen/src/guidesign.fbp index 2340fc4..19eb9d6 100644 --- a/utils/screenshotgen/src/guidesign.fbp +++ b/utils/screenshotgen/src/guidesign.fbp @@ -70,7 +70,7 @@ - + 1 @@ -122,10 +122,10 @@ 0 1 - Open the directory where the screenshots generated. + Opens the directory where the screenshots are saved. wxID_ZOOM_IN wxITEM_NORMAL - &View screenshots... + &Open screenshots folder... m_menuSeeScr none Ctrl+O @@ -140,7 +140,7 @@ 0 1 - Quit the application + Quits the application. wxID_EXIT wxITEM_NORMAL &Quit @@ -160,7 +160,7 @@ 0 1 - Can screenshot be taken properly? + Takes a screenshot of the entire screen. idMenuCapFullScreen wxITEM_NORMAL &Full Screen @@ -175,7 +175,7 @@ play; Load From Icon Resource [-1; -1] 0 1 - Manually specify rectangular regions + Manually specify rectangular regions for the screenshots. idMenuCapRect wxITEM_NORMAL Regions<Begin> @@ -190,7 +190,7 @@ stop; Load From Icon Resource [-1; -1] 0 0 - Stop generating screenshots... + Stop manually generating screenshots. idMenuEndCapRect wxITEM_NORMAL Regions<End> @@ -205,7 +205,7 @@ ; Load From Resource 0 1 - Take screenshot for all controls autoly. + Takes screenshots for all controls automatically. idMenuCapAll wxITEM_NORMAL Capture All @@ -225,7 +225,7 @@ 0 1 - Show info about this application + Shows info about this application. wxID_ABOUT wxITEM_NORMAL &About... @@ -238,7 +238,7 @@ - + bSizer0 wxVERTICAL @@ -519,7 +519,7 @@ 0 wxID_ANY - Not checked + Unchecked m_checkBox2 @@ -570,7 +570,7 @@ 0 wxID_ANY - Chosen + Checked m_radioBtn1 @@ -622,7 +622,7 @@ 0 wxID_ANY - Not chosen + Unchecked m_radioBtn2 @@ -1017,7 +1017,7 @@ 0 wxID_ANY - Not Toggled + Untoggled m_toggleBtn1 @@ -1347,8 +1347,8 @@ - Choosing Controls - 1 + Multiple choice Controls + 0 @@ -1918,7 +1918,7 @@ - Text Richtext + [Rich]Text Controls 0 @@ -2155,7 +2155,7 @@ Picker Controls - 0 + 1 @@ -2263,7 +2263,7 @@ 20 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL 0 @@ -2315,7 +2315,7 @@ 20 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL 0 @@ -2608,7 +2608,7 @@ - Drop Down Controls + Drop-down Controls 0 diff --git a/utils/screenshotgen/src/guiframe.cpp b/utils/screenshotgen/src/guiframe.cpp index 541e63f..08b3181 100644 --- a/utils/screenshotgen/src/guiframe.cpp +++ b/utils/screenshotgen/src/guiframe.cpp @@ -36,24 +36,24 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons 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") ) + wxT('\t') + wxT("Ctrl+Alt+R"), _("Manually specify rectangular regions"), wxITEM_NORMAL ); + m_menuCapRect = new wxMenuItem( captureMenu, idMenuCapRect, wxString( _("Regions") ) + 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__ ) @@ -62,7 +62,7 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons captureMenu->Append( m_menuCapRect ); wxMenuItem* m_menuEndCapRect; - m_menuEndCapRect = new wxMenuItem( captureMenu, idMenuEndCapRect, wxString( _("Regions") ) + wxT('\t') + wxT("Ctrl+Alt+E"), _("Stop generating screenshots..."), wxITEM_NORMAL ); + m_menuEndCapRect = new wxMenuItem( captureMenu, idMenuEndCapRect, wxString( _("Regions") ) + wxT('\t') + wxT("Ctrl+Alt+E"), _("Stop manually generating screenshots."), wxITEM_NORMAL ); #ifdef __WXMSW__ m_menuEndCapRect->SetBitmaps( wxICON( stop ) ); #elif defined( __WXGTK__ ) @@ -72,14 +72,14 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons 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") ); @@ -110,19 +110,19 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons 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 ); @@ -164,7 +164,7 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons 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 ); @@ -274,7 +274,7 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons 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 ); @@ -301,7 +301,7 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons 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 ); @@ -317,12 +317,12 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons 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 ); @@ -353,7 +353,7 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons 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 ); @@ -444,7 +444,7 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons 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 ); diff --git a/utils/screenshotgen/src/screenshot_main.cpp b/utils/screenshotgen/src/screenshot_main.cpp index c9966ff..00f95ac 100644 --- a/utils/screenshotgen/src/screenshot_main.cpp +++ b/utils/screenshotgen/src/screenshot_main.cpp @@ -25,43 +25,15 @@ #include #include +#include +#include +#include +#include #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 @@ -75,11 +47,10 @@ ScreenshotFrame::ScreenshotFrame(wxFrame *frame) #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 @@ -102,9 +73,8 @@ ScreenshotFrame::~ScreenshotFrame() /* 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. */ @@ -120,12 +90,9 @@ void ScreenshotFrame::InitFBControls() // 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 @@ -137,7 +104,13 @@ void ScreenshotFrame::InitFBControls() // 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); } @@ -161,21 +134,11 @@ void ScreenshotFrame::OnSeeScreenshots(wxCommandEvent& WXUNUSED(event)) 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)) @@ -199,6 +162,11 @@ void ScreenshotFrame::OnCaptureFullScreen(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)) @@ -260,7 +228,7 @@ wxNotebookEvent& event #endif ) { - if(!capturingRect) + if (!capturingRect) { event.Skip(); return; @@ -277,31 +245,35 @@ wxNotebookEvent& event 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); @@ -363,6 +335,6 @@ void ScreenshotFrame::OnCaptureAllControls(wxCommandEvent& WXUNUSED(event)) 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); } -- 2.7.4