other cleanup; adjusted english in the UI
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56121 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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()
|
||||
|
@@ -70,7 +70,7 @@
|
||||
<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>
|
||||
@@ -122,10 +122,10 @@
|
||||
<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>
|
||||
@@ -140,7 +140,7 @@
|
||||
<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>
|
||||
@@ -160,7 +160,7 @@
|
||||
<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>
|
||||
@@ -175,7 +175,7 @@
|
||||
<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>
|
||||
@@ -190,7 +190,7 @@
|
||||
<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>
|
||||
@@ -205,7 +205,7 @@
|
||||
<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>
|
||||
@@ -225,7 +225,7 @@
|
||||
<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>
|
||||
@@ -238,7 +238,7 @@
|
||||
</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>
|
||||
@@ -519,7 +519,7 @@
|
||||
<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>
|
||||
@@ -570,7 +570,7 @@
|
||||
<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>
|
||||
@@ -622,7 +622,7 @@
|
||||
<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>
|
||||
@@ -1017,7 +1017,7 @@
|
||||
<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>
|
||||
@@ -1347,8 +1347,8 @@
|
||||
</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>
|
||||
@@ -1918,7 +1918,7 @@
|
||||
</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>
|
||||
@@ -2155,7 +2155,7 @@
|
||||
<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>
|
||||
@@ -2263,7 +2263,7 @@
|
||||
</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>
|
||||
@@ -2315,7 +2315,7 @@
|
||||
</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>
|
||||
@@ -2608,7 +2608,7 @@
|
||||
</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>
|
||||
|
@@ -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<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__ )
|
||||
@@ -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<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__ )
|
||||
@@ -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 );
|
||||
|
||||
|
@@ -25,43 +25,15 @@
|
||||
|
||||
#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
|
||||
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user