OGL samples again buildable after deprecated/setup.h turned off by default. Minor cleaning where applicable.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33225 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-03-31 19:18:25 +00:00
parent 694f70fa9c
commit cecdcad1db
18 changed files with 112 additions and 101 deletions

View File

@@ -194,7 +194,7 @@ bool DiagramCommand::Do(void)
{
switch (cmd)
{
case OGLEDIT_CUT:
case wxID_CUT:
{
if (shape)
{
@@ -340,7 +340,7 @@ bool DiagramCommand::Undo(void)
{
switch (cmd)
{
case OGLEDIT_CUT:
case wxID_CUT:
{
if (shape)
{
@@ -428,7 +428,7 @@ void DiagramCommand::RemoveLines(wxShape *shape)
while (node)
{
wxLineShape *line = (wxLineShape *)node->GetData();
doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Cut"), OGLEDIT_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Cut"), wxID_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
node = shape->GetLines().GetFirst();
}

View File

@@ -20,7 +20,7 @@
#include <wx/cmdproc.h>
#include <wx/string.h>
#include <wx/deprecated/setup.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
#if wxUSE_PROLOGIO
#include <wx/deprecated/wxexpr.h>

View File

@@ -88,7 +88,7 @@ bool MyApp::OnInit(void)
edit_menu->Append(wxID_UNDO, _T("&Undo"));
edit_menu->Append(wxID_REDO, _T("&Redo"));
edit_menu->AppendSeparator();
edit_menu->Append(OGLEDIT_CUT, _T("&Cut"));
edit_menu->Append(wxID_CUT, _T("&Cut"));
edit_menu->AppendSeparator();
edit_menu->Append(OGLEDIT_CHANGE_BACKGROUND_COLOUR, _T("Change &background colour"));
edit_menu->Append(OGLEDIT_EDIT_LABEL, _T("Edit &label"));

View File

@@ -17,23 +17,23 @@
#define _OGLSAMPLE_OGLEDIT_H_
#include <wx/docview.h>
#include <wx/deprecated/setup.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
// Define a new application
class MyFrame;
class EditorToolPalette;
class MyApp: public wxApp
{
public:
MyFrame *frame;
wxDocManager* myDocManager;
public:
MyFrame *frame;
wxDocManager* myDocManager;
MyApp(void);
bool OnInit(void);
int OnExit(void);
MyApp(void);
bool OnInit(void);
int OnExit(void);
// Palette stuff
EditorToolPalette *CreatePalette(wxFrame *parent);
// Palette stuff
EditorToolPalette *CreatePalette(wxFrame *parent);
};
DECLARE_APP(MyApp)
@@ -42,22 +42,22 @@ DECLARE_APP(MyApp)
class MyCanvas;
class MyFrame: public wxDocParentFrame
{
DECLARE_CLASS(MyFrame)
public:
wxMenu *editMenu;
DECLARE_CLASS(MyFrame)
public:
wxMenu *editMenu;
MyCanvas *canvas;
EditorToolPalette *palette;
MyCanvas *canvas;
EditorToolPalette *palette;
MyFrame(wxDocManager *manager, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE);
MyFrame(wxDocManager *manager, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE);
MyCanvas *CreateCanvas(wxView *view, wxFrame *parent);
void OnSize(wxSizeEvent& event);
void OnCloseWindow(wxCloseEvent& event);
void OnAbout(wxCommandEvent& event);
MyCanvas *CreateCanvas(wxView *view, wxFrame *parent);
void OnSize(wxSizeEvent& event);
void OnCloseWindow(wxCloseEvent& event);
void OnAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
@@ -66,13 +66,14 @@ extern MyFrame *GetMainFrame(void);
// Menu/undo/redo commands
#define OGLEDIT_CUT 1
#define OGLEDIT_ADD_SHAPE 2
#define OGLEDIT_ADD_LINE 3
#define OGLEDIT_EDIT_LABEL 4
#define OGLEDIT_CHANGE_BACKGROUND_COLOUR 5
#define OGLEDIT_ABOUT 100
enum
{
OGLEDIT_ADD_SHAPE = wxID_HIGHEST,
OGLEDIT_ADD_LINE,
OGLEDIT_EDIT_LABEL,
OGLEDIT_CHANGE_BACKGROUND_COLOUR,
OGLEDIT_ABOUT = wxID_ABOUT
};
#endif
// _OGLSAMPLE_OGLEDIT_H_

View File

@@ -38,7 +38,7 @@
IMPLEMENT_DYNAMIC_CLASS(DiagramView, wxView)
BEGIN_EVENT_TABLE(DiagramView, wxView)
EVT_MENU(OGLEDIT_CUT, DiagramView::OnCut)
EVT_MENU(wxID_CUT, DiagramView::OnCut)
EVT_MENU(OGLEDIT_CHANGE_BACKGROUND_COLOUR, DiagramView::OnChangeBackgroundColour)
EVT_MENU(OGLEDIT_EDIT_LABEL, DiagramView::OnEditLabel)
END_EVENT_TABLE()
@@ -195,7 +195,7 @@ void DiagramView::OnCut(wxCommandEvent& WXUNUSED(event))
wxShape *theShape = FindSelectedShape();
if (theShape)
doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Cut"), OGLEDIT_CUT, doc, NULL, 0.0, 0.0, true, theShape));
doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Cut"), wxID_CUT, doc, NULL, 0.0, 0.0, true, theShape));
}
void DiagramView::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event))

View File

@@ -18,19 +18,13 @@
#include <wx/wx.h>
#include <wx/string.h>
#include <wx/deprecated/tbarsmpl.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
/*
* Object editor tool palette
*
*/
// TODO for wxWin: wxToolBar95 cannot be moved to a non-0,0 position!
// Needs to have a parent window...
// So use a simple toolbar at present.
// ABX: Simple toolbar is not available in default compilation and is deprecated
// so I use wxToolBar anyway
// #define TOOLPALETTECLASS wxToolBarSimple
#define TOOLPALETTECLASS wxToolBar
class csEditorToolPalette: public TOOLPALETTECLASS

View File

@@ -24,8 +24,7 @@
#include <wx/wx.h>
#endif
#include <wx/deprecated/setup.h>
#include <wx/deprecated/wxexpr.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
#include <wx/clipbrd.h>

View File

@@ -24,14 +24,14 @@
#include <wx/wx.h>
#endif
#include <wx/deprecated/setup.h>
#include <wx/deprecated/resource.h>
#include "dialogs.h"
#include "doc.h"
#include "view.h"
#include "studio.h"
#include "studio_resources.h"
#if wxUSE_WX_RESOURCES
IMPLEMENT_CLASS(csLabelEditingDialog, wxDialog)
BEGIN_EVENT_TABLE(csLabelEditingDialog, wxDialog)
@@ -257,7 +257,7 @@ END_EVENT_TABLE()
// For 400x400 settings dialog, size your panels to about 375x325 in dialog editor
csShapePropertiesDialog::csShapePropertiesDialog(wxWindow* parent, const wxString& title,
wxPanel* attributeDialog, const wxString& attributeDialogName):
wxPanel* attributeDialog, const wxString& attributeDialogName):
wxDialog(parent, wxID_ANY, title, wxPoint(0, 0), wxSize(SHAPE_PROPERTY_DIALOG_WIDTH, SHAPE_PROPERTY_DIALOG_HEIGHT))
{
m_attributeDialog = attributeDialog;
@@ -416,6 +416,8 @@ void csGeneralShapePropertiesDialog::SetShapeLabel(const wxString& label)
textCtrl->SetValue(label);
}
#endif // wxUSE_WX_RESOURCES
/*
* csThinRectangleDialog
*/

View File

@@ -19,6 +19,10 @@
#include <wx/wx.h>
#include <wx/notebook.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
#if wxUSE_WX_RESOURCES
/*
* Label editing dialog (about to become obsolete)
*/
@@ -122,6 +126,8 @@ protected:
DECLARE_EVENT_TABLE()
};
#endif // wxUSE_WX_RESOURCES
#define ID_SHAPE_PROPERTY_NOTEBOOK 1000
//// Specific attribute-editing panel classes below here
@@ -243,6 +249,5 @@ public:
DECLARE_EVENT_TABLE()
};
#endif
// _STUDIO_DIALOGS_H_

View File

@@ -53,6 +53,7 @@ bool csDiagramDocument::OnCloseDocument()
return true;
}
#if wxUSE_PROLOGIO
bool csDiagramDocument::OnSaveDocument(const wxString& file)
{
if (file == wxEmptyString)
@@ -100,6 +101,7 @@ bool csDiagramDocument::OnOpenDocument(const wxString& file)
return true;
}
#endif // wxUSE_PROLOGIO
/*

View File

@@ -20,10 +20,8 @@
#include <wx/cmdproc.h>
#include <wx/string.h>
#include <wx/deprecated/setup.h>
#include <wx/deprecated/wxexpr.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
#include <wx/ogl/ogl.h>
#include "shapes.h"
/*
@@ -37,8 +35,10 @@ public:
csDiagramDocument();
~csDiagramDocument();
#if wxUSE_PROLOGIO
bool OnSaveDocument(const wxString& file);
bool OnOpenDocument(const wxString& file);
#endif // wxUSE_PROLOGIO
inline wxDiagram *GetDiagram() { return &m_diagram; }

View File

@@ -80,9 +80,11 @@ void csFrame::OnHelp(wxCommandEvent& WXUNUSED(event))
void csFrame::OnSettings(wxCommandEvent& WXUNUSED(event))
{
#if wxUSE_WX_RESOURCES
csSettingsDialog* dialog = new csSettingsDialog(this);
/* int ret = */ dialog->ShowModal();
dialog->Destroy();
#endif // wxUSE_WX_RESOURCES
}
void csFrame::OnQuit(wxCommandEvent& WXUNUSED(event))

View File

@@ -28,15 +28,12 @@
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h!
#endif
#include <wx/deprecated/setup.h>
#include <wx/deprecated/wxexpr.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
#include "studio.h"
#include "doc.h"
#include "shapes.h"
#include "view.h"
#include <wx/ogl/basicp.h>
#include <wx/ogl/linesp.h>
#include "cspalette.h"
#include "dialogs.h"
@@ -682,6 +679,9 @@ bool csEvtHandler::EditProperties()
return false;
}
wxString newLabel(m_label);
#if wxUSE_WX_RESOURCES
csShapePropertiesDialog* dialog = new csShapePropertiesDialog(shape->GetCanvas()->GetParent(), title, attributeDialog, attributeDialogName);
dialog->GetGeneralPropertiesDialog()->SetShapeLabel(m_label);
if (dialog->ShowModal() == wxID_CANCEL)
@@ -690,8 +690,11 @@ bool csEvtHandler::EditProperties()
return false;
}
wxString newLabel = dialog->GetGeneralPropertiesDialog()->GetShapeLabel();
newLabel = dialog->GetGeneralPropertiesDialog()->GetShapeLabel();
dialog->Destroy();
#else
wxUnusedVar(attributeDialog);
#endif // wxUSE_WX_RESOURCES
wxShape* newShape = shape->CreateNewCopy();
@@ -708,6 +711,7 @@ bool csEvtHandler::EditProperties()
* Diagram
*/
#if wxUSE_PROLOGIO
bool csDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
wxDiagram::OnShapeSave(db, shape, expr);
@@ -726,6 +730,7 @@ bool csDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
return true;
}
#endif // wxUSE_PROLOGIO
IMPLEMENT_DYNAMIC_CLASS(csThinRectangleShape, wxDrawnShape)

View File

@@ -18,10 +18,7 @@
#include <wx/docview.h>
#include <wx/string.h>
#include <wx/deprecated/setup.h>
#include <wx/deprecated/wxexpr.h>
#include <wx/ogl/ogl.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
#include <wx/ogl/basicp.h>
#include <wx/ogl/linesp.h>
#include <wx/ogl/drawn.h>
@@ -38,8 +35,10 @@ DECLARE_CLASS(csDiagram)
public:
csDiagram(csDiagramDocument* doc) { m_doc = doc; }
~csDiagram();
#if wxUSE_PROLOGIO
bool OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
bool OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
#endif // wxUSE_PROLOGIO
inline csDiagramDocument* GetDocument() const { return m_doc; }
virtual void Redraw(wxDC& dc);

View File

@@ -21,8 +21,8 @@
#include "wx/mdi.h"
#endif
#include <wx/deprecated/setup.h>
#include <wx/deprecated/resource.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
#include "wx/config.h"
#include "wx/laywin.h"
@@ -92,11 +92,13 @@ csApp::~csApp()
// Initialise this in OnInit, not statically
bool csApp::OnInit(void)
{
#if wxUSE_WX_RESOURCES
if (!wxResourceParseFile(_T("studio_resources.wxr")))
{
wxMessageBox(_T("Could not find or parse resource file: studio_resources.wxr"), _T("Studio"));
return false;
}
#endif
#if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
m_helpController = new wxWinHelpController;

View File

@@ -24,8 +24,7 @@
#include <wx/wx.h>
#endif
#include <wx/deprecated/setup.h>
#include <wx/deprecated/wxexpr.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
#include "studio.h"
#include "doc.h"

View File

@@ -19,10 +19,7 @@
#include <wx/docview.h>
#include <wx/string.h>
#include <wx/deprecated/setup.h>
#include <wx/deprecated/wxexpr.h>
#include <wx/ogl/ogl.h>
#include <wx/ogl/ogl.h> // base header of OGL, includes and adjusts wx/deprecated/setup.h
/*
* csSymbol

View File

@@ -877,6 +877,9 @@ void csCanvas::OnLeftClick(double x, double y, int WXUNUSED(keys))
if (palette->GetSelection() == PALETTE_TEXT_TOOL)
{
wxString newLabel;
#if wxUSE_WX_RESOURCES
// Ask for a label and create a new free-floating text region
csLabelEditingDialog* dialog = new csLabelEditingDialog(GetParent());
@@ -888,8 +891,9 @@ void csCanvas::OnLeftClick(double x, double y, int WXUNUSED(keys))
return;
}
wxString newLabel = dialog->GetShapeLabel();
newLabel = dialog->GetShapeLabel();
dialog->Destroy();
#endif // wxUSE_WX_RESOURCES
wxShape* shape = new csTextBoxShape;
shape->AssignNewIds();