mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 23:00:42 +00:00
Move save dialog to top of screen when using OSK.
This commit is contained in:
53
ApplicationResourcePatches/DITL/2007.json
Normal file
53
ApplicationResourcePatches/DITL/2007.json
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"items" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name" : "Okay",
|
||||||
|
"itemType" : "Button",
|
||||||
|
"pos" : [ 376, 208 ],
|
||||||
|
"size" : [ 58, 20 ],
|
||||||
|
"id" : 1,
|
||||||
|
"enabled" : true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "Cancel",
|
||||||
|
"itemType" : "Button",
|
||||||
|
"pos" : [ 302, 208 ],
|
||||||
|
"size" : [ 58, 20 ],
|
||||||
|
"id" : 2,
|
||||||
|
"enabled" : true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "",
|
||||||
|
"itemType" : "CustomControl",
|
||||||
|
"pos" : [ 17, 33 ],
|
||||||
|
"size" : [ 401, 154 ],
|
||||||
|
"id" : 2,
|
||||||
|
"enabled" : true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "",
|
||||||
|
"itemType" : "CustomControl",
|
||||||
|
"pos" : [ 418, 32 ],
|
||||||
|
"size" : [ 16, 156 ],
|
||||||
|
"id" : 3,
|
||||||
|
"enabled" : true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "",
|
||||||
|
"itemType" : "EditBox",
|
||||||
|
"pos" : [ 16, 208 ],
|
||||||
|
"size" : [ 270, 16 ],
|
||||||
|
"id" : 4,
|
||||||
|
"enabled" : true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "^0",
|
||||||
|
"itemType" : "Label",
|
||||||
|
"pos" : [ 16, 16 ],
|
||||||
|
"size" : [ 418, 16 ],
|
||||||
|
"id" : 10,
|
||||||
|
"enabled" : true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@@ -9,6 +9,7 @@
|
|||||||
"DITL/2004.json" : "ApplicationResourcePatches/DITL/2004.json",
|
"DITL/2004.json" : "ApplicationResourcePatches/DITL/2004.json",
|
||||||
"DITL/2005.json" : "ApplicationResourcePatches/DITL/2005.json",
|
"DITL/2005.json" : "ApplicationResourcePatches/DITL/2005.json",
|
||||||
"DITL/2006.json" : "ApplicationResourcePatches/DITL/2006.json",
|
"DITL/2006.json" : "ApplicationResourcePatches/DITL/2006.json",
|
||||||
|
"DITL/2007.json" : "ApplicationResourcePatches/DITL/2007.json",
|
||||||
"PICT/1300.bmp" : "ApplicationResourcePatches/PICT/1300.bmp",
|
"PICT/1300.bmp" : "ApplicationResourcePatches/PICT/1300.bmp",
|
||||||
"PICT/1301.bmp" : "ApplicationResourcePatches/PICT/1301.bmp",
|
"PICT/1301.bmp" : "ApplicationResourcePatches/PICT/1301.bmp",
|
||||||
"PICT/1302.bmp" : "ApplicationResourcePatches/PICT/1302.bmp",
|
"PICT/1302.bmp" : "ApplicationResourcePatches/PICT/1302.bmp",
|
||||||
|
@@ -41,6 +41,8 @@ static const int kFileBrowserUIOpenDialogTemplateID = 2001;
|
|||||||
static const int kFileBrowserUISaveDialogTemplateID = 2002;
|
static const int kFileBrowserUISaveDialogTemplateID = 2002;
|
||||||
static const int kFileBrowserUIOverwriteDialogTemplateID = 2003;
|
static const int kFileBrowserUIOverwriteDialogTemplateID = 2003;
|
||||||
static const int kFileBrowserUIBadNameDialogTemplateID = 2004;
|
static const int kFileBrowserUIBadNameDialogTemplateID = 2004;
|
||||||
|
static const int kFileBrowserUISaveDialogUnobstructiveTemplateID = 2007;
|
||||||
|
|
||||||
|
|
||||||
static const int kOverwriteNoButton = 1;
|
static const int kOverwriteNoButton = 1;
|
||||||
static const int kOverwriteYesButton = 2;
|
static const int kOverwriteYesButton = 2;
|
||||||
@@ -472,6 +474,12 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
int16_t FileBrowserUIImpl::PopUpAlert(const Rect &rect, int dialogResID, const DialogTextSubstitutions *substitutions)
|
int16_t FileBrowserUIImpl::PopUpAlert(const Rect &rect, int dialogResID, const DialogTextSubstitutions *substitutions)
|
||||||
{
|
{
|
||||||
|
PortabilityLayer::HostSystemServices *sysServices = PortabilityLayer::HostSystemServices::GetInstance();
|
||||||
|
|
||||||
|
// Disable text input temporarily and restore it after
|
||||||
|
const bool wasTextInput = sysServices->IsTextInputEnabled();
|
||||||
|
sysServices->SetTextInputEnabled(false);
|
||||||
|
|
||||||
PortabilityLayer::DialogManager *dialogManager = PortabilityLayer::DialogManager::GetInstance();
|
PortabilityLayer::DialogManager *dialogManager = PortabilityLayer::DialogManager::GetInstance();
|
||||||
Dialog *dialog = dialogManager->LoadDialogFromTemplate(dialogResID, rect, true, false, 0, 0, PL_GetPutInFrontWindowPtr(), PSTR(""), substitutions);
|
Dialog *dialog = dialogManager->LoadDialogFromTemplate(dialogResID, rect, true, false, 0, 0, PL_GetPutInFrontWindowPtr(), PSTR(""), substitutions);
|
||||||
|
|
||||||
@@ -488,16 +496,29 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
dialog->Destroy();
|
dialog->Destroy();
|
||||||
|
|
||||||
|
sysServices->SetTextInputEnabled(wasTextInput);
|
||||||
|
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileBrowserUI::Prompt(Mode mode, VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText)
|
bool FileBrowserUI::Prompt(Mode mode, VirtualDirectory_t dirID, char *path, size_t &outPathLength, size_t pathCapacity, const PLPasStr &initialFileName, const PLPasStr &promptText)
|
||||||
{
|
{
|
||||||
int dialogID = 0;
|
int dialogID = 0;
|
||||||
|
bool isObstructive = false;
|
||||||
|
int windowHeight = 272;
|
||||||
if (mode == Mode_Open)
|
if (mode == Mode_Open)
|
||||||
dialogID = kFileBrowserUIOpenDialogTemplateID;
|
dialogID = kFileBrowserUIOpenDialogTemplateID;
|
||||||
else if (mode == Mode_Save)
|
else if (mode == Mode_Save)
|
||||||
|
{
|
||||||
|
if (PortabilityLayer::HostSystemServices::GetInstance()->IsTextInputObstructive())
|
||||||
|
{
|
||||||
|
dialogID = kFileBrowserUISaveDialogUnobstructiveTemplateID;
|
||||||
|
windowHeight = 240;
|
||||||
|
isObstructive = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
dialogID = kFileBrowserUISaveDialogTemplateID;
|
dialogID = kFileBrowserUISaveDialogTemplateID;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
@@ -538,7 +559,7 @@ namespace PortabilityLayer
|
|||||||
dirCursor->Destroy();
|
dirCursor->Destroy();
|
||||||
|
|
||||||
const int scrollBarWidth = 16;
|
const int scrollBarWidth = 16;
|
||||||
const Rect windowRect = Rect::Create(0, 0, 272, 450);
|
const Rect windowRect = Rect::Create(0, 0, windowHeight, 450);
|
||||||
|
|
||||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(windowRect, PortabilityLayer::WindowStyleFlags::kAlert, true, 0, 0, PSTR(""));
|
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(windowRect, PortabilityLayer::WindowStyleFlags::kAlert, true, 0, 0, PSTR(""));
|
||||||
|
|
||||||
@@ -557,6 +578,9 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
Window *window = dialog->GetWindow();
|
Window *window = dialog->GetWindow();
|
||||||
|
|
||||||
|
if (isObstructive)
|
||||||
|
window->SetPosition(PortabilityLayer::Vec2i(window->GetPosition().m_x, 6));
|
||||||
|
|
||||||
DrawSurface *surface = window->GetDrawSurface();
|
DrawSurface *surface = window->GetDrawSurface();
|
||||||
|
|
||||||
const PortabilityLayer::DialogItem &firstItem = *dialog->GetItems().begin();
|
const PortabilityLayer::DialogItem &firstItem = *dialog->GetItems().begin();
|
||||||
|
Reference in New Issue
Block a user