mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-13 19:49:36 +00:00
Fix up radio buttons, more editbox functionality.
All blocking issues with UI should now be fixed.
This commit is contained in:
@@ -83,6 +83,7 @@
|
|||||||
<Import Project="GpApp.props" />
|
<Import Project="GpApp.props" />
|
||||||
<Import Project="..\Common.props" />
|
<Import Project="..\Common.props" />
|
||||||
<Import Project="..\GpCommon.props" />
|
<Import Project="..\GpCommon.props" />
|
||||||
|
<Import Project="..\Release.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
|
|||||||
@@ -397,6 +397,9 @@ Boolean TestHighScore (void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsHighScoreForceTop())
|
||||||
|
placing = 0;
|
||||||
|
|
||||||
if (placing != -1)
|
if (placing != -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "PLCheckboxWidget.h"
|
#include "PLCheckboxWidget.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
#include "FontFamily.h"
|
#include "FontFamily.h"
|
||||||
|
#include "PLTimeTaggedVOSEvent.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -9,6 +10,7 @@ namespace PortabilityLayer
|
|||||||
CheckboxWidget::CheckboxWidget(const WidgetBasicState &state)
|
CheckboxWidget::CheckboxWidget(const WidgetBasicState &state)
|
||||||
: WidgetSpec<CheckboxWidget>(state)
|
: WidgetSpec<CheckboxWidget>(state)
|
||||||
, m_text(state.m_text)
|
, m_text(state.m_text)
|
||||||
|
, m_haveMouseDown(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,4 +71,40 @@ namespace PortabilityLayer
|
|||||||
if (m_window)
|
if (m_window)
|
||||||
DrawControl(&m_window->m_surface);
|
DrawControl(&m_window->m_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WidgetHandleState_t CheckboxWidget::ProcessEvent(const TimeTaggedVOSEvent &evt)
|
||||||
|
{
|
||||||
|
if (m_haveMouseDown)
|
||||||
|
{
|
||||||
|
if (evt.IsLMouseUpEvent())
|
||||||
|
{
|
||||||
|
m_haveMouseDown = false;
|
||||||
|
|
||||||
|
const Point pt = m_window->MouseToLocal(evt.m_vosEvent.m_event.m_mouseInputEvent);
|
||||||
|
if (m_rect.Contains(pt))
|
||||||
|
return WidgetHandleStates::kActivated;
|
||||||
|
else
|
||||||
|
return WidgetHandleStates::kIgnored;
|
||||||
|
}
|
||||||
|
|
||||||
|
return WidgetHandleStates::kCaptured;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (evt.IsLMouseDownEvent())
|
||||||
|
{
|
||||||
|
const Point pt = m_window->MouseToLocal(evt.m_vosEvent.m_event.m_mouseInputEvent);
|
||||||
|
|
||||||
|
if (m_rect.Contains(pt))
|
||||||
|
{
|
||||||
|
m_haveMouseDown = true;
|
||||||
|
return WidgetHandleStates::kCaptured;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return WidgetHandleStates::kIgnored;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return WidgetHandleStates::kIgnored;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
void OnStateChanged() override;
|
void OnStateChanged() override;
|
||||||
|
|
||||||
|
WidgetHandleState_t ProcessEvent(const TimeTaggedVOSEvent &evt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PascalStr<255> m_text;
|
PascalStr<255> m_text;
|
||||||
|
bool m_haveMouseDown;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -810,12 +810,12 @@ void Window::DrawControls()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Window::IsHandlingTickEvents()
|
bool Window::IsHandlingTickEvents()
|
||||||
{
|
{
|
||||||
return m_numTickReceivingWidgets > 0;
|
return m_numTickReceivingWidgets > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::OnTick()
|
void Window::OnTick()
|
||||||
{
|
{
|
||||||
if (m_numTickReceivingWidgets == 0)
|
if (m_numTickReceivingWidgets == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#include "PLDialogs.h"
|
#include "PLDialogs.h"
|
||||||
|
|
||||||
|
#include "DialogManager.h"
|
||||||
|
#include "PLArrayView.h"
|
||||||
#include "PLPasStr.h"
|
#include "PLPasStr.h"
|
||||||
|
#include "PLEditboxWidget.h"
|
||||||
|
|
||||||
|
|
||||||
DialogTextSubstitutions::DialogTextSubstitutions()
|
DialogTextSubstitutions::DialogTextSubstitutions()
|
||||||
@@ -78,7 +82,9 @@ void SetDialogItemText(THandle<Control> handle, const PLPasStr &str)
|
|||||||
|
|
||||||
void SelectDialogItemText(Dialog *dialog, int item, int firstSelChar, int lastSelCharExclusive)
|
void SelectDialogItemText(Dialog *dialog, int item, int firstSelChar, int lastSelCharExclusive)
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented_TODO("TextBox_Critical");
|
PortabilityLayer::EditboxWidget *widget = static_cast<PortabilityLayer::EditboxWidget*>(dialog->GetItems()[item - 1].GetWidget());
|
||||||
|
widget->GetWindow()->FocusWidget(widget);
|
||||||
|
widget->SetSelection(firstSelChar, lastSelCharExclusive);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModalFilterUPP NewModalFilterUPP(ModalFilterUPP func)
|
ModalFilterUPP NewModalFilterUPP(ModalFilterUPP func)
|
||||||
|
|||||||
@@ -166,6 +166,9 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
if (evt.m_vosEvent.m_eventType == GpVOSEventTypes::kKeyboardInput)
|
if (evt.m_vosEvent.m_eventType == GpVOSEventTypes::kKeyboardInput)
|
||||||
{
|
{
|
||||||
|
if (!m_hasFocus)
|
||||||
|
return WidgetHandleStates::kIgnored;
|
||||||
|
|
||||||
const GpKeyboardInputEvent &keyEvent = evt.m_vosEvent.m_event.m_keyboardInputEvent;
|
const GpKeyboardInputEvent &keyEvent = evt.m_vosEvent.m_event.m_keyboardInputEvent;
|
||||||
|
|
||||||
if (keyEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar || keyEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar)
|
if (keyEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar || keyEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar)
|
||||||
@@ -191,8 +194,6 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
if (ch >= 0x20 && ch <= 0x7e)
|
if (ch >= 0x20 && ch <= 0x7e)
|
||||||
HandleCharacter(ch, keyEvent.m_repeatCount);
|
HandleCharacter(ch, keyEvent.m_repeatCount);
|
||||||
else if (ch == '\b')
|
|
||||||
HandleBackspace(keyEvent.m_repeatCount);
|
|
||||||
|
|
||||||
return WidgetHandleStates::kDigested;
|
return WidgetHandleStates::kDigested;
|
||||||
}
|
}
|
||||||
@@ -206,7 +207,7 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
if (keyEvent.m_key.m_specialKey == GpKeySpecials::kBackspace)
|
if (keyEvent.m_key.m_specialKey == GpKeySpecials::kBackspace)
|
||||||
{
|
{
|
||||||
|
HandleBackspace(keyEvent.m_repeatCount);
|
||||||
return WidgetHandleStates::kDigested;
|
return WidgetHandleStates::kDigested;
|
||||||
}
|
}
|
||||||
else if (keyEvent.m_key.m_specialKey == GpKeySpecials::kDelete)
|
else if (keyEvent.m_key.m_specialKey == GpKeySpecials::kDelete)
|
||||||
@@ -234,6 +235,24 @@ namespace PortabilityLayer
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditboxWidget::SetSelection(size_t startChar, size_t endChar)
|
||||||
|
{
|
||||||
|
if (startChar > m_length)
|
||||||
|
startChar = m_length;
|
||||||
|
|
||||||
|
if (endChar < startChar)
|
||||||
|
endChar = startChar;
|
||||||
|
|
||||||
|
if (endChar > m_length)
|
||||||
|
endChar = m_length;
|
||||||
|
|
||||||
|
m_selStartChar = startChar;
|
||||||
|
m_selEndChar = endChar;
|
||||||
|
|
||||||
|
m_caratTimer = 0;
|
||||||
|
Redraw();
|
||||||
|
}
|
||||||
|
|
||||||
void EditboxWidget::OnTick()
|
void EditboxWidget::OnTick()
|
||||||
{
|
{
|
||||||
if (m_hasFocus)
|
if (m_hasFocus)
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
bool HandlesTickEvents() const;
|
bool HandlesTickEvents() const;
|
||||||
|
|
||||||
|
void SetSelection(size_t startChar, size_t endChar);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const unsigned int kCaratBlinkRate = 20;
|
static const unsigned int kCaratBlinkRate = 20;
|
||||||
|
|
||||||
|
|||||||
@@ -19,3 +19,8 @@ bool IsRoomEditorDisabled()
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsHighScoreForceTop()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ bool IsMacPlusGraphicBanned();
|
|||||||
bool IsMacPlusSoundBanned();
|
bool IsMacPlusSoundBanned();
|
||||||
bool IsHighScoreDisabled();
|
bool IsHighScoreDisabled();
|
||||||
bool IsRoomEditorDisabled();
|
bool IsRoomEditorDisabled();
|
||||||
|
bool IsHighScoreForceTop();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "PLRadioButtonWidget.h"
|
#include "PLRadioButtonWidget.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
#include "FontFamily.h"
|
#include "FontFamily.h"
|
||||||
|
#include "PLTimeTaggedVOSEvent.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -9,6 +10,7 @@ namespace PortabilityLayer
|
|||||||
RadioButtonWidget::RadioButtonWidget(const WidgetBasicState &state)
|
RadioButtonWidget::RadioButtonWidget(const WidgetBasicState &state)
|
||||||
: WidgetSpec<RadioButtonWidget>(state)
|
: WidgetSpec<RadioButtonWidget>(state)
|
||||||
, m_text(state.m_text)
|
, m_text(state.m_text)
|
||||||
|
, m_haveMouseDown(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,4 +70,40 @@ namespace PortabilityLayer
|
|||||||
if (m_window)
|
if (m_window)
|
||||||
DrawControl(&m_window->m_surface);
|
DrawControl(&m_window->m_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WidgetHandleState_t RadioButtonWidget::ProcessEvent(const TimeTaggedVOSEvent &evt)
|
||||||
|
{
|
||||||
|
if (m_haveMouseDown)
|
||||||
|
{
|
||||||
|
if (evt.IsLMouseUpEvent())
|
||||||
|
{
|
||||||
|
m_haveMouseDown = false;
|
||||||
|
|
||||||
|
const Point pt = m_window->MouseToLocal(evt.m_vosEvent.m_event.m_mouseInputEvent);
|
||||||
|
if (m_rect.Contains(pt))
|
||||||
|
return WidgetHandleStates::kActivated;
|
||||||
|
else
|
||||||
|
return WidgetHandleStates::kIgnored;
|
||||||
|
}
|
||||||
|
|
||||||
|
return WidgetHandleStates::kCaptured;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (evt.IsLMouseDownEvent())
|
||||||
|
{
|
||||||
|
const Point pt = m_window->MouseToLocal(evt.m_vosEvent.m_event.m_mouseInputEvent);
|
||||||
|
|
||||||
|
if (m_rect.Contains(pt))
|
||||||
|
{
|
||||||
|
m_haveMouseDown = true;
|
||||||
|
return WidgetHandleStates::kCaptured;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return WidgetHandleStates::kIgnored;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return WidgetHandleStates::kIgnored;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
void OnStateChanged() override;
|
void OnStateChanged() override;
|
||||||
|
|
||||||
|
WidgetHandleState_t ProcessEvent(const TimeTaggedVOSEvent &evt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PascalStr<255> m_text;
|
PascalStr<255> m_text;
|
||||||
|
bool m_haveMouseDown;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
<Import Project="..\MacRomanConversion.props" />
|
<Import Project="..\MacRomanConversion.props" />
|
||||||
<Import Project="..\zlib.props" />
|
<Import Project="..\zlib.props" />
|
||||||
<Import Project="..\RapidJSON.props" />
|
<Import Project="..\RapidJSON.props" />
|
||||||
|
<Import Project="..\Release.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
<Import Project="..\MacRomanConversion.props" />
|
<Import Project="..\MacRomanConversion.props" />
|
||||||
<Import Project="..\zlib.props" />
|
<Import Project="..\zlib.props" />
|
||||||
<Import Project="..\RapidJSON.props" />
|
<Import Project="..\RapidJSON.props" />
|
||||||
|
<Import Project="..\Release.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
@@ -91,6 +93,7 @@
|
|||||||
<Import Project="..\MacRomanConversion.props" />
|
<Import Project="..\MacRomanConversion.props" />
|
||||||
<Import Project="..\zlib.props" />
|
<Import Project="..\zlib.props" />
|
||||||
<Import Project="..\RapidJSON.props" />
|
<Import Project="..\RapidJSON.props" />
|
||||||
|
<Import Project="..\Release.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
|
|||||||
12
Release.props
Normal file
12
Release.props
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Label="PropertySheets" />
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup />
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<ClCompile>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user