/////////////////////////////////////////////////////////////////////////////
// Name: screenshot_main.cpp
-// Purpose: Implement the Application Frame
+// Purpose: Implements the window containing all controls.
// Author: Utensil Candel (UtensilCandel@@gmail.com)
// RCS-ID: $Id$
// Licence: wxWindows license
#include "wx/wxprec.h"
#ifdef __BORLANDC__
- #pragma hdrstop
+#pragma hdrstop
#endif
-// for all others, include the necessary headers
+// for all others, include the necessary headers wxWidgets headers)
#ifndef WX_PRECOMP
- #include <wx/filename.h>
- #include <wx/dcbuffer.h>
- #include <wx/colordlg.h>
- #include <wx/fontdlg.h>
- #include <wx/filedlg.h>
- #include <wx/dirdlg.h>
+#include "wx/wx.h"
#endif
-#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 "wx/aboutdlg.h"
+#include "wx/dir.h"
#include "screenshot_main.h"
#include "ctrlmaskout.h"
// ScreenshotFrame
// ----------------------------------------------------------------------------
-ScreenshotFrame::ScreenshotFrame(wxFrame *frame)
-#if SCREENSHOTGEN_USE_AUI
-: AuiGUIFrame(frame)
-#else
-: GUIFrame(frame)
-#endif
+ScreenshotFrame::ScreenshotFrame(wxFrame *frame) : GUIFrame(frame)
{
#if wxUSE_STATUSBAR
statusBar->SetStatusText(_("Welcome to the Automatic Screenshot Generator!"), 0);
// Do some further customization on some controls generated by wxFormBuilder
InitFBControls();
-#if SCREENSHOTGEN_USE_AUI
- // Somehow it will be very small after I move to Aui
- SetSize(600, 600);
- // Maximize(true);
-#endif
}
ScreenshotFrame::~ScreenshotFrame()
}
/*
- Do some further customization on some controls generated by wxFormBuilder.
-
- 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.
-
+ Do some further customization on some controls.
NB: under wxGTK for the radio button "unchecked" to be unchecked, it's
important to put the wxRB_GROUP style on the first wxRadioButton
*/
void ScreenshotFrame::InitFBControls()
{
- // For some reason, wxFormBuilder does not set the scrollbar range
m_scrollBar1->SetScrollbar(50, 1, 100, 1);
// Do the default selection for wxComboBox
m_treeCtrl1->ExpandAll();
// Add items into wxListCtrl
- m_listCtrl1->InsertColumn(0, "Names");
- m_listCtrl1->InsertColumn(1, "Values");
- for(long index = 0; index < 5; index++) {
+ m_listCtrl1->InsertColumn(0, "Names");
+ m_listCtrl1->InsertColumn(1, "Values");
+ for(long index = 0; index < 5; index++) {
m_listCtrl1->InsertItem( index, wxString::Format(_("Item%d"),index));
- m_listCtrl1->SetItem(index, 1, wxString::Format("%d", index));
- }
+ m_listCtrl1->SetItem(index, 1, wxString::Format("%d", index));
+ }
- // Init file and dir pickers
- wxString file, dir;
+ // Init file and dir pickers
+ wxString file, dir;
#if defined(__WXMSW__)
- file = "C:\\Windows\\explorer.exe";
- dir = "C:\\Windows";
+ file = "C:\\Windows\\explorer.exe";
+ dir = "C:\\Windows";
#else
- file = "/bin/bash";
- dir = "/home";
+ file = "/bin/bash";
+ dir = "/home";
#endif
- m_filePicker1->SetPath(file);
- m_dirPicker1->SetPath(dir);
+ m_filePicker1->SetPath(file);
+ m_dirPicker1->SetPath(dir);
// Check the first item in wxCheckListBox
m_checkList1->Check(0);
// set minimum size hints
GetSizer()->SetSizeHints(this);
- // add bitmaps to the menus
- m_menuCapRect->SetBitmaps( wxIcon(play_xpm) );
- m_menuEndCapRect->SetBitmaps( wxIcon(stop_xpm) );
+ // add bitmaps to the menus
+ m_menuCapRect->SetBitmap( wxIcon(play_xpm) );
+ m_menuEndCapRect->SetBitmap( wxIcon(stop_xpm) );
}
void ScreenshotFrame::OnSeeScreenshots(wxCommandEvent& WXUNUSED(event))
{
- wxString defaultDir = m_maskout->GetDefaultDirectory();
+ wxFileName defaultDir = wxFileName::DirName(m_maskout->GetDefaultDirectory());
+ defaultDir.MakeAbsolute();
// Check if defaultDir already existed
- if (!wxDirExists(defaultDir))
- wxMkdir(defaultDir);
+ if (!defaultDir.DirExists())
+ defaultDir.Mkdir();
// Use the native file browser to open defaultDir
- wxLaunchDefaultBrowser(wxFileSystem::FileNameToURL(defaultDir));
+ wxLaunchDefaultBrowser(defaultDir.GetFullPath());
}
void ScreenshotFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
thePage->Disconnect( wxEVT_MOTION, wxMouseEventHandler( CtrlMaskOut::OnMouseMoving ), NULL, m_maskout);
}
-void ScreenshotFrame::OnNotebookPageChanging(
-#if SCREENSHOTGEN_USE_AUI
-wxAuiNotebookEvent& event
-#else
-wxNotebookEvent& event
-#endif
-)
+void ScreenshotFrame::OnNotebookPageChanging(wxNotebookEvent& event)
{
if (!capturingRect)
{
event.Skip();
}
-void ScreenshotFrame::OnNotebookPageChanged(
-#if SCREENSHOTGEN_USE_AUI
-wxAuiNotebookEvent& event
-#else
-wxNotebookEvent& event
-#endif
-)
+void ScreenshotFrame::OnNotebookPageChanged(wxNotebookEvent& event)
{
if (!capturingRect)
{
auto_cap.RegisterControl(m_slider1);
auto_cap.RegisterControl(m_toggleBtn1, AJ_Union);
auto_cap.RegisterControl(m_toggleBtn2, AJ_UnionEnd);
- auto_cap.RegisterControl(m_hyperlink1);
+ auto_cap.RegisterControl(m_hyperlink1, wxT("wxHyperlinkCtrl"));
auto_cap.RegisterControl(m_spinCtrl1, AJ_RegionAdjust);
auto_cap.RegisterControl(m_spinBtn1);
auto_cap.RegisterControl(m_scrollBar1);