Added missing OGL files; added defaults to wxDocMDIParentFrame; corrected
toolbar usage in Dialog Editor git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@396 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,8 +27,9 @@ class wxDocMDIParentFrame: public wxMDIParentFrame
|
|||||||
{
|
{
|
||||||
DECLARE_CLASS(wxDocMDIParentFrame)
|
DECLARE_CLASS(wxDocMDIParentFrame)
|
||||||
public:
|
public:
|
||||||
wxDocMDIParentFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size,
|
wxDocMDIParentFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id,
|
||||||
long style, const wxString& name);
|
const wxString& title, const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||||
|
|
||||||
bool OnClose(void);
|
bool OnClose(void);
|
||||||
// Extend event processing to search the document manager's event table
|
// Extend event processing to search the document manager's event table
|
||||||
@@ -55,8 +56,8 @@ class WXDLLEXPORT wxDocMDIChildFrame: public wxMDIChildFrame
|
|||||||
DECLARE_CLASS(wxDocMDIChildFrame)
|
DECLARE_CLASS(wxDocMDIChildFrame)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, const wxString& title,
|
wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
long type = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
long type = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||||
~wxDocMDIChildFrame(void);
|
~wxDocMDIChildFrame(void);
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
static const char *GetMessageName(int message);
|
const char *wxGetMessageName(int message);
|
||||||
#endif //WXDEBUG
|
#endif //WXDEBUG
|
||||||
|
|
||||||
#define WINDOW_MARGIN 3 // This defines sensitivity of Leave events
|
#define WINDOW_MARGIN 3 // This defines sensitivity of Leave events
|
||||||
@@ -954,7 +954,7 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
|
|||||||
long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
wxLogTrace(wxTraceMessages, "Processing %s", GetMessageName(message));
|
wxLogTrace(wxTraceMessages, "Processing %s", wxGetMessageName(message));
|
||||||
#endif // WXDEBUG
|
#endif // WXDEBUG
|
||||||
|
|
||||||
HWND hWnd = (HWND)m_hWnd;
|
HWND hWnd = (HWND)m_hWnd;
|
||||||
@@ -1938,7 +1938,7 @@ long wxWindow::Default()
|
|||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
wxLogTrace(wxTraceMessages, "Forwarding %s to DefWindowProc.",
|
wxLogTrace(wxTraceMessages, "Forwarding %s to DefWindowProc.",
|
||||||
GetMessageName(m_lastMsg));
|
wxGetMessageName(m_lastMsg));
|
||||||
#endif // WXDEBUG
|
#endif // WXDEBUG
|
||||||
|
|
||||||
return this->MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam);
|
return this->MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam);
|
||||||
@@ -4593,10 +4593,8 @@ bool wxWindow::IsExposed(const wxRect& rect) const
|
|||||||
return (m_updateRegion.Contains(rect) != wxOutRegion);
|
return (m_updateRegion.Contains(rect) != wxOutRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
static const char *GetMessageName(int message)
|
const char *wxGetMessageName(int message)
|
||||||
{
|
{
|
||||||
switch ( message ) {
|
switch ( message ) {
|
||||||
case 0x0000: return "WM_NULL";
|
case 0x0000: return "WM_NULL";
|
||||||
|
@@ -732,10 +732,8 @@ wxToolBarBase *wxResourceManager::OnCreateToolBar(wxFrame *parent)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create the toolbar
|
// Create the toolbar
|
||||||
EditorToolBar *toolbar = new EditorToolBar(parent, wxPoint(0, 0), wxSize(-1, -1), wxNO_BORDER,
|
EditorToolBar *toolbar = new EditorToolBar(parent, wxPoint(0, 0), wxSize(-1, -1), wxNO_BORDER|wxTB_HORIZONTAL);
|
||||||
wxVERTICAL, 1);
|
|
||||||
toolbar->SetMargins(2, 2);
|
toolbar->SetMargins(2, 2);
|
||||||
// toolbar->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH);
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
int width = 24;
|
int width = 24;
|
||||||
@@ -792,11 +790,9 @@ wxToolBarBase *wxResourceManager::OnCreateToolBar(wxFrame *parent)
|
|||||||
FALSE, (float)currentX, -1, NULL, "Help");
|
FALSE, (float)currentX, -1, NULL, "Help");
|
||||||
currentX += width + dx;
|
currentX += width + dx;
|
||||||
|
|
||||||
toolbar->CreateTools();
|
toolbar->Realize();
|
||||||
|
|
||||||
return toolbar;
|
return toolbar;
|
||||||
|
|
||||||
// parent->OnSize(-1, -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxResourceManager::UpdateResourceList()
|
void wxResourceManager::UpdateResourceList()
|
||||||
@@ -1965,8 +1961,8 @@ BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
EditorToolBar::EditorToolBar(wxFrame *frame, const wxPoint& pos, const wxSize& size,
|
EditorToolBar::EditorToolBar(wxFrame *frame, const wxPoint& pos, const wxSize& size,
|
||||||
long style, int direction, int RowsOrColumns):
|
long style):
|
||||||
wxToolBar(frame, -1, pos, size, style, direction, RowsOrColumns)
|
wxToolBar(frame, -1, pos, size, style)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -373,7 +373,7 @@ class EditorToolBar: public wxToolBar
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0),
|
EditorToolBar(wxFrame *frame, const wxPoint& pos = wxPoint(0, 0), const wxSize& size = wxSize(0, 0),
|
||||||
long style = 0, int direction = wxVERTICAL, int RowsOrColumns = 2);
|
long style = wxTB_HORIZONTAL);
|
||||||
bool OnLeftClick(int toolIndex, bool toggled);
|
bool OnLeftClick(int toolIndex, bool toggled);
|
||||||
void OnMouseEnter(int toolIndex);
|
void OnMouseEnter(int toolIndex);
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
|
BIN
utils/ogl/samples/ogledit/bitmaps/arrow.bmp
Normal file
BIN
utils/ogl/samples/ogledit/bitmaps/arrow.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 382 B |
BIN
utils/ogl/samples/ogledit/bitmaps/tool1.bmp
Normal file
BIN
utils/ogl/samples/ogledit/bitmaps/tool1.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 382 B |
BIN
utils/ogl/samples/ogledit/bitmaps/tool2.bmp
Normal file
BIN
utils/ogl/samples/ogledit/bitmaps/tool2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 382 B |
BIN
utils/ogl/samples/ogledit/bitmaps/tool3.bmp
Normal file
BIN
utils/ogl/samples/ogledit/bitmaps/tool3.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 382 B |
BIN
utils/ogl/samples/ogledit/bitmaps/tool4.bmp
Normal file
BIN
utils/ogl/samples/ogledit/bitmaps/tool4.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 382 B |
570
utils/ogl/samples/ogledit/doc.cpp
Normal file
570
utils/ogl/samples/ogledit/doc.cpp
Normal file
@@ -0,0 +1,570 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: doc.cpp
|
||||||
|
// Purpose: Implements document functionality in OGLEdit
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12/07/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
// #pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include <wx/wxprec.h>
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !USE_DOC_VIEW_ARCHITECTURE
|
||||||
|
#error You must set USE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h!
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "ogledit.h"
|
||||||
|
#include "doc.h"
|
||||||
|
#include <wx/wxexpr.h>
|
||||||
|
#include "view.h"
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(DiagramDocument, wxDocument)
|
||||||
|
|
||||||
|
DiagramDocument::DiagramDocument(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
DiagramDocument::~DiagramDocument(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DiagramDocument::OnCloseDocument(void)
|
||||||
|
{
|
||||||
|
diagram.DeleteAllShapes();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ostream& DiagramDocument::SaveObject(ostream& stream)
|
||||||
|
{
|
||||||
|
wxDocument::SaveObject(stream);
|
||||||
|
|
||||||
|
char buf[400];
|
||||||
|
(void) wxGetTempFileName("diag", buf);
|
||||||
|
|
||||||
|
diagram.SaveFile(buf);
|
||||||
|
wxTransferFileToStream(buf, stream);
|
||||||
|
|
||||||
|
wxRemoveFile(buf);
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
istream& DiagramDocument::LoadObject(istream& stream)
|
||||||
|
{
|
||||||
|
wxDocument::LoadObject(stream);
|
||||||
|
|
||||||
|
char buf[400];
|
||||||
|
(void) wxGetTempFileName("diag", buf);
|
||||||
|
|
||||||
|
wxTransferStreamToFile(stream, buf);
|
||||||
|
|
||||||
|
diagram.DeleteAllShapes();
|
||||||
|
diagram.LoadFile(buf);
|
||||||
|
wxRemoveFile(buf);
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation of drawing command
|
||||||
|
*/
|
||||||
|
|
||||||
|
DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, wxClassInfo *info, float xx, float yy,
|
||||||
|
bool sel, wxShape *theShape, wxShape *fs, wxShape *ts):
|
||||||
|
wxCommand(TRUE, name)
|
||||||
|
{
|
||||||
|
doc = ddoc;
|
||||||
|
cmd = command;
|
||||||
|
shape = theShape;
|
||||||
|
fromShape = fs;
|
||||||
|
toShape = ts;
|
||||||
|
shapeInfo = info;
|
||||||
|
shapeBrush = NULL;
|
||||||
|
shapePen = NULL;
|
||||||
|
x = xx;
|
||||||
|
y = yy;
|
||||||
|
selected = sel;
|
||||||
|
deleteShape = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape):
|
||||||
|
wxCommand(TRUE, name)
|
||||||
|
{
|
||||||
|
doc = ddoc;
|
||||||
|
cmd = command;
|
||||||
|
shape = theShape;
|
||||||
|
fromShape = NULL;
|
||||||
|
toShape = NULL;
|
||||||
|
shapeInfo = NULL;
|
||||||
|
x = 0.0;
|
||||||
|
y = 0.0;
|
||||||
|
selected = FALSE;
|
||||||
|
deleteShape = FALSE;
|
||||||
|
shapeBrush = backgroundColour;
|
||||||
|
shapePen = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, const wxString& lab, wxShape *theShape):
|
||||||
|
wxCommand(TRUE, name)
|
||||||
|
{
|
||||||
|
doc = ddoc;
|
||||||
|
cmd = command;
|
||||||
|
shape = theShape;
|
||||||
|
fromShape = NULL;
|
||||||
|
toShape = NULL;
|
||||||
|
shapeInfo = NULL;
|
||||||
|
x = 0.0;
|
||||||
|
y = 0.0;
|
||||||
|
selected = FALSE;
|
||||||
|
deleteShape = FALSE;
|
||||||
|
shapeBrush = NULL;
|
||||||
|
shapePen = NULL;
|
||||||
|
shapeLabel = lab;
|
||||||
|
}
|
||||||
|
|
||||||
|
DiagramCommand::~DiagramCommand(void)
|
||||||
|
{
|
||||||
|
if (shape && deleteShape)
|
||||||
|
{
|
||||||
|
shape->SetCanvas(NULL);
|
||||||
|
delete shape;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DiagramCommand::Do(void)
|
||||||
|
{
|
||||||
|
switch (cmd)
|
||||||
|
{
|
||||||
|
case OGLEDIT_CUT:
|
||||||
|
{
|
||||||
|
if (shape)
|
||||||
|
{
|
||||||
|
deleteShape = TRUE;
|
||||||
|
|
||||||
|
shape->Select(FALSE);
|
||||||
|
|
||||||
|
// Generate commands to explicitly remove each connected line.
|
||||||
|
RemoveLines(shape);
|
||||||
|
|
||||||
|
doc->GetDiagram()->RemoveShape(shape);
|
||||||
|
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
|
||||||
|
{
|
||||||
|
wxLineShape *lineShape = (wxLineShape *)shape;
|
||||||
|
fromShape = lineShape->GetFrom();
|
||||||
|
toShape = lineShape->GetTo();
|
||||||
|
}
|
||||||
|
shape->Unlink();
|
||||||
|
|
||||||
|
doc->Modify(TRUE);
|
||||||
|
doc->UpdateAllViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OGLEDIT_ADD_SHAPE:
|
||||||
|
{
|
||||||
|
wxShape *theShape = NULL;
|
||||||
|
if (shape)
|
||||||
|
theShape = shape; // Saved from undoing the shape
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theShape = (wxShape *)shapeInfo->CreateObject();
|
||||||
|
theShape->AssignNewIds();
|
||||||
|
theShape->SetEventHandler(new MyEvtHandler(theShape, theShape, wxString("")));
|
||||||
|
theShape->SetCentreResize(FALSE);
|
||||||
|
theShape->SetPen(wxBLACK_PEN);
|
||||||
|
theShape->SetBrush(wxCYAN_BRUSH);
|
||||||
|
|
||||||
|
theShape->SetSize(60, 60);
|
||||||
|
}
|
||||||
|
doc->GetDiagram()->AddShape(theShape);
|
||||||
|
theShape->Show(TRUE);
|
||||||
|
|
||||||
|
wxClientDC dc(theShape->GetCanvas());
|
||||||
|
theShape->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
theShape->Move(dc, x, y);
|
||||||
|
|
||||||
|
shape = theShape;
|
||||||
|
deleteShape = FALSE;
|
||||||
|
|
||||||
|
doc->Modify(TRUE);
|
||||||
|
doc->UpdateAllViews();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OGLEDIT_ADD_LINE:
|
||||||
|
{
|
||||||
|
wxShape *theShape = NULL;
|
||||||
|
if (shape)
|
||||||
|
theShape = shape; // Saved from undoing the line
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theShape = (wxShape *)shapeInfo->CreateObject();
|
||||||
|
theShape->AssignNewIds();
|
||||||
|
theShape->SetEventHandler(new MyEvtHandler(theShape, theShape, wxString("")));
|
||||||
|
theShape->SetPen(wxBLACK_PEN);
|
||||||
|
theShape->SetBrush(wxRED_BRUSH);
|
||||||
|
|
||||||
|
wxLineShape *lineShape = (wxLineShape *)theShape;
|
||||||
|
|
||||||
|
// Yes, you can have more than 2 control points, in which case
|
||||||
|
// it becomes a multi-segment line.
|
||||||
|
lineShape->MakeLineControlPoints(2);
|
||||||
|
lineShape->AddArrow(ARROW_ARROW, ARROW_POSITION_END, 10.0, 0.0, "Normal arrowhead");
|
||||||
|
}
|
||||||
|
|
||||||
|
doc->GetDiagram()->AddShape(theShape);
|
||||||
|
|
||||||
|
fromShape->AddLine((wxLineShape *)theShape, toShape);
|
||||||
|
|
||||||
|
theShape->Show(TRUE);
|
||||||
|
|
||||||
|
wxClientDC dc(theShape->GetCanvas());
|
||||||
|
theShape->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
// It won't get drawn properly unless you move both
|
||||||
|
// connected images
|
||||||
|
fromShape->Move(dc, fromShape->GetX(), fromShape->GetY());
|
||||||
|
toShape->Move(dc, toShape->GetX(), toShape->GetY());
|
||||||
|
|
||||||
|
shape = theShape;
|
||||||
|
deleteShape = FALSE;
|
||||||
|
|
||||||
|
doc->Modify(TRUE);
|
||||||
|
doc->UpdateAllViews();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OGLEDIT_CHANGE_BACKGROUND_COLOUR:
|
||||||
|
{
|
||||||
|
if (shape)
|
||||||
|
{
|
||||||
|
wxClientDC dc(shape->GetCanvas());
|
||||||
|
shape->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
wxBrush *oldBrush = shape->GetBrush();
|
||||||
|
shape->SetBrush(shapeBrush);
|
||||||
|
shapeBrush = oldBrush;
|
||||||
|
shape->Draw(dc);
|
||||||
|
|
||||||
|
doc->Modify(TRUE);
|
||||||
|
doc->UpdateAllViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OGLEDIT_EDIT_LABEL:
|
||||||
|
{
|
||||||
|
if (shape)
|
||||||
|
{
|
||||||
|
MyEvtHandler *myHandler = (MyEvtHandler *)shape->GetEventHandler();
|
||||||
|
wxString oldLabel(myHandler->label);
|
||||||
|
myHandler->label = shapeLabel;
|
||||||
|
shapeLabel = oldLabel;
|
||||||
|
|
||||||
|
wxClientDC dc(shape->GetCanvas());
|
||||||
|
shape->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
shape->FormatText(dc, (char*) (const char*) myHandler->label);
|
||||||
|
shape->Draw(dc);
|
||||||
|
|
||||||
|
doc->Modify(TRUE);
|
||||||
|
doc->UpdateAllViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DiagramCommand::Undo(void)
|
||||||
|
{
|
||||||
|
switch (cmd)
|
||||||
|
{
|
||||||
|
case OGLEDIT_CUT:
|
||||||
|
{
|
||||||
|
if (shape)
|
||||||
|
{
|
||||||
|
doc->GetDiagram()->AddShape(shape);
|
||||||
|
shape->Show(TRUE);
|
||||||
|
|
||||||
|
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
|
||||||
|
{
|
||||||
|
wxLineShape *lineShape = (wxLineShape *)shape;
|
||||||
|
|
||||||
|
fromShape->AddLine(lineShape, toShape);
|
||||||
|
}
|
||||||
|
if (selected)
|
||||||
|
shape->Select(TRUE);
|
||||||
|
|
||||||
|
deleteShape = FALSE;
|
||||||
|
}
|
||||||
|
doc->Modify(TRUE);
|
||||||
|
doc->UpdateAllViews();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OGLEDIT_ADD_SHAPE:
|
||||||
|
case OGLEDIT_ADD_LINE:
|
||||||
|
{
|
||||||
|
if (shape)
|
||||||
|
{
|
||||||
|
wxClientDC dc(shape->GetCanvas());
|
||||||
|
shape->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
shape->Select(FALSE, &dc);
|
||||||
|
doc->GetDiagram()->RemoveShape(shape);
|
||||||
|
shape->Unlink();
|
||||||
|
deleteShape = TRUE;
|
||||||
|
}
|
||||||
|
doc->Modify(TRUE);
|
||||||
|
doc->UpdateAllViews();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OGLEDIT_CHANGE_BACKGROUND_COLOUR:
|
||||||
|
{
|
||||||
|
if (shape)
|
||||||
|
{
|
||||||
|
wxClientDC dc(shape->GetCanvas());
|
||||||
|
shape->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
wxBrush *oldBrush = shape->GetBrush();
|
||||||
|
shape->SetBrush(shapeBrush);
|
||||||
|
shapeBrush = oldBrush;
|
||||||
|
shape->Draw(dc);
|
||||||
|
|
||||||
|
doc->Modify(TRUE);
|
||||||
|
doc->UpdateAllViews();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OGLEDIT_EDIT_LABEL:
|
||||||
|
{
|
||||||
|
if (shape)
|
||||||
|
{
|
||||||
|
MyEvtHandler *myHandler = (MyEvtHandler *)shape->GetEventHandler();
|
||||||
|
wxString oldLabel(myHandler->label);
|
||||||
|
myHandler->label = shapeLabel;
|
||||||
|
shapeLabel = oldLabel;
|
||||||
|
|
||||||
|
wxClientDC dc(shape->GetCanvas());
|
||||||
|
shape->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
shape->FormatText(dc, (char*) (const char*) myHandler->label);
|
||||||
|
shape->Draw(dc);
|
||||||
|
|
||||||
|
doc->Modify(TRUE);
|
||||||
|
doc->UpdateAllViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove each individual line connected to a shape by sending a command.
|
||||||
|
void DiagramCommand::RemoveLines(wxShape *shape)
|
||||||
|
{
|
||||||
|
wxNode *node = shape->GetLines().First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxLineShape *line = (wxLineShape *)node->Data();
|
||||||
|
doc->GetCommandProcessor()->Submit(new DiagramCommand("Cut", OGLEDIT_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
|
||||||
|
|
||||||
|
node = shape->GetLines().First();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MyEvtHandler: an event handler class for all shapes
|
||||||
|
*/
|
||||||
|
|
||||||
|
void MyEvtHandler::OnLeftClick(float x, float y, int keys, int attachment)
|
||||||
|
{
|
||||||
|
wxClientDC dc(GetShape()->GetCanvas());
|
||||||
|
GetShape()->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
if (keys == 0)
|
||||||
|
{
|
||||||
|
// Selection is a concept the library knows about
|
||||||
|
if (GetShape()->Selected())
|
||||||
|
{
|
||||||
|
GetShape()->Select(FALSE, &dc);
|
||||||
|
GetShape()->GetCanvas()->Redraw(dc); // Redraw because bits of objects will be are missing
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Ensure no other shape is selected, to simplify Undo/Redo code
|
||||||
|
bool redraw = FALSE;
|
||||||
|
wxNode *node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxShape *eachShape = (wxShape *)node->Data();
|
||||||
|
if (eachShape->GetParent() == NULL)
|
||||||
|
{
|
||||||
|
if (eachShape->Selected())
|
||||||
|
{
|
||||||
|
eachShape->Select(FALSE, &dc);
|
||||||
|
redraw = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
GetShape()->Select(TRUE, &dc);
|
||||||
|
if (redraw)
|
||||||
|
GetShape()->GetCanvas()->Redraw(dc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (keys & KEY_CTRL)
|
||||||
|
{
|
||||||
|
// Do something for CONTROL
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxGetApp().frame->SetStatusText(label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implement connection of two shapes by right-dragging between them.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void MyEvtHandler::OnBeginDragRight(float x, float y, int keys, int attachment)
|
||||||
|
{
|
||||||
|
// Force attachment to be zero for now. Eventually we can deal with
|
||||||
|
// the actual attachment point, e.g. a rectangle side if attachment mode is on.
|
||||||
|
attachment = 0;
|
||||||
|
|
||||||
|
wxClientDC dc(GetShape()->GetCanvas());
|
||||||
|
GetShape()->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
|
||||||
|
dc.SetLogicalFunction(wxXOR);
|
||||||
|
dc.SetPen(dottedPen);
|
||||||
|
float xp, yp;
|
||||||
|
GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
|
||||||
|
dc.DrawLine(xp, yp, x, y);
|
||||||
|
GetShape()->GetCanvas()->CaptureMouse();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyEvtHandler::OnDragRight(bool draw, float x, float y, int keys, int attachment)
|
||||||
|
{
|
||||||
|
// Force attachment to be zero for now
|
||||||
|
attachment = 0;
|
||||||
|
|
||||||
|
wxClientDC dc(GetShape()->GetCanvas());
|
||||||
|
GetShape()->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
|
||||||
|
dc.SetLogicalFunction(wxXOR);
|
||||||
|
dc.SetPen(dottedPen);
|
||||||
|
float xp, yp;
|
||||||
|
GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
|
||||||
|
dc.DrawLine(xp, yp, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyEvtHandler::OnEndDragRight(float x, float y, int keys, int attachment)
|
||||||
|
{
|
||||||
|
GetShape()->GetCanvas()->ReleaseMouse();
|
||||||
|
MyCanvas *canvas = (MyCanvas *)GetShape()->GetCanvas();
|
||||||
|
|
||||||
|
// Check if we're on an object
|
||||||
|
int new_attachment;
|
||||||
|
wxShape *otherShape = canvas->FindFirstSensitiveShape(x, y, &new_attachment, OP_DRAG_RIGHT);
|
||||||
|
|
||||||
|
if (otherShape && !otherShape->IsKindOf(CLASSINFO(wxLineShape)))
|
||||||
|
{
|
||||||
|
canvas->view->GetDocument()->GetCommandProcessor()->Submit(
|
||||||
|
new DiagramCommand("wxLineShape", OGLEDIT_ADD_LINE, (DiagramDocument *)canvas->view->GetDocument(), CLASSINFO(wxLineShape),
|
||||||
|
0.0, 0.0, FALSE, NULL, GetShape(), otherShape));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyEvtHandler::OnEndSize(float x, float y)
|
||||||
|
{
|
||||||
|
wxClientDC dc(GetShape()->GetCanvas());
|
||||||
|
GetShape()->GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
|
GetShape()->FormatText(dc, (char*) (const char*) label);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Diagram
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool MyDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
|
||||||
|
{
|
||||||
|
wxDiagram::OnShapeSave(db, shape, expr);
|
||||||
|
MyEvtHandler *handler = (MyEvtHandler *)shape.GetEventHandler();
|
||||||
|
expr.AddAttributeValueString("label", handler->label);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MyDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
|
||||||
|
{
|
||||||
|
wxDiagram::OnShapeLoad(db, shape, expr);
|
||||||
|
char *label = NULL;
|
||||||
|
expr.AssignAttributeValue("label", &label);
|
||||||
|
MyEvtHandler *handler = new MyEvtHandler(&shape, &shape, wxString(label));
|
||||||
|
shape.SetEventHandler(handler);
|
||||||
|
|
||||||
|
if (label)
|
||||||
|
delete[] label;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* New shapes
|
||||||
|
*/
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxRoundedRectangleShape, wxRectangleShape)
|
||||||
|
|
||||||
|
wxRoundedRectangleShape::wxRoundedRectangleShape(float w, float h):
|
||||||
|
wxRectangleShape(w, h)
|
||||||
|
{
|
||||||
|
// 0.3 of the smaller rectangle dimension
|
||||||
|
SetCornerRadius((float) -0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxDiamondShape, wxPolygonShape)
|
||||||
|
|
||||||
|
wxDiamondShape::wxDiamondShape(float w, float h):
|
||||||
|
wxPolygonShape()
|
||||||
|
{
|
||||||
|
// wxPolygonShape::SetSize relies on the shape having non-zero
|
||||||
|
// size initially.
|
||||||
|
if (w == 0.0)
|
||||||
|
w = 60.0;
|
||||||
|
if (h == 0.0)
|
||||||
|
h = 60.0;
|
||||||
|
|
||||||
|
wxList *thePoints = new wxList;
|
||||||
|
wxRealPoint *point = new wxRealPoint(0.0, (-h/2.0));
|
||||||
|
thePoints->Append((wxObject*) point);
|
||||||
|
|
||||||
|
point = new wxRealPoint((w/2.0), 0.0);
|
||||||
|
thePoints->Append((wxObject*) point);
|
||||||
|
|
||||||
|
point = new wxRealPoint(0.0, (h/2.0));
|
||||||
|
thePoints->Append((wxObject*) point);
|
||||||
|
|
||||||
|
point = new wxRealPoint((-w/2.0), 0.0);
|
||||||
|
thePoints->Append((wxObject*) point);
|
||||||
|
|
||||||
|
Create(thePoints);
|
||||||
|
}
|
172
utils/ogl/samples/ogledit/doc.h
Normal file
172
utils/ogl/samples/ogledit/doc.h
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: doc.h
|
||||||
|
// Purpose: Document classes
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12/07/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _OGLSAMPLE_DOC_H_
|
||||||
|
#define _OGLSAMPLE_DOC_H_
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
// #pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <wx/docview.h>
|
||||||
|
#include <wx/string.h>
|
||||||
|
#include <wx/wxexpr.h>
|
||||||
|
|
||||||
|
#include "ogl.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Override a few members for this application
|
||||||
|
*/
|
||||||
|
|
||||||
|
class MyDiagram: public wxDiagram
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyDiagram(void) {}
|
||||||
|
bool OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
|
||||||
|
bool OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A few new shape classes so we have a 1:1 mapping
|
||||||
|
* between palette symbol and unique class
|
||||||
|
*/
|
||||||
|
|
||||||
|
class wxRoundedRectangleShape: public wxRectangleShape
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxRoundedRectangleShape)
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
wxRoundedRectangleShape(float w = 0.0, float h = 0.0);
|
||||||
|
};
|
||||||
|
|
||||||
|
class wxDiamondShape: public wxPolygonShape
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxDiamondShape)
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
wxDiamondShape(float w = 0.0, float h = 0.0);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All shape event behaviour is routed through this handler, so we don't
|
||||||
|
* have to derive from each shape class. We plug this in to each shape.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class MyEvtHandler: public wxShapeEvtHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxString label;
|
||||||
|
MyEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL, const wxString& lab = ""):wxShapeEvtHandler(prev, shape)
|
||||||
|
{
|
||||||
|
label = lab;
|
||||||
|
}
|
||||||
|
~MyEvtHandler(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
|
||||||
|
void OnBeginDragRight(float x, float y, int keys = 0, int attachment = 0);
|
||||||
|
void OnDragRight(bool draw, float x, float y, int keys = 0, int attachment = 0);
|
||||||
|
void OnEndDragRight(float x, float y, int keys = 0, int attachment = 0);
|
||||||
|
void OnEndSize(float x, float y);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A diagram document, which contains a diagram.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class DiagramDocument: public wxDocument
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(DiagramDocument)
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
MyDiagram diagram;
|
||||||
|
|
||||||
|
DiagramDocument(void);
|
||||||
|
~DiagramDocument(void);
|
||||||
|
|
||||||
|
ostream& SaveObject(ostream& stream);
|
||||||
|
istream& LoadObject(istream& stream);
|
||||||
|
|
||||||
|
inline wxDiagram *GetDiagram() { return &diagram; }
|
||||||
|
|
||||||
|
bool OnCloseDocument(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Most user interface commands are routed through this, to give us the
|
||||||
|
* Undo/Redo mechanism. If you add more commands, such as changing the shape colour,
|
||||||
|
* you will need to add members to 'remember' what the user applied (for 'Do') and what the
|
||||||
|
* previous state was (for 'Undo').
|
||||||
|
* You can have one member for each property to be changed. Assume we also have
|
||||||
|
* a pointer member wxShape *shape, which is set to the shape being changed.
|
||||||
|
* Let's assume we're changing the shape colour. Our member for this is shapeColour.
|
||||||
|
*
|
||||||
|
* - In 'Do':
|
||||||
|
* o Set a temporary variable 'temp' to the current colour for 'shape'.
|
||||||
|
* o Change the colour to the new colour.
|
||||||
|
* o Set shapeColour to the _old_ colour, 'temp'.
|
||||||
|
* - In 'Undo':
|
||||||
|
* o Set a temporary variable 'temp' to the current colour for 'shape'.
|
||||||
|
* o Change the colour to shapeColour (the old colour).
|
||||||
|
* o Set shapeColour to 'temp'.
|
||||||
|
*
|
||||||
|
* So, as long as we have a pointer to the shape being changed,
|
||||||
|
* we only need one member variable for each property.
|
||||||
|
*
|
||||||
|
* PROBLEM: when an Add shape command is redone, the 'shape' pointer changes.
|
||||||
|
* Assume, as here, that we keep a pointer to the old shape so we reuse it
|
||||||
|
* when we recreate.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class DiagramCommand: public wxCommand
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
DiagramDocument *doc;
|
||||||
|
int cmd;
|
||||||
|
wxShape *shape; // Pointer to the shape we're acting on
|
||||||
|
wxShape *fromShape;
|
||||||
|
wxShape *toShape;
|
||||||
|
wxClassInfo *shapeInfo;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
bool selected;
|
||||||
|
bool deleteShape;
|
||||||
|
|
||||||
|
// Storage for property commands
|
||||||
|
wxBrush *shapeBrush;
|
||||||
|
wxPen *shapePen;
|
||||||
|
wxString shapeLabel;
|
||||||
|
public:
|
||||||
|
// Multi-purpose constructor for creating, deleting shapes
|
||||||
|
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxClassInfo *shapeInfo = NULL,
|
||||||
|
float x = 0.0, float y = 0.0, bool sel = FALSE, wxShape *theShape = NULL, wxShape *fs = NULL, wxShape *ts = NULL);
|
||||||
|
|
||||||
|
// Property-changing command constructors
|
||||||
|
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape);
|
||||||
|
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, const wxString& lab, wxShape *theShape);
|
||||||
|
|
||||||
|
~DiagramCommand(void);
|
||||||
|
|
||||||
|
bool Do(void);
|
||||||
|
bool Undo(void);
|
||||||
|
|
||||||
|
inline void SetShape(wxShape *s) { shape = s; }
|
||||||
|
inline wxShape *GetShape(void) { return shape; }
|
||||||
|
inline wxShape *GetFromShape(void) { return fromShape; }
|
||||||
|
inline wxShape *GetToShape(void) { return toShape; }
|
||||||
|
inline wxClassInfo *GetShapeInfo(void) { return shapeInfo; }
|
||||||
|
inline bool GetSelected(void) { return selected; }
|
||||||
|
|
||||||
|
void RemoveLines(wxShape *shape);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// _OGLSAMPLE_DOC_H_
|
88
utils/ogl/samples/ogledit/makefile.b32
Normal file
88
utils/ogl/samples/ogledit/makefile.b32
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.bcc
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1996
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1996
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds OGL example for BC++, 32-bit.
|
||||||
|
|
||||||
|
!if "$(BCCDIR)" == ""
|
||||||
|
!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "$(WXWIN)" == ""
|
||||||
|
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!ifndef FINAL
|
||||||
|
FINAL=0
|
||||||
|
!endif
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
!include $(WXDIR)\src\makeb32.env
|
||||||
|
|
||||||
|
THISDIR = $(WXDIR)\utils\ogl\samples\ogledit
|
||||||
|
|
||||||
|
OGLDIR = ..\.. # $(WXDIR)\utils\ogl # Command line too long!
|
||||||
|
OGLINC = $(OGLDIR)\src
|
||||||
|
OGLLIB = $(WXDIR)\lib\ogl.lib
|
||||||
|
|
||||||
|
WXLIB = $(WXDIR)\lib\wx32.lib
|
||||||
|
LIBS=$(WXLIB) $(OGLLIB) cw32 import32
|
||||||
|
INC=/I$(OGLINC)
|
||||||
|
CFG=$(WXDIR)\src\wxwin32.cfg
|
||||||
|
|
||||||
|
!if "$(FINAL)" == "0"
|
||||||
|
LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||||
|
OPT = -Od
|
||||||
|
DEBUG_FLAGS= -v -DDEBUG=$(DEBUG)
|
||||||
|
!else
|
||||||
|
LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||||
|
OPT = -O2
|
||||||
|
DEBUG_FLAGS = -DDEBUG=$(DEBUG)
|
||||||
|
!endif
|
||||||
|
|
||||||
|
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||||
|
|
||||||
|
OBJECTS = ogledit.obj doc.obj view.obj palette.obj
|
||||||
|
|
||||||
|
all: ogl ogledit.exe
|
||||||
|
|
||||||
|
ogl:
|
||||||
|
cd $(OGLDIR)\src
|
||||||
|
make -f makefile.b32
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
ogledit.exe: $(WXLIB) $(OBJECTS) ogledit.def ogledit.res
|
||||||
|
tlink32 $(LINKFLAGS) @&&!
|
||||||
|
c0w32.obj $(OBJECTS)
|
||||||
|
ogledit
|
||||||
|
nul
|
||||||
|
$(LIBS)
|
||||||
|
ogledit.def
|
||||||
|
!
|
||||||
|
brc32 -K ogledit.res
|
||||||
|
|
||||||
|
.$(SRCSUFF).obj:
|
||||||
|
bcc32 $(CPPFLAGS) $(INC) -c {$< }
|
||||||
|
|
||||||
|
ogledit.obj: ogledit.$(SRCSUFF)
|
||||||
|
|
||||||
|
doc.obj: doc.$(SRCSUFF)
|
||||||
|
|
||||||
|
view.obj: view.$(SRCSUFF)
|
||||||
|
|
||||||
|
palette.obj: palette.$(SRCSUFF)
|
||||||
|
|
||||||
|
ogledit.res : ogledit.rc $(WXDIR)\include\msw\wx.rc
|
||||||
|
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa ogledit
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-erase *.obj
|
||||||
|
-erase *.exe
|
||||||
|
-erase *.res
|
||||||
|
-erase *.map
|
||||||
|
-erase *.rws
|
87
utils/ogl/samples/ogledit/makefile.bcc
Normal file
87
utils/ogl/samples/ogledit/makefile.bcc
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.bcc
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1996
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1996
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds OGL example for BC++, 16-bit.
|
||||||
|
|
||||||
|
!if "$(BCCDIR)" == ""
|
||||||
|
!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "$(WXWIN)" == ""
|
||||||
|
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!ifndef FINAL
|
||||||
|
FINAL=0
|
||||||
|
!endif
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
!include $(WXDIR)\src\makebcc.env
|
||||||
|
|
||||||
|
THISDIR = $(WXDIR)\utils\ogl\samples\ogledit
|
||||||
|
|
||||||
|
OGLDIR = $(WXDIR)\utils\ogl
|
||||||
|
OGLINC = $(OGLDIR)\src
|
||||||
|
OGLLIB = $(OGLDIR)\lib\ogl.lib
|
||||||
|
|
||||||
|
WXLIB = $(WXDIR)\lib\wx.lib
|
||||||
|
LIBS=$(WXLIB) $(OGLLIB) mathwl cwl import
|
||||||
|
INC=/I$(OGLINC)
|
||||||
|
CFG=$(WXDIR)\src\wxwin.cfg
|
||||||
|
|
||||||
|
!if "$(FINAL)" == "0"
|
||||||
|
LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
|
||||||
|
OPT = -Od
|
||||||
|
DEBUG_FLAGS= -v
|
||||||
|
!else
|
||||||
|
LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib
|
||||||
|
OPT = -O2
|
||||||
|
DEBUG_FLAGS =
|
||||||
|
!endif
|
||||||
|
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||||
|
|
||||||
|
OBJECTS = ogledit.obj doc.obj view.obj palette.obj
|
||||||
|
|
||||||
|
all: ogl ogledit.exe
|
||||||
|
|
||||||
|
ogl:
|
||||||
|
cd $(OGLDIR)\src
|
||||||
|
make -f makefile.bcc
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
ogledit.exe: $(WXLIB) $(OBJECTS) ogledit.def ogledit.res
|
||||||
|
tlink $(LINKFLAGS) @&&!
|
||||||
|
c0wl.obj $(OBJECTS)
|
||||||
|
ogledit
|
||||||
|
nul
|
||||||
|
$(LIBS)
|
||||||
|
ogledit.def
|
||||||
|
!
|
||||||
|
rc -30 -K ogledit.res
|
||||||
|
|
||||||
|
.$(SRCSUFF).obj:
|
||||||
|
bcc $(CPPFLAGS) $(INC) -c {$< }
|
||||||
|
|
||||||
|
ogledit.obj: ogledit.$(SRCSUFF)
|
||||||
|
|
||||||
|
doc.obj: doc.$(SRCSUFF)
|
||||||
|
|
||||||
|
view.obj: view.$(SRCSUFF)
|
||||||
|
|
||||||
|
palette.obj: palette.$(SRCSUFF)
|
||||||
|
|
||||||
|
ogledit.res : ogledit.rc $(WXDIR)\include\wx\msw\wx.rc
|
||||||
|
rc -r /i$(BCCDIR)\include /i$(WXDIR)\include ogledit
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-erase *.obj
|
||||||
|
-erase *.exe
|
||||||
|
-erase *.res
|
||||||
|
-erase *.map
|
||||||
|
-erase *.rws
|
103
utils/ogl/samples/ogledit/makefile.dos
Normal file
103
utils/ogl/samples/ogledit/makefile.dos
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.dos
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1995
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1995, AIAI, University of Edinburgh
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds OGLEdit example (MSVC++ 1.5).
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||||
|
# info
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makemsc.env
|
||||||
|
|
||||||
|
THISDIR = $(WXDIR)\utils\ogl\samples\ogledit
|
||||||
|
WXLIB = $(WXDIR)\lib\wx.lib
|
||||||
|
|
||||||
|
OGLDIR = $(WXDIR)\utils\ogl
|
||||||
|
OGLINC = $(OGLDIR)\src
|
||||||
|
OGLLIB = $(OGLDIR)\lib\ogl.lib
|
||||||
|
|
||||||
|
LIBS=$(WXLIB) $(OGLLIB) oldnames libw llibcew commdlg shell ddeml
|
||||||
|
|
||||||
|
EXTRAFLAGS=/I$(OGLINC)
|
||||||
|
|
||||||
|
OBJECTS = ogledit.obj doc.obj view.obj palette.obj
|
||||||
|
|
||||||
|
all: ogledit.exe
|
||||||
|
|
||||||
|
wx:
|
||||||
|
cd $(WXDIR)\src\msw
|
||||||
|
nmake -f makefile.dos
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
wxclean:
|
||||||
|
cd $(WXDIR)\src\msw
|
||||||
|
nmake -f makefile.dos clean
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
ogl:
|
||||||
|
cd $(OGLDIR)\src
|
||||||
|
nmake -f makefile.dos FINAL=$(FINAL)
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
prologio:
|
||||||
|
cd $(PROLOGDIR)\src
|
||||||
|
nmake -f makefile.dos FINAL=$(FINAL)
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
ogledit.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(OBJECTS) $(OGLLIB) ogledit.def ogledit.res
|
||||||
|
link $(LINKFLAGS) @<<
|
||||||
|
$(WXDIR)\src\msw\dummy.obj $(OBJECTS),
|
||||||
|
ogledit,
|
||||||
|
NUL,
|
||||||
|
$(LIBS),
|
||||||
|
ogledit.def
|
||||||
|
;
|
||||||
|
<<
|
||||||
|
rc -30 -K ogledit.res
|
||||||
|
|
||||||
|
ogledit.obj: ogledit.h ogledit.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
view.obj: view.h view.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
doc.obj: doc.h doc.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
palette.obj: view.h doc.h ogledit.h palette.$(SRCSUFF) $(DUMMYOBJ)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
ogledit.res : ogledit.rc $(WXDIR)\include\msw\wx.rc
|
||||||
|
rc -r /dFAFA_LIB /i$(WXDIR)\contrib\fafa /i$(WXDIR)\include\msw ogledit
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-erase *.obj
|
||||||
|
-erase *.exe
|
||||||
|
-erase *.res
|
||||||
|
-erase *.map
|
||||||
|
-erase *.sbr
|
||||||
|
-erase *.pdb
|
||||||
|
|
||||||
|
cleanogl:
|
||||||
|
cd $(OGLDIR)\src
|
||||||
|
nmake -f makefile.dos clean
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
cleanall:
|
||||||
|
cd $(OGLDIR)\src
|
||||||
|
nmake -f makefile.dos clean
|
||||||
|
cd $(THISDIR)
|
95
utils/ogl/samples/ogledit/makefile.nt
Normal file
95
utils/ogl/samples/ogledit/makefile.nt
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.nt
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds docview example (MS VC++).
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||||
|
# info
|
||||||
|
|
||||||
|
# Set WXDIR for your system
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\ntwxwin.mak
|
||||||
|
|
||||||
|
THISDIR = $(WXDIR)\utils\ogl\samples\ogledit
|
||||||
|
|
||||||
|
OGLDIR = $(WXDIR)\utils\ogl
|
||||||
|
OGLINC = $(OGLDIR)\src
|
||||||
|
OGLLIB = $(WXDIR)\lib\ogl.lib
|
||||||
|
|
||||||
|
PROGRAM=ogledit
|
||||||
|
|
||||||
|
EXTRALIBS=$(OGLLIB)
|
||||||
|
EXTRAINC=/I$(OGLINC)
|
||||||
|
|
||||||
|
OBJECTS = $(PROGRAM).obj doc.obj view.obj palette.obj
|
||||||
|
|
||||||
|
$(PROGRAM): $(PROGRAM).exe
|
||||||
|
|
||||||
|
all: $(PROGRAM).exe
|
||||||
|
|
||||||
|
wx:
|
||||||
|
cd $(WXDIR)\src\msw
|
||||||
|
nmake -f makefile.nt FINAL=$(FINAL)
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
wxclean:
|
||||||
|
cd $(WXDIR)\src\msw
|
||||||
|
nmake -f makefile.nt clean
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
ogl:
|
||||||
|
cd $(OGLDIR)\src
|
||||||
|
nmake -f makefile.nt FINAL=$(FINAL)
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(OGLLIB) $(PROGRAM).res
|
||||||
|
$(link) @<<
|
||||||
|
-out:$(PROGRAM).exe
|
||||||
|
$(LINKFLAGS)
|
||||||
|
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
|
||||||
|
$(LIBS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(PROGRAM).obj: $(PROGRAM).h doc.h view.h palette.h $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
|
||||||
|
$(cc) @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
doc.obj: view.h doc.h doc.$(SRCSUFF) ogledit.h $(DUMMYOBJ)
|
||||||
|
$(cc) @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
view.obj: view.h doc.h view.$(SRCSUFF) ogledit.h $(DUMMYOBJ)
|
||||||
|
$(cc) @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
palette.obj: view.h doc.h ogledit.h palette.$(SRCSUFF) $(DUMMYOBJ)
|
||||||
|
$(cc) @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc ogl.ico
|
||||||
|
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
|
||||||
|
|
||||||
|
|
||||||
|
cleanogl:
|
||||||
|
cd $(OGLDIR)\src
|
||||||
|
nmake -f makefile.nt clean
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-erase *.obj
|
||||||
|
-erase *.sbr
|
||||||
|
-erase *.exe
|
||||||
|
-erase *.res
|
||||||
|
-erase *.map
|
||||||
|
-erase *.pdb
|
||||||
|
|
33
utils/ogl/samples/ogledit/makefile.sc
Normal file
33
utils/ogl/samples/ogledit/makefile.sc
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Symantec C++ makefile for docview example
|
||||||
|
# NOTE that peripheral libraries are now dealt in main wxWindows makefile.
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
include $(WXDIR)\src\makesc.env
|
||||||
|
|
||||||
|
WXLIB = $(WXDIR)\lib\wx.lib
|
||||||
|
INCDIR = $(WXDIR)\include
|
||||||
|
MSWINC = $(INCDIR)\msw
|
||||||
|
BASEINC = $(INCDIR)\base
|
||||||
|
|
||||||
|
INCLUDE=$(BASEINC);$(MSWINC)
|
||||||
|
|
||||||
|
LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib
|
||||||
|
|
||||||
|
OBJECTS=docview.obj view.obj doc.obj
|
||||||
|
|
||||||
|
.$(SRCSUFF).obj:
|
||||||
|
*$(CC) -c $(CFLAGS) -I$(INCLUDE) $<
|
||||||
|
|
||||||
|
.rc.res:
|
||||||
|
*$(RC) -r -I$(INCLUDE) $<
|
||||||
|
|
||||||
|
docview.exe: $(OBJECTS) docview.def docview.res
|
||||||
|
*$(CC) $(LDFLAGS) -o$@ $(OBJECTS) docview.def $(LIBS)
|
||||||
|
*$(RC) -k docview.res
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-del *.obj
|
||||||
|
-del *.exe
|
||||||
|
-del *.res
|
||||||
|
-del *.map
|
||||||
|
-del *.rws
|
79
utils/ogl/samples/ogledit/makefile.unx
Normal file
79
utils/ogl/samples/ogledit/makefile.unx
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for docview example (UNIX).
|
||||||
|
|
||||||
|
WXDIR = ../../../..
|
||||||
|
|
||||||
|
# All common UNIX compiler flags and options are now in
|
||||||
|
# this central makefile.
|
||||||
|
include $(WXDIR)/src/make.env
|
||||||
|
|
||||||
|
OGLDIR = $(WXDIR)/utils/ogl
|
||||||
|
OGLINC = $(OGLDIR)/src
|
||||||
|
OGLLIB = $(OGLDIR)/lib/libogl$(GUISUFFIX).a
|
||||||
|
|
||||||
|
OBJECTS = $(OBJDIR)/ogledit.$(OBJSUFF) $(OBJDIR)/view.$(OBJSUFF) $(OBJDIR)/doc.$(OBJSUFF) $(OBJDIR)/palette.$(OBJSUFF)
|
||||||
|
|
||||||
|
LDFLAGS = $(XLIB) -L$(WXDIR)/lib -L$(OGLDIR)/lib -L$(MFDIR)/lib
|
||||||
|
|
||||||
|
XVIEWLDLIBS = -logl_ol -lwx_ol -lxview -lolgx -lX11 -lm $(COMPLIBS)
|
||||||
|
MOTIFLDLIBS = -logl_motif -lwx_motif -lXm -lXt -lX11 -lm $(COMPLIBS)
|
||||||
|
HPLDLIBS = -logl_motif -lwx_hp -lXm -lXt -lX11 -lm $(COMPLIBS)
|
||||||
|
|
||||||
|
CPPFLAGS = -I$(OGLINC) -I$(PROLOGINC) -I$(MFINC) $(XINCLUDE) $(INC) $(GUI) -DDEBUG='$(DEBUG)' $(DEBUGFLAGS) $(WARN) $(OPTIONS) -DPROLOGIO
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
all: $(OBJDIR) ogledit$(GUISUFFIX)
|
||||||
|
|
||||||
|
wx_motif:
|
||||||
|
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif
|
||||||
|
|
||||||
|
wx_ol:
|
||||||
|
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
|
||||||
|
motif:
|
||||||
|
$(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
|
||||||
|
|
||||||
|
xview:
|
||||||
|
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)'
|
||||||
|
|
||||||
|
hp:
|
||||||
|
$(MAKE) -f makefile,unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='' WARN='-w' \
|
||||||
|
XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)'
|
||||||
|
|
||||||
|
$(OBJDIR):
|
||||||
|
mkdir $(OBJDIR)
|
||||||
|
|
||||||
|
ogledit$(GUISUFFIX): $(OBJECTS) $(WXLIB)
|
||||||
|
$(CC) $(LDFLAGS) -o ogledit$(GUISUFFIX) $(OBJECTS) $(XVIEW_LINK) $(LDLIBS)
|
||||||
|
|
||||||
|
$(OBJDIR)/ogledit.$(OBJSUFF): ogledit.$(SRCSUFF) ogledit.h doc.h view.h palette.h
|
||||||
|
$(CC) -c $(CPPFLAGS) -o $@ ogledit.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(OBJDIR)/doc.$(OBJSUFF): doc.$(SRCSUFF) doc.h
|
||||||
|
$(CC) -c $(CPPFLAGS) -o $@ doc.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(OBJDIR)/view.$(OBJSUFF): view.$(SRCSUFF) view.h
|
||||||
|
$(CC) -c $(CPPFLAGS) -o $@ view.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(OBJDIR)/palette.$(OBJSUFF): palette.$(SRCSUFF) palette.h
|
||||||
|
$(CC) -c $(CPPFLAGS) -o $@ palette.$(SRCSUFF)
|
||||||
|
|
||||||
|
clean_motif:
|
||||||
|
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
|
||||||
|
|
||||||
|
clean_ol:
|
||||||
|
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
|
||||||
|
|
||||||
|
clean_hp:
|
||||||
|
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
|
||||||
|
|
||||||
|
cleanany:
|
||||||
|
rm -f $(OBJECTS) ogledit(GUISUFFIX) core
|
44
utils/ogl/samples/ogledit/makefile.vms
Normal file
44
utils/ogl/samples/ogledit/makefile.vms
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#************************************************************************
|
||||||
|
# Makefile for DOCVIEW under VMS
|
||||||
|
# by Stefan Hammes
|
||||||
|
# (incomplete) update history:
|
||||||
|
# 09.06.95
|
||||||
|
#************************************************************************
|
||||||
|
|
||||||
|
#************************************************************************
|
||||||
|
# Definition section
|
||||||
|
# (cave: definitions and includes must begin with ',')
|
||||||
|
#************************************************************************
|
||||||
|
|
||||||
|
APPOPTS =
|
||||||
|
APPDEFS =
|
||||||
|
APPINCS =
|
||||||
|
|
||||||
|
#************************************************************************
|
||||||
|
# Module section
|
||||||
|
#************************************************************************
|
||||||
|
|
||||||
|
# Name of main module
|
||||||
|
MAIN = docview
|
||||||
|
|
||||||
|
# Object modules of the application.
|
||||||
|
OBJS = docview.obj view.obj doc.obj
|
||||||
|
OBJLIST =docview.obj,view.obj,doc.obj
|
||||||
|
|
||||||
|
.include [--.src]makevms.env
|
||||||
|
|
||||||
|
# main dependency
|
||||||
|
$(MAIN).exe : $(OBJS)
|
||||||
|
$(LINK) $(LINKFLAGS) /exec=$(MAIN).exe $(OBJLIST),$(WXLIB)/lib,$(OPTSFILE)/option
|
||||||
|
- purge *.exe
|
||||||
|
|
||||||
|
#************************************************************************
|
||||||
|
# Header file depedencies following
|
||||||
|
#************************************************************************
|
||||||
|
|
||||||
|
docview.$(OBJSUFF) : docview.$(SRCSUFF) docview.h doc.h view.h
|
||||||
|
|
||||||
|
doc.$(OBJSUFF) : doc.$(SRCSUFF) doc.h
|
||||||
|
|
||||||
|
view.$(OBJSUFF) : view.$(SRCSUFF) view.h
|
||||||
|
|
43
utils/ogl/samples/ogledit/makefile.wat
Normal file
43
utils/ogl/samples/ogledit/makefile.wat
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#
|
||||||
|
# Makefile for WATCOM
|
||||||
|
#
|
||||||
|
# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
|
||||||
|
# 8 Nov 1994
|
||||||
|
#
|
||||||
|
|
||||||
|
WXDIR = ..\..
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makewat.env
|
||||||
|
|
||||||
|
WXLIB = $(WXDIR)\lib
|
||||||
|
NAME = docview
|
||||||
|
LNK = $(name).lnk
|
||||||
|
OBJS = $(name).obj doc.obj view.obj
|
||||||
|
|
||||||
|
all: $(name).exe
|
||||||
|
|
||||||
|
$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib
|
||||||
|
wlink @$(LNK)
|
||||||
|
$(BINDCOMMAND) $(name).res
|
||||||
|
|
||||||
|
$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc
|
||||||
|
$(RC) $(RESFLAGS1) $(name).rc
|
||||||
|
|
||||||
|
$(LNK) : makefile.wat
|
||||||
|
%create $(LNK)
|
||||||
|
@%append $(LNK) debug all
|
||||||
|
@%append $(LNK) system $(LINKOPTION)
|
||||||
|
@%append $(LNK) $(MINDATA)
|
||||||
|
@%append $(LNK) $(MAXDATA)
|
||||||
|
@%append $(LNK) $(STACK)
|
||||||
|
@%append $(LNK) name $(name)
|
||||||
|
@%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib
|
||||||
|
@for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i
|
||||||
|
@for %i in ($(OBJS)) do @%append $(LNK) file %i
|
||||||
|
|
||||||
|
thing: .SYMBOLIC
|
||||||
|
echo $(WATLIBDIR)
|
||||||
|
|
||||||
|
clean: .SYMBOLIC
|
||||||
|
-erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex
|
||||||
|
|
BIN
utils/ogl/samples/ogledit/ogl.ico
Normal file
BIN
utils/ogl/samples/ogledit/ogl.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
211
utils/ogl/samples/ogledit/ogledit.cpp
Normal file
211
utils/ogl/samples/ogledit/ogledit.cpp
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: ogledit.cpp
|
||||||
|
// Purpose: OGLEdit sample app
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12/07/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
// #pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include <wx/wxprec.h>
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !USE_DOC_VIEW_ARCHITECTURE
|
||||||
|
#error You must set USE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h!
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "ogledit.h"
|
||||||
|
#include "palette.h"
|
||||||
|
#include "doc.h"
|
||||||
|
#include "view.h"
|
||||||
|
|
||||||
|
// A macro needed for some compilers (AIX) that need 'main' to be defined
|
||||||
|
// in the application itself.
|
||||||
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
|
// This statement initialises the whole application
|
||||||
|
MyApp myApp;
|
||||||
|
|
||||||
|
MyApp::MyApp(void)
|
||||||
|
{
|
||||||
|
frame = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The `main program' equivalent, creating the windows and returning the
|
||||||
|
// main frame
|
||||||
|
bool MyApp::OnInit(void)
|
||||||
|
{
|
||||||
|
wxOGLInitialize();
|
||||||
|
|
||||||
|
//// Create a document manager
|
||||||
|
wxDocManager *myDocManager = new wxDocManager;
|
||||||
|
|
||||||
|
//// Create a template relating drawing documents to their views
|
||||||
|
(void) new wxDocTemplate(myDocManager, "Diagram", "*.dia", "", "dia", "Diagram Doc", "Diagram View",
|
||||||
|
CLASSINFO(DiagramDocument), CLASSINFO(DiagramView));
|
||||||
|
|
||||||
|
// If we've only got one window, we only get to edit
|
||||||
|
// one document at a time.
|
||||||
|
myDocManager->SetMaxDocsOpen(1);
|
||||||
|
|
||||||
|
//// Create the main frame window
|
||||||
|
frame = new MyFrame(myDocManager, NULL, "OGLEdit Demo", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
|
||||||
|
|
||||||
|
//// Give it an icon
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
frame->SetIcon(wxIcon("ogl_icn"));
|
||||||
|
#endif
|
||||||
|
#ifdef __X__
|
||||||
|
frame->SetIcon(wxIcon("ogl.xbm"));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//// Make a menubar
|
||||||
|
wxMenu *file_menu = new wxMenu;
|
||||||
|
wxMenu *edit_menu = NULL;
|
||||||
|
|
||||||
|
file_menu->Append(wxID_NEW, "&New...");
|
||||||
|
file_menu->Append(wxID_OPEN, "&Open...");
|
||||||
|
|
||||||
|
file_menu->Append(wxID_CLOSE, "&Close");
|
||||||
|
file_menu->Append(wxID_SAVE, "&Save");
|
||||||
|
file_menu->Append(wxID_SAVEAS, "Save &As...");
|
||||||
|
file_menu->AppendSeparator();
|
||||||
|
file_menu->Append(wxID_PRINT, "&Print...");
|
||||||
|
file_menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
|
||||||
|
file_menu->Append(wxID_PREVIEW, "Print Pre&view");
|
||||||
|
|
||||||
|
edit_menu = new wxMenu;
|
||||||
|
edit_menu->Append(wxID_UNDO, "&Undo");
|
||||||
|
edit_menu->Append(wxID_REDO, "&Redo");
|
||||||
|
edit_menu->AppendSeparator();
|
||||||
|
edit_menu->Append(OGLEDIT_CUT, "&Cut");
|
||||||
|
edit_menu->AppendSeparator();
|
||||||
|
edit_menu->Append(OGLEDIT_CHANGE_BACKGROUND_COLOUR, "Change &background colour");
|
||||||
|
edit_menu->Append(OGLEDIT_EDIT_LABEL, "Edit &label");
|
||||||
|
|
||||||
|
frame->editMenu = edit_menu;
|
||||||
|
|
||||||
|
file_menu->AppendSeparator();
|
||||||
|
file_menu->Append(wxID_EXIT, "E&xit");
|
||||||
|
|
||||||
|
// A nice touch: a history of files visited. Use this menu.
|
||||||
|
myDocManager->FileHistoryUseMenu(file_menu);
|
||||||
|
|
||||||
|
wxMenu *help_menu = new wxMenu;
|
||||||
|
help_menu->Append(OGLEDIT_ABOUT, "&About");
|
||||||
|
|
||||||
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
|
|
||||||
|
menu_bar->Append(file_menu, "&File");
|
||||||
|
if (edit_menu)
|
||||||
|
menu_bar->Append(edit_menu, "&Edit");
|
||||||
|
menu_bar->Append(help_menu, "&Help");
|
||||||
|
|
||||||
|
frame->canvas = frame->CreateCanvas(NULL, frame);
|
||||||
|
frame->palette = myApp.CreatePalette(frame);
|
||||||
|
myDocManager->CreateDocument("", wxDOC_NEW);
|
||||||
|
|
||||||
|
//// Associate the menu bar with the frame
|
||||||
|
frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
|
frame->CreateStatusBar(1);
|
||||||
|
|
||||||
|
frame->Centre(wxBOTH);
|
||||||
|
frame->Show(TRUE);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the top-level window of the application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS(MyFrame, wxDocParentFrame)
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyFrame, wxDocParentFrame)
|
||||||
|
EVT_MENU(OGLEDIT_ABOUT, MyFrame::OnAbout)
|
||||||
|
EVT_SIZE(MyFrame::OnSize)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
MyFrame::MyFrame(wxDocManager *manager, wxFrame *frame, const wxString& title,
|
||||||
|
const wxPoint& pos, const wxSize& size, long type):
|
||||||
|
wxDocParentFrame(manager, frame, -1, title, pos, size, type)
|
||||||
|
{
|
||||||
|
canvas = NULL;
|
||||||
|
palette = NULL;
|
||||||
|
editMenu = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnSize(wxSizeEvent& event)
|
||||||
|
{
|
||||||
|
if (canvas && palette)
|
||||||
|
{
|
||||||
|
int cw, ch;
|
||||||
|
GetClientSize(&cw, &ch);
|
||||||
|
int paletteX = 0;
|
||||||
|
int paletteY = 0;
|
||||||
|
int paletteW = 30;
|
||||||
|
int paletteH = ch;
|
||||||
|
int canvasX = paletteX + paletteW;
|
||||||
|
int canvasY = 0;
|
||||||
|
int canvasW = cw - paletteW;
|
||||||
|
int canvasH = ch;
|
||||||
|
|
||||||
|
palette->SetSize(paletteX, paletteY, paletteW, paletteH);
|
||||||
|
canvas->SetSize(canvasX, canvasY, canvasW, canvasH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MyFrame::OnClose(void)
|
||||||
|
{
|
||||||
|
if (wxDocParentFrame::OnClose())
|
||||||
|
{
|
||||||
|
wxOGLCleanUp();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intercept menu commands
|
||||||
|
void MyFrame::OnAbout(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
(void)wxMessageBox("OGLEdit Demo\nTo draw a shape, select a shape on the toolbar and left-click on the canvas.\nTo draw a line, right-drag between shapes.\nFor further details, see the OGL manual.\n (c) Julian Smart 1996", "About OGLEdit");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates a canvas. Called by OnInit as a child of the main window
|
||||||
|
MyCanvas *MyFrame::CreateCanvas(wxView *view, wxFrame *parent)
|
||||||
|
{
|
||||||
|
int width, height;
|
||||||
|
parent->GetClientSize(&width, &height);
|
||||||
|
|
||||||
|
// Non-retained canvas
|
||||||
|
MyCanvas *canvas = new MyCanvas(view, parent, -1, wxPoint(0, 0), wxSize(width, height), 0);
|
||||||
|
wxCursor *cursor = new wxCursor(wxCURSOR_HAND);
|
||||||
|
canvas->SetCursor(cursor);
|
||||||
|
|
||||||
|
// Give it scrollbars
|
||||||
|
canvas->SetScrollbars(20, 20, 50, 50);
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyFrame *GetMainFrame(void)
|
||||||
|
{
|
||||||
|
return myApp.frame;
|
||||||
|
}
|
||||||
|
|
8
utils/ogl/samples/ogledit/ogledit.def
Normal file
8
utils/ogl/samples/ogledit/ogledit.def
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
NAME OGLEdit
|
||||||
|
DESCRIPTION 'OGL Editor Sample'
|
||||||
|
EXETYPE WINDOWS
|
||||||
|
STUB 'WINSTUB.EXE'
|
||||||
|
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||||
|
DATA PRELOAD MOVEABLE MULTIPLE
|
||||||
|
HEAPSIZE 1024
|
||||||
|
STACKSIZE 8192
|
75
utils/ogl/samples/ogledit/ogledit.h
Normal file
75
utils/ogl/samples/ogledit/ogledit.h
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: ogledit.h
|
||||||
|
// Purpose: OGL sample
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12/07/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
// #pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _OGLSAMPLE_OGLEDIT_H_
|
||||||
|
#define _OGLSAMPLE_OGLEDIT_H_
|
||||||
|
|
||||||
|
#include <wx/docview.h>
|
||||||
|
|
||||||
|
// Define a new application
|
||||||
|
class MyFrame;
|
||||||
|
class EditorToolPalette;
|
||||||
|
class MyApp: public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyFrame *frame;
|
||||||
|
|
||||||
|
MyApp(void);
|
||||||
|
bool OnInit(void);
|
||||||
|
|
||||||
|
// Palette stuff
|
||||||
|
EditorToolPalette *CreatePalette(wxFrame *parent);
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_APP(MyApp)
|
||||||
|
|
||||||
|
// Define a new frame
|
||||||
|
class MyCanvas;
|
||||||
|
class MyFrame: public wxDocParentFrame
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(MyFrame)
|
||||||
|
public:
|
||||||
|
wxMenu *editMenu;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
MyCanvas *CreateCanvas(wxView *view, wxFrame *parent);
|
||||||
|
void OnSize(wxSizeEvent& event);
|
||||||
|
bool OnClose(void);
|
||||||
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// _OGLSAMPLE_OGLEDIT_H_
|
10
utils/ogl/samples/ogledit/ogledit.rc
Normal file
10
utils/ogl/samples/ogledit/ogledit.rc
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
ogl_icn ICON ogl.ico
|
||||||
|
|
||||||
|
TOOL1 BITMAP "bitmaps/tool1.bmp"
|
||||||
|
TOOL2 BITMAP "bitmaps/tool2.bmp"
|
||||||
|
TOOL3 BITMAP "bitmaps/tool3.bmp"
|
||||||
|
TOOL4 BITMAP "bitmaps/tool4.bmp"
|
||||||
|
ARROWTOOL BITMAP "bitmaps/arrow.bmp"
|
||||||
|
|
||||||
|
#include "wx/msw/wx.rc"
|
||||||
|
|
115
utils/ogl/samples/ogledit/palette.cpp
Normal file
115
utils/ogl/samples/ogledit/palette.cpp
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: palette.cpp
|
||||||
|
// Purpose: OGLEdit palette
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12/07/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
// #pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include <wx/wxprec.h>
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <wx/tbar95.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "doc.h"
|
||||||
|
#include "view.h"
|
||||||
|
#include "ogledit.h"
|
||||||
|
#include "palette.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Object editor tool palette
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
EditorToolPalette::EditorToolPalette(wxWindow* parent, const wxPoint& pos, const wxSize& size,
|
||||||
|
long style):
|
||||||
|
TOOLPALETTECLASS(parent, -1, pos, size, style)
|
||||||
|
{
|
||||||
|
currentlySelected = -1;
|
||||||
|
|
||||||
|
SetMaxRowsCols(1000, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditorToolPalette::OnLeftClick(int toolIndex, bool toggled)
|
||||||
|
{
|
||||||
|
// BEGIN mutual exclusivity code
|
||||||
|
if (toggled && (currentlySelected != -1) && (toolIndex != currentlySelected))
|
||||||
|
ToggleTool(currentlySelected, FALSE);
|
||||||
|
|
||||||
|
if (toggled)
|
||||||
|
currentlySelected = toolIndex;
|
||||||
|
else if (currentlySelected == toolIndex)
|
||||||
|
currentlySelected = -1;
|
||||||
|
// END mutual exclusivity code
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditorToolPalette::OnMouseEnter(int toolIndex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditorToolPalette::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
|
{
|
||||||
|
TOOLPALETTECLASS::SetSize(x, y, width, height, sizeFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorToolPalette *MyApp::CreatePalette(wxFrame *parent)
|
||||||
|
{
|
||||||
|
// Load palette bitmaps
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
wxBitmap PaletteTool1("TOOL1");
|
||||||
|
wxBitmap PaletteTool2("TOOL2");
|
||||||
|
wxBitmap PaletteTool3("TOOL3");
|
||||||
|
wxBitmap PaletteTool4("TOOL4");
|
||||||
|
wxBitmap PaletteArrow("ARROWTOOL");
|
||||||
|
#endif
|
||||||
|
#ifdef __X__
|
||||||
|
wxBitmap PaletteTool1(tool1_bits, tool1_width, tool1_height);
|
||||||
|
wxBitmap PaletteTool2(tool2_bits, tool2_width, tool2_height);
|
||||||
|
wxBitmap PaletteTool3(tool3_bits, tool3_width, tool3_height);
|
||||||
|
wxBitmap PaletteTool4(tool4_bits, tool4_width, tool4_height);
|
||||||
|
wxBitmap PaletteArrow(arrow_bits, arrow_width, arrow_height);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EditorToolPalette *palette = new EditorToolPalette(parent, wxPoint(0, 0), wxSize(-1, -1), wxTB_HORIZONTAL);
|
||||||
|
|
||||||
|
palette->SetMargins(2, 2);
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
if (palette->IsKindOf(CLASSINFO(wxToolBar95)))
|
||||||
|
((wxToolBar95 *)palette)->SetToolBitmapSize(wxSize(22, 22));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
palette->AddTool(PALETTE_ARROW, PaletteArrow, wxNullBitmap, TRUE, 0, -1, NULL, "Pointer");
|
||||||
|
palette->AddTool(PALETTE_TOOL1, PaletteTool1, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 1");
|
||||||
|
palette->AddTool(PALETTE_TOOL2, PaletteTool2, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 2");
|
||||||
|
palette->AddTool(PALETTE_TOOL3, PaletteTool3, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 3");
|
||||||
|
palette->AddTool(PALETTE_TOOL4, PaletteTool4, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 4");
|
||||||
|
|
||||||
|
palette->Realize();
|
||||||
|
|
||||||
|
palette->ToggleTool(PALETTE_ARROW, TRUE);
|
||||||
|
palette->currentlySelected = PALETTE_ARROW;
|
||||||
|
return palette;
|
||||||
|
}
|
||||||
|
|
58
utils/ogl/samples/ogledit/palette.h
Normal file
58
utils/ogl/samples/ogledit/palette.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: palette.h
|
||||||
|
// Purpose: OGL sample palette
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12/07/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _OGLSAMPLE_PALETTE_H_
|
||||||
|
#define _OGLSAMPLE_PALETTE_H_
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
// #pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#include <wx/string.h>
|
||||||
|
#include <wx/tbarsmpl.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.
|
||||||
|
#define TOOLPALETTECLASS wxToolBarSimple
|
||||||
|
|
||||||
|
class EditorToolPalette: public TOOLPALETTECLASS
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int currentlySelected;
|
||||||
|
|
||||||
|
EditorToolPalette(wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTB_VERTICAL);
|
||||||
|
bool OnLeftClick(int toolIndex, bool toggled);
|
||||||
|
void OnMouseEnter(int toolIndex);
|
||||||
|
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
||||||
|
};
|
||||||
|
|
||||||
|
#define PALETTE_TOOL1 1
|
||||||
|
#define PALETTE_TOOL2 2
|
||||||
|
#define PALETTE_TOOL3 3
|
||||||
|
#define PALETTE_TOOL4 4
|
||||||
|
#define PALETTE_TOOL5 5
|
||||||
|
#define PALETTE_TOOL6 6
|
||||||
|
#define PALETTE_TOOL7 7
|
||||||
|
#define PALETTE_TOOL8 8
|
||||||
|
#define PALETTE_TOOL9 9
|
||||||
|
#define PALETTE_ARROW 10
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// _OGLSAMPLE_PALETTE_H_
|
264
utils/ogl/samples/ogledit/view.cpp
Normal file
264
utils/ogl/samples/ogledit/view.cpp
Normal file
@@ -0,0 +1,264 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: view.cpp
|
||||||
|
// Purpose: Implements view functionality in OGLEdit
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12/07/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
// #pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include <wx/wxprec.h>
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <wx/colordlg.h>
|
||||||
|
|
||||||
|
#if !USE_DOC_VIEW_ARCHITECTURE
|
||||||
|
#error You must set USE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h!
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "ogledit.h"
|
||||||
|
#include "doc.h"
|
||||||
|
#include "view.h"
|
||||||
|
#include "palette.h"
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(DiagramView, wxView)
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(DiagramView, wxView)
|
||||||
|
EVT_MENU(OGLEDIT_CUT, DiagramView::OnCut)
|
||||||
|
EVT_MENU(OGLEDIT_CHANGE_BACKGROUND_COLOUR, DiagramView::OnChangeBackgroundColour)
|
||||||
|
EVT_MENU(OGLEDIT_EDIT_LABEL, DiagramView::OnEditLabel)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
// What to do when a view is created. Creates actual
|
||||||
|
// windows for displaying the view.
|
||||||
|
bool DiagramView::OnCreate(wxDocument *doc, long flags)
|
||||||
|
{
|
||||||
|
frame = GetMainFrame();
|
||||||
|
canvas = GetMainFrame()->canvas;
|
||||||
|
canvas->view = this;
|
||||||
|
|
||||||
|
SetFrame(frame);
|
||||||
|
Activate(TRUE);
|
||||||
|
|
||||||
|
// Initialize the edit menu Undo and Redo items
|
||||||
|
doc->GetCommandProcessor()->SetEditMenu(((MyFrame *)frame)->editMenu);
|
||||||
|
doc->GetCommandProcessor()->Initialize();
|
||||||
|
|
||||||
|
wxShapeCanvas *shapeCanvas = (wxShapeCanvas *)canvas;
|
||||||
|
DiagramDocument *diagramDoc = (DiagramDocument *)doc;
|
||||||
|
shapeCanvas->SetDiagram(diagramDoc->GetDiagram());
|
||||||
|
diagramDoc->GetDiagram()->SetCanvas(shapeCanvas);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sneakily gets used for default print/preview
|
||||||
|
// as well as drawing on the screen.
|
||||||
|
void DiagramView::OnDraw(wxDC *dc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramView::OnUpdate(wxView *sender, wxObject *hint)
|
||||||
|
{
|
||||||
|
if (canvas)
|
||||||
|
canvas->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean up windows used for displaying the view.
|
||||||
|
bool DiagramView::OnClose(bool deleteWindow)
|
||||||
|
{
|
||||||
|
if (!GetDocument()->Close())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
DiagramDocument *diagramDoc = (DiagramDocument *)GetDocument();
|
||||||
|
diagramDoc->GetDiagram()->SetCanvas(NULL);
|
||||||
|
|
||||||
|
canvas->Clear();
|
||||||
|
canvas->SetDiagram(NULL);
|
||||||
|
canvas->view = NULL;
|
||||||
|
canvas = NULL;
|
||||||
|
|
||||||
|
wxString s = wxTheApp->GetAppName();
|
||||||
|
if (frame)
|
||||||
|
frame->SetTitle(s);
|
||||||
|
|
||||||
|
SetFrame(NULL);
|
||||||
|
|
||||||
|
Activate(FALSE);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxShape *DiagramView::FindSelectedShape(void)
|
||||||
|
{
|
||||||
|
DiagramDocument *doc = (DiagramDocument *)GetDocument();
|
||||||
|
wxShape *theShape = NULL;
|
||||||
|
wxNode *node = doc->GetDiagram()->GetShapeList()->First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxShape *eachShape = (wxShape *)node->Data();
|
||||||
|
if ((eachShape->GetParent() == NULL) && eachShape->Selected())
|
||||||
|
{
|
||||||
|
theShape = eachShape;
|
||||||
|
node = NULL;
|
||||||
|
}
|
||||||
|
else node = node->Next();
|
||||||
|
}
|
||||||
|
return theShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramView::OnCut(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
DiagramDocument *doc = (DiagramDocument *)GetDocument();
|
||||||
|
|
||||||
|
wxShape *theShape = FindSelectedShape();
|
||||||
|
if (theShape)
|
||||||
|
doc->GetCommandProcessor()->Submit(new DiagramCommand("Cut", OGLEDIT_CUT, doc, NULL, 0.0, 0.0, TRUE, theShape));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramView::OnChangeBackgroundColour(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
DiagramDocument *doc = (DiagramDocument *)GetDocument();
|
||||||
|
|
||||||
|
wxShape *theShape = FindSelectedShape();
|
||||||
|
if (theShape)
|
||||||
|
{
|
||||||
|
wxColourData data;
|
||||||
|
data.SetChooseFull(TRUE);
|
||||||
|
data.SetColour(theShape->GetBrush()->GetColour());
|
||||||
|
|
||||||
|
wxColourDialog *dialog = new wxColourDialog(frame, &data);
|
||||||
|
wxBrush *theBrush = NULL;
|
||||||
|
if (dialog->ShowModal() == wxID_OK)
|
||||||
|
{
|
||||||
|
wxColourData retData = dialog->GetColourData();
|
||||||
|
wxColour col = retData.GetColour();
|
||||||
|
theBrush = wxTheBrushList->FindOrCreateBrush(col, wxSOLID);
|
||||||
|
}
|
||||||
|
dialog->Close();
|
||||||
|
|
||||||
|
if (theBrush)
|
||||||
|
doc->GetCommandProcessor()->Submit(new DiagramCommand("Change colour", OGLEDIT_CHANGE_BACKGROUND_COLOUR, doc,
|
||||||
|
theBrush, theShape));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramView::OnEditLabel(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
wxShape *theShape = FindSelectedShape();
|
||||||
|
if (theShape)
|
||||||
|
{
|
||||||
|
wxString newLabel = wxGetTextFromUser("Enter new label", "Shape Label", ((MyEvtHandler *)theShape->GetEventHandler())->label);
|
||||||
|
GetDocument()->GetCommandProcessor()->Submit(new DiagramCommand("Edit label", OGLEDIT_EDIT_LABEL, (DiagramDocument*) GetDocument(), newLabel, theShape));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Window implementations
|
||||||
|
*/
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyCanvas, wxShapeCanvas)
|
||||||
|
EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent)
|
||||||
|
EVT_PAINT(MyCanvas::OnPaint)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
// Define a constructor for my canvas
|
||||||
|
MyCanvas::MyCanvas(wxView *v, wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
||||||
|
const wxSize& size, long style):
|
||||||
|
wxShapeCanvas(parent, id, pos, size, style)
|
||||||
|
{
|
||||||
|
view = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyCanvas::~MyCanvas(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnLeftClick(float x, float y, int keys)
|
||||||
|
{
|
||||||
|
EditorToolPalette *palette = wxGetApp().frame->palette;
|
||||||
|
wxClassInfo *info = NULL;
|
||||||
|
switch (palette->currentlySelected)
|
||||||
|
{
|
||||||
|
case PALETTE_TOOL1:
|
||||||
|
{
|
||||||
|
info = CLASSINFO(wxRectangleShape);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PALETTE_TOOL2:
|
||||||
|
{
|
||||||
|
info = CLASSINFO(wxRoundedRectangleShape);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PALETTE_TOOL3:
|
||||||
|
{
|
||||||
|
info = CLASSINFO(wxEllipseShape);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PALETTE_TOOL4:
|
||||||
|
{
|
||||||
|
info = CLASSINFO(wxDiamondShape);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (info)
|
||||||
|
{
|
||||||
|
view->GetDocument()->GetCommandProcessor()->Submit(new DiagramCommand(info->GetClassName(), OGLEDIT_ADD_SHAPE, (DiagramDocument *)view->GetDocument(), info,
|
||||||
|
x, y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnRightClick(float x, float y, int keys)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnDragLeft(bool draw, float x, float y, int keys)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnBeginDragLeft(float x, float y, int keys)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnEndDragLeft(float x, float y, int keys)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnDragRight(bool draw, float x, float y, int keys)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnBeginDragRight(float x, float y, int keys)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnEndDragRight(float x, float y, int keys)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnMouseEvent(wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
wxShapeCanvas::OnMouseEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnPaint(wxPaintEvent& event)
|
||||||
|
{
|
||||||
|
// if (GetDiagram())
|
||||||
|
wxShapeCanvas::OnPaint(event);
|
||||||
|
}
|
79
utils/ogl/samples/ogledit/view.h
Normal file
79
utils/ogl/samples/ogledit/view.h
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: view.h
|
||||||
|
// Purpose: View-related classes
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12/07/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _OGLSAMPLE_VIEW_H_
|
||||||
|
#define _OGLSAMPLE_VIEW_H_
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
// #pragma interface "view.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "doc.h"
|
||||||
|
#include "ogl.h"
|
||||||
|
|
||||||
|
class MyCanvas: public wxShapeCanvas
|
||||||
|
{
|
||||||
|
// DECLARE_DYNAMIC_CLASS(wxShapeCanvas)
|
||||||
|
protected:
|
||||||
|
public:
|
||||||
|
wxView *view;
|
||||||
|
|
||||||
|
MyCanvas(wxView *view, wxWindow *parent = NULL, wxWindowID id = -1,
|
||||||
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxRETAINED);
|
||||||
|
~MyCanvas(void);
|
||||||
|
|
||||||
|
void OnMouseEvent(wxMouseEvent& event);
|
||||||
|
void OnPaint(wxPaintEvent& event);
|
||||||
|
|
||||||
|
virtual void OnLeftClick(float x, float y, int keys = 0);
|
||||||
|
virtual void OnRightClick(float x, float y, int keys = 0);
|
||||||
|
|
||||||
|
virtual void OnDragLeft(bool draw, float x, float y, int keys=0); // Erase if draw false
|
||||||
|
virtual void OnBeginDragLeft(float x, float y, int keys=0);
|
||||||
|
virtual void OnEndDragLeft(float x, float y, int keys=0);
|
||||||
|
|
||||||
|
virtual void OnDragRight(bool draw, float x, float y, int keys=0); // Erase if draw false
|
||||||
|
virtual void OnBeginDragRight(float x, float y, int keys=0);
|
||||||
|
virtual void OnEndDragRight(float x, float y, int keys=0);
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
class DiagramView: public wxView
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(DiagramView)
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
wxFrame *frame;
|
||||||
|
MyCanvas *canvas;
|
||||||
|
|
||||||
|
DiagramView(void) { canvas = NULL; frame = NULL; };
|
||||||
|
~DiagramView(void) {};
|
||||||
|
|
||||||
|
bool OnCreate(wxDocument *doc, long flags);
|
||||||
|
void OnDraw(wxDC *dc);
|
||||||
|
void OnUpdate(wxView *sender, wxObject *hint = NULL);
|
||||||
|
bool OnClose(bool deleteWindow = TRUE);
|
||||||
|
|
||||||
|
wxShape *FindSelectedShape(void);
|
||||||
|
|
||||||
|
// void OnMenuCommand(int cmd);
|
||||||
|
|
||||||
|
void OnCut(wxCommandEvent& event);
|
||||||
|
void OnChangeBackgroundColour(wxCommandEvent& event);
|
||||||
|
void OnEditLabel(wxCommandEvent& event);
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// _OGLSAMPLE_VIEW_H_
|
@@ -102,8 +102,8 @@ class wxShapeRegion;
|
|||||||
class wxShape;
|
class wxShape;
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
class wxExpr;
|
class WXDLLEXPORT wxExpr;
|
||||||
class wxDatabase;
|
class WXDLLEXPORT wxExprDatabase;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class wxShapeEvtHandler: public wxObject
|
class wxShapeEvtHandler: public wxObject
|
||||||
|
Reference in New Issue
Block a user