-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Minor annoyance: Allow an escape key binding on popups #14
Comments
hotkeys are defined in 3DMMForever/src/studio/utest.rc Lines 58 to 79 in 79b3010
|
Browsers and Easels are implimented in Chunky Script. This could prove a tad complicated. We might need to create a new event that we can add a handler for in the Chunky Script. |
You might also get away with just handling it with the command handler ESL and the various browser classes. I believe there is a base browser class? And they are what get instantiated by those scripts I think. Edit: Or have the escape key send a cancel button command. |
I'm not sure how to find which Browser to dispatch the message to. If I hardcode it to just one /***************************************************************************
Escape Key
***************************************************************************/
bool Studio::FCmdEscapeKey(PCMD pcmd)
{
PKidspaceGraphicObject pgok = pvNil;
AssertThis(0);
AssertVarMem(pcmd);
printf("Studio::FCmdEscapeKey\n");
pgok = (PKidspaceGraphicObject)((APP *)vpappb)->Pkwa()->PgobFromHid(kidCameraGlass);
if (pgok != pvNil)
{
vpcex->EnqueueCid(cidBrowserCancel, pgok, pvNil, kidBrowserCancel, 0,0,0);
}
return fTrue;
} |
The same works for Easels. It feels like a bit of a bodge, but we could iterate over the handler id's. And, if it has a graphic object, post the cancel message. /***************************************************************************
Escape Key
***************************************************************************/
bool Studio::FCmdEscapeKey(PCMD pcmd)
{
PKidspaceGraphicObject pgok = pvNil;
AssertThis(0);
AssertVarMem(pcmd);
printf("Studio::FCmdEscapeKey\n");
pgok = (PKidspaceGraphicObject)((APP *)vpappb)->Pkwa()->PgobFromHid(kidCostGlass);
if (pgok != pvNil)
{
// vpcex->EnqueueCid(cidBrowserCancel, pgok, pvNil, kidBrowserCancel, 0,0,0);
vpcex->EnqueueCid(cidEaselCancel, pgok, pvNil, 0, 0,0,0);
}
return fTrue;
} |
One edge case I've seen noted in the Chunky scripts is the Sound Recorder. You've got an Easel open over a Browser. |
Have it send without a target, pvNil. The browser/easel should pick it up since the command accepts fcmmNobody. But still need to figure out edge cases where there would be multiple browsers or easels open at a time. |
Do you mean like this? vpcex->EnqueueCid(cidClicked, pvNil, pvNil, 0,0,0,0);
vpcex->EnqueueCid(cidBrowserCancel, pvNil,pvNil, kidBrowserCancel, 0,0,0); That didn't work for me. I assumed it was because I had to pass the GOK object.
CLICK_SCRIPT("Browser cancel clicked")
EnqueueCid(cidBrowserCancel, GidParGob(GidParThis()), GidThis(), 0, 0, 0);
ENDCHUNK Is |
Ah, so the browsers never receive the commands because they are never being added the Command Execution list. So the only way currently they are able to handle them is if you pass the GOK object. So you need to do something similar like this in the browser constructor/init: 3DMMForever/src/studio/studio.cpp Lines 261 to 262 in 79b3010
And the browsers have their own Command Handler Level. This constant is defined but never used: Line 37 in 79b3010
I got an opportunity to play around here and was able to get them to handle the command, but it turns out you can "cancel" those roll call views (the actor/prop selection views on the sides) 😂 So a little more work to be done but definitely getting somewhere lol. |
It means it handles those events that have no target, specifically pvNil. Lines 87 to 94 in 79b3010
To handle all events you can use kgrfcmmAll, which is what the helper ON_CID_ALL does: Lines 116 to 119 in 79b3010
|
Instead of having to click the red close button, allow for an escape key to do the same thing.
The text was updated successfully, but these errors were encountered: