#include "wx/wx.h"
#endif
-#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__)
+#ifndef __WXMSW__
#include "mondrian.xpm"
#endif
// ---------------------------------------------------------------------------
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()
// 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;
frame->CreateStatusBar();
#endif // wxUSE_STATUSBAR
- frame->Show(TRUE);
+ frame->Show(true);
SetTopWindow(frame);
- return TRUE;
+ return true;
}
// ---------------------------------------------------------------------------
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
_T("About Animation Demo"));
}
+#if wxUSE_FILEDLG
void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
{
wxFileDialog dialog(this, _T("Please choose an animated GIF"),
}
}
}
+#endif // wxUSE_FILEDLG
// ---------------------------------------------------------------------------
}
#endif
}
-
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; }
-#if 0
+#if 0
wxAnimationPlayer& GetPlayer() { return m_player; }
wxAnimationBase& GetAnimation() { return m_animation; }
#endif
wxGIFAnimation m_animation;
#endif
};
-
-// menu items ids
-enum
-{
- ANITEST_QUIT = 100,
- ANITEST_OPEN,
- ANITEST_ABOUT
-};
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)
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();
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
if (event.GetActive() && canvas)
canvas->SetFocus();
}
-
}
// 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);
UpdateMMedInfo();
}
-
//! 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_
};
+#if wxUSE_PRINTING_ARCHITECTURE
+
//----------------------------------------------------------------------------
//! EditPrint
class EditPrint: public wxPrintout {
bool PrintScaling (wxDC *dc);
};
-#endif // _EDIT_H_
+#endif // wxUSE_PRINTING_ARCHITECTURE
+#endif // _EDIT_H_
// 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
//! 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.
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);
// 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;
}
// 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)) {
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)) {
// 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),
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);
}
}
(*g_printData) = printer.GetPrintDialogData().GetPrintData();
+#endif // wxUSE_PRINTING_ARCHITECTURE
}
// edit events
}
// private functions
-void AppFrame::CreateMenu () {
-
+void AppFrame::CreateMenu ()
+{
// File menu
wxMenu *menuFile = new wxMenu;
menuFile->Append (wxID_OPEN, _("&Open ..\tCtrl+O"));
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);
}
m_timer = NULL;
EndModal (wxID_OK);
}
-
SetTopWindow(frame);
- return TRUE;
+ return true;
}
// Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar);
- subframe->Show(TRUE);
+ subframe->Show(true);
}
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();
void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
{
+#if wxUSE_FILEDLG
MyChild * pChild = (MyChild *)GetActiveChild ();
if (pChild == NULL)
{
}
}
return ;
+#endif // wxUSE_FILEDLG
}
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);
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);
void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
{
- Close(TRUE);
+ Close(true);
}
if (!view->GetValueText())
return;
- wxString s = wxFileSelector(
- m_filenameMessage.GetData(),
- wxPathOnly(property->GetValue().StringValue()),
- wxFileNameFromPath(property->GetValue().StringValue()),
- NULL,
- m_filenameWildCard.GetData(),
- 0,
- parentWindow);
- if ( !s.empty() )
- {
- property->GetValue() = s;
- view->DisplayProperty(property);
- view->UpdatePropertyDisplayInList(property);
- view->OnPropertyChanged(property);
- }
+#if wxUSE_FILEDLG
+ wxString s = wxFileSelector(
+ m_filenameMessage.GetData(),
+ wxPathOnly(property->GetValue().StringValue()),
+ wxFileNameFromPath(property->GetValue().StringValue()),
+ NULL,
+ m_filenameWildCard.GetData(),
+ 0,
+ parentWindow);
+ if ( !s.empty() )
+ {
+ property->GetValue() = s;
+ view->DisplayProperty(property);
+ view->UpdatePropertyDisplayInList(property);
+ view->OnPropertyChanged(property);
+ }
+#else
+ wxUnusedVar(property);
+ wxUnusedVar(view);
+ wxUnusedVar(parentWindow);
+#endif
}
///
class wxPropertyStringListEditorDialog: public wxDialog
{
- public:
+public:
wxPropertyStringListEditorDialog(wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("stringEditorDialogBox")):
wxDialog(parent, wxID_ANY, title, pos, size, windowStyle, name)
{
- m_stringList = NULL;
- m_stringText = NULL;
- m_listBox = NULL;
- sm_dialogCancelled = false;
- m_currentSelection = -1;
+ m_stringList = NULL;
+ m_stringText = NULL;
+ m_listBox = NULL;
+ sm_dialogCancelled = false;
+ m_currentSelection = -1;
}
~wxPropertyStringListEditorDialog(void) {}
void OnCloseWindow(wxCloseEvent& event);
void wxPropertyStringListEditorDialog::OnStrings(wxCommandEvent& WXUNUSED(event))
{
- int sel = m_listBox->GetSelection();
- if (sel != wxNOT_FOUND)
- {
- m_currentSelection = sel;
+ int sel = m_listBox->GetSelection();
+ if (sel != wxNOT_FOUND)
+ {
+ m_currentSelection = sel;
- ShowCurrentSelection();
- }
+ ShowCurrentSelection();
+ }
}
void wxPropertyStringListEditorDialog::OnDelete(wxCommandEvent& WXUNUSED(event))
{
- int sel = m_listBox->GetSelection();
- if (sel == wxNOT_FOUND)
- return;
+ int sel = m_listBox->GetSelection();
+ if (sel == wxNOT_FOUND)
+ return;
- wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(sel);
- if (!node)
- return;
+ wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(sel);
+ if (!node)
+ return;
- m_listBox->Delete(sel);
- delete[] (wxChar *)node->GetData();
- delete node;
- m_currentSelection = -1;
- m_stringText->SetValue(wxEmptyString);
+ m_listBox->Delete(sel);
+ delete[] (wxChar *)node->GetData();
+ delete node;
+ m_currentSelection = -1;
+ m_stringText->SetValue(wxEmptyString);
}
void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event))
void wxPropertyStringListEditorDialog::OnOK(wxCommandEvent& WXUNUSED(event))
{
- SaveCurrentSelection();
- EndModal(wxID_OK);
- // Close(true);
- this->Destroy();
+ SaveCurrentSelection();
+ EndModal(wxID_OK);
+// Close(true);
+ this->Destroy();
}
void wxPropertyStringListEditorDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
{
- sm_dialogCancelled = true;
- EndModal(wxID_CANCEL);
+ sm_dialogCancelled = true;
+ EndModal(wxID_CANCEL);
// Close(true);
- this->Destroy();
+ this->Destroy();
}
void wxPropertyStringListEditorDialog::OnText(wxCommandEvent& event)
{
- if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER)
- {
- SaveCurrentSelection();
- }
+ if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER)
+ {
+ SaveCurrentSelection();
+ }
}
void
wxPropertyStringListEditorDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
- SaveCurrentSelection();
+ SaveCurrentSelection();
- Destroy();
+ Destroy();
}
void wxPropertyStringListEditorDialog::SaveCurrentSelection()
/*
// FIXME:: see places where _gHorizCursorImg is used
-static const char* _gHorizCursorImg[] =
+static const char* _gHorizCursorImg[] =
{
"............XX....XX............",
"............XX....XX............",
"............XX....XX............"
};
-static const char* _gVertCursorImg[] =
+static const char* _gVertCursorImg[] =
{
"................X...............",
"...............XXX..............",
if ( ( r2.y >= r1.y && r2.y <= r1.y + r1.height ) ||
( r1.y >= r2.y && r1.y <= r2.y + r2.height ) )
-
+
return 1;
return 0;
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.x >= r2.x + r2.width ||
- r1.y >= r2.y + r2.height
- )
+ r1.y >= r2.y + r2.height
+ )
{
hide_rect( r1 );
return;
mpBarWnd(0)
{}
-cbBarSpy::cbBarSpy( wxFrameLayout* pPanel )
+cbBarSpy::cbBarSpy( wxFrameLayout* pPanel )
: mpLayout(pPanel),
mpBarWnd(0)
mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mBlackPen ( wxColour( 0, 0, 0), 1, wxSOLID ),
mBorderPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
-
+
mNullPen( wxColour(0,0,0), 1, wxTRANSPARENT ),
mpPaneInFocus( NULL ),
mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mBlackPen ( wxColour( 0, 0, 0), 1, wxSOLID ),
mBorderPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
-
+
mNullPen( wxColour(0,0,0), 1, wxTRANSPARENT ),
mpPaneInFocus( NULL ),
mpLRUPane ( NULL ),
-
+
mFloatingOn ( true ),
-
+
mpTopPlugin ( NULL ),
mpCaputesInput( NULL ),
-
+
mClientWndRefreshPending( false ),
mRecalcPending( true ),
mCheckFocusWhenIdle( false ),
-
+
mpUpdatesMgr( NULL )
{
CreateCursors();
#ifdef __WXMSW__
return true;
#elif defined(__WXGTK20__)
- return TRUE;
+ return true;
#elif defined (__WXGTK__)
//return true;
return false;
//return;
#else
+ wxUnusedVar(pChild);
+ wxUnusedVar(pNewParent);
wxMessageBox( "Sorry, docking is not supported for ports other than MSW and wxGTK" );
#endif
}
for ( i = 0; i != MAX_PANES; ++i )
{
- if ( mPanes[i] )
+ if ( mPanes[i] )
delete mPanes[i];
}
- if ( mpHorizCursor )
+ if ( mpHorizCursor )
delete mpHorizCursor;
- if ( mpVertCursor )
+ if ( mpVertCursor )
delete mpVertCursor;
- if ( mpNormalCursor )
+ if ( mpNormalCursor )
delete mpNormalCursor;
- if ( mpDragCursor )
+ if ( mpDragCursor )
delete mpDragCursor;
- if ( mpNECursor )
+ if ( mpNECursor )
delete mpNECursor;
wxObjectList::compatibility_iterator pSpy = mBarSpyList.GetFirst();
//return new cbSimpleUpdatesMgr( this );
}
-void wxFrameLayout::AddBar( wxWindow* pBarWnd,
+void wxFrameLayout::AddBar( wxWindow* pBarWnd,
const cbDimInfo& dimInfo,
int alignment,
int rowNo,
DoSetBarState( pInfo );
}
-bool wxFrameLayout::RedockBar( cbBarInfo* pBar,
+bool wxFrameLayout::RedockBar( cbBarInfo* pBar,
const wxRect& shapeInParent,
cbDockPane* pToPane,
bool updateNow )
{
if ( !pToPane )
-
+
pToPane = HitTestPanes( shapeInParent, NULL );
- if ( !pToPane )
-
- return false; // bar's shape does not hit any pane
+ if ( !pToPane )
+
+ return false; // bar's shape does not hit any pane
// - redocking is NOT possible
cbDockPane* pBarPane = GetBarPane( pBar );
// FIXME FIXME:: the recalculation below may be a *huge* performance
// hit, it could be eliminated though...
- // but first the "pane-postion-changed" problem
- // has to be fixed
+ // but first the "pane-postion-changed" problem
+ // has to be fixed
RecalcLayout( false );
cbRowInfo* pRow;
#ifdef __WXDEBUG__
- bool success =
+ bool success =
#endif
LocateBar( pBar, &pRow, &pPane );
if ( pFFrm->GetBar() == pBar )
{
- pFFrm->Show( false ); // reduces flicker sligthly
+ pFFrm->Show( false ); // reduces flicker sligthly
ReparentWindow( pBar->mpBarWnd, &GetParentFrame() );
if ( newState == wxCBAR_FLOATING )
- this->RepositionFloatedBar( pBar );
+ this->RepositionFloatedBar( pBar );
}
void wxFrameLayout::ApplyBarProperties( cbBarInfo* pBar )
GetParentFrame().ClientToScreen( &x, &y );
- pFFrm->PositionFloatedWnd( x,y,
+ pFFrm->PositionFloatedWnd( x,y,
bounds.width,
bounds.height );
{
if ( pBar->mState != wxCBAR_FLOATING &&
pBar->mState != wxCBAR_HIDDEN )
-
+
// dock it
mPanes[pBar->mAlignment]->InsertBar( pBar );
pBar->mpBarWnd->Show( false );
}
else
- {
+ {
if ( !(mFloatingOn && pBar->mFloatingOn) )
return;
// float it
if ( pBar->mpBarWnd == NULL || !CanReparent() )
- {
+ {
// FOR NOW:: just hide it
if ( pBar->mpBarWnd )
pMiniFrm->SetBar( pBar );
pMiniFrm->SetLayout( this );
- pMiniFrm->Create( &GetParentFrame(), wxID_ANY, pBar->mName,
+ pMiniFrm->Create( &GetParentFrame(), wxID_ANY, pBar->mName,
wxPoint( 50,50 ),
wxSize ( 0, 0 ),
wxFRAME_FLOAT_ON_PARENT |
if ( mAllBars[i] == pBarInfo )
{
#if wxCHECK_VERSION(2,3,2)
- mAllBars.RemoveAt(i);
+ mAllBars.RemoveAt(i);
#else
- mAllBars.Remove(i);
+ mAllBars.Remove(i);
#endif
if ( pBarInfo->mpBarWnd ) // hides it's window
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,
cbDockPane** ppPane )
{
wxBarIterator i( mPanes[n]->GetRowList() );
while ( i.Next() )
-
+
if ( &i.BarInfo() == pBarInfo )
{
(*ppPane) = mPanes[n];
pPane->SetBoundsInParent( rect );
- // setup LEFT pane
+ // setup LEFT pane
pPane = mPanes[ FL_ALIGN_LEFT ];
// 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;
- mClntWndBounds.y = mPanes[FL_ALIGN_TOP ]->mBoundsInParent.y +
+ mClntWndBounds.y = mPanes[FL_ALIGN_TOP ]->mBoundsInParent.y +
mPanes[FL_ALIGN_TOP ]->mBoundsInParent.height;
mClntWndBounds.width = mPanes[FL_ALIGN_RIGHT]->mBoundsInParent.x -
{
if ( mClntWndBounds.width >= 1 && mClntWndBounds.height >= 1 )
{
- mpFrameClient->SetSize( mClntWndBounds.x, mClntWndBounds.y,
+ mpFrameClient->SetSize( mClntWndBounds.x, mClntWndBounds.y,
mClntWndBounds.width, mClntWndBounds.height, 0 );
if ( !mpFrameClient->IsShown() )
// NOTE:: the SetEvtHandlerEnabled() method is not used
// here, since it is assumed that unhooking layout
// from window may result destroying of the layout itself
- //
- // BUG BUG BUG (wx):: this would not be a problem if
- // wxEvtHandler's destructor checked if
- // this handler is currently the top-most
- // handler of some window, and additionally
+ //
+ // BUG BUG BUG (wx):: this would not be a problem if
+ // wxEvtHandler's destructor checked if
+ // this handler is currently the top-most
+ // handler of some window, and additionally
// 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()
// FOR NOW::
/*
// FIXME:: The below code somehow doesn't work - cursors remain unchanged
char bits[64];
-
+
set_cursor_bits( _gHorizCursorImg, bits, 32, 16 );
mpHorizCursor = new wxCursor( bits, 32, 16 );
{
// 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;
int i;
for ( i = 0; i != MAX_PANES; ++i )
{
if ( pCurPane != mPanes[i] &&
- rect_hits_rect( mPanes[i]->GetRealRect(), rect ) )
+ rect_hits_rect( mPanes[i]->GetRealRect(), rect ) )
{
return mPanes[i];
}
return 0;
}
-void wxFrameLayout::ForwardMouseEvent( wxMouseEvent& event,
+void wxFrameLayout::ForwardMouseEvent( wxMouseEvent& event,
cbDockPane* pToPane,
int eventType )
{
void wxFrameLayout::OnMouseMove( wxMouseEvent& event )
{
if ( mpPaneInFocus )
-
+
ForwardMouseEvent( event, mpPaneInFocus, cbEVT_PL_MOTION );
else
{
{
// check state of input capture, before processing the event
- if ( mpCaputesInput )
+ if ( mpCaputesInput )
{
bool isInputEvt = true;
#if wxCHECK_VERSION(2,3,0)
case cbEVT_PL_RIGHT_DOWN : break;
case cbEVT_PL_RIGHT_UP : break;
case cbEVT_PL_MOTION : break;
-
+
default : isInputEvt = false; break;
}
#endif // #if wxCHECK_VERSION(2,3,0)
cbPluginBase& wxFrameLayout::GetTopPlugin()
{
- if ( !mpTopPlugin )
-
+ if ( !mpTopPlugin )
+
PushDefaultPlugins(); // automatic configuration
return *mpTopPlugin;
}
-void wxFrameLayout::SetTopPlugin( cbPluginBase* pPlugin )
-{
- mpTopPlugin = pPlugin;
+void wxFrameLayout::SetTopPlugin( cbPluginBase* pPlugin )
+{
+ mpTopPlugin = pPlugin;
}
-bool wxFrameLayout::HasTopPlugin()
-{
- return ( mpTopPlugin != NULL );
+bool wxFrameLayout::HasTopPlugin()
+{
+ return ( mpTopPlugin != NULL );
}
void wxFrameLayout::PushPlugin( cbPluginBase* pPlugin )
{
- if ( !mpTopPlugin )
-
+ if ( !mpTopPlugin )
+
mpTopPlugin = pPlugin;
else
{
PushPlugin( pObj );
}
-void wxFrameLayout::AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlInfo,
+void wxFrameLayout::AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlInfo,
int paneMask )
{
wxASSERT( pNextPlInfo != pPlInfo ); // DBG:: no sense
// remove existing one if present
cbPluginBase* pExistingPl = FindPlugin( pPlInfo );
-
+
if ( pExistingPl ) RemovePlugin( pPlInfo );
- // create an instance
+ // create an instance
cbPluginBase* pNewPl = (cbPluginBase*)pPlInfo->CreateObject();
// insert it to the chain
if ( pNextPl->GetPreviousHandler() )
-
pNextPl->GetPreviousHandler()->SetNextHandler( pNewPl );
else
mpTopPlugin = pNewPl;
IMPLEMENT_DYNAMIC_CLASS( cbUpdateMgrData, wxObject )
-cbUpdateMgrData::cbUpdateMgrData()
+cbUpdateMgrData::cbUpdateMgrData()
: mPrevBounds( -1,-1,0,0 ),
mIsDirty( true ), // inidicate initial change
{}
void cbUpdateMgrData::StoreItemState( const wxRect& boundsInParent )
-{
- mPrevBounds = boundsInParent;
+{
+ mPrevBounds = boundsInParent;
}
void cbUpdateMgrData::SetDirty( bool isDirty )
}
bool wxBarIterator::Next()
-{
+{
if ( mpRow )
{
if ( mpBar )
{
if ( mpRow->mBars.GetCount() == 0 )
{
- return false;
+ return false;
}
mpBar = mpRow->mBars[0];
}
-
+
if ( !mpBar )
- {
+ {
// skip to the next row
mpRow = mpRow->mpNext;
-
+
if ( mpRow )
-
mpBar = mpRow->mBars[0];
else
return false;
}
-
+
return true;
}
else
IMPLEMENT_DYNAMIC_CLASS( cbDimInfo, wxObject )
-cbDimInfo::cbDimInfo()
+cbDimInfo::cbDimInfo()
- : mVertGap ( 0 ),
+ : mVertGap ( 0 ),
mHorizGap( 0 ),
mIsFixed(true),
// int vtad = *((int*)mpHandler);
mpHandler->AddRef();
}
-
+
size_t i;
for ( i = 0; i != MAX_BAR_STATES; ++i )
{
size_t i;
for ( i = 0; i != MAX_BAR_STATES; ++i )
mBounds[i] = wxRect( -1,-1,-1,-1 );
-}
+}
-cbDimInfo::cbDimInfo( int x, int y,
- bool isFixed, int gap,
+cbDimInfo::cbDimInfo( int x, int y,
+ bool isFixed, int gap,
cbBarDimHandlerBase* pDimHandler)
: mVertGap ( gap ),
mHorizGap ( gap ),
mSizes[wxCBAR_DOCKED_VERTICALLY ].y = y;
mSizes[wxCBAR_FLOATING ].x = x;
mSizes[wxCBAR_FLOATING ].y = y;
-
+
size_t i;
for ( i = 0; i != MAX_BAR_STATES; ++i )
mBounds[i] = wxRect( -1,-1,-1,-1 );
cbDimInfo::~cbDimInfo()
{
- if ( mpHandler )
-
+ if ( mpHandler )
+
mpHandler->RemoveRef();
}
mColProportionsOn = props.mColProportionsOn;
mBarCollapseIconsOn = props.mBarCollapseIconsOn;
mBarDragHintsOn = props.mBarDragHintsOn;
-
+
mMinCBarDim = props.mMinCBarDim;
mResizeHandleSize = props.mResizeHandleSize;
// FIXME:: how to eliminate these cut&pasted constructors?
-cbDockPane::cbDockPane(void)
+cbDockPane::cbDockPane(void)
: mLeftMargin ( 1 ),
mRightMargin ( 1 ),
mTopMargin ( 1 ),
mBottomMargin( 1 ),
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
mPaneHeight( 32768 ),
mAlignment ( -1 ),
{}
cbDockPane::cbDockPane( int alignment, wxFrameLayout* pPanel )
-
+
: mLeftMargin ( 1 ),
mRightMargin ( 1 ),
mTopMargin ( 1 ),
mBottomMargin( 1 ),
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
mPaneHeight( 32768 ),
mAlignment ( alignment ),
mpLayout ( pPanel ),
- mpStoredRow( NULL )
+ mpStoredRow( NULL )
{}
cbDockPane::~cbDockPane()
delete mRows[i];
WX_CLEAR_LIST(wxList,mRowShapeData)
-
+
// NOTE:: control bar infromation structures are cleaned-up
// in wxFrameLayout's destructor, using global control-bar list
}
// decorations first
for ( i = 0; i != pRow->mBars.Count(); ++i )
-
+
PaintBarDecorations( pRow->mBars[i], dc );
// then handles if present
void cbDockPane::RemoveBar( cbBarInfo* pBar )
{
- bool needsRestoring = mProps.mNonDestructFrictionOn &&
+ bool needsRestoring = mProps.mNonDestructFrictionOn &&
mpStoredRow == pBar->mpRow;
cbRemoveBarEvent evt( pBar, this );
*y -= mTopMargin;
if ( mAlignment == FL_ALIGN_TOP ||
- mAlignment == FL_ALIGN_BOTTOM
+ mAlignment == FL_ALIGN_BOTTOM
)
{
*x -= mBoundsInParent.x;
void cbDockPane::PaneToFrame( int* x, int* y )
{
if ( mAlignment == FL_ALIGN_TOP ||
- mAlignment == FL_ALIGN_BOTTOM
+ mAlignment == FL_ALIGN_BOTTOM
)
{
*x += mBoundsInParent.x;
int rowHeight = mRows[i]->mRowHeight;
int third = rowHeight/3;
-
- if ( paneY >= curY && paneY < curY + third )
+
+ if ( paneY >= curY && paneY < curY + third )
return i-1;
- if ( paneY >= curY + third && paneY < curY + rowHeight - third )
+ if ( paneY >= curY + third && paneY < curY + rowHeight - third )
return i;
curY += rowHeight;
if ( upperY >= curY &&
lowerY < curY ) return row;
- if ( upperY <= curY &&
+ if ( upperY <= curY &&
lowerY >= curY &&
curY - upperY >= oneThird ) return row-1;
- if ( ( upperY < curY + rowHeight &&
+ if ( ( upperY < curY + rowHeight &&
lowerY >= curY + rowHeight &&
- curY + rowHeight - lowerY >= oneThird )
+ curY + rowHeight - lowerY >= oneThird )
)
return row+1;
if ( pRow->mHasOnlyFixedBars )
return true;
- }
+ }
return false;
}
return true;
}
-
+
return false;
}
return true;
}
-
+
return false;
}
void cbDockPane::RecalcRowLayout( cbRowInfo* pRow )
{
cbLayoutRowEvent evt( pRow, this );
-
+
mpLayout->FirePluginEvent( evt );
}
if ( !pCur->IsFixed() )
{
ratios.Add( 0.0 );
- ratios[ ratios.GetCount() - 1 ] = pCur->mLenRatio;
+ ratios[ ratios.GetCount() - 1 ] = pCur->mLenRatio;
}
pCur = pCur->mpNext;
pRow = new cbRowInfo();
if ( rowNo == -1 && mRows.Count() )
-
- mRows.Insert( pRow, 0 );
+
+ mRows.Insert( pRow, 0 );
else
mRows.Add( pRow );
// store original shape of the row (before the bar is inserted)
mpStoredRow = pRow;
-
+
GetRowShapeData( mpStoredRow, &mRowShapeData );
}
}
if ( noMarginsRect.width < 0 ||
noMarginsRect.height < 0 )
-
+
hide_rect( noMarginsRect );
// calculate mBoundsInParent for each item in the pane
}
if ( bar.mHasRightHandle )
-
+
bounds.width -= mProps.mResizeHandleSize;
PaneToFrame( &bounds );
wxBarIterator iter( mRows );
while( iter.Next() )
-
+
if ( &iter.BarInfo() == pBar ) return true;
return false;
size_t i;
for ( i = 0; i != mRows.Count(); ++i )
{
- if ( mRows[i] == pRow )
+ if ( mRows[i] == pRow )
return i;
}
int height = 0;
if ( IsHorizontal() )
-
height += mTopMargin + mBottomMargin;
else
height += mLeftMargin + mRightMargin;
int count = mRows.Count();
if ( count )
-
height += mRows[count-1]->mRowY + mRows[count-1]->mRowHeight;
return height;
cbLayoutRowsEvent evt( this );
mpLayout->FirePluginEvent( evt );
- // then horizontally in each row
+ // then horizontally in each row
size_t i;
for ( i = 0; i != mRows.Count(); ++i )
int cbDockPane::GetDockingState()
{
- if ( mAlignment == FL_ALIGN_TOP ||
+ if ( mAlignment == FL_ALIGN_TOP ||
mAlignment == FL_ALIGN_BOTTOM )
{
return wxCBAR_DOCKED_HORIZONTALLY;
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 )
{
- return ( pos.x >= x &&
+ return ( pos.x >= x &&
pos.y >= y &&
pos.x < x + width &&
pos.y < y + height );
else
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 ) )
return CB_LOWER_ROW_HANDLE_HITTED;
{
if ( HasPoint( pos, bounds.x + bounds.width - mProps.mResizeHandleSize, bounds.y,
mProps.mResizeHandleSize, bounds.height ) )
-
+
return CB_RIGHT_BAR_HANDLE_HITTED;
}
// treat not-fixed bars as minimized
- if ( !pBar->IsFixed() )
-
+ if ( !pBar->IsFixed() )
notFree += mProps.mMinCBarDim.x;
- else
+ else
{
if ( pBar->mBounds.x + pBar->mBounds.width >= mPaneWidth )
{
notFree += pBar->mBounds.width;
}
- }
+ }
*till = mPaneWidth - notFree;
// do not let resizing totally deform the bar itself
if ( forLeftHandle )
-
(*till) -= mProps.mMinCBarDim.x;
else
-
(*from) += mProps.mMinCBarDim.x;
}
if ( pRow->mHasLowerHandle )
height += mProps.mResizeHandleSize;
-
+
return height;
}
};
- *from = notFree;
+ *from = notFree;
// allow accupy the client window space by resizing pane rows
if ( mAlignment == FL_ALIGN_BOTTOM )
}
- *till = mPaneHeight - notFree;
+ *till = mPaneHeight - notFree;
// allow adjustinig pane space vs. client window space by resizing pane row heights
cbRowInfo& row = *pGivenRow;
if ( forUpperHandle )
- {
+ {
*till = row.mRowY + row.mRowHeight - GetMinimalRowHeight( pGivenRow );
if ( row.mHasUpperHandle )
}
}
-void cbDockPane::ResizeRow( cbRowInfo* pRow, int ofs,
+void cbDockPane::ResizeRow( cbRowInfo* pRow, int ofs,
bool forUpperHandle )
{
cbResizeRowEvent evt( pRow, ofs, forUpperHandle, this );
mpLayout->FirePluginEvent( evt );
}
-void cbDockPane::ResizeBar( cbBarInfo* pBar, int ofs,
+void cbDockPane::ResizeBar( cbBarInfo* pBar, int ofs,
bool forLeftHandle )
{
pBar->mpRow->mpExpandedBar = NULL;
}
else
{
- // move bar left if necessary
+ // move bar left if necessary
if ( bounds.width + ofs < mProps.mMinCBarDim.x )
{
bounds.x = bounds.x + bounds.width + ofs - mProps.mMinCBarDim.x;
wxBarIterator i( mRows );
while( i.Next() )
-
+
if ( i.BarInfo().mpBarWnd == pBarWnd )
return &i.BarInfo();
bool cbPluginBase::ProcessEvent(wxEvent& event)
{
- if ( mPaneMask == wxALL_PANES )
+ if ( mPaneMask == wxALL_PANES )
return wxEvtHandler::ProcessEvent( event );
// if event's pane maks matches the plugin's mask
- if ( mPaneMask & mask )
+ if ( mPaneMask & mask )
return wxEvtHandler::ProcessEvent( event );
else
return false;
}
-
#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);
{
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
- // this condition fixes extsitence of warning but
- wxScrolledWindow* scrolledWindow =
+ // this condition fixes extsitence of warning but
+ wxScrolledWindow* scrolledWindow =
// but GetScrolledWindow is still executed in case internally does something
#endif
GetScrolledWindow();
}
// In case we're using the generic tree control.
-void wxRemotelyScrolledTreeCtrl::PrepareDC(
+void wxRemotelyScrolledTreeCtrl::PrepareDC(
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
wxDC& dc
#else
#ifdef __WXMSW__
#if USE_GENERIC_TREECTRL
if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
-#endif
+#endif // USE_GENERIC_TREECTRL
{
UINT sbCode = SB_THUMBPOSITION;
HWND vertScrollBar = 0;
}
#if USE_GENERIC_TREECTRL
else
-#endif
-#endif
+#endif // USE_GENERIC_TREECTRL
+#endif // __WXMSW__
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
{
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
}
*/
}
-#endif
+#endif // USE_GENERIC_TREECTRL || !defined(__WXMSW__)
+ wxUnusedVar(posVert);
}
void wxRemotelyScrolledTreeCtrl::OnSize(wxSizeEvent& event)
inOnScroll = false;
}
-
//----------------------------------------------------------------------
+#if wxUSE_DATAOBJ
static wxTextFileType wxConvertEOLMode(int scintillaMode)
{
wxTextFileType type;
}
return type;
}
+#endif // wxUSE_DATAOBJ
//----------------------------------------------------------------------
pdoc->BeginUndoAction();
ClearSelection();
+#if wxUSE_DATAOBJ
wxTextDataObject data;
bool gotData = false;
pdoc->InsertString(currentPos, buf, len);
SetEmptySelection(currentPos + len);
}
+#endif // wxUSE_DATAOBJ
pdoc->EndUndoAction();
NotifyChange();
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;
}
}
return canPaste;
+#else
+ return false;
+#endif // wxUSE_CLIPBOARD
}
void ScintillaWX::CreateCallTipWindow(PRectangle) {
void wxMainFrame::OnRc2Wxr(wxCommandEvent& WXUNUSED(event))
{
+#if wxUSE_FILEDLG
wxFileDialog filed(this);
filed.SetWildcard(_T("*.rc"));
filed.SetStyle(wxOPEN);
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)
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)
rc2xml XMLCon;
XMLCon.Convert(f.GetPath(),xmlfile.GetPath());
-
+#endif // wxUSE_FILEDLG
}
bool wxConvertApp::HandleCommandLine()
//! 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_
};
+#if wxUSE_PRINTING_ARCHITECTURE
+
//----------------------------------------------------------------------------
//! EditPrint
class EditPrint: public wxPrintout {
bool PrintScaling (wxDC *dc);
};
-#endif // _EDIT_H_
+#endif // wxUSE_PRINTING_ARCHITECTURE
+#endif // _EDIT_H_
// 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
//! 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.
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);
// 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;
}
// 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)) {
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)) {
// 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),
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);
}
}
(*g_printData) = printer.GetPrintDialogData().GetPrintData();
+#endif // wxUSE_PRINTING_ARCHITECTURE
}
// edit events
}
// private functions
-void AppFrame::CreateMenu () {
-
+void AppFrame::CreateMenu ()
+{
// File menu
wxMenu *menuFile = new wxMenu;
menuFile->Append (wxID_OPEN, _("&Open ..\tCtrl+O"));
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);
}
m_timer = NULL;
EndModal (wxID_OK);
}
-
SetTopWindow(frame);
- return TRUE;
+ return true;
}
// Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar);
- subframe->Show(TRUE);
+ subframe->Show(true);
}
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();
void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
{
+#if wxUSE_FILEDLG
MyChild * pChild = (MyChild *)GetActiveChild ();
if (pChild == NULL)
{
}
}
return ;
+#endif // wxUSE_FILEDLG
}
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);
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);
void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
{
- Close(TRUE);
+ Close(true);
}
//----------------------------------------------------------------------
+#if wxUSE_DATAOBJ
static wxTextFileType wxConvertEOLMode(int scintillaMode)
{
wxTextFileType type;
}
return type;
}
+#endif // wxUSE_DATAOBJ
//----------------------------------------------------------------------
pdoc->BeginUndoAction();
ClearSelection();
+#if wxUSE_DATAOBJ
wxTextDataObject data;
bool gotData = false;
pdoc->InsertString(currentPos, buf, len);
SetEmptySelection(currentPos + len);
}
+#endif // wxUSE_DATAOBJ
pdoc->EndUndoAction();
NotifyChange();
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;
}
}
return canPaste;
+#else
+ return false;
+#endif // wxUSE_CLIPBOARD
}
void ScintillaWX::CreateCallTipWindow(PRectangle) {