Interact.cpp: Use double instead of float for storing absolute times (since the precision is required).
Atlas: Nicer handling of menus. This was SVN commit r2400.
This commit is contained in:
parent
471fd5d6f3
commit
92d221f183
@ -260,6 +260,10 @@ public:
|
||||
// the number of times the following code is called - it looks like
|
||||
// a rather worrying amount of work for rendering a single button...
|
||||
|
||||
// Also TODO: DOT3_RGB requires GL_(EXT|ARB)_texture_env_dot3. What should
|
||||
// we do if that's not supported? (Probable answer: blindly ignore the problem,
|
||||
// since it's only relevant for TNT2 / RAGE 128 / etc.)
|
||||
|
||||
// Texture unit 0:
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
@ -22,7 +22,7 @@ extern bool keys[SDLK_LAST];
|
||||
extern bool g_active;
|
||||
extern CStr g_CursorName;
|
||||
|
||||
static const float SELECT_DBLCLICK_RATE = 0.5f;
|
||||
static const double SELECT_DBLCLICK_RATE = 0.5;
|
||||
const int ORDER_DELAY = 5;
|
||||
|
||||
bool customSelectionMode=false;
|
||||
@ -784,7 +784,7 @@ int interactInputHandler( const SDL_Event* ev )
|
||||
|
||||
// One entry for each of five mouse buttons (SDL mouse buttons 1-5, mouse
|
||||
// buttons over 5 if existant, will be ignored)
|
||||
static float lastclicktime[5] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
|
||||
static double lastclicktime[5] = {0.0, 0.0, 0.0, 0.0, 0.0};
|
||||
static HEntity lastclickobject[5];
|
||||
static u8 clicks[5] = {0, 0, 0, 0, 0};
|
||||
|
||||
@ -863,8 +863,7 @@ int interactInputHandler( const SDL_Event* ev )
|
||||
// arrays above.
|
||||
if (button >= 0 && button < 5)
|
||||
{
|
||||
float time;
|
||||
time = (float)get_time();
|
||||
double time = get_time();
|
||||
// Reset clicks counter if too slow or if the cursor's
|
||||
// hovering over something else now.
|
||||
|
||||
|
@ -9,19 +9,21 @@
|
||||
#include "wx/file.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(ActorEditor, AtlasWindow)
|
||||
EVT_MENU(ID_Custom1, OnCreateEntity)
|
||||
EVT_MENU(ID_CreateEntity, OnCreateEntity)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
static AtlasWindow::CustomMenu::CustomMenuItem menuItem1 = { _("Create &entity...") };
|
||||
static AtlasWindow::CustomMenu::CustomMenuItem* menuItems[] = { &menuItem1, NULL };
|
||||
static AtlasWindow::CustomMenu menu = { _("&Actor"), menuItems };
|
||||
|
||||
ActorEditor::ActorEditor(wxWindow* parent)
|
||||
: AtlasWindow(parent, _("Actor Editor"), wxSize(1024, 450), &menu)
|
||||
: AtlasWindow(parent, _("Actor Editor"), wxSize(1024, 450))
|
||||
{
|
||||
SetIcon(wxIcon(_T("ICON_ActorEditor")));
|
||||
|
||||
wxMenu* menu = new wxMenu;
|
||||
menu->Append(ID_CreateEntity, _("Create &entity..."));
|
||||
AddCustomMenu(menu, _("&Actor"));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxPanel* mainPanel = new wxPanel(this);
|
||||
|
||||
m_ActorEditorListCtrl = new ActorEditorListCtrl(mainPanel);
|
||||
@ -80,7 +82,6 @@ ActorEditor::ActorEditor(wxWindow* parent)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ActorEditor::ThawData(AtObj& in)
|
||||
{
|
||||
AtObj actor (in["actor"]);
|
||||
|
@ -4,6 +4,11 @@ class ActorEditorListCtrl;
|
||||
|
||||
class ActorEditor : public AtlasWindow
|
||||
{
|
||||
enum
|
||||
{
|
||||
ID_CreateEntity = ID_Custom
|
||||
};
|
||||
|
||||
public:
|
||||
ActorEditor(wxWindow* parent);
|
||||
|
||||
|
@ -70,16 +70,16 @@ BEGIN_EVENT_TABLE(AtlasWindow, wxFrame)
|
||||
EVT_CLOSE(AtlasWindow::OnClose)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
AtlasWindow::AtlasWindow(wxWindow* parent, const wxString& title, const wxSize& size, CustomMenu* menu)
|
||||
AtlasWindow::AtlasWindow(wxWindow* parent, const wxString& title, const wxSize& size)
|
||||
: wxFrame(parent, wxID_ANY, _T(""), wxDefaultPosition, size),
|
||||
m_WindowTitle(title), m_FileHistory(9)
|
||||
{
|
||||
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
SetMenuBar(menuBar);
|
||||
m_MenuBar = new wxMenuBar;
|
||||
SetMenuBar(m_MenuBar);
|
||||
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
menuBar->Append(menuFile, _("&File"));
|
||||
m_MenuBar->Append(menuFile, _("&File"));
|
||||
{
|
||||
menuFile->Append(ID_New, _("&New"));
|
||||
// menuFile->Append(ID_Import, _("&Import..."));
|
||||
@ -93,11 +93,11 @@ AtlasWindow::AtlasWindow(wxWindow* parent, const wxString& title, const wxSize&
|
||||
m_FileHistory.AddFilesToMenu();
|
||||
}
|
||||
|
||||
m_menuItem_Save = menuFile->FindItem(ID_Save); // to let it be greyed out
|
||||
m_menuItem_Save = menuFile->FindItem(ID_Save); // remember this item, to let it be greyed out
|
||||
wxASSERT(m_menuItem_Save);
|
||||
|
||||
wxMenu *menuEdit = new wxMenu;
|
||||
menuBar->Append(menuEdit, _("&Edit"));
|
||||
m_MenuBar->Append(menuEdit, _("&Edit"));
|
||||
{
|
||||
menuEdit->Append(wxID_UNDO, _("&Undo"));
|
||||
menuEdit->Append(wxID_REDO, _("&Redo"));
|
||||
@ -106,18 +106,6 @@ AtlasWindow::AtlasWindow(wxWindow* parent, const wxString& title, const wxSize&
|
||||
m_CommandProc.SetEditMenu(menuEdit);
|
||||
m_CommandProc.Initialize();
|
||||
|
||||
|
||||
if (menu)
|
||||
{
|
||||
wxMenu* menuCustom = new wxMenu;
|
||||
menuBar->Append(menuCustom, menu->title);
|
||||
|
||||
int id = ID_Custom1;
|
||||
for (CustomMenu::CustomMenuItem** item = menu->items; *item; ++item)
|
||||
menuCustom->Append(id++, (*item)->name);
|
||||
}
|
||||
|
||||
|
||||
m_FileHistory.Load(*wxConfigBase::Get());
|
||||
|
||||
CreateStatusBar();
|
||||
@ -126,6 +114,11 @@ AtlasWindow::AtlasWindow(wxWindow* parent, const wxString& title, const wxSize&
|
||||
SetCurrentFilename();
|
||||
}
|
||||
|
||||
void AtlasWindow::AddCustomMenu(wxMenu* menu, const wxString& title)
|
||||
{
|
||||
m_MenuBar->Append(menu, title);
|
||||
}
|
||||
|
||||
void AtlasWindow::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
Close();
|
||||
|
@ -25,23 +25,14 @@ public:
|
||||
ID_Save,
|
||||
ID_SaveAs,
|
||||
|
||||
// IDs for custom window-specific menu items
|
||||
ID_Custom1,
|
||||
ID_Custom2,
|
||||
ID_Custom3
|
||||
// First available ID for custom window-specific menu items
|
||||
ID_Custom
|
||||
};
|
||||
|
||||
// See ActorEditor.cpp for example usage
|
||||
struct CustomMenu {
|
||||
const wxChar* title;
|
||||
struct CustomMenuItem {
|
||||
const wxChar* name;
|
||||
}** items;
|
||||
};
|
||||
|
||||
AtlasWindow(wxWindow* parent, const wxString& title, const wxSize& size, CustomMenu* menu = NULL);
|
||||
AtlasWindow(wxWindow* parent, const wxString& title, const wxSize& size);
|
||||
|
||||
private:
|
||||
|
||||
void OnNew(wxCommandEvent& event);
|
||||
// void OnImport(wxCommandEvent& event);
|
||||
// void OnExport(wxCommandEvent& event);
|
||||
@ -63,6 +54,8 @@ protected:
|
||||
void SetCurrentFilename(wxFileName filename = wxString());
|
||||
wxFileName GetCurrentFilename() { return m_CurrentFilename; }
|
||||
|
||||
void AddCustomMenu(wxMenu* menu, const wxString& title);
|
||||
|
||||
virtual wxString GetDefaultOpenDirectory() = 0;
|
||||
|
||||
bool SaveChanges(bool forceSaveAs);
|
||||
@ -73,6 +66,7 @@ private:
|
||||
AtlasWindowCommandProc m_CommandProc;
|
||||
|
||||
wxMenuItem* m_menuItem_Save;
|
||||
wxMenuBar* m_MenuBar;
|
||||
|
||||
wxFileName m_CurrentFilename;
|
||||
wxString m_WindowTitle;
|
||||
|
Loading…
Reference in New Issue
Block a user