mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-13 19:49:36 +00:00
More editor progress
This commit is contained in:
@@ -7,7 +7,7 @@ class ArrayViewIterator;
|
||||
|
||||
template<class T>
|
||||
class ArrayView
|
||||
{
|
||||
{
|
||||
public:
|
||||
ArrayView(const T *items, size_t count);
|
||||
ArrayView(const ArrayView<T> &other);
|
||||
@@ -15,8 +15,8 @@ public:
|
||||
size_t Count() const;
|
||||
const T &operator[](size_t index) const;
|
||||
|
||||
ArrayViewIterator<T> begin() const;
|
||||
ArrayViewIterator<T> end() const;
|
||||
ArrayViewIterator<const T> begin() const;
|
||||
ArrayViewIterator<const T> end() const;
|
||||
|
||||
private:
|
||||
const T *m_items;
|
||||
@@ -34,14 +34,14 @@ template<class T>
|
||||
inline ArrayView<T>::ArrayView(const T *items, size_t count)
|
||||
: m_items(items)
|
||||
, m_count(count)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline ArrayView<T>::ArrayView(const ArrayView<T> &other)
|
||||
: m_items(other.m_items)
|
||||
, m_count(other.m_count)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@@ -51,7 +51,7 @@ inline size_t ArrayView<T>::Count() const
|
||||
}
|
||||
|
||||
template<class T>
|
||||
const T &ArrayView<T>::operator[](size_t index) const
|
||||
inline const T &ArrayView<T>::operator[](size_t index) const
|
||||
{
|
||||
#if GP_DEBUG_CONFIG
|
||||
assert(index < m_count);
|
||||
@@ -61,21 +61,21 @@ const T &ArrayView<T>::operator[](size_t index) const
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline ArrayViewIterator<T> ArrayView<T>::begin() const
|
||||
inline ArrayViewIterator<const T> ArrayView<T>::begin() const
|
||||
{
|
||||
#if GP_DEBUG_CONFIG
|
||||
return ArrayViewIterator<T>(m_items, m_count, 0);
|
||||
return ArrayViewIterator<const T>(this->m_items, this->m_count, 0);
|
||||
#else
|
||||
return ArrayViewIterator<T>(m_items);
|
||||
return ArrayViewIterator<const T>(this->m_items);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline ArrayViewIterator<T> ArrayView<T>::end() const
|
||||
inline ArrayViewIterator<const T> ArrayView<T>::end() const
|
||||
{
|
||||
#if GP_DEBUG_CONFIG
|
||||
return ArrayViewIterator<T>(m_items, m_count, m_count);
|
||||
return ArrayViewIterator<const T>(m_items, m_count, m_count);
|
||||
#else
|
||||
return ArrayViewIterator<T>(m_items + m_count);
|
||||
return ArrayViewIterator<const T>(m_items + m_count);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "PLControlDefinitions.h"
|
||||
|
||||
#include "PLArrayView.h"
|
||||
#include "PLArrayViewIterator.h"
|
||||
#include "PLWidgets.h"
|
||||
|
||||
int FindControl(Point point, WindowPtr window, ControlHandle *outControl)
|
||||
{
|
||||
@@ -9,7 +11,21 @@ int FindControl(Point point, WindowPtr window, ControlHandle *outControl)
|
||||
|
||||
int FindControl(Point point, WindowPtr window, PortabilityLayer::Widget **outControl)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
// Returns clicked part
|
||||
ArrayView<PortabilityLayer::Widget*> widgets = window->GetWidgets();
|
||||
|
||||
for (ArrayViewIterator<PortabilityLayer::Widget*const> it = widgets.begin(), itEnd = widgets.end(); it != itEnd; ++it)
|
||||
{
|
||||
PortabilityLayer::Widget *widget = *it;
|
||||
const Rect widgetRect = widget->GetRect();
|
||||
if (widgetRect.Contains(point))
|
||||
{
|
||||
*outControl = widget;
|
||||
return kControlButtonPart;
|
||||
}
|
||||
}
|
||||
|
||||
*outControl = nullptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "PLCore.h"
|
||||
|
||||
#include "PLArrayView.h"
|
||||
#include "PLApplication.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
@@ -822,3 +824,8 @@ void Window::OnTick()
|
||||
for (size_t i = 0; i < m_numWidgets; i++)
|
||||
m_widgets[i]->OnTick();
|
||||
}
|
||||
|
||||
ArrayView<PortabilityLayer::Widget*> Window::GetWidgets() const
|
||||
{
|
||||
return ArrayView< PortabilityLayer::Widget*>(m_widgets, m_numWidgets);
|
||||
}
|
||||
|
||||
@@ -13,11 +13,14 @@
|
||||
#pragma warning(error:4311) // Pointer truncation to int
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
class ArrayView;
|
||||
struct IGpColorCursor;
|
||||
struct GpVOSEvent;
|
||||
struct GpMouseInputEvent;
|
||||
struct TimeTaggedVOSEvent;
|
||||
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct MMHandleBlock;
|
||||
@@ -90,6 +93,8 @@ struct Window
|
||||
|
||||
void OnTick();
|
||||
|
||||
ArrayView<PortabilityLayer::Widget*> GetWidgets() const;
|
||||
|
||||
DrawSurface m_surface; // Must be the first item until the immediate mode draw API is completely removed
|
||||
|
||||
// The port is always at 0,0
|
||||
|
||||
@@ -17,10 +17,10 @@ bool IsHighScoreDisabled()
|
||||
|
||||
bool IsRoomEditorDisabled()
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsHighScoreForceTop()
|
||||
{
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1655,13 +1655,6 @@ Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection)
|
||||
}
|
||||
|
||||
|
||||
Boolean PtInRect(Point point, const Rect *rect)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void RestoreDeviceClut(void *unknown)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
|
||||
@@ -146,8 +146,6 @@ void SubPt(Point srcPoint, Point *destPoint);
|
||||
|
||||
Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection);
|
||||
|
||||
Boolean PtInRect(Point point, const Rect *rect);
|
||||
|
||||
void RestoreDeviceClut(void *unknown);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user