2000-03-03 06:25:10 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: palette.cpp
|
|
|
|
// Purpose: OGLEdit palette
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 12/07/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
2004-06-09 12:42:34 -04:00
|
|
|
// Licence: wxWindows licence
|
2000-03-03 06:25:10 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
// #pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// For compilers that support precompilation, includes "wx.h".
|
2001-10-30 08:33:34 -05:00
|
|
|
#include "wx/wxprec.h"
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
#include <wx/wx.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <wx/toolbar.h>
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "doc.h"
|
|
|
|
#include "view.h"
|
|
|
|
#include "ogledit.h"
|
|
|
|
#include "palette.h"
|
|
|
|
|
|
|
|
// Include pixmaps
|
|
|
|
#include "bitmaps/arrow.xpm"
|
|
|
|
#include "bitmaps/tool1.xpm"
|
|
|
|
#include "bitmaps/tool2.xpm"
|
|
|
|
#include "bitmaps/tool3.xpm"
|
|
|
|
#include "bitmaps/tool4.xpm"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Object editor tool palette
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
EditorToolPalette::EditorToolPalette(wxWindow* parent, const wxPoint& pos, const wxSize& size,
|
|
|
|
long style):
|
2004-06-09 12:42:34 -04:00
|
|
|
TOOLPALETTECLASS(parent, wxID_ANY, pos, size, style)
|
2000-03-03 06:25:10 -05:00
|
|
|
{
|
2003-12-29 05:47:51 -05:00
|
|
|
currentlySelected = -1;
|
2000-03-03 06:25:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorToolPalette::OnLeftClick(int toolIndex, bool toggled)
|
|
|
|
{
|
|
|
|
// BEGIN mutual exclusivity code
|
|
|
|
if (toggled && (currentlySelected != -1) && (toolIndex != currentlySelected))
|
2004-06-09 12:42:34 -04:00
|
|
|
ToggleTool(currentlySelected, false);
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
if (toggled)
|
|
|
|
currentlySelected = toolIndex;
|
|
|
|
else if (currentlySelected == toolIndex)
|
|
|
|
currentlySelected = -1;
|
|
|
|
// END mutual exclusivity code
|
|
|
|
|
2004-06-09 12:42:34 -04:00
|
|
|
return true;
|
2000-03-03 06:25:10 -05:00
|
|
|
}
|
|
|
|
|
2003-08-21 05:05:56 -04:00
|
|
|
void EditorToolPalette::OnMouseEnter(int WXUNUSED(toolIndex))
|
2000-03-03 06:25:10 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2003-12-29 05:47:51 -05:00
|
|
|
// Load palette bitmaps. MSW-specific bitmaps no
|
|
|
|
// longer needed.
|
|
|
|
#if 0
|
2003-08-21 05:05:56 -04:00
|
|
|
wxBitmap PaletteTool1(_T("TOOL1"));
|
|
|
|
wxBitmap PaletteTool2(_T("TOOL2"));
|
|
|
|
wxBitmap PaletteTool3(_T("TOOL3"));
|
|
|
|
wxBitmap PaletteTool4(_T("TOOL4"));
|
|
|
|
wxBitmap PaletteArrow(_T("ARROWTOOL"));
|
2003-12-29 05:47:51 -05:00
|
|
|
#else
|
2000-03-03 06:25:10 -05:00
|
|
|
wxBitmap PaletteTool1(tool1_xpm);
|
|
|
|
wxBitmap PaletteTool2(tool2_xpm);
|
|
|
|
wxBitmap PaletteTool3(tool3_xpm);
|
|
|
|
wxBitmap PaletteTool4(tool4_xpm);
|
|
|
|
wxBitmap PaletteArrow(arrow_xpm);
|
|
|
|
#endif
|
|
|
|
|
2004-06-09 12:42:34 -04:00
|
|
|
EditorToolPalette *palette = new EditorToolPalette(parent, wxPoint(0, 0), wxDefaultSize,
|
2003-12-29 05:47:51 -05:00
|
|
|
wxTB_VERTICAL);
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
palette->SetMargins(2, 2);
|
|
|
|
palette->SetToolBitmapSize(wxSize(22, 22));
|
|
|
|
|
2004-07-20 06:09:47 -04:00
|
|
|
palette->AddTool(PALETTE_ARROW, PaletteArrow, wxNullBitmap, true, 0, wxDefaultCoord, NULL, _T("Pointer"));
|
|
|
|
palette->AddTool(PALETTE_TOOL1, PaletteTool1, wxNullBitmap, true, 0, wxDefaultCoord, NULL, _T("Tool 1"));
|
|
|
|
palette->AddTool(PALETTE_TOOL2, PaletteTool2, wxNullBitmap, true, 0, wxDefaultCoord, NULL, _T("Tool 2"));
|
|
|
|
palette->AddTool(PALETTE_TOOL3, PaletteTool3, wxNullBitmap, true, 0, wxDefaultCoord, NULL, _T("Tool 3"));
|
|
|
|
palette->AddTool(PALETTE_TOOL4, PaletteTool4, wxNullBitmap, true, 0, wxDefaultCoord, NULL, _T("Tool 4"));
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
palette->Realize();
|
|
|
|
|
2004-06-09 12:42:34 -04:00
|
|
|
palette->ToggleTool(PALETTE_ARROW, true);
|
2000-03-03 06:25:10 -05:00
|
|
|
palette->currentlySelected = PALETTE_ARROW;
|
|
|
|
return palette;
|
|
|
|
}
|
|
|
|
|