wxOS2/OW warning and build fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35282 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-08-23 16:02:51 +00:00
parent 5f4d35b804
commit c54e5eb0f6
19 changed files with 365 additions and 281 deletions

View File

@@ -28,7 +28,7 @@
#include "wx/wx.h"
#endif
#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__)
#ifndef __WXMSW__
#include "mondrian.xpm"
#endif
@@ -45,9 +45,11 @@ IMPLEMENT_APP(MyApp)
// ---------------------------------------------------------------------------
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ANITEST_ABOUT, MyFrame::OnAbout)
EVT_MENU(ANITEST_QUIT, MyFrame::OnQuit)
EVT_MENU(ANITEST_OPEN, MyFrame::OnOpen)
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
#if wxUSE_FILEDLG
EVT_MENU(wxID_OPEN, MyFrame::OnOpen)
#endif // wxUSE_FILEDLG
EVT_SIZE(MyFrame::OnSize)
END_EVENT_TABLE()
@@ -79,11 +81,13 @@ bool MyApp::OnInit()
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(ANITEST_OPEN, _T("&Open Animation...\tCtrl+O"), _T("Open a GIF animation"));
file_menu->Append(ANITEST_QUIT, _T("&Exit\tAlt+X"), _T("Quit the program"));
#if wxUSE_FILEDLG
file_menu->Append(wxID_OPEN, _T("&Open Animation...\tCtrl+O"), _T("Open a GIF animation"));
#endif // wxUSE_FILEDLG
file_menu->Append(wxID_EXIT, _T("&Exit\tAlt+X"), _T("Quit the program"));
wxMenu *help_menu = new wxMenu;
help_menu->Append(ANITEST_ABOUT, _T("&About\tF1"));
help_menu->Append(wxID_ABOUT, _T("&About\tF1"));
wxMenuBar *menu_bar = new wxMenuBar;
@@ -97,11 +101,11 @@ bool MyApp::OnInit()
frame->CreateStatusBar();
#endif // wxUSE_STATUSBAR
frame->Show(TRUE);
frame->Show(true);
SetTopWindow(frame);
return TRUE;
return true;
}
// ---------------------------------------------------------------------------
@@ -119,9 +123,9 @@ MyFrame::MyFrame(wxWindow *parent,
style | wxNO_FULL_REPAINT_ON_RESIZE)
{
// m_animation = NULL;
m_canvas = new MyCanvas(this, wxPoint(0, 0), wxSize(-1, -1));
m_canvas = new MyCanvas(this, wxPoint(0, 0), wxDefaultSize);
#if 0
m_player.SetDestroyAnimation(FALSE);
m_player.SetDestroyAnimation(false);
m_player.SetWindow(m_canvas);
m_player.SetPosition(wxPoint(0, 0));
#endif
@@ -146,6 +150,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
_T("About Animation Demo"));
}
#if wxUSE_FILEDLG
void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
{
wxFileDialog dialog(this, _T("Please choose an animated GIF"),
@@ -165,6 +170,7 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
}
}
}
#endif // wxUSE_FILEDLG
// ---------------------------------------------------------------------------
@@ -196,4 +202,3 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
}
#endif
}

View File

@@ -41,7 +41,9 @@ public:
void OnAbout(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
#if wxUSE_FILEDLG
void OnOpen(wxCommandEvent& event);
#endif // wxUSE_FILEDLG
MyCanvas* GetCanvas() const { return m_canvas; }
wxGIFAnimationCtrl* GetAnimationCtrl() const { return m_animationCtrl; }
@@ -61,11 +63,3 @@ protected:
wxGIFAnimation m_animation;
#endif
};
// menu items ids
enum
{
ANITEST_QUIT = 100,
ANITEST_OPEN,
ANITEST_ABOUT
};

View File

@@ -117,8 +117,10 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnToggleWindow(wxCommandEvent& WXUNUSED(event))
{
m_leftWindow1->Show(!m_leftWindow1->IsShown());
#if wxUSE_MDI_ARCHITECTURE
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);
#endif // wxUSE_MDI_ARCHITECTURE
}
void MyFrame::OnFoldPanelBarDrag(wxSashEvent& event)
@@ -129,8 +131,10 @@ void MyFrame::OnFoldPanelBarDrag(wxSashEvent& event)
if(event.GetId() == ID_WINDOW_LEFT1)
m_leftWindow1->SetDefaultSize(wxSize(event.GetDragRect().width, 1000));
#if wxUSE_MDI_ARCHITECTURE
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);
#endif // wxUSE_MDI_ARCHITECTURE
// Leaves bits of itself behind sometimes
GetClientWindow()->Refresh();
@@ -496,8 +500,10 @@ void MyCanvas::OnEvent(wxMouseEvent& event)
void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event))
{
#if wxUSE_MDI_ARCHITECTURE
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);
#endif // wxUSE_MDI_ARCHITECTURE
}
// Note that FPBTEST_NEW_WINDOW and FPBTEST_ABOUT commands get passed
@@ -532,4 +538,3 @@ void MyChild::OnActivate(wxActivateEvent& event)
if (event.GetActive() && canvas)
canvas->SetFocus();
}

View File

@@ -425,8 +425,10 @@ void MMBoardFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
}
// select a file to be opened
#if wxUSE_FILEDLG
selected_file = wxLoadFileSelector(_T("multimedia"), _T("*"), NULL, this);
if (selected_file.IsNull())
#endif // wxUSE_FILEDLG
if (selected_file.empty())
return;
m_opened_file = MMBoardManager::Open(selected_file);
@@ -590,4 +592,3 @@ void MMBoardFrame::OnSetPosition(wxCommandEvent& WXUNUSED(event))
UpdateMMedInfo();
}

View File

@@ -96,9 +96,12 @@ enum {
//! global application name
extern wxString *g_appname;
#if wxUSE_PRINTING_ARCHITECTURE
//! global print data, to remember settings during the session
extern wxPrintData *g_printData;
extern wxPageSetupData *g_pageSetupData;
#endif // _WX_DEFSEXT_H_
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif // _WX_DEFSEXT_H_

View File

@@ -139,6 +139,8 @@ private:
};
#if wxUSE_PRINTING_ARCHITECTURE
//----------------------------------------------------------------------------
//! EditPrint
class EditPrint: public wxPrintout {
@@ -165,5 +167,6 @@ private:
bool PrintScaling (wxDC *dc);
};
#endif // _EDIT_H_
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif // _EDIT_H_

View File

@@ -22,17 +22,17 @@
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all 'standard' wxWidgets headers)
#ifndef WX_PRECOMP
#include <wx/wx.h>
#include "wx/wx.h"
#endif
//! wxWidgets headers
#include <wx/config.h> // configuration support
#include <wx/filedlg.h> // file dialog support
#include <wx/filename.h> // filename support
#include <wx/notebook.h> // notebook support
#include <wx/settings.h> // system settings
#include <wx/string.h> // strings support
#include <wx/image.h> // images support
#include "wx/config.h" // configuration support
#include "wx/filedlg.h" // file dialog support
#include "wx/filename.h" // filename support
#include "wx/notebook.h" // notebook support
#include "wx/settings.h" // system settings
#include "wx/string.h" // strings support
#include "wx/image.h" // images support
//! application headers
#include "defsext.h" // Additional definitions
@@ -76,10 +76,14 @@ class AppBook;
//! global application name
wxString *g_appname = NULL;
#if wxUSE_PRINTING_ARCHITECTURE
//! global print data, to remember settings during the session
wxPrintData *g_printData = (wxPrintData*) NULL;
wxPageSetupData *g_pageSetupData = (wxPageSetupData*) NULL;
#endif // wxUSE_PRINTING_ARCHITECTURE
//----------------------------------------------------------------------------
//! application APP_VENDOR-APP_NAME.
@@ -200,9 +204,11 @@ bool App::OnInit () {
g_appname->Append (_T("-"));
g_appname->Append (APP_NAME);
#if wxUSE_PRINTING_ARCHITECTURE
// initialize print data and setup
g_printData = new wxPrintData;
g_pageSetupData = new wxPageSetupDialogData;
#endif // wxUSE_PRINTING_ARCHITECTURE
// create application frame
m_frame = new AppFrame (*g_appname);
@@ -220,9 +226,11 @@ int App::OnExit () {
// delete global appname
delete g_appname;
#if wxUSE_PRINTING_ARCHITECTURE
// delete global print data and setup
if (g_printData) delete g_printData;
if (g_pageSetupData) delete g_pageSetupData;
#endif // wxUSE_PRINTING_ARCHITECTURE
return 0;
}
@@ -339,12 +347,14 @@ void AppFrame::OnExit (wxCommandEvent &WXUNUSED(event)) {
// file event handlers
void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) {
if (!m_edit) return;
#if wxUSE_FILEDLG
wxString fname;
wxFileDialog dlg (this, _T("Open file"), _T(""), _T(""), _T("Any file (*)|*"),
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
if (dlg.ShowModal() != wxID_OK) return;
fname = dlg.GetPath ();
FileOpen (fname);
#endif // wxUSE_FILEDLG
}
void AppFrame::OnFileSave (wxCommandEvent &WXUNUSED(event)) {
@@ -359,11 +369,13 @@ void AppFrame::OnFileSave (wxCommandEvent &WXUNUSED(event)) {
void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) {
if (!m_edit) return;
#if wxUSE_FILEDLG
wxString filename = wxEmptyString;
wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT);
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK) return;
filename = dlg.GetPath();
m_edit->SaveFile (filename);
#endif // wxUSE_FILEDLG
}
void AppFrame::OnFileClose (wxCommandEvent &WXUNUSED(event)) {
@@ -392,14 +404,17 @@ void AppFrame::OnProperties (wxCommandEvent &WXUNUSED(event)) {
// print event handlers
void AppFrame::OnPrintSetup (wxCommandEvent &WXUNUSED(event)) {
#if wxUSE_PRINTING_ARCHITECTURE
(*g_pageSetupData) = * g_printData;
wxPageSetupDialog pageSetupDialog(this, g_pageSetupData);
pageSetupDialog.ShowModal();
(*g_printData) = pageSetupDialog.GetPageSetupData().GetPrintData();
(*g_pageSetupData) = pageSetupDialog.GetPageSetupData();
#endif // wxUSE_PRINTING_ARCHITECTURE
}
void AppFrame::OnPrintPreview (wxCommandEvent &WXUNUSED(event)) {
#if wxUSE_PRINTING_ARCHITECTURE
wxPrintDialogData printDialogData( *g_printData);
wxPrintPreview *preview =
new wxPrintPreview (new EditPrint (m_edit),
@@ -418,9 +433,11 @@ void AppFrame::OnPrintPreview (wxCommandEvent &WXUNUSED(event)) {
frame->Centre(wxBOTH);
frame->Initialize();
frame->Show(true);
#endif // wxUSE_PRINTING_ARCHITECTURE
}
void AppFrame::OnPrint (wxCommandEvent &WXUNUSED(event)) {
#if wxUSE_PRINTING_ARCHITECTURE
wxPrintDialogData printDialogData( *g_printData);
wxPrinter printer (&printDialogData);
EditPrint printout (m_edit);
@@ -433,6 +450,7 @@ void AppFrame::OnPrint (wxCommandEvent &WXUNUSED(event)) {
}
}
(*g_printData) = printer.GetPrintDialogData().GetPrintData();
#endif // wxUSE_PRINTING_ARCHITECTURE
}
// edit events
@@ -441,8 +459,8 @@ void AppFrame::OnEdit (wxCommandEvent &event) {
}
// private functions
void AppFrame::CreateMenu () {
void AppFrame::CreateMenu ()
{
// File menu
wxMenu *menuFile = new wxMenu;
menuFile->Append (wxID_OPEN, _("&Open ..\tCtrl+O"));
@@ -552,10 +570,10 @@ void AppFrame::CreateMenu () {
m_menuBar->Append (menuWindow, _("&Window"));
m_menuBar->Append (menuHelp, _("&Help"));
SetMenuBar (m_menuBar);
}
void AppFrame::FileOpen (wxString fname) {
void AppFrame::FileOpen (wxString fname)
{
wxFileName w(fname); w.Normalize(); fname = w.GetFullPath();
m_edit->LoadFile (fname);
}
@@ -661,4 +679,3 @@ void AppAbout::OnTimerEvent (wxTimerEvent &WXUNUSED(event)) {
m_timer = NULL;
EndModal (wxID_OK);
}

View File

@@ -187,7 +187,7 @@ bool MyApp::OnInit()
SetTopWindow(frame);
return TRUE;
return true;
}
@@ -298,7 +298,7 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
// Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar);
subframe->Show(TRUE);
subframe->Show(true);
}
@@ -324,12 +324,12 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
int width = 16;
int currentX = 5;
toolBar->AddTool( MDI_NEW_WINDOW, *(bitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, wxT("New SVG test window"));
toolBar->AddTool( MDI_NEW_WINDOW, *(bitmaps[0]), wxNullBitmap, false, currentX, wxDefaultCoord, (wxObject *) NULL, wxT("New SVG test window"));
currentX += width + 5;
toolBar->AddTool( MDI_SAVE, *bitmaps[1], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, wxT("Save test in SVG format"));
toolBar->AddTool( MDI_SAVE, *bitmaps[1], wxNullBitmap, false, currentX, wxDefaultCoord, (wxObject *) NULL, wxT("Save test in SVG format"));
currentX += width + 5;
toolBar->AddSeparator();
toolBar->AddTool(MDI_ABOUT, *bitmaps[2], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, wxT("Help"));
toolBar->AddTool(MDI_ABOUT, *bitmaps[2], wxNullBitmap, false, currentX, wxDefaultCoord, (wxObject *) NULL, wxT("Help"));
toolBar->Realize();
@@ -341,6 +341,7 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
{
#if wxUSE_FILEDLG
MyChild * pChild = (MyChild *)GetActiveChild ();
if (pChild == NULL)
{
@@ -359,6 +360,7 @@ void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
}
}
return ;
#endif // wxUSE_FILEDLG
}
@@ -464,7 +466,7 @@ void MyCanvas::OnDraw(wxDC& dc)
dc.DrawText(wxT("This is a Red string"), 50, 200);
dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45);
dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90);
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, FALSE, wxT("Times New Roman"));
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
dc.SetFont(wF);
dc.SetTextForeground (wC) ;
dc.DrawText(wxT("This is a Times-style string"), 50, 60);
@@ -520,7 +522,7 @@ void MyCanvas::OnDraw(wxDC& dc)
break ;
case 5:
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, FALSE, wxT("Times New Roman"));
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
dc.SetFont(wF);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
@@ -601,7 +603,7 @@ MyChild::~MyChild()
void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
Close(true);
}

View File

@@ -1341,6 +1341,7 @@ void wxFilenameListValidator::OnEdit(wxProperty *property, wxPropertyListView *v
if (!view->GetValueText())
return;
#if wxUSE_FILEDLG
wxString s = wxFileSelector(
m_filenameMessage.GetData(),
wxPathOnly(property->GetValue().StringValue()),
@@ -1356,6 +1357,11 @@ void wxFilenameListValidator::OnEdit(wxProperty *property, wxPropertyListView *v
view->UpdatePropertyDisplayInList(property);
view->OnPropertyChanged(property);
}
#else
wxUnusedVar(property);
wxUnusedVar(view);
wxUnusedVar(parentWindow);
#endif
}
///

View File

@@ -352,7 +352,7 @@ bool wxFrameLayout::CanReparent()
#ifdef __WXMSW__
return true;
#elif defined(__WXGTK20__)
return TRUE;
return true;
#elif defined (__WXGTK__)
//return true;
return false;
@@ -402,6 +402,8 @@ void wxFrameLayout::ReparentWindow( wxWindow* pChild, wxWindow* pNewParent )
//return;
#else
wxUnusedVar(pChild);
wxUnusedVar(pNewParent);
wxMessageBox( "Sorry, docking is not supported for ports other than MSW and wxGTK" );
#endif
}
@@ -1728,7 +1730,6 @@ void wxFrameLayout::AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlI
// insert it to the chain
if ( pNextPl->GetPreviousHandler() )
pNextPl->GetPreviousHandler()->SetNextHandler( pNewPl );
else
mpTopPlugin = pNewPl;
@@ -1845,7 +1846,6 @@ bool wxBarIterator::Next()
mpRow = mpRow->mpNext;
if ( mpRow )
mpBar = mpRow->mBars[0];
else
return false;
@@ -3006,7 +3006,6 @@ int cbDockPane::GetPaneHeight()
int height = 0;
if ( IsHorizontal() )
height += mTopMargin + mBottomMargin;
else
height += mLeftMargin + mRightMargin;
@@ -3014,7 +3013,6 @@ int cbDockPane::GetPaneHeight()
int count = mRows.Count();
if ( count )
height += mRows[count-1]->mRowY + mRows[count-1]->mRowHeight;
return height;
@@ -3182,7 +3180,6 @@ void cbDockPane::GetBarResizeRange( cbBarInfo* pBar, int* from, int *till,
// treat not-fixed bars as minimized
if ( !pBar->IsFixed() )
notFree += mProps.mMinCBarDim.x;
else
{
@@ -3202,10 +3199,8 @@ void cbDockPane::GetBarResizeRange( cbBarInfo* pBar, int* from, int *till,
// do not let resizing totally deform the bar itself
if ( forLeftHandle )
(*till) -= mProps.mMinCBarDim.x;
else
(*from) += mProps.mMinCBarDim.x;
}
@@ -3543,4 +3538,3 @@ bool cbPluginBase::ProcessEvent(wxEvent& event)
else
return false;
}

View File

@@ -513,7 +513,8 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
#ifdef __WXMSW__ // This is currently MSW specific
gray_out_image_on_dc( destDc, destDim.x, destDim.y );
#else
wxBrush checkerBrush( wxBitmap( (const char*)_gDisableImage,8,8) );
wxBitmap bmp( (const char*)_gDisableImage,8,8);
wxBrush checkerBrush(bmp);
checkerBrush.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
destDc.SetBrush( checkerBrush );
destDc.DrawRectangle( imgPos.x, imgPos.y, srcBmp->GetWidth()+1, srcBmp->GetHeight()+1);

View File

@@ -232,7 +232,7 @@ void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVer
#ifdef __WXMSW__
#if USE_GENERIC_TREECTRL
if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
#endif
#endif // USE_GENERIC_TREECTRL
{
UINT sbCode = SB_THUMBPOSITION;
HWND vertScrollBar = 0;
@@ -240,8 +240,8 @@ void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVer
}
#if USE_GENERIC_TREECTRL
else
#endif
#endif
#endif // USE_GENERIC_TREECTRL
#endif // __WXMSW__
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
{
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
@@ -256,7 +256,8 @@ void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVer
}
*/
}
#endif
#endif // USE_GENERIC_TREECTRL || !defined(__WXMSW__)
wxUnusedVar(posVert);
}
void wxRemotelyScrolledTreeCtrl::OnSize(wxSizeEvent& event)
@@ -745,4 +746,3 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
inOnScroll = false;
}

View File

@@ -154,6 +154,7 @@ END_EVENT_TABLE()
//----------------------------------------------------------------------
#if wxUSE_DATAOBJ
static wxTextFileType wxConvertEOLMode(int scintillaMode)
{
wxTextFileType type;
@@ -177,6 +178,7 @@ static wxTextFileType wxConvertEOLMode(int scintillaMode)
}
return type;
}
#endif // wxUSE_DATAOBJ
//----------------------------------------------------------------------
@@ -439,6 +441,7 @@ void ScintillaWX::Paste() {
pdoc->BeginUndoAction();
ClearSelection();
#if wxUSE_DATAOBJ
wxTextDataObject data;
bool gotData = false;
@@ -455,6 +458,7 @@ void ScintillaWX::Paste() {
pdoc->InsertString(currentPos, buf, len);
SetEmptySelection(currentPos + len);
}
#endif // wxUSE_DATAOBJ
pdoc->EndUndoAction();
NotifyChange();
@@ -463,16 +467,21 @@ void ScintillaWX::Paste() {
void ScintillaWX::CopyToClipboard(const SelectionText& st) {
#if wxUSE_CLIPBOARD
if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(false);
wxString text = wxTextBuffer::Translate(stc2wx(st.s, st.len-1));
wxTheClipboard->SetData(new wxTextDataObject(text));
wxTheClipboard->Close();
}
#else
wxUnusedVar(st);
#endif // wxUSE_CLIPBOARD
}
bool ScintillaWX::CanPaste() {
#if wxUSE_CLIPBOARD
bool canPaste = false;
bool didOpen;
@@ -489,6 +498,9 @@ bool ScintillaWX::CanPaste() {
}
}
return canPaste;
#else
return false;
#endif // wxUSE_CLIPBOARD
}
void ScintillaWX::CreateCallTipWindow(PRectangle) {

View File

@@ -127,6 +127,7 @@ void wxMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void wxMainFrame::OnRc2Wxr(wxCommandEvent& WXUNUSED(event))
{
#if wxUSE_FILEDLG
wxFileDialog filed(this);
filed.SetWildcard(_T("*.rc"));
filed.SetStyle(wxOPEN);
@@ -144,10 +145,12 @@ void wxMainFrame::OnRc2Wxr(wxCommandEvent& WXUNUSED(event))
rc2wxr convert;
convert.Convert(wxrfile.GetPath(),filed.GetPath());
#endif // wxUSE_FILEDLG
}
void wxMainFrame::OnWXR2XML(wxCommandEvent& WXUNUSED(event))
{
#if wxUSE_FILEDLG
wxFileDialog f(this);
f.SetWildcard(_T("*.wxr"));
if (f.ShowModal()!=wxID_OK)
@@ -164,11 +167,12 @@ void wxMainFrame::OnWXR2XML(wxCommandEvent& WXUNUSED(event))
wxr2xml XMLCon;
XMLCon.Convert(f.GetPath(),xmlfile.GetPath());
#endif // wxUSE_FILEDLG
}
void wxMainFrame::OnRC2XML(wxCommandEvent& WXUNUSED(event))
{
#if wxUSE_FILEDLG
wxFileDialog f(this);
f.SetWildcard(_T("*.rc"));
if (f.ShowModal()!=wxID_OK)
@@ -184,7 +188,7 @@ void wxMainFrame::OnRC2XML(wxCommandEvent& WXUNUSED(event))
rc2xml XMLCon;
XMLCon.Convert(f.GetPath(),xmlfile.GetPath());
#endif // wxUSE_FILEDLG
}
bool wxConvertApp::HandleCommandLine()

View File

@@ -96,9 +96,12 @@ enum {
//! global application name
extern wxString *g_appname;
#if wxUSE_PRINTING_ARCHITECTURE
//! global print data, to remember settings during the session
extern wxPrintData *g_printData;
extern wxPageSetupData *g_pageSetupData;
#endif // _WX_DEFSEXT_H_
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif // _WX_DEFSEXT_H_

View File

@@ -139,6 +139,8 @@ private:
};
#if wxUSE_PRINTING_ARCHITECTURE
//----------------------------------------------------------------------------
//! EditPrint
class EditPrint: public wxPrintout {
@@ -165,5 +167,6 @@ private:
bool PrintScaling (wxDC *dc);
};
#endif // _EDIT_H_
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif // _EDIT_H_

View File

@@ -22,17 +22,17 @@
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all 'standard' wxWidgets headers)
#ifndef WX_PRECOMP
#include <wx/wx.h>
#include "wx/wx.h"
#endif
//! wxWidgets headers
#include <wx/config.h> // configuration support
#include <wx/filedlg.h> // file dialog support
#include <wx/filename.h> // filename support
#include <wx/notebook.h> // notebook support
#include <wx/settings.h> // system settings
#include <wx/string.h> // strings support
#include <wx/image.h> // images support
#include "wx/config.h" // configuration support
#include "wx/filedlg.h" // file dialog support
#include "wx/filename.h" // filename support
#include "wx/notebook.h" // notebook support
#include "wx/settings.h" // system settings
#include "wx/string.h" // strings support
#include "wx/image.h" // images support
//! application headers
#include "defsext.h" // Additional definitions
@@ -76,10 +76,14 @@ class AppBook;
//! global application name
wxString *g_appname = NULL;
#if wxUSE_PRINTING_ARCHITECTURE
//! global print data, to remember settings during the session
wxPrintData *g_printData = (wxPrintData*) NULL;
wxPageSetupData *g_pageSetupData = (wxPageSetupData*) NULL;
#endif // wxUSE_PRINTING_ARCHITECTURE
//----------------------------------------------------------------------------
//! application APP_VENDOR-APP_NAME.
@@ -200,9 +204,11 @@ bool App::OnInit () {
g_appname->Append (_T("-"));
g_appname->Append (APP_NAME);
#if wxUSE_PRINTING_ARCHITECTURE
// initialize print data and setup
g_printData = new wxPrintData;
g_pageSetupData = new wxPageSetupDialogData;
#endif // wxUSE_PRINTING_ARCHITECTURE
// create application frame
m_frame = new AppFrame (*g_appname);
@@ -220,9 +226,11 @@ int App::OnExit () {
// delete global appname
delete g_appname;
#if wxUSE_PRINTING_ARCHITECTURE
// delete global print data and setup
if (g_printData) delete g_printData;
if (g_pageSetupData) delete g_pageSetupData;
#endif // wxUSE_PRINTING_ARCHITECTURE
return 0;
}
@@ -339,12 +347,14 @@ void AppFrame::OnExit (wxCommandEvent &WXUNUSED(event)) {
// file event handlers
void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) {
if (!m_edit) return;
#if wxUSE_FILEDLG
wxString fname;
wxFileDialog dlg (this, _T("Open file"), _T(""), _T(""), _T("Any file (*)|*"),
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
if (dlg.ShowModal() != wxID_OK) return;
fname = dlg.GetPath ();
FileOpen (fname);
#endif // wxUSE_FILEDLG
}
void AppFrame::OnFileSave (wxCommandEvent &WXUNUSED(event)) {
@@ -359,11 +369,13 @@ void AppFrame::OnFileSave (wxCommandEvent &WXUNUSED(event)) {
void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) {
if (!m_edit) return;
#if wxUSE_FILEDLG
wxString filename = wxEmptyString;
wxFileDialog dlg (this, _T("Save file"), _T(""), _T(""), _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT);
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK) return;
filename = dlg.GetPath();
m_edit->SaveFile (filename);
#endif // wxUSE_FILEDLG
}
void AppFrame::OnFileClose (wxCommandEvent &WXUNUSED(event)) {
@@ -392,14 +404,17 @@ void AppFrame::OnProperties (wxCommandEvent &WXUNUSED(event)) {
// print event handlers
void AppFrame::OnPrintSetup (wxCommandEvent &WXUNUSED(event)) {
#if wxUSE_PRINTING_ARCHITECTURE
(*g_pageSetupData) = * g_printData;
wxPageSetupDialog pageSetupDialog(this, g_pageSetupData);
pageSetupDialog.ShowModal();
(*g_printData) = pageSetupDialog.GetPageSetupData().GetPrintData();
(*g_pageSetupData) = pageSetupDialog.GetPageSetupData();
#endif // wxUSE_PRINTING_ARCHITECTURE
}
void AppFrame::OnPrintPreview (wxCommandEvent &WXUNUSED(event)) {
#if wxUSE_PRINTING_ARCHITECTURE
wxPrintDialogData printDialogData( *g_printData);
wxPrintPreview *preview =
new wxPrintPreview (new EditPrint (m_edit),
@@ -418,9 +433,11 @@ void AppFrame::OnPrintPreview (wxCommandEvent &WXUNUSED(event)) {
frame->Centre(wxBOTH);
frame->Initialize();
frame->Show(true);
#endif // wxUSE_PRINTING_ARCHITECTURE
}
void AppFrame::OnPrint (wxCommandEvent &WXUNUSED(event)) {
#if wxUSE_PRINTING_ARCHITECTURE
wxPrintDialogData printDialogData( *g_printData);
wxPrinter printer (&printDialogData);
EditPrint printout (m_edit);
@@ -433,6 +450,7 @@ void AppFrame::OnPrint (wxCommandEvent &WXUNUSED(event)) {
}
}
(*g_printData) = printer.GetPrintDialogData().GetPrintData();
#endif // wxUSE_PRINTING_ARCHITECTURE
}
// edit events
@@ -441,8 +459,8 @@ void AppFrame::OnEdit (wxCommandEvent &event) {
}
// private functions
void AppFrame::CreateMenu () {
void AppFrame::CreateMenu ()
{
// File menu
wxMenu *menuFile = new wxMenu;
menuFile->Append (wxID_OPEN, _("&Open ..\tCtrl+O"));
@@ -552,10 +570,10 @@ void AppFrame::CreateMenu () {
m_menuBar->Append (menuWindow, _("&Window"));
m_menuBar->Append (menuHelp, _("&Help"));
SetMenuBar (m_menuBar);
}
void AppFrame::FileOpen (wxString fname) {
void AppFrame::FileOpen (wxString fname)
{
wxFileName w(fname); w.Normalize(); fname = w.GetFullPath();
m_edit->LoadFile (fname);
}
@@ -661,4 +679,3 @@ void AppAbout::OnTimerEvent (wxTimerEvent &WXUNUSED(event)) {
m_timer = NULL;
EndModal (wxID_OK);
}

View File

@@ -187,7 +187,7 @@ bool MyApp::OnInit()
SetTopWindow(frame);
return TRUE;
return true;
}
@@ -298,7 +298,7 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
// Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar);
subframe->Show(TRUE);
subframe->Show(true);
}
@@ -324,12 +324,12 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
int width = 16;
int currentX = 5;
toolBar->AddTool( MDI_NEW_WINDOW, *(bitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, wxT("New SVG test window"));
toolBar->AddTool( MDI_NEW_WINDOW, *(bitmaps[0]), wxNullBitmap, false, currentX, wxDefaultCoord, (wxObject *) NULL, wxT("New SVG test window"));
currentX += width + 5;
toolBar->AddTool( MDI_SAVE, *bitmaps[1], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, wxT("Save test in SVG format"));
toolBar->AddTool( MDI_SAVE, *bitmaps[1], wxNullBitmap, false, currentX, wxDefaultCoord, (wxObject *) NULL, wxT("Save test in SVG format"));
currentX += width + 5;
toolBar->AddSeparator();
toolBar->AddTool(MDI_ABOUT, *bitmaps[2], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, wxT("Help"));
toolBar->AddTool(MDI_ABOUT, *bitmaps[2], wxNullBitmap, false, currentX, wxDefaultCoord, (wxObject *) NULL, wxT("Help"));
toolBar->Realize();
@@ -341,6 +341,7 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
{
#if wxUSE_FILEDLG
MyChild * pChild = (MyChild *)GetActiveChild ();
if (pChild == NULL)
{
@@ -359,6 +360,7 @@ void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
}
}
return ;
#endif // wxUSE_FILEDLG
}
@@ -464,7 +466,7 @@ void MyCanvas::OnDraw(wxDC& dc)
dc.DrawText(wxT("This is a Red string"), 50, 200);
dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45);
dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90);
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, FALSE, wxT("Times New Roman"));
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
dc.SetFont(wF);
dc.SetTextForeground (wC) ;
dc.DrawText(wxT("This is a Times-style string"), 50, 60);
@@ -520,7 +522,7 @@ void MyCanvas::OnDraw(wxDC& dc)
break ;
case 5:
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, FALSE, wxT("Times New Roman"));
wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
dc.SetFont(wF);
dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200);
@@ -601,7 +603,7 @@ MyChild::~MyChild()
void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
Close(true);
}

View File

@@ -154,6 +154,7 @@ END_EVENT_TABLE()
//----------------------------------------------------------------------
#if wxUSE_DATAOBJ
static wxTextFileType wxConvertEOLMode(int scintillaMode)
{
wxTextFileType type;
@@ -177,6 +178,7 @@ static wxTextFileType wxConvertEOLMode(int scintillaMode)
}
return type;
}
#endif // wxUSE_DATAOBJ
//----------------------------------------------------------------------
@@ -439,6 +441,7 @@ void ScintillaWX::Paste() {
pdoc->BeginUndoAction();
ClearSelection();
#if wxUSE_DATAOBJ
wxTextDataObject data;
bool gotData = false;
@@ -455,6 +458,7 @@ void ScintillaWX::Paste() {
pdoc->InsertString(currentPos, buf, len);
SetEmptySelection(currentPos + len);
}
#endif // wxUSE_DATAOBJ
pdoc->EndUndoAction();
NotifyChange();
@@ -463,16 +467,21 @@ void ScintillaWX::Paste() {
void ScintillaWX::CopyToClipboard(const SelectionText& st) {
#if wxUSE_CLIPBOARD
if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(false);
wxString text = wxTextBuffer::Translate(stc2wx(st.s, st.len-1));
wxTheClipboard->SetData(new wxTextDataObject(text));
wxTheClipboard->Close();
}
#else
wxUnusedVar(st);
#endif // wxUSE_CLIPBOARD
}
bool ScintillaWX::CanPaste() {
#if wxUSE_CLIPBOARD
bool canPaste = false;
bool didOpen;
@@ -489,6 +498,9 @@ bool ScintillaWX::CanPaste() {
}
}
return canPaste;
#else
return false;
#endif // wxUSE_CLIPBOARD
}
void ScintillaWX::CreateCallTipWindow(PRectangle) {