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

View File

@@ -41,12 +41,14 @@ public:
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
#if wxUSE_FILEDLG
void OnOpen(wxCommandEvent& event); void OnOpen(wxCommandEvent& event);
#endif // wxUSE_FILEDLG
MyCanvas* GetCanvas() const { return m_canvas; } MyCanvas* GetCanvas() const { return m_canvas; }
wxGIFAnimationCtrl* GetAnimationCtrl() const { return m_animationCtrl; } wxGIFAnimationCtrl* GetAnimationCtrl() const { return m_animationCtrl; }
#if 0 #if 0
wxAnimationPlayer& GetPlayer() { return m_player; } wxAnimationPlayer& GetPlayer() { return m_player; }
wxAnimationBase& GetAnimation() { return m_animation; } wxAnimationBase& GetAnimation() { return m_animation; }
#endif #endif
@@ -61,11 +63,3 @@ protected:
wxGIFAnimation m_animation; wxGIFAnimation m_animation;
#endif #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)) void MyFrame::OnToggleWindow(wxCommandEvent& WXUNUSED(event))
{ {
m_leftWindow1->Show(!m_leftWindow1->IsShown()); m_leftWindow1->Show(!m_leftWindow1->IsShown());
#if wxUSE_MDI_ARCHITECTURE
wxLayoutAlgorithm layout; wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this); layout.LayoutMDIFrame(this);
#endif // wxUSE_MDI_ARCHITECTURE
} }
void MyFrame::OnFoldPanelBarDrag(wxSashEvent& event) void MyFrame::OnFoldPanelBarDrag(wxSashEvent& event)
@@ -129,8 +131,10 @@ void MyFrame::OnFoldPanelBarDrag(wxSashEvent& event)
if(event.GetId() == ID_WINDOW_LEFT1) if(event.GetId() == ID_WINDOW_LEFT1)
m_leftWindow1->SetDefaultSize(wxSize(event.GetDragRect().width, 1000)); m_leftWindow1->SetDefaultSize(wxSize(event.GetDragRect().width, 1000));
#if wxUSE_MDI_ARCHITECTURE
wxLayoutAlgorithm layout; wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this); layout.LayoutMDIFrame(this);
#endif // wxUSE_MDI_ARCHITECTURE
// Leaves bits of itself behind sometimes // Leaves bits of itself behind sometimes
GetClientWindow()->Refresh(); GetClientWindow()->Refresh();
@@ -496,8 +500,10 @@ void MyCanvas::OnEvent(wxMouseEvent& event)
void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event)) void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event))
{ {
#if wxUSE_MDI_ARCHITECTURE
wxLayoutAlgorithm layout; wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this); layout.LayoutMDIFrame(this);
#endif // wxUSE_MDI_ARCHITECTURE
} }
// Note that FPBTEST_NEW_WINDOW and FPBTEST_ABOUT commands get passed // Note that FPBTEST_NEW_WINDOW and FPBTEST_ABOUT commands get passed
@@ -532,4 +538,3 @@ void MyChild::OnActivate(wxActivateEvent& event)
if (event.GetActive() && canvas) if (event.GetActive() && canvas)
canvas->SetFocus(); canvas->SetFocus();
} }

View File

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

View File

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

View File

@@ -187,7 +187,7 @@ bool MyApp::OnInit()
SetTopWindow(frame); SetTopWindow(frame);
return TRUE; return true;
} }
@@ -298,7 +298,7 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
// Associate the menu bar with the frame // Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar); subframe->SetMenuBar(menu_bar);
subframe->Show(TRUE); subframe->Show(true);
} }
@@ -324,12 +324,12 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
int width = 16; int width = 16;
int currentX = 5; 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; 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; currentX += width + 5;
toolBar->AddSeparator(); 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(); toolBar->Realize();
@@ -341,6 +341,7 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) ) void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
{ {
#if wxUSE_FILEDLG
MyChild * pChild = (MyChild *)GetActiveChild (); MyChild * pChild = (MyChild *)GetActiveChild ();
if (pChild == NULL) if (pChild == NULL)
{ {
@@ -359,6 +360,7 @@ void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
} }
} }
return ; return ;
#endif // wxUSE_FILEDLG
} }
@@ -464,7 +466,7 @@ void MyCanvas::OnDraw(wxDC& dc)
dc.DrawText(wxT("This is a Red string"), 50, 200); 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 45 deg string"), 50, 200, 45);
dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90); 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.SetFont(wF);
dc.SetTextForeground (wC) ; dc.SetTextForeground (wC) ;
dc.DrawText(wxT("This is a Times-style string"), 50, 60); dc.DrawText(wxT("This is a Times-style string"), 50, 60);
@@ -520,7 +522,7 @@ void MyCanvas::OnDraw(wxDC& dc)
break ; break ;
case 5: 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.SetFont(wF);
dc.DrawLine(0, 0, 200, 200); dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200); dc.DrawLine(200, 0, 0, 200);
@@ -601,7 +603,7 @@ MyChild::~MyChild()
void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
{ {
Close(TRUE); Close(true);
} }

View File

@@ -1341,21 +1341,27 @@ void wxFilenameListValidator::OnEdit(wxProperty *property, wxPropertyListView *v
if (!view->GetValueText()) if (!view->GetValueText())
return; return;
wxString s = wxFileSelector( #if wxUSE_FILEDLG
m_filenameMessage.GetData(), wxString s = wxFileSelector(
wxPathOnly(property->GetValue().StringValue()), m_filenameMessage.GetData(),
wxFileNameFromPath(property->GetValue().StringValue()), wxPathOnly(property->GetValue().StringValue()),
NULL, wxFileNameFromPath(property->GetValue().StringValue()),
m_filenameWildCard.GetData(), NULL,
0, m_filenameWildCard.GetData(),
parentWindow); 0,
if ( !s.empty() ) parentWindow);
{ if ( !s.empty() )
property->GetValue() = s; {
view->DisplayProperty(property); property->GetValue() = s;
view->UpdatePropertyDisplayInList(property); view->DisplayProperty(property);
view->OnPropertyChanged(property); view->UpdatePropertyDisplayInList(property);
} view->OnPropertyChanged(property);
}
#else
wxUnusedVar(property);
wxUnusedVar(view);
wxUnusedVar(parentWindow);
#endif
} }
/// ///
@@ -1575,17 +1581,17 @@ void wxListOfStringsListValidator::OnEdit( wxProperty *property,
class wxPropertyStringListEditorDialog: public wxDialog class wxPropertyStringListEditorDialog: public wxDialog
{ {
public: public:
wxPropertyStringListEditorDialog(wxWindow *parent, const wxString& title, wxPropertyStringListEditorDialog(wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("stringEditorDialogBox")): long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("stringEditorDialogBox")):
wxDialog(parent, wxID_ANY, title, pos, size, windowStyle, name) wxDialog(parent, wxID_ANY, title, pos, size, windowStyle, name)
{ {
m_stringList = NULL; m_stringList = NULL;
m_stringText = NULL; m_stringText = NULL;
m_listBox = NULL; m_listBox = NULL;
sm_dialogCancelled = false; sm_dialogCancelled = false;
m_currentSelection = -1; m_currentSelection = -1;
} }
~wxPropertyStringListEditorDialog(void) {} ~wxPropertyStringListEditorDialog(void) {}
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);
@@ -1712,30 +1718,30 @@ bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList
void wxPropertyStringListEditorDialog::OnStrings(wxCommandEvent& WXUNUSED(event)) void wxPropertyStringListEditorDialog::OnStrings(wxCommandEvent& WXUNUSED(event))
{ {
int sel = m_listBox->GetSelection(); int sel = m_listBox->GetSelection();
if (sel != wxNOT_FOUND) if (sel != wxNOT_FOUND)
{ {
m_currentSelection = sel; m_currentSelection = sel;
ShowCurrentSelection(); ShowCurrentSelection();
} }
} }
void wxPropertyStringListEditorDialog::OnDelete(wxCommandEvent& WXUNUSED(event)) void wxPropertyStringListEditorDialog::OnDelete(wxCommandEvent& WXUNUSED(event))
{ {
int sel = m_listBox->GetSelection(); int sel = m_listBox->GetSelection();
if (sel == wxNOT_FOUND) if (sel == wxNOT_FOUND)
return; return;
wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(sel); wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(sel);
if (!node) if (!node)
return; return;
m_listBox->Delete(sel); m_listBox->Delete(sel);
delete[] (wxChar *)node->GetData(); delete[] (wxChar *)node->GetData();
delete node; delete node;
m_currentSelection = -1; m_currentSelection = -1;
m_stringText->SetValue(wxEmptyString); m_stringText->SetValue(wxEmptyString);
} }
void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event)) void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event))
@@ -1753,34 +1759,34 @@ void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event))
void wxPropertyStringListEditorDialog::OnOK(wxCommandEvent& WXUNUSED(event)) void wxPropertyStringListEditorDialog::OnOK(wxCommandEvent& WXUNUSED(event))
{ {
SaveCurrentSelection(); SaveCurrentSelection();
EndModal(wxID_OK); EndModal(wxID_OK);
// Close(true); // Close(true);
this->Destroy(); this->Destroy();
} }
void wxPropertyStringListEditorDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) void wxPropertyStringListEditorDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
{ {
sm_dialogCancelled = true; sm_dialogCancelled = true;
EndModal(wxID_CANCEL); EndModal(wxID_CANCEL);
// Close(true); // Close(true);
this->Destroy(); this->Destroy();
} }
void wxPropertyStringListEditorDialog::OnText(wxCommandEvent& event) void wxPropertyStringListEditorDialog::OnText(wxCommandEvent& event)
{ {
if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER) if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER)
{ {
SaveCurrentSelection(); SaveCurrentSelection();
} }
} }
void void
wxPropertyStringListEditorDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) wxPropertyStringListEditorDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{ {
SaveCurrentSelection(); SaveCurrentSelection();
Destroy(); Destroy();
} }
void wxPropertyStringListEditorDialog::SaveCurrentSelection() void wxPropertyStringListEditorDialog::SaveCurrentSelection()

View File

@@ -90,7 +90,7 @@
/* /*
// FIXME:: see places where _gHorizCursorImg is used // FIXME:: see places where _gHorizCursorImg is used
static const char* _gHorizCursorImg[] = static const char* _gHorizCursorImg[] =
{ {
"............XX....XX............", "............XX....XX............",
"............XX....XX............", "............XX....XX............",
@@ -110,7 +110,7 @@ static const char* _gHorizCursorImg[] =
"............XX....XX............" "............XX....XX............"
}; };
static const char* _gVertCursorImg[] = static const char* _gVertCursorImg[] =
{ {
"................X...............", "................X...............",
"...............XXX..............", "...............XXX..............",
@@ -148,7 +148,7 @@ static inline bool rect_hits_rect( const wxRect& r1, const wxRect& r2 )
if ( ( r2.y >= r1.y && r2.y <= r1.y + r1.height ) || if ( ( r2.y >= r1.y && r2.y <= r1.y + r1.height ) ||
( r1.y >= r2.y && r1.y <= r2.y + r2.height ) ) ( r1.y >= r2.y && r1.y <= r2.y + r2.height ) )
return 1; return 1;
return 0; return 0;
@@ -164,11 +164,11 @@ static inline void hide_rect( wxRect& r )
static inline void clip_rect_against_rect( wxRect& r1, const wxRect& r2 ) static inline void clip_rect_against_rect( wxRect& r1, const wxRect& r2 )
{ {
if ( r1.x < r2.x || if ( r1.x < r2.x ||
r1.y < r2.y || r1.y < r2.y ||
r1.x >= r2.x + r2.width || r1.x >= r2.x + r2.width ||
r1.y >= r2.y + r2.height r1.y >= r2.y + r2.height
) )
{ {
hide_rect( r1 ); hide_rect( r1 );
return; return;
@@ -194,7 +194,7 @@ cbBarSpy::cbBarSpy(void)
mpBarWnd(0) mpBarWnd(0)
{} {}
cbBarSpy::cbBarSpy( wxFrameLayout* pPanel ) cbBarSpy::cbBarSpy( wxFrameLayout* pPanel )
: mpLayout(pPanel), : mpLayout(pPanel),
mpBarWnd(0) mpBarWnd(0)
@@ -275,7 +275,7 @@ wxFrameLayout::wxFrameLayout(void)
mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ), mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mBlackPen ( wxColour( 0, 0, 0), 1, wxSOLID ), mBlackPen ( wxColour( 0, 0, 0), 1, wxSOLID ),
mBorderPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ), mBorderPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mNullPen( wxColour(0,0,0), 1, wxTRANSPARENT ), mNullPen( wxColour(0,0,0), 1, wxTRANSPARENT ),
mpPaneInFocus( NULL ), mpPaneInFocus( NULL ),
@@ -308,21 +308,21 @@ wxFrameLayout::wxFrameLayout( wxWindow* pParentFrame, wxWindow* pFrameClient, bo
mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ), mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mBlackPen ( wxColour( 0, 0, 0), 1, wxSOLID ), mBlackPen ( wxColour( 0, 0, 0), 1, wxSOLID ),
mBorderPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ), mBorderPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mNullPen( wxColour(0,0,0), 1, wxTRANSPARENT ), mNullPen( wxColour(0,0,0), 1, wxTRANSPARENT ),
mpPaneInFocus( NULL ), mpPaneInFocus( NULL ),
mpLRUPane ( NULL ), mpLRUPane ( NULL ),
mFloatingOn ( true ), mFloatingOn ( true ),
mpTopPlugin ( NULL ), mpTopPlugin ( NULL ),
mpCaputesInput( NULL ), mpCaputesInput( NULL ),
mClientWndRefreshPending( false ), mClientWndRefreshPending( false ),
mRecalcPending( true ), mRecalcPending( true ),
mCheckFocusWhenIdle( false ), mCheckFocusWhenIdle( false ),
mpUpdatesMgr( NULL ) mpUpdatesMgr( NULL )
{ {
CreateCursors(); CreateCursors();
@@ -352,7 +352,7 @@ bool wxFrameLayout::CanReparent()
#ifdef __WXMSW__ #ifdef __WXMSW__
return true; return true;
#elif defined(__WXGTK20__) #elif defined(__WXGTK20__)
return TRUE; return true;
#elif defined (__WXGTK__) #elif defined (__WXGTK__)
//return true; //return true;
return false; return false;
@@ -402,6 +402,8 @@ void wxFrameLayout::ReparentWindow( wxWindow* pChild, wxWindow* pNewParent )
//return; //return;
#else #else
wxUnusedVar(pChild);
wxUnusedVar(pNewParent);
wxMessageBox( "Sorry, docking is not supported for ports other than MSW and wxGTK" ); wxMessageBox( "Sorry, docking is not supported for ports other than MSW and wxGTK" );
#endif #endif
} }
@@ -484,18 +486,18 @@ wxFrameLayout::~wxFrameLayout()
for ( i = 0; i != MAX_PANES; ++i ) for ( i = 0; i != MAX_PANES; ++i )
{ {
if ( mPanes[i] ) if ( mPanes[i] )
delete mPanes[i]; delete mPanes[i];
} }
if ( mpHorizCursor ) if ( mpHorizCursor )
delete mpHorizCursor; delete mpHorizCursor;
if ( mpVertCursor ) if ( mpVertCursor )
delete mpVertCursor; delete mpVertCursor;
if ( mpNormalCursor ) if ( mpNormalCursor )
delete mpNormalCursor; delete mpNormalCursor;
if ( mpDragCursor ) if ( mpDragCursor )
delete mpDragCursor; delete mpDragCursor;
if ( mpNECursor ) if ( mpNECursor )
delete mpNECursor; delete mpNECursor;
wxObjectList::compatibility_iterator pSpy = mBarSpyList.GetFirst(); wxObjectList::compatibility_iterator pSpy = mBarSpyList.GetFirst();
@@ -574,7 +576,7 @@ cbUpdatesManagerBase* wxFrameLayout::CreateUpdatesManager()
//return new cbSimpleUpdatesMgr( this ); //return new cbSimpleUpdatesMgr( this );
} }
void wxFrameLayout::AddBar( wxWindow* pBarWnd, void wxFrameLayout::AddBar( wxWindow* pBarWnd,
const cbDimInfo& dimInfo, const cbDimInfo& dimInfo,
int alignment, int alignment,
int rowNo, int rowNo,
@@ -611,18 +613,18 @@ void wxFrameLayout::AddBar( wxWindow* pBarWnd,
DoSetBarState( pInfo ); DoSetBarState( pInfo );
} }
bool wxFrameLayout::RedockBar( cbBarInfo* pBar, bool wxFrameLayout::RedockBar( cbBarInfo* pBar,
const wxRect& shapeInParent, const wxRect& shapeInParent,
cbDockPane* pToPane, cbDockPane* pToPane,
bool updateNow ) bool updateNow )
{ {
if ( !pToPane ) if ( !pToPane )
pToPane = HitTestPanes( shapeInParent, NULL ); pToPane = HitTestPanes( shapeInParent, NULL );
if ( !pToPane ) if ( !pToPane )
return false; // bar's shape does not hit any pane return false; // bar's shape does not hit any pane
// - redocking is NOT possible // - redocking is NOT possible
cbDockPane* pBarPane = GetBarPane( pBar ); cbDockPane* pBarPane = GetBarPane( pBar );
@@ -635,8 +637,8 @@ bool wxFrameLayout::RedockBar( cbBarInfo* pBar,
// FIXME FIXME:: the recalculation below may be a *huge* performance // FIXME FIXME:: the recalculation below may be a *huge* performance
// hit, it could be eliminated though... // hit, it could be eliminated though...
// but first the "pane-postion-changed" problem // but first the "pane-postion-changed" problem
// has to be fixed // has to be fixed
RecalcLayout( false ); RecalcLayout( false );
@@ -700,7 +702,7 @@ void wxFrameLayout::SetBarState( cbBarInfo* pBar, int newState, bool updateNow )
cbRowInfo* pRow; cbRowInfo* pRow;
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
bool success = bool success =
#endif #endif
LocateBar( pBar, &pRow, &pPane ); LocateBar( pBar, &pRow, &pPane );
@@ -734,7 +736,7 @@ void wxFrameLayout::SetBarState( cbBarInfo* pBar, int newState, bool updateNow )
if ( pFFrm->GetBar() == pBar ) if ( pFFrm->GetBar() == pBar )
{ {
pFFrm->Show( false ); // reduces flicker sligthly pFFrm->Show( false ); // reduces flicker sligthly
ReparentWindow( pBar->mpBarWnd, &GetParentFrame() ); ReparentWindow( pBar->mpBarWnd, &GetParentFrame() );
@@ -814,7 +816,7 @@ void wxFrameLayout::InverseVisibility( cbBarInfo* pBar )
if ( newState == wxCBAR_FLOATING ) if ( newState == wxCBAR_FLOATING )
this->RepositionFloatedBar( pBar ); this->RepositionFloatedBar( pBar );
} }
void wxFrameLayout::ApplyBarProperties( cbBarInfo* pBar ) void wxFrameLayout::ApplyBarProperties( cbBarInfo* pBar )
@@ -852,7 +854,7 @@ void wxFrameLayout::RepositionFloatedBar( cbBarInfo* pBar )
GetParentFrame().ClientToScreen( &x, &y ); GetParentFrame().ClientToScreen( &x, &y );
pFFrm->PositionFloatedWnd( x,y, pFFrm->PositionFloatedWnd( x,y,
bounds.width, bounds.width,
bounds.height ); bounds.height );
@@ -867,7 +869,7 @@ void wxFrameLayout::DoSetBarState( cbBarInfo* pBar )
{ {
if ( pBar->mState != wxCBAR_FLOATING && if ( pBar->mState != wxCBAR_FLOATING &&
pBar->mState != wxCBAR_HIDDEN ) pBar->mState != wxCBAR_HIDDEN )
// dock it // dock it
mPanes[pBar->mAlignment]->InsertBar( pBar ); mPanes[pBar->mAlignment]->InsertBar( pBar );
@@ -881,14 +883,14 @@ void wxFrameLayout::DoSetBarState( cbBarInfo* pBar )
pBar->mpBarWnd->Show( false ); pBar->mpBarWnd->Show( false );
} }
else else
{ {
if ( !(mFloatingOn && pBar->mFloatingOn) ) if ( !(mFloatingOn && pBar->mFloatingOn) )
return; return;
// float it // float it
if ( pBar->mpBarWnd == NULL || !CanReparent() ) if ( pBar->mpBarWnd == NULL || !CanReparent() )
{ {
// FOR NOW:: just hide it // FOR NOW:: just hide it
if ( pBar->mpBarWnd ) if ( pBar->mpBarWnd )
@@ -905,7 +907,7 @@ void wxFrameLayout::DoSetBarState( cbBarInfo* pBar )
pMiniFrm->SetBar( pBar ); pMiniFrm->SetBar( pBar );
pMiniFrm->SetLayout( this ); pMiniFrm->SetLayout( this );
pMiniFrm->Create( &GetParentFrame(), wxID_ANY, pBar->mName, pMiniFrm->Create( &GetParentFrame(), wxID_ANY, pBar->mName,
wxPoint( 50,50 ), wxPoint( 50,50 ),
wxSize ( 0, 0 ), wxSize ( 0, 0 ),
wxFRAME_FLOAT_ON_PARENT | wxFRAME_FLOAT_ON_PARENT |
@@ -976,9 +978,9 @@ void wxFrameLayout::RemoveBar( cbBarInfo* pBarInfo )
if ( mAllBars[i] == pBarInfo ) if ( mAllBars[i] == pBarInfo )
{ {
#if wxCHECK_VERSION(2,3,2) #if wxCHECK_VERSION(2,3,2)
mAllBars.RemoveAt(i); mAllBars.RemoveAt(i);
#else #else
mAllBars.Remove(i); mAllBars.Remove(i);
#endif #endif
if ( pBarInfo->mpBarWnd ) // hides it's window if ( pBarInfo->mpBarWnd ) // hides it's window
@@ -992,7 +994,7 @@ void wxFrameLayout::RemoveBar( cbBarInfo* pBarInfo )
wxFAIL_MSG(wxT("bar info should be present in the list of all bars of all panes")); wxFAIL_MSG(wxT("bar info should be present in the list of all bars of all panes"));
} }
bool wxFrameLayout::LocateBar( cbBarInfo* pBarInfo, bool wxFrameLayout::LocateBar( cbBarInfo* pBarInfo,
cbRowInfo** ppRow, cbRowInfo** ppRow,
cbDockPane** ppPane ) cbDockPane** ppPane )
{ {
@@ -1005,7 +1007,7 @@ bool wxFrameLayout::LocateBar( cbBarInfo* pBarInfo,
wxBarIterator i( mPanes[n]->GetRowList() ); wxBarIterator i( mPanes[n]->GetRowList() );
while ( i.Next() ) while ( i.Next() )
if ( &i.BarInfo() == pBarInfo ) if ( &i.BarInfo() == pBarInfo )
{ {
(*ppPane) = mPanes[n]; (*ppPane) = mPanes[n];
@@ -1066,7 +1068,7 @@ void wxFrameLayout::RecalcLayout( bool repositionBarsNow )
pPane->SetBoundsInParent( rect ); pPane->SetBoundsInParent( rect );
// setup LEFT pane // setup LEFT pane
pPane = mPanes[ FL_ALIGN_LEFT ]; pPane = mPanes[ FL_ALIGN_LEFT ];
@@ -1106,9 +1108,9 @@ void wxFrameLayout::RecalcLayout( bool repositionBarsNow )
// recalc bounds of the client-window // recalc bounds of the client-window
mClntWndBounds.x = mPanes[FL_ALIGN_LEFT]->mBoundsInParent.x + mClntWndBounds.x = mPanes[FL_ALIGN_LEFT]->mBoundsInParent.x +
mPanes[FL_ALIGN_LEFT]->mBoundsInParent.width; mPanes[FL_ALIGN_LEFT]->mBoundsInParent.width;
mClntWndBounds.y = mPanes[FL_ALIGN_TOP ]->mBoundsInParent.y + mClntWndBounds.y = mPanes[FL_ALIGN_TOP ]->mBoundsInParent.y +
mPanes[FL_ALIGN_TOP ]->mBoundsInParent.height; mPanes[FL_ALIGN_TOP ]->mBoundsInParent.height;
mClntWndBounds.width = mPanes[FL_ALIGN_RIGHT]->mBoundsInParent.x - mClntWndBounds.width = mPanes[FL_ALIGN_RIGHT]->mBoundsInParent.x -
@@ -1141,7 +1143,7 @@ void wxFrameLayout::PositionClientWindow()
{ {
if ( mClntWndBounds.width >= 1 && mClntWndBounds.height >= 1 ) if ( mClntWndBounds.width >= 1 && mClntWndBounds.height >= 1 )
{ {
mpFrameClient->SetSize( mClntWndBounds.x, mClntWndBounds.y, mpFrameClient->SetSize( mClntWndBounds.x, mClntWndBounds.y,
mClntWndBounds.width, mClntWndBounds.height, 0 ); mClntWndBounds.width, mClntWndBounds.height, 0 );
if ( !mpFrameClient->IsShown() ) if ( !mpFrameClient->IsShown() )
@@ -1203,13 +1205,13 @@ void wxFrameLayout::UnhookFromFrame()
// NOTE:: the SetEvtHandlerEnabled() method is not used // NOTE:: the SetEvtHandlerEnabled() method is not used
// here, since it is assumed that unhooking layout // here, since it is assumed that unhooking layout
// from window may result destroying of the layout itself // from window may result destroying of the layout itself
// //
// BUG BUG BUG (wx):: this would not be a problem if // BUG BUG BUG (wx):: this would not be a problem if
// wxEvtHandler's destructor checked if // wxEvtHandler's destructor checked if
// this handler is currently the top-most // this handler is currently the top-most
// handler of some window, and additionally // handler of some window, and additionally
// to the reconnecting itself from the chain. // to the reconnecting itself from the chain.
// It would also re-setup current event handler // It would also re-setup current event handler
// of the window using wxWindow::SetEventHandler() // of the window using wxWindow::SetEventHandler()
// FOR NOW:: // FOR NOW::
@@ -1285,7 +1287,7 @@ void wxFrameLayout::CreateCursors()
/* /*
// FIXME:: The below code somehow doesn't work - cursors remain unchanged // FIXME:: The below code somehow doesn't work - cursors remain unchanged
char bits[64]; char bits[64];
set_cursor_bits( _gHorizCursorImg, bits, 32, 16 ); set_cursor_bits( _gHorizCursorImg, bits, 32, 16 );
mpHorizCursor = new wxCursor( bits, 32, 16 ); mpHorizCursor = new wxCursor( bits, 32, 16 );
@@ -1320,15 +1322,15 @@ cbDockPane* wxFrameLayout::HitTestPanes( const wxRect& rect,
{ {
// first, give the privilege to the current pane // first, give the privilege to the current pane
if ( pCurPane && rect_hits_rect( pCurPane->GetRealRect(), rect ) ) if ( pCurPane && rect_hits_rect( pCurPane->GetRealRect(), rect ) )
return pCurPane; return pCurPane;
int i; int i;
for ( i = 0; i != MAX_PANES; ++i ) for ( i = 0; i != MAX_PANES; ++i )
{ {
if ( pCurPane != mPanes[i] && if ( pCurPane != mPanes[i] &&
rect_hits_rect( mPanes[i]->GetRealRect(), rect ) ) rect_hits_rect( mPanes[i]->GetRealRect(), rect ) )
{ {
return mPanes[i]; return mPanes[i];
} }
@@ -1336,7 +1338,7 @@ cbDockPane* wxFrameLayout::HitTestPanes( const wxRect& rect,
return 0; return 0;
} }
void wxFrameLayout::ForwardMouseEvent( wxMouseEvent& event, void wxFrameLayout::ForwardMouseEvent( wxMouseEvent& event,
cbDockPane* pToPane, cbDockPane* pToPane,
int eventType ) int eventType )
{ {
@@ -1425,7 +1427,7 @@ void wxFrameLayout::OnLButtonUp( wxMouseEvent& event )
void wxFrameLayout::OnMouseMove( wxMouseEvent& event ) void wxFrameLayout::OnMouseMove( wxMouseEvent& event )
{ {
if ( mpPaneInFocus ) if ( mpPaneInFocus )
ForwardMouseEvent( event, mpPaneInFocus, cbEVT_PL_MOTION ); ForwardMouseEvent( event, mpPaneInFocus, cbEVT_PL_MOTION );
else else
{ {
@@ -1554,7 +1556,7 @@ void wxFrameLayout::FirePluginEvent( cbPluginEvent& event )
{ {
// check state of input capture, before processing the event // check state of input capture, before processing the event
if ( mpCaputesInput ) if ( mpCaputesInput )
{ {
bool isInputEvt = true; bool isInputEvt = true;
#if wxCHECK_VERSION(2,3,0) #if wxCHECK_VERSION(2,3,0)
@@ -1572,7 +1574,7 @@ void wxFrameLayout::FirePluginEvent( cbPluginEvent& event )
case cbEVT_PL_RIGHT_DOWN : break; case cbEVT_PL_RIGHT_DOWN : break;
case cbEVT_PL_RIGHT_UP : break; case cbEVT_PL_RIGHT_UP : break;
case cbEVT_PL_MOTION : break; case cbEVT_PL_MOTION : break;
default : isInputEvt = false; break; default : isInputEvt = false; break;
} }
#endif // #if wxCHECK_VERSION(2,3,0) #endif // #if wxCHECK_VERSION(2,3,0)
@@ -1626,27 +1628,27 @@ void wxFrameLayout::ReleaseEventsFromPane( cbDockPane* WXUNUSED(fromPane) )
cbPluginBase& wxFrameLayout::GetTopPlugin() cbPluginBase& wxFrameLayout::GetTopPlugin()
{ {
if ( !mpTopPlugin ) if ( !mpTopPlugin )
PushDefaultPlugins(); // automatic configuration PushDefaultPlugins(); // automatic configuration
return *mpTopPlugin; return *mpTopPlugin;
} }
void wxFrameLayout::SetTopPlugin( cbPluginBase* pPlugin ) void wxFrameLayout::SetTopPlugin( cbPluginBase* pPlugin )
{ {
mpTopPlugin = pPlugin; mpTopPlugin = pPlugin;
} }
bool wxFrameLayout::HasTopPlugin() bool wxFrameLayout::HasTopPlugin()
{ {
return ( mpTopPlugin != NULL ); return ( mpTopPlugin != NULL );
} }
void wxFrameLayout::PushPlugin( cbPluginBase* pPlugin ) void wxFrameLayout::PushPlugin( cbPluginBase* pPlugin )
{ {
if ( !mpTopPlugin ) if ( !mpTopPlugin )
mpTopPlugin = pPlugin; mpTopPlugin = pPlugin;
else else
{ {
@@ -1699,7 +1701,7 @@ void wxFrameLayout::AddPlugin( wxClassInfo* pPlInfo, int paneMask )
PushPlugin( pObj ); PushPlugin( pObj );
} }
void wxFrameLayout::AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlInfo, void wxFrameLayout::AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlInfo,
int paneMask ) int paneMask )
{ {
wxASSERT( pNextPlInfo != pPlInfo ); // DBG:: no sense wxASSERT( pNextPlInfo != pPlInfo ); // DBG:: no sense
@@ -1716,10 +1718,10 @@ void wxFrameLayout::AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlI
// remove existing one if present // remove existing one if present
cbPluginBase* pExistingPl = FindPlugin( pPlInfo ); cbPluginBase* pExistingPl = FindPlugin( pPlInfo );
if ( pExistingPl ) RemovePlugin( pPlInfo ); if ( pExistingPl ) RemovePlugin( pPlInfo );
// create an instance // create an instance
cbPluginBase* pNewPl = (cbPluginBase*)pPlInfo->CreateObject(); cbPluginBase* pNewPl = (cbPluginBase*)pPlInfo->CreateObject();
@@ -1728,7 +1730,6 @@ void wxFrameLayout::AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlI
// insert it to the chain // insert it to the chain
if ( pNextPl->GetPreviousHandler() ) if ( pNextPl->GetPreviousHandler() )
pNextPl->GetPreviousHandler()->SetNextHandler( pNewPl ); pNextPl->GetPreviousHandler()->SetNextHandler( pNewPl );
else else
mpTopPlugin = pNewPl; mpTopPlugin = pNewPl;
@@ -1783,7 +1784,7 @@ cbPluginBase* wxFrameLayout::FindPlugin( wxClassInfo* pPlInfo )
IMPLEMENT_DYNAMIC_CLASS( cbUpdateMgrData, wxObject ) IMPLEMENT_DYNAMIC_CLASS( cbUpdateMgrData, wxObject )
cbUpdateMgrData::cbUpdateMgrData() cbUpdateMgrData::cbUpdateMgrData()
: mPrevBounds( -1,-1,0,0 ), : mPrevBounds( -1,-1,0,0 ),
mIsDirty( true ), // inidicate initial change mIsDirty( true ), // inidicate initial change
@@ -1791,8 +1792,8 @@ cbUpdateMgrData::cbUpdateMgrData()
{} {}
void cbUpdateMgrData::StoreItemState( const wxRect& boundsInParent ) void cbUpdateMgrData::StoreItemState( const wxRect& boundsInParent )
{ {
mPrevBounds = boundsInParent; mPrevBounds = boundsInParent;
} }
void cbUpdateMgrData::SetDirty( bool isDirty ) void cbUpdateMgrData::SetDirty( bool isDirty )
@@ -1823,7 +1824,7 @@ wxBarIterator::wxBarIterator( RowArrayT& rows )
} }
bool wxBarIterator::Next() bool wxBarIterator::Next()
{ {
if ( mpRow ) if ( mpRow )
{ {
if ( mpBar ) if ( mpBar )
@@ -1832,25 +1833,24 @@ bool wxBarIterator::Next()
{ {
if ( mpRow->mBars.GetCount() == 0 ) if ( mpRow->mBars.GetCount() == 0 )
{ {
return false; return false;
} }
mpBar = mpRow->mBars[0]; mpBar = mpRow->mBars[0];
} }
if ( !mpBar ) if ( !mpBar )
{ {
// skip to the next row // skip to the next row
mpRow = mpRow->mpNext; mpRow = mpRow->mpNext;
if ( mpRow ) if ( mpRow )
mpBar = mpRow->mBars[0]; mpBar = mpRow->mBars[0];
else else
return false; return false;
} }
return true; return true;
} }
else else
@@ -1889,9 +1889,9 @@ void cbBarDimHandlerBase::RemoveRef()
IMPLEMENT_DYNAMIC_CLASS( cbDimInfo, wxObject ) IMPLEMENT_DYNAMIC_CLASS( cbDimInfo, wxObject )
cbDimInfo::cbDimInfo() cbDimInfo::cbDimInfo()
: mVertGap ( 0 ), : mVertGap ( 0 ),
mHorizGap( 0 ), mHorizGap( 0 ),
mIsFixed(true), mIsFixed(true),
@@ -1921,7 +1921,7 @@ cbDimInfo::cbDimInfo( cbBarDimHandlerBase* pDimHandler,
// int vtad = *((int*)mpHandler); // int vtad = *((int*)mpHandler);
mpHandler->AddRef(); mpHandler->AddRef();
} }
size_t i; size_t i;
for ( i = 0; i != MAX_BAR_STATES; ++i ) for ( i = 0; i != MAX_BAR_STATES; ++i )
{ {
@@ -1963,10 +1963,10 @@ cbDimInfo::cbDimInfo( int dh_x, int dh_y,
size_t i; size_t i;
for ( i = 0; i != MAX_BAR_STATES; ++i ) for ( i = 0; i != MAX_BAR_STATES; ++i )
mBounds[i] = wxRect( -1,-1,-1,-1 ); mBounds[i] = wxRect( -1,-1,-1,-1 );
} }
cbDimInfo::cbDimInfo( int x, int y, cbDimInfo::cbDimInfo( int x, int y,
bool isFixed, int gap, bool isFixed, int gap,
cbBarDimHandlerBase* pDimHandler) cbBarDimHandlerBase* pDimHandler)
: mVertGap ( gap ), : mVertGap ( gap ),
mHorizGap ( gap ), mHorizGap ( gap ),
@@ -1985,7 +1985,7 @@ cbDimInfo::cbDimInfo( int x, int y,
mSizes[wxCBAR_DOCKED_VERTICALLY ].y = y; mSizes[wxCBAR_DOCKED_VERTICALLY ].y = y;
mSizes[wxCBAR_FLOATING ].x = x; mSizes[wxCBAR_FLOATING ].x = x;
mSizes[wxCBAR_FLOATING ].y = y; mSizes[wxCBAR_FLOATING ].y = y;
size_t i; size_t i;
for ( i = 0; i != MAX_BAR_STATES; ++i ) for ( i = 0; i != MAX_BAR_STATES; ++i )
mBounds[i] = wxRect( -1,-1,-1,-1 ); mBounds[i] = wxRect( -1,-1,-1,-1 );
@@ -1993,8 +1993,8 @@ cbDimInfo::cbDimInfo( int x, int y,
cbDimInfo::~cbDimInfo() cbDimInfo::~cbDimInfo()
{ {
if ( mpHandler ) if ( mpHandler )
mpHandler->RemoveRef(); mpHandler->RemoveRef();
} }
@@ -2071,7 +2071,7 @@ cbCommonPaneProperties& cbCommonPaneProperties::operator=(const cbCommonPaneProp
mColProportionsOn = props.mColProportionsOn; mColProportionsOn = props.mColProportionsOn;
mBarCollapseIconsOn = props.mBarCollapseIconsOn; mBarCollapseIconsOn = props.mBarCollapseIconsOn;
mBarDragHintsOn = props.mBarDragHintsOn; mBarDragHintsOn = props.mBarDragHintsOn;
mMinCBarDim = props.mMinCBarDim; mMinCBarDim = props.mMinCBarDim;
mResizeHandleSize = props.mResizeHandleSize; mResizeHandleSize = props.mResizeHandleSize;
@@ -2119,13 +2119,13 @@ IMPLEMENT_DYNAMIC_CLASS( cbDockPane, wxObject )
// FIXME:: how to eliminate these cut&pasted constructors? // FIXME:: how to eliminate these cut&pasted constructors?
cbDockPane::cbDockPane(void) cbDockPane::cbDockPane(void)
: mLeftMargin ( 1 ), : mLeftMargin ( 1 ),
mRightMargin ( 1 ), mRightMargin ( 1 ),
mTopMargin ( 1 ), mTopMargin ( 1 ),
mBottomMargin( 1 ), mBottomMargin( 1 ),
mPaneWidth ( 32768 ), // fake-up very large pane dims, mPaneWidth ( 32768 ), // fake-up very large pane dims,
// since the real dimensions of the pane may not // since the real dimensions of the pane may not
// be known, while inserting bars initially // be known, while inserting bars initially
mPaneHeight( 32768 ), mPaneHeight( 32768 ),
mAlignment ( -1 ), mAlignment ( -1 ),
@@ -2134,18 +2134,18 @@ cbDockPane::cbDockPane(void)
{} {}
cbDockPane::cbDockPane( int alignment, wxFrameLayout* pPanel ) cbDockPane::cbDockPane( int alignment, wxFrameLayout* pPanel )
: mLeftMargin ( 1 ), : mLeftMargin ( 1 ),
mRightMargin ( 1 ), mRightMargin ( 1 ),
mTopMargin ( 1 ), mTopMargin ( 1 ),
mBottomMargin( 1 ), mBottomMargin( 1 ),
mPaneWidth ( 32768 ), // fake-up very large pane dims, mPaneWidth ( 32768 ), // fake-up very large pane dims,
// since the real dimensions of the pane may not // since the real dimensions of the pane may not
// be known, while inserting bars initially // be known, while inserting bars initially
mPaneHeight( 32768 ), mPaneHeight( 32768 ),
mAlignment ( alignment ), mAlignment ( alignment ),
mpLayout ( pPanel ), mpLayout ( pPanel ),
mpStoredRow( NULL ) mpStoredRow( NULL )
{} {}
cbDockPane::~cbDockPane() cbDockPane::~cbDockPane()
@@ -2155,7 +2155,7 @@ cbDockPane::~cbDockPane()
delete mRows[i]; delete mRows[i];
WX_CLEAR_LIST(wxList,mRowShapeData) WX_CLEAR_LIST(wxList,mRowShapeData)
// NOTE:: control bar infromation structures are cleaned-up // NOTE:: control bar infromation structures are cleaned-up
// in wxFrameLayout's destructor, using global control-bar list // in wxFrameLayout's destructor, using global control-bar list
} }
@@ -2214,7 +2214,7 @@ void cbDockPane::PaintRowDecorations( cbRowInfo* pRow, wxDC& dc )
// decorations first // decorations first
for ( i = 0; i != pRow->mBars.Count(); ++i ) for ( i = 0; i != pRow->mBars.Count(); ++i )
PaintBarDecorations( pRow->mBars[i], dc ); PaintBarDecorations( pRow->mBars[i], dc );
// then handles if present // then handles if present
@@ -2326,7 +2326,7 @@ int cbDockPane::GetNotFixedBarsCount( cbRowInfo* pRow )
void cbDockPane::RemoveBar( cbBarInfo* pBar ) void cbDockPane::RemoveBar( cbBarInfo* pBar )
{ {
bool needsRestoring = mProps.mNonDestructFrictionOn && bool needsRestoring = mProps.mNonDestructFrictionOn &&
mpStoredRow == pBar->mpRow; mpStoredRow == pBar->mpRow;
cbRemoveBarEvent evt( pBar, this ); cbRemoveBarEvent evt( pBar, this );
@@ -2369,7 +2369,7 @@ void cbDockPane::FrameToPane( int* x, int* y )
*y -= mTopMargin; *y -= mTopMargin;
if ( mAlignment == FL_ALIGN_TOP || if ( mAlignment == FL_ALIGN_TOP ||
mAlignment == FL_ALIGN_BOTTOM mAlignment == FL_ALIGN_BOTTOM
) )
{ {
*x -= mBoundsInParent.x; *x -= mBoundsInParent.x;
@@ -2388,7 +2388,7 @@ void cbDockPane::FrameToPane( int* x, int* y )
void cbDockPane::PaneToFrame( int* x, int* y ) void cbDockPane::PaneToFrame( int* x, int* y )
{ {
if ( mAlignment == FL_ALIGN_TOP || if ( mAlignment == FL_ALIGN_TOP ||
mAlignment == FL_ALIGN_BOTTOM mAlignment == FL_ALIGN_BOTTOM
) )
{ {
*x += mBoundsInParent.x; *x += mBoundsInParent.x;
@@ -2455,11 +2455,11 @@ int cbDockPane::GetRowAt( int paneY )
int rowHeight = mRows[i]->mRowHeight; int rowHeight = mRows[i]->mRowHeight;
int third = rowHeight/3; int third = rowHeight/3;
if ( paneY >= curY && paneY < curY + third ) if ( paneY >= curY && paneY < curY + third )
return i-1; return i-1;
if ( paneY >= curY + third && paneY < curY + rowHeight - third ) if ( paneY >= curY + third && paneY < curY + rowHeight - third )
return i; return i;
curY += rowHeight; curY += rowHeight;
@@ -2488,13 +2488,13 @@ int cbDockPane::GetRowAt( int upperY, int lowerY )
if ( upperY >= curY && if ( upperY >= curY &&
lowerY < curY ) return row; lowerY < curY ) return row;
if ( upperY <= curY && if ( upperY <= curY &&
lowerY >= curY && lowerY >= curY &&
curY - upperY >= oneThird ) return row-1; curY - upperY >= oneThird ) return row-1;
if ( ( upperY < curY + rowHeight && if ( ( upperY < curY + rowHeight &&
lowerY >= curY + rowHeight && lowerY >= curY + rowHeight &&
curY + rowHeight - lowerY >= oneThird ) curY + rowHeight - lowerY >= oneThird )
) )
return row+1; return row+1;
@@ -2551,7 +2551,7 @@ bool cbDockPane::HasNotFixedRowsAbove( cbRowInfo* pRow )
if ( pRow->mHasOnlyFixedBars ) if ( pRow->mHasOnlyFixedBars )
return true; return true;
} }
return false; return false;
} }
@@ -2580,7 +2580,7 @@ bool cbDockPane::HasNotFixedBarsLeft( cbBarInfo* pBar )
return true; return true;
} }
return false; return false;
} }
@@ -2594,7 +2594,7 @@ bool cbDockPane::HasNotFixedBarsRight( cbBarInfo* pBar )
return true; return true;
} }
return false; return false;
} }
@@ -2628,7 +2628,7 @@ void cbDockPane::CalcLengthRatios( cbRowInfo* pInRow )
void cbDockPane::RecalcRowLayout( cbRowInfo* pRow ) void cbDockPane::RecalcRowLayout( cbRowInfo* pRow )
{ {
cbLayoutRowEvent evt( pRow, this ); cbLayoutRowEvent evt( pRow, this );
mpLayout->FirePluginEvent( evt ); mpLayout->FirePluginEvent( evt );
} }
@@ -2652,7 +2652,7 @@ void cbDockPane::ExpandBar( cbBarInfo* pBar )
if ( !pCur->IsFixed() ) if ( !pCur->IsFixed() )
{ {
ratios.Add( 0.0 ); ratios.Add( 0.0 );
ratios[ ratios.GetCount() - 1 ] = pCur->mLenRatio; ratios[ ratios.GetCount() - 1 ] = pCur->mLenRatio;
} }
pCur = pCur->mpNext; pCur = pCur->mpNext;
@@ -2763,8 +2763,8 @@ void cbDockPane::DoInsertBar( cbBarInfo* pBar, int rowNo )
pRow = new cbRowInfo(); pRow = new cbRowInfo();
if ( rowNo == -1 && mRows.Count() ) if ( rowNo == -1 && mRows.Count() )
mRows.Insert( pRow, 0 ); mRows.Insert( pRow, 0 );
else else
mRows.Add( pRow ); mRows.Add( pRow );
@@ -2779,7 +2779,7 @@ void cbDockPane::DoInsertBar( cbBarInfo* pBar, int rowNo )
// store original shape of the row (before the bar is inserted) // store original shape of the row (before the bar is inserted)
mpStoredRow = pRow; mpStoredRow = pRow;
GetRowShapeData( mpStoredRow, &mRowShapeData ); GetRowShapeData( mpStoredRow, &mRowShapeData );
} }
} }
@@ -2916,7 +2916,7 @@ void cbDockPane::SetBoundsInParent( const wxRect& rect )
if ( noMarginsRect.width < 0 || if ( noMarginsRect.width < 0 ||
noMarginsRect.height < 0 ) noMarginsRect.height < 0 )
hide_rect( noMarginsRect ); hide_rect( noMarginsRect );
// calculate mBoundsInParent for each item in the pane // calculate mBoundsInParent for each item in the pane
@@ -2953,7 +2953,7 @@ void cbDockPane::SetBoundsInParent( const wxRect& rect )
} }
if ( bar.mHasRightHandle ) if ( bar.mHasRightHandle )
bounds.width -= mProps.mResizeHandleSize; bounds.width -= mProps.mResizeHandleSize;
PaneToFrame( &bounds ); PaneToFrame( &bounds );
@@ -2969,7 +2969,7 @@ bool cbDockPane::BarPresent( cbBarInfo* pBar )
wxBarIterator iter( mRows ); wxBarIterator iter( mRows );
while( iter.Next() ) while( iter.Next() )
if ( &iter.BarInfo() == pBar ) return true; if ( &iter.BarInfo() == pBar ) return true;
return false; return false;
@@ -2987,7 +2987,7 @@ int cbDockPane::GetRowIndex( cbRowInfo* pRow )
size_t i; size_t i;
for ( i = 0; i != mRows.Count(); ++i ) for ( i = 0; i != mRows.Count(); ++i )
{ {
if ( mRows[i] == pRow ) if ( mRows[i] == pRow )
return i; return i;
} }
@@ -3006,7 +3006,6 @@ int cbDockPane::GetPaneHeight()
int height = 0; int height = 0;
if ( IsHorizontal() ) if ( IsHorizontal() )
height += mTopMargin + mBottomMargin; height += mTopMargin + mBottomMargin;
else else
height += mLeftMargin + mRightMargin; height += mLeftMargin + mRightMargin;
@@ -3014,7 +3013,6 @@ int cbDockPane::GetPaneHeight()
int count = mRows.Count(); int count = mRows.Count();
if ( count ) if ( count )
height += mRows[count-1]->mRowY + mRows[count-1]->mRowHeight; height += mRows[count-1]->mRowY + mRows[count-1]->mRowHeight;
return height; return height;
@@ -3052,7 +3050,7 @@ void cbDockPane::RecalcLayout()
cbLayoutRowsEvent evt( this ); cbLayoutRowsEvent evt( this );
mpLayout->FirePluginEvent( evt ); mpLayout->FirePluginEvent( evt );
// then horizontally in each row // then horizontally in each row
size_t i; size_t i;
for ( i = 0; i != mRows.Count(); ++i ) for ( i = 0; i != mRows.Count(); ++i )
@@ -3061,7 +3059,7 @@ void cbDockPane::RecalcLayout()
int cbDockPane::GetDockingState() int cbDockPane::GetDockingState()
{ {
if ( mAlignment == FL_ALIGN_TOP || if ( mAlignment == FL_ALIGN_TOP ||
mAlignment == FL_ALIGN_BOTTOM ) mAlignment == FL_ALIGN_BOTTOM )
{ {
return wxCBAR_DOCKED_HORIZONTALLY; return wxCBAR_DOCKED_HORIZONTALLY;
@@ -3070,10 +3068,10 @@ int cbDockPane::GetDockingState()
return wxCBAR_DOCKED_VERTICALLY; return wxCBAR_DOCKED_VERTICALLY;
} }
inline bool cbDockPane::HasPoint( const wxPoint& pos, int x, int y, inline bool cbDockPane::HasPoint( const wxPoint& pos, int x, int y,
int width, int height ) int width, int height )
{ {
return ( pos.x >= x && return ( pos.x >= x &&
pos.y >= y && pos.y >= y &&
pos.x < x + width && pos.x < x + width &&
pos.y < y + height ); pos.y < y + height );
@@ -3106,7 +3104,7 @@ int cbDockPane::HitTestPaneItems( const wxPoint& pos,
else else
if ( row.mHasLowerHandle ) if ( row.mHasLowerHandle )
{ {
if ( HasPoint( pos, 0, row.mRowY + row.mRowHeight - mProps.mResizeHandleSize, if ( HasPoint( pos, 0, row.mRowY + row.mRowHeight - mProps.mResizeHandleSize,
row.mRowWidth, mProps.mResizeHandleSize ) ) row.mRowWidth, mProps.mResizeHandleSize ) )
return CB_LOWER_ROW_HANDLE_HITTED; return CB_LOWER_ROW_HANDLE_HITTED;
@@ -3134,7 +3132,7 @@ int cbDockPane::HitTestPaneItems( const wxPoint& pos,
{ {
if ( HasPoint( pos, bounds.x + bounds.width - mProps.mResizeHandleSize, bounds.y, if ( HasPoint( pos, bounds.x + bounds.width - mProps.mResizeHandleSize, bounds.y,
mProps.mResizeHandleSize, bounds.height ) ) mProps.mResizeHandleSize, bounds.height ) )
return CB_RIGHT_BAR_HANDLE_HITTED; return CB_RIGHT_BAR_HANDLE_HITTED;
} }
@@ -3181,10 +3179,9 @@ void cbDockPane::GetBarResizeRange( cbBarInfo* pBar, int* from, int *till,
// treat not-fixed bars as minimized // treat not-fixed bars as minimized
if ( !pBar->IsFixed() ) if ( !pBar->IsFixed() )
notFree += mProps.mMinCBarDim.x; notFree += mProps.mMinCBarDim.x;
else else
{ {
if ( pBar->mBounds.x + pBar->mBounds.width >= mPaneWidth ) if ( pBar->mBounds.x + pBar->mBounds.width >= mPaneWidth )
{ {
@@ -3195,17 +3192,15 @@ void cbDockPane::GetBarResizeRange( cbBarInfo* pBar, int* from, int *till,
notFree += pBar->mBounds.width; notFree += pBar->mBounds.width;
} }
} }
*till = mPaneWidth - notFree; *till = mPaneWidth - notFree;
// do not let resizing totally deform the bar itself // do not let resizing totally deform the bar itself
if ( forLeftHandle ) if ( forLeftHandle )
(*till) -= mProps.mMinCBarDim.x; (*till) -= mProps.mMinCBarDim.x;
else else
(*from) += mProps.mMinCBarDim.x; (*from) += mProps.mMinCBarDim.x;
} }
@@ -3225,7 +3220,7 @@ int cbDockPane::GetMinimalRowHeight( cbRowInfo* pRow )
if ( pRow->mHasLowerHandle ) if ( pRow->mHasLowerHandle )
height += mProps.mResizeHandleSize; height += mProps.mResizeHandleSize;
return height; return height;
} }
@@ -3264,7 +3259,7 @@ void cbDockPane::GetRowResizeRange( cbRowInfo* pRow, int* from, int* till,
}; };
*from = notFree; *from = notFree;
// allow accupy the client window space by resizing pane rows // allow accupy the client window space by resizing pane rows
if ( mAlignment == FL_ALIGN_BOTTOM ) if ( mAlignment == FL_ALIGN_BOTTOM )
@@ -3289,7 +3284,7 @@ void cbDockPane::GetRowResizeRange( cbRowInfo* pRow, int* from, int* till,
} }
*till = mPaneHeight - notFree; *till = mPaneHeight - notFree;
// allow adjustinig pane space vs. client window space by resizing pane row heights // allow adjustinig pane space vs. client window space by resizing pane row heights
@@ -3306,7 +3301,7 @@ void cbDockPane::GetRowResizeRange( cbRowInfo* pRow, int* from, int* till,
cbRowInfo& row = *pGivenRow; cbRowInfo& row = *pGivenRow;
if ( forUpperHandle ) if ( forUpperHandle )
{ {
*till = row.mRowY + row.mRowHeight - GetMinimalRowHeight( pGivenRow ); *till = row.mRowY + row.mRowHeight - GetMinimalRowHeight( pGivenRow );
if ( row.mHasUpperHandle ) if ( row.mHasUpperHandle )
@@ -3323,7 +3318,7 @@ void cbDockPane::GetRowResizeRange( cbRowInfo* pRow, int* from, int* till,
} }
} }
void cbDockPane::ResizeRow( cbRowInfo* pRow, int ofs, void cbDockPane::ResizeRow( cbRowInfo* pRow, int ofs,
bool forUpperHandle ) bool forUpperHandle )
{ {
cbResizeRowEvent evt( pRow, ofs, forUpperHandle, this ); cbResizeRowEvent evt( pRow, ofs, forUpperHandle, this );
@@ -3331,7 +3326,7 @@ void cbDockPane::ResizeRow( cbRowInfo* pRow, int ofs,
mpLayout->FirePluginEvent( evt ); mpLayout->FirePluginEvent( evt );
} }
void cbDockPane::ResizeBar( cbBarInfo* pBar, int ofs, void cbDockPane::ResizeBar( cbBarInfo* pBar, int ofs,
bool forLeftHandle ) bool forLeftHandle )
{ {
pBar->mpRow->mpExpandedBar = NULL; pBar->mpRow->mpExpandedBar = NULL;
@@ -3356,7 +3351,7 @@ void cbDockPane::ResizeBar( cbBarInfo* pBar, int ofs,
} }
else else
{ {
// move bar left if necessary // move bar left if necessary
if ( bounds.width + ofs < mProps.mMinCBarDim.x ) if ( bounds.width + ofs < mProps.mMinCBarDim.x )
{ {
bounds.x = bounds.x + bounds.width + ofs - mProps.mMinCBarDim.x; bounds.x = bounds.x + bounds.width + ofs - mProps.mMinCBarDim.x;
@@ -3437,7 +3432,7 @@ cbBarInfo* cbDockPane::GetBarInfoByWindow( wxWindow* pBarWnd )
wxBarIterator i( mRows ); wxBarIterator i( mRows );
while( i.Next() ) while( i.Next() )
if ( i.BarInfo().mpBarWnd == pBarWnd ) if ( i.BarInfo().mpBarWnd == pBarWnd )
return &i.BarInfo(); return &i.BarInfo();
@@ -3506,7 +3501,7 @@ cbPluginBase::~cbPluginBase()
bool cbPluginBase::ProcessEvent(wxEvent& event) bool cbPluginBase::ProcessEvent(wxEvent& event)
{ {
if ( mPaneMask == wxALL_PANES ) if ( mPaneMask == wxALL_PANES )
return wxEvtHandler::ProcessEvent( event ); return wxEvtHandler::ProcessEvent( event );
@@ -3531,7 +3526,7 @@ bool cbPluginBase::ProcessEvent(wxEvent& event)
// if event's pane maks matches the plugin's mask // if event's pane maks matches the plugin's mask
if ( mPaneMask & mask ) if ( mPaneMask & mask )
return wxEvtHandler::ProcessEvent( event ); return wxEvtHandler::ProcessEvent( event );
@@ -3543,4 +3538,3 @@ bool cbPluginBase::ProcessEvent(wxEvent& event)
else else
return false; return false;
} }

View File

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

View File

@@ -144,8 +144,8 @@ int wxRemotelyScrolledTreeCtrl::GetScrollPos(
{ {
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
// this condition fixes extsitence of warning but // this condition fixes extsitence of warning but
wxScrolledWindow* scrolledWindow = wxScrolledWindow* scrolledWindow =
// but GetScrolledWindow is still executed in case internally does something // but GetScrolledWindow is still executed in case internally does something
#endif #endif
GetScrolledWindow(); GetScrolledWindow();
@@ -197,7 +197,7 @@ void wxRemotelyScrolledTreeCtrl::GetViewStart(int *x, int *y) const
} }
// In case we're using the generic tree control. // In case we're using the generic tree control.
void wxRemotelyScrolledTreeCtrl::PrepareDC( void wxRemotelyScrolledTreeCtrl::PrepareDC(
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
wxDC& dc wxDC& dc
#else #else
@@ -232,7 +232,7 @@ void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVer
#ifdef __WXMSW__ #ifdef __WXMSW__
#if USE_GENERIC_TREECTRL #if USE_GENERIC_TREECTRL
if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
#endif #endif // USE_GENERIC_TREECTRL
{ {
UINT sbCode = SB_THUMBPOSITION; UINT sbCode = SB_THUMBPOSITION;
HWND vertScrollBar = 0; HWND vertScrollBar = 0;
@@ -240,8 +240,8 @@ void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVer
} }
#if USE_GENERIC_TREECTRL #if USE_GENERIC_TREECTRL
else else
#endif #endif // USE_GENERIC_TREECTRL
#endif #endif // __WXMSW__
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
{ {
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; 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) void wxRemotelyScrolledTreeCtrl::OnSize(wxSizeEvent& event)
@@ -745,4 +746,3 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
inOnScroll = false; inOnScroll = false;
} }

View File

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

View File

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

View File

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

View File

@@ -187,7 +187,7 @@ bool MyApp::OnInit()
SetTopWindow(frame); SetTopWindow(frame);
return TRUE; return true;
} }
@@ -298,7 +298,7 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
// Associate the menu bar with the frame // Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar); subframe->SetMenuBar(menu_bar);
subframe->Show(TRUE); subframe->Show(true);
} }
@@ -324,12 +324,12 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
int width = 16; int width = 16;
int currentX = 5; 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; 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; currentX += width + 5;
toolBar->AddSeparator(); 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(); toolBar->Realize();
@@ -341,6 +341,7 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) ) void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
{ {
#if wxUSE_FILEDLG
MyChild * pChild = (MyChild *)GetActiveChild (); MyChild * pChild = (MyChild *)GetActiveChild ();
if (pChild == NULL) if (pChild == NULL)
{ {
@@ -359,6 +360,7 @@ void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
} }
} }
return ; return ;
#endif // wxUSE_FILEDLG
} }
@@ -464,7 +466,7 @@ void MyCanvas::OnDraw(wxDC& dc)
dc.DrawText(wxT("This is a Red string"), 50, 200); 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 45 deg string"), 50, 200, 45);
dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90); 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.SetFont(wF);
dc.SetTextForeground (wC) ; dc.SetTextForeground (wC) ;
dc.DrawText(wxT("This is a Times-style string"), 50, 60); dc.DrawText(wxT("This is a Times-style string"), 50, 60);
@@ -520,7 +522,7 @@ void MyCanvas::OnDraw(wxDC& dc)
break ; break ;
case 5: 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.SetFont(wF);
dc.DrawLine(0, 0, 200, 200); dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200); dc.DrawLine(200, 0, 0, 200);
@@ -601,7 +603,7 @@ MyChild::~MyChild()
void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event)) 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) static wxTextFileType wxConvertEOLMode(int scintillaMode)
{ {
wxTextFileType type; wxTextFileType type;
@@ -177,6 +178,7 @@ static wxTextFileType wxConvertEOLMode(int scintillaMode)
} }
return type; return type;
} }
#endif // wxUSE_DATAOBJ
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -439,6 +441,7 @@ void ScintillaWX::Paste() {
pdoc->BeginUndoAction(); pdoc->BeginUndoAction();
ClearSelection(); ClearSelection();
#if wxUSE_DATAOBJ
wxTextDataObject data; wxTextDataObject data;
bool gotData = false; bool gotData = false;
@@ -455,6 +458,7 @@ void ScintillaWX::Paste() {
pdoc->InsertString(currentPos, buf, len); pdoc->InsertString(currentPos, buf, len);
SetEmptySelection(currentPos + len); SetEmptySelection(currentPos + len);
} }
#endif // wxUSE_DATAOBJ
pdoc->EndUndoAction(); pdoc->EndUndoAction();
NotifyChange(); NotifyChange();
@@ -463,16 +467,21 @@ void ScintillaWX::Paste() {
void ScintillaWX::CopyToClipboard(const SelectionText& st) { void ScintillaWX::CopyToClipboard(const SelectionText& st) {
#if wxUSE_CLIPBOARD
if (wxTheClipboard->Open()) { if (wxTheClipboard->Open()) {
wxTheClipboard->UsePrimarySelection(false); wxTheClipboard->UsePrimarySelection(false);
wxString text = wxTextBuffer::Translate(stc2wx(st.s, st.len-1)); wxString text = wxTextBuffer::Translate(stc2wx(st.s, st.len-1));
wxTheClipboard->SetData(new wxTextDataObject(text)); wxTheClipboard->SetData(new wxTextDataObject(text));
wxTheClipboard->Close(); wxTheClipboard->Close();
} }
#else
wxUnusedVar(st);
#endif // wxUSE_CLIPBOARD
} }
bool ScintillaWX::CanPaste() { bool ScintillaWX::CanPaste() {
#if wxUSE_CLIPBOARD
bool canPaste = false; bool canPaste = false;
bool didOpen; bool didOpen;
@@ -489,6 +498,9 @@ bool ScintillaWX::CanPaste() {
} }
} }
return canPaste; return canPaste;
#else
return false;
#endif // wxUSE_CLIPBOARD
} }
void ScintillaWX::CreateCallTipWindow(PRectangle) { void ScintillaWX::CreateCallTipWindow(PRectangle) {