Missing wxUSE_... flags and source cleaning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35304 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -502,8 +502,9 @@ bool Edit::InitializePrefs (const wxString &name) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Edit::LoadFile () {
|
bool Edit::LoadFile ()
|
||||||
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
// get filname
|
// get filname
|
||||||
if (!m_filename) {
|
if (!m_filename) {
|
||||||
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString,
|
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString,
|
||||||
@@ -514,6 +515,9 @@ bool Edit::LoadFile () {
|
|||||||
|
|
||||||
// load file
|
// load file
|
||||||
return LoadFile (m_filename);
|
return LoadFile (m_filename);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Edit::LoadFile (const wxString &filename) {
|
bool Edit::LoadFile (const wxString &filename) {
|
||||||
@@ -544,8 +548,9 @@ bool Edit::LoadFile (const wxString &filename) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Edit::SaveFile () {
|
bool Edit::SaveFile ()
|
||||||
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
// return if no change
|
// return if no change
|
||||||
if (!Modified()) return true;
|
if (!Modified()) return true;
|
||||||
|
|
||||||
@@ -559,6 +564,9 @@ bool Edit::SaveFile () {
|
|||||||
|
|
||||||
// save file
|
// save file
|
||||||
return SaveFile (m_filename);
|
return SaveFile (m_filename);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Edit::SaveFile (const wxString &filename) {
|
bool Edit::SaveFile (const wxString &filename) {
|
||||||
@@ -695,6 +703,8 @@ EditProperties::EditProperties (Edit *edit,
|
|||||||
ShowModal();
|
ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_PRINTING_ARCHITECTURE
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EditPrint
|
// EditPrint
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -821,3 +831,4 @@ bool EditPrint::PrintScaling (wxDC *dc){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||||
|
@@ -423,7 +423,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// create a menu bar
|
// create a menu bar
|
||||||
wxMenu *menuFile = new wxMenu(_T(""), wxMENU_TEAROFF);
|
wxMenu *menuFile = new wxMenu(wxEmptyString, wxMENU_TEAROFF);
|
||||||
menuFile->Append(Exec_Kill, _T("&Kill process...\tCtrl-K"),
|
menuFile->Append(Exec_Kill, _T("&Kill process...\tCtrl-K"),
|
||||||
_T("Kill a process by PID"));
|
_T("Kill a process by PID"));
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
@@ -456,7 +456,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
|||||||
execMenu->Append(Exec_DDERequest, _T("Send DDE &request...\tCtrl-R"));
|
execMenu->Append(Exec_DDERequest, _T("Send DDE &request...\tCtrl-R"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxMenu *helpMenu = new wxMenu(_T(""), wxMENU_TEAROFF);
|
wxMenu *helpMenu = new wxMenu(wxEmptyString, wxMENU_TEAROFF);
|
||||||
helpMenu->Append(Exec_About, _T("&About...\tF1"), _T("Show about dialog"));
|
helpMenu->Append(Exec_About, _T("&About...\tF1"), _T("Show about dialog"));
|
||||||
|
|
||||||
// now append the freshly created menu to the menu bar...
|
// now append the freshly created menu to the menu bar...
|
||||||
@@ -800,8 +800,13 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
static wxString s_filename;
|
static wxString s_filename;
|
||||||
|
|
||||||
wxString filename = wxLoadFileSelector(_T(""), _T(""), s_filename);
|
wxString filename;
|
||||||
if ( !filename )
|
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
|
filename = wxLoadFileSelector(wxEmptyString, wxEmptyString, s_filename);
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
|
|
||||||
|
if ( filename.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s_filename = filename;
|
s_filename = filename;
|
||||||
@@ -817,7 +822,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
wxString cmd;
|
wxString cmd;
|
||||||
bool ok = ft->GetOpenCommand(&cmd,
|
bool ok = ft->GetOpenCommand(&cmd,
|
||||||
wxFileType::MessageParameters(filename, _T("")));
|
wxFileType::MessageParameters(filename));
|
||||||
delete ft;
|
delete ft;
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
{
|
{
|
||||||
@@ -865,7 +870,7 @@ void MyFrame::OnDDEExec(wxCommandEvent& WXUNUSED(event))
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
wxDDEClient client;
|
wxDDEClient client;
|
||||||
wxConnectionBase *conn = client.MakeConnection(_T(""), m_server, m_topic);
|
wxConnectionBase *conn = client.MakeConnection(wxEmptyString, m_server, m_topic);
|
||||||
if ( !conn )
|
if ( !conn )
|
||||||
{
|
{
|
||||||
wxLogError(_T("Failed to connect to the DDE server '%s'."),
|
wxLogError(_T("Failed to connect to the DDE server '%s'."),
|
||||||
@@ -891,7 +896,7 @@ void MyFrame::OnDDERequest(wxCommandEvent& WXUNUSED(event))
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
wxDDEClient client;
|
wxDDEClient client;
|
||||||
wxConnectionBase *conn = client.MakeConnection(_T(""), m_server, m_topic);
|
wxConnectionBase *conn = client.MakeConnection(wxEmptyString, m_server, m_topic);
|
||||||
if ( !conn )
|
if ( !conn )
|
||||||
{
|
{
|
||||||
wxLogError(_T("Failed to connect to the DDE server '%s'."),
|
wxLogError(_T("Failed to connect to the DDE server '%s'."),
|
||||||
@@ -1061,14 +1066,14 @@ MyPipeFrame::MyPipeFrame(wxFrame *parent,
|
|||||||
|
|
||||||
wxPanel *panel = new wxPanel(this, wxID_ANY);
|
wxPanel *panel = new wxPanel(this, wxID_ANY);
|
||||||
|
|
||||||
m_textOut = new wxTextCtrl(panel, wxID_ANY, _T(""),
|
m_textOut = new wxTextCtrl(panel, wxID_ANY, wxEmptyString,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxTE_PROCESS_ENTER);
|
wxTE_PROCESS_ENTER);
|
||||||
m_textIn = new wxTextCtrl(panel, wxID_ANY, _T(""),
|
m_textIn = new wxTextCtrl(panel, wxID_ANY, wxEmptyString,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxTE_MULTILINE | wxTE_RICH);
|
wxTE_MULTILINE | wxTE_RICH);
|
||||||
m_textIn->SetEditable(false);
|
m_textIn->SetEditable(false);
|
||||||
m_textErr = new wxTextCtrl(panel, wxID_ANY, _T(""),
|
m_textErr = new wxTextCtrl(panel, wxID_ANY, wxEmptyString,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxTE_MULTILINE | wxTE_RICH);
|
wxTE_MULTILINE | wxTE_RICH);
|
||||||
m_textErr->SetEditable(false);
|
m_textErr->SetEditable(false);
|
||||||
@@ -1098,6 +1103,7 @@ MyPipeFrame::MyPipeFrame(wxFrame *parent,
|
|||||||
|
|
||||||
void MyPipeFrame::OnBtnSendFile(wxCommandEvent& WXUNUSED(event))
|
void MyPipeFrame::OnBtnSendFile(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
wxFileDialog filedlg(this, _T("Select file to send"));
|
wxFileDialog filedlg(this, _T("Select file to send"));
|
||||||
if ( filedlg.ShowModal() != wxID_OK )
|
if ( filedlg.ShowModal() != wxID_OK )
|
||||||
return;
|
return;
|
||||||
@@ -1125,6 +1131,7 @@ void MyPipeFrame::OnBtnSendFile(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
DoGet();
|
DoGet();
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyPipeFrame::DoGet()
|
void MyPipeFrame::DoGet()
|
||||||
|
@@ -386,6 +386,7 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString facename;
|
wxString facename;
|
||||||
|
|
||||||
if ( silent )
|
if ( silent )
|
||||||
{
|
{
|
||||||
// choose the first
|
// choose the first
|
||||||
@@ -408,7 +409,7 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
|
|||||||
delete [] facenames;
|
delete [] facenames;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !facename.IsEmpty() )
|
if ( !facename.empty() )
|
||||||
{
|
{
|
||||||
wxFont font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
|
wxFont font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
|
||||||
wxFONTWEIGHT_NORMAL, false, facename, encoding);
|
wxFONTWEIGHT_NORMAL, false, facename, encoding);
|
||||||
@@ -471,7 +472,7 @@ void MyFrame::OnCheckNativeToFromString(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
wxString fontInfo = m_canvas->GetTextFont().GetNativeFontInfoDesc();
|
wxString fontInfo = m_canvas->GetTextFont().GetNativeFontInfoDesc();
|
||||||
|
|
||||||
if ( fontInfo.IsEmpty() )
|
if ( fontInfo.empty() )
|
||||||
{
|
{
|
||||||
wxLogError(wxT("Native font info string is empty!"));
|
wxLogError(wxT("Native font info string is empty!"));
|
||||||
}
|
}
|
||||||
@@ -585,6 +586,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
// first, choose the file
|
// first, choose the file
|
||||||
static wxString s_dir, s_file;
|
static wxString s_dir, s_file;
|
||||||
wxFileDialog dialog(this, wxT("Open an email message file"),
|
wxFileDialog dialog(this, wxT("Open an email message file"),
|
||||||
@@ -696,6 +698,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxFontMapper::GetEncodingDescription(fontenc).c_str());
|
wxFontMapper::GetEncodingDescription(fontenc).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||||
|
@@ -232,11 +232,13 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnPageOpen(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnPageOpen(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
wxString p = wxFileSelector(_("Open HTML document"), wxEmptyString,
|
wxString p = wxFileSelector(_("Open HTML document"), wxEmptyString,
|
||||||
wxEmptyString, wxEmptyString, wxT("HTML files|*.htm"));
|
wxEmptyString, wxEmptyString, wxT("HTML files|*.htm"));
|
||||||
|
|
||||||
if (p != wxEmptyString)
|
if (!p.empty())
|
||||||
m_Html->LoadPage(p);
|
m_Html->LoadPage(p);
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnBack(wxCommandEvent& WXUNUSED(event))
|
||||||
|
@@ -151,11 +151,12 @@ public:
|
|||||||
|
|
||||||
void OnSave(wxMouseEvent& WXUNUSED(event))
|
void OnSave(wxMouseEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
wxImage image = m_bitmap.ConvertToImage();
|
wxImage image = m_bitmap.ConvertToImage();
|
||||||
|
|
||||||
wxString savefilename = wxFileSelector( wxT("Save Image"),
|
wxString savefilename = wxFileSelector( wxT("Save Image"),
|
||||||
wxT(""),
|
wxEmptyString,
|
||||||
wxT(""),
|
wxEmptyString,
|
||||||
(const wxChar *)NULL,
|
(const wxChar *)NULL,
|
||||||
wxT("BMP files (*.bmp)|*.bmp|")
|
wxT("BMP files (*.bmp)|*.bmp|")
|
||||||
wxT("PNG files (*.png)|*.png|")
|
wxT("PNG files (*.png)|*.png|")
|
||||||
@@ -271,6 +272,7 @@ public:
|
|||||||
// (it may fail if the extension is not recognized):
|
// (it may fail if the extension is not recognized):
|
||||||
image.SaveFile(savefilename);
|
image.SaveFile(savefilename);
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -992,6 +994,7 @@ void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
void MyFrame::OnNewFrame( wxCommandEvent &WXUNUSED(event) )
|
void MyFrame::OnNewFrame( wxCommandEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
wxString filename = wxFileSelector(_T("Select image file"));
|
wxString filename = wxFileSelector(_T("Select image file"));
|
||||||
if ( !filename )
|
if ( !filename )
|
||||||
return;
|
return;
|
||||||
@@ -1005,6 +1008,7 @@ void MyFrame::OnNewFrame( wxCommandEvent &WXUNUSED(event) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
(new MyImageFrame(this, wxBitmap(image)))->Show();
|
(new MyImageFrame(this, wxBitmap(image)))->Show();
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef wxHAVE_RAW_BITMAP
|
#ifdef wxHAVE_RAW_BITMAP
|
||||||
@@ -1096,4 +1100,3 @@ bool MyApp::OnInit()
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
// Create edit control. Since it is the only
|
// Create edit control. Since it is the only
|
||||||
// control in the frame, it will be resized
|
// control in the frame, it will be resized
|
||||||
// to file it out.
|
// to file it out.
|
||||||
m_text = new wxTextCtrl( this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
m_text = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||||
|
|
||||||
// Read .ini file for file history etc.
|
// Read .ini file for file history etc.
|
||||||
wxConfig *conf = (wxConfig*) wxConfig::Get();
|
wxConfig *conf = (wxConfig*) wxConfig::Get();
|
||||||
@@ -213,15 +213,16 @@ void MyFrame::OnNew( wxCommandEvent& WXUNUSED(event) )
|
|||||||
m_filename = wxEmptyString;
|
m_filename = wxEmptyString;
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
SetStatusText( _T("") );
|
SetStatusText( wxEmptyString );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
if (!Discard()) return;
|
if (!Discard()) return;
|
||||||
|
|
||||||
wxFileDialog dialog( this, _T("Open text"), _T(""), _T(""),
|
wxFileDialog dialog( this, _T("Open text"), wxEmptyString, wxEmptyString,
|
||||||
_T("Text file (*.txt)|*.txt|Any file (*)|*"),
|
_T("Text file (*.txt)|*.txt|Any file (*)|*"),
|
||||||
wxOPEN|wxFILE_MUST_EXIST );
|
wxOPEN|wxFILE_MUST_EXIST );
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
@@ -265,6 +266,7 @@ void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) )
|
|||||||
SetStatusText( m_filename );
|
SetStatusText( m_filename );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnSave( wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnSave( wxCommandEvent& WXUNUSED(event) )
|
||||||
@@ -274,7 +276,8 @@ void MyFrame::OnSave( wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
void MyFrame::OnSaveAs( wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnSaveAs( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxFileDialog dialog( this, _T("Open text"), _T(""), _T(""),
|
#if wxUSE_FILEDLG
|
||||||
|
wxFileDialog dialog( this, _T("Open text"), wxEmptyString, wxEmptyString,
|
||||||
_T("Text file (*.txt)|*.txt|Any file (*)|*"),
|
_T("Text file (*.txt)|*.txt|Any file (*)|*"),
|
||||||
wxSAVE|wxOVERWRITE_PROMPT );
|
wxSAVE|wxOVERWRITE_PROMPT );
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
@@ -286,6 +289,7 @@ void MyFrame::OnSaveAs( wxCommandEvent& WXUNUSED(event) )
|
|||||||
SetStatusText( m_filename );
|
SetStatusText( m_filename );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
|
||||||
@@ -417,4 +421,3 @@ int MyApp::OnExit()
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -110,40 +110,43 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxString f = wxFileSelector( wxT("Save Image"), (const wxChar *)NULL,
|
#if wxUSE_FILEDLG
|
||||||
(const wxChar *)NULL,
|
wxString f = wxFileSelector( wxT("Save Image"), (const wxChar *)NULL,
|
||||||
wxT("png"), wxT("PNG files (*.png)|*.png") );
|
(const wxChar *)NULL,
|
||||||
|
wxT("png"), wxT("PNG files (*.png)|*.png") );
|
||||||
|
|
||||||
if (f == _T("")) return;
|
if (f.empty()) return;
|
||||||
|
|
||||||
wxBitmap *backstore = new wxBitmap( 150, 150 );
|
wxBitmap *backstore = new wxBitmap( 150, 150 );
|
||||||
|
|
||||||
wxMemoryDC memDC;
|
wxMemoryDC memDC;
|
||||||
memDC.SelectObject( *backstore );
|
memDC.SelectObject( *backstore );
|
||||||
memDC.Clear();
|
memDC.Clear();
|
||||||
memDC.SetBrush( *wxBLACK_BRUSH );
|
memDC.SetBrush( *wxBLACK_BRUSH );
|
||||||
memDC.SetPen( *wxWHITE_PEN );
|
memDC.SetPen( *wxWHITE_PEN );
|
||||||
memDC.DrawRectangle( 0, 0, 150, 150 );
|
memDC.DrawRectangle( 0, 0, 150, 150 );
|
||||||
memDC.SetPen( *wxBLACK_PEN );
|
memDC.SetPen( *wxBLACK_PEN );
|
||||||
memDC.DrawLine( 0, 0, 0, 10 );
|
memDC.DrawLine( 0, 0, 0, 10 );
|
||||||
memDC.SetTextForeground( *wxWHITE );
|
memDC.SetTextForeground( *wxWHITE );
|
||||||
memDC.DrawText( _T("This is a memory dc."), 10, 10 );
|
memDC.DrawText( _T("This is a memory dc."), 10, 10 );
|
||||||
|
|
||||||
memDC.SelectObject( wxNullBitmap );
|
memDC.SelectObject( wxNullBitmap );
|
||||||
|
|
||||||
backstore->SaveFile( f, wxBITMAP_TYPE_PNG, (wxPalette*)NULL );
|
backstore->SaveFile( f, wxBITMAP_TYPE_PNG, (wxPalette*)NULL );
|
||||||
|
|
||||||
delete backstore;
|
delete backstore;
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnLoadFile(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnLoadFile(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
// Show file selector.
|
// Show file selector.
|
||||||
wxString f = wxFileSelector(wxT("Open Image"), (const wxChar *) NULL,
|
wxString f = wxFileSelector(wxT("Open Image"), (const wxChar *) NULL,
|
||||||
(const wxChar *) NULL, wxT("png"),
|
(const wxChar *) NULL, wxT("png"),
|
||||||
wxT("PNG files (*.png)|*.png"));
|
wxT("PNG files (*.png)|*.png"));
|
||||||
|
|
||||||
if (f == _T(""))
|
if (f.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( g_TestBitmap )
|
if ( g_TestBitmap )
|
||||||
@@ -157,6 +160,7 @@ void MyFrame::OnLoadFile(wxCommandEvent& WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
canvas->Refresh();
|
canvas->Refresh();
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||||
@@ -172,41 +176,39 @@ MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size):
|
|||||||
// Define the repainting behaviour
|
// Define the repainting behaviour
|
||||||
void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
|
void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
dc.SetPen(* wxRED_PEN);
|
dc.SetPen(* wxRED_PEN);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0; i < 500; i += 10)
|
for ( i = 0; i < 500; i += 10)
|
||||||
{
|
|
||||||
dc.DrawLine(0, i, 800, i);
|
|
||||||
}
|
|
||||||
if ( g_TestBitmap && g_TestBitmap->Ok() )
|
|
||||||
{
|
|
||||||
wxMemoryDC memDC;
|
|
||||||
if ( g_TestBitmap->GetPalette() )
|
|
||||||
{
|
{
|
||||||
memDC.SetPalette(* g_TestBitmap->GetPalette());
|
dc.DrawLine(0, i, 800, i);
|
||||||
dc.SetPalette(* g_TestBitmap->GetPalette());
|
|
||||||
}
|
}
|
||||||
memDC.SelectObject(* g_TestBitmap);
|
if ( g_TestBitmap && g_TestBitmap->Ok() )
|
||||||
|
{
|
||||||
|
wxMemoryDC memDC;
|
||||||
|
if ( g_TestBitmap->GetPalette() )
|
||||||
|
{
|
||||||
|
memDC.SetPalette(* g_TestBitmap->GetPalette());
|
||||||
|
dc.SetPalette(* g_TestBitmap->GetPalette());
|
||||||
|
}
|
||||||
|
memDC.SelectObject(* g_TestBitmap);
|
||||||
|
|
||||||
// Normal, non-transparent blitting
|
// Normal, non-transparent blitting
|
||||||
dc.Blit(20, 20, g_TestBitmap->GetWidth(), g_TestBitmap->GetHeight(), & memDC, 0, 0, wxCOPY, false);
|
dc.Blit(20, 20, g_TestBitmap->GetWidth(), g_TestBitmap->GetHeight(), & memDC, 0, 0, wxCOPY, false);
|
||||||
|
|
||||||
memDC.SelectObject(wxNullBitmap);
|
memDC.SelectObject(wxNullBitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_TestBitmap && g_TestBitmap->Ok() )
|
if ( g_TestBitmap && g_TestBitmap->Ok() )
|
||||||
{
|
{
|
||||||
wxMemoryDC memDC;
|
wxMemoryDC memDC;
|
||||||
memDC.SelectObject(* g_TestBitmap);
|
memDC.SelectObject(* g_TestBitmap);
|
||||||
|
|
||||||
// Transparent blitting if there's a mask in the bitmap
|
// Transparent blitting if there's a mask in the bitmap
|
||||||
dc.Blit(20 + g_TestBitmap->GetWidth() + 20, 20, g_TestBitmap->GetWidth(), g_TestBitmap->GetHeight(), & memDC,
|
dc.Blit(20 + g_TestBitmap->GetWidth() + 20, 20, g_TestBitmap->GetWidth(), g_TestBitmap->GetHeight(), & memDC,
|
||||||
0, 0, wxCOPY, true);
|
0, 0, wxCOPY, true);
|
||||||
|
|
||||||
memDC.SelectObject(wxNullBitmap);
|
memDC.SelectObject(wxNullBitmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -981,6 +981,7 @@ void MyFrame::NotifyUsingFile(const wxString& name)
|
|||||||
|
|
||||||
void MyFrame::OnSelectFile(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnSelectFile(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
wxFileDialog dlg(this, _T("Choose a sound file"),
|
wxFileDialog dlg(this, _T("Choose a sound file"),
|
||||||
wxEmptyString, wxEmptyString,
|
wxEmptyString, wxEmptyString,
|
||||||
_T("WAV files (*.wav)|*.wav"), wxOPEN|wxCHANGE_DIR);
|
_T("WAV files (*.wav)|*.wav"), wxOPEN|wxCHANGE_DIR);
|
||||||
@@ -996,6 +997,7 @@ void MyFrame::OnSelectFile(wxCommandEvent& WXUNUSED(event))
|
|||||||
m_sound = NULL;
|
m_sound = NULL;
|
||||||
NotifyUsingFile(m_soundFile);
|
NotifyUsingFile(m_soundFile);
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
@@ -502,8 +502,9 @@ bool Edit::InitializePrefs (const wxString &name) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Edit::LoadFile () {
|
bool Edit::LoadFile ()
|
||||||
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
// get filname
|
// get filname
|
||||||
if (!m_filename) {
|
if (!m_filename) {
|
||||||
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString,
|
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString,
|
||||||
@@ -514,6 +515,9 @@ bool Edit::LoadFile () {
|
|||||||
|
|
||||||
// load file
|
// load file
|
||||||
return LoadFile (m_filename);
|
return LoadFile (m_filename);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Edit::LoadFile (const wxString &filename) {
|
bool Edit::LoadFile (const wxString &filename) {
|
||||||
@@ -544,8 +548,9 @@ bool Edit::LoadFile (const wxString &filename) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Edit::SaveFile () {
|
bool Edit::SaveFile ()
|
||||||
|
{
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
// return if no change
|
// return if no change
|
||||||
if (!Modified()) return true;
|
if (!Modified()) return true;
|
||||||
|
|
||||||
@@ -559,6 +564,9 @@ bool Edit::SaveFile () {
|
|||||||
|
|
||||||
// save file
|
// save file
|
||||||
return SaveFile (m_filename);
|
return SaveFile (m_filename);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Edit::SaveFile (const wxString &filename) {
|
bool Edit::SaveFile (const wxString &filename) {
|
||||||
@@ -695,6 +703,8 @@ EditProperties::EditProperties (Edit *edit,
|
|||||||
ShowModal();
|
ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_PRINTING_ARCHITECTURE
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EditPrint
|
// EditPrint
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -821,3 +831,4 @@ bool EditPrint::PrintScaling (wxDC *dc){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||||
|
Reference in New Issue
Block a user