mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-17 22:48:44 +00:00
Merge
This commit is contained in:
commit
7c0fe6703b
7 changed files with 62 additions and 14 deletions
|
@ -50,6 +50,8 @@ namespace NLGUI
|
||||||
// see interface.txt for meaning of auto
|
// see interface.txt for meaning of auto
|
||||||
_ToolTipParentPosRef= Hotspot_TTAuto;
|
_ToolTipParentPosRef= Hotspot_TTAuto;
|
||||||
_ToolTipPosRef= Hotspot_TTAuto;
|
_ToolTipPosRef= Hotspot_TTAuto;
|
||||||
|
_EventX = 0;
|
||||||
|
_EventY = 0;
|
||||||
resizer = false;
|
resizer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +72,9 @@ namespace NLGUI
|
||||||
|
|
||||||
bool handleEvent (const NLGUI::CEventDescriptor &event);
|
bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||||
|
|
||||||
|
sint32 getEventX() { return _EventX; }
|
||||||
|
sint32 getEventY() { return _EventY; }
|
||||||
|
|
||||||
virtual CCtrlBase *getSubCtrl (sint32 /* x */, sint32 /* y */) { return this; }
|
virtual CCtrlBase *getSubCtrl (sint32 /* x */, sint32 /* y */) { return this; }
|
||||||
|
|
||||||
/// Debug
|
/// Debug
|
||||||
|
@ -181,6 +186,9 @@ namespace NLGUI
|
||||||
static std::map< std::string, std::map< std::string, std::string > > AHCache;
|
static std::map< std::string, std::map< std::string, std::string > > AHCache;
|
||||||
|
|
||||||
bool resizer;
|
bool resizer;
|
||||||
|
|
||||||
|
sint32 _EventX;
|
||||||
|
sint32 _EventY;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace NLGUI
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
// submit form
|
// submit form
|
||||||
void submitForm (uint formId, const char *submitButtonName);
|
void submitForm (uint formId, const char *submitButtonType, const char *submitButtonName, const char *submitButtonValue, sint32 x, sint32 y);
|
||||||
|
|
||||||
// Browse error
|
// Browse error
|
||||||
void browseError (const char *msg);
|
void browseError (const char *msg);
|
||||||
|
@ -328,7 +328,11 @@ namespace NLGUI
|
||||||
bool _BrowseNextTime;
|
bool _BrowseNextTime;
|
||||||
bool _PostNextTime;
|
bool _PostNextTime;
|
||||||
uint _PostFormId;
|
uint _PostFormId;
|
||||||
|
std::string _PostFormSubmitType;
|
||||||
std::string _PostFormSubmitButton;
|
std::string _PostFormSubmitButton;
|
||||||
|
std::string _PostFormSubmitValue;
|
||||||
|
sint32 _PostFormSubmitX;
|
||||||
|
sint32 _PostFormSubmitY;
|
||||||
|
|
||||||
// Browsing..
|
// Browsing..
|
||||||
bool _Browsing;
|
bool _Browsing;
|
||||||
|
|
|
@ -701,6 +701,11 @@ namespace NLGUI
|
||||||
//pIM->submitEvent ("button_click:"+getId());
|
//pIM->submitEvent ("button_click:"+getId());
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// top-right corner is EventX=0, EventY=0
|
||||||
|
_EventX = eventDesc.getX() - _XReal;
|
||||||
|
_EventY = (_YReal + _HReal) - eventDesc.getY();
|
||||||
|
|
||||||
runLeftClickAction();
|
runLeftClickAction();
|
||||||
if (CWidgetManager::getInstance()->getCapturePointerLeft() == NULL) return true; // event handler may release cpature from this object (if it is removed for example)
|
if (CWidgetManager::getInstance()->getCapturePointerLeft() == NULL) return true; // event handler may release cpature from this object (if it is removed for example)
|
||||||
|
|
||||||
|
|
|
@ -999,7 +999,8 @@ namespace NLGUI
|
||||||
break;
|
break;
|
||||||
// OTHER
|
// OTHER
|
||||||
default:
|
default:
|
||||||
if ((rEDK.getChar() == KeyRETURN) && !_WantReturn)
|
bool isKeyRETURN = !rEDK.getKeyCtrl() && rEDK.getChar() == KeyRETURN;
|
||||||
|
if (isKeyRETURN && !_WantReturn)
|
||||||
{
|
{
|
||||||
// update historic.
|
// update historic.
|
||||||
if(_MaxHistoric)
|
if(_MaxHistoric)
|
||||||
|
@ -1030,9 +1031,9 @@ namespace NLGUI
|
||||||
// If the char is not alphanumeric -> return.
|
// If the char is not alphanumeric -> return.
|
||||||
// if(!isalnum(ec.Char))
|
// if(!isalnum(ec.Char))
|
||||||
// return
|
// return
|
||||||
if( (rEDK.getChar()>=32) || (rEDK.getChar() == KeyRETURN) )
|
if( (rEDK.getChar()>=32) || isKeyRETURN )
|
||||||
{
|
{
|
||||||
if (rEDK.getChar() == KeyRETURN)
|
if (isKeyRETURN)
|
||||||
{
|
{
|
||||||
ucstring copyStr= _InputString;
|
ucstring copyStr= _InputString;
|
||||||
if ((uint) std::count(copyStr.begin(), copyStr.end(), '\n') >= _MaxNumReturn)
|
if ((uint) std::count(copyStr.begin(), copyStr.end(), '\n') >= _MaxNumReturn)
|
||||||
|
@ -1049,7 +1050,7 @@ namespace NLGUI
|
||||||
cutSelection();
|
cutSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
ucchar c = (rEDK.getChar() == KeyRETURN)?'\n':rEDK.getChar();
|
ucchar c = isKeyRETURN ? '\n' : rEDK.getChar();
|
||||||
if (isFiltered(c)) return;
|
if (isFiltered(c)) return;
|
||||||
switch(_EntryType)
|
switch(_EntryType)
|
||||||
{
|
{
|
||||||
|
@ -1128,7 +1129,7 @@ namespace NLGUI
|
||||||
++ _CursorPos;
|
++ _CursorPos;
|
||||||
triggerOnChangeAH();
|
triggerOnChangeAH();
|
||||||
}
|
}
|
||||||
if (rEDK.getChar() == KeyRETURN)
|
if (isKeyRETURN)
|
||||||
{
|
{
|
||||||
CAHManager::getInstance()->runActionHandler(_AHOnEnter, this, _AHOnEnterParams);
|
CAHManager::getInstance()->runActionHandler(_AHOnEnter, this, _AHOnEnterParams);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1217,7 +1217,7 @@ namespace NLGUI
|
||||||
normal = value[MY_HTML_INPUT_SRC];
|
normal = value[MY_HTML_INPUT_SRC];
|
||||||
|
|
||||||
// Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name"
|
// Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name"
|
||||||
string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name;
|
string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name + "|submit_button_type=image";
|
||||||
|
|
||||||
// Add the ctrl button
|
// Add the ctrl button
|
||||||
addButton (CCtrlButton::PushButton, name, normal, pushed.empty()?normal:pushed, over,
|
addButton (CCtrlButton::PushButton, name, normal, pushed.empty()?normal:pushed, over,
|
||||||
|
@ -1241,7 +1241,15 @@ namespace NLGUI
|
||||||
text = value[MY_HTML_INPUT_VALUE];
|
text = value[MY_HTML_INPUT_VALUE];
|
||||||
|
|
||||||
// Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name"
|
// Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name"
|
||||||
string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name;
|
string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name + "|submit_button_type=submit";
|
||||||
|
if (text.size() > 0)
|
||||||
|
{
|
||||||
|
// escape AH param separator
|
||||||
|
string tmp = text;
|
||||||
|
while(NLMISC::strFindReplace(tmp, "|", "|"))
|
||||||
|
;
|
||||||
|
param = param + "|submit_button_value=" + tmp;
|
||||||
|
}
|
||||||
|
|
||||||
// Add the ctrl button
|
// Add the ctrl button
|
||||||
if (!_Paragraph)
|
if (!_Paragraph)
|
||||||
|
@ -3638,14 +3646,18 @@ namespace NLGUI
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
void CGroupHTML::submitForm (uint formId, const char *submitButtonName)
|
void CGroupHTML::submitForm (uint formId, const char *submitButtonType, const char *submitButtonName, const char *submitButtonValue, sint32 x, sint32 y)
|
||||||
{
|
{
|
||||||
// Form id valid ?
|
// Form id valid ?
|
||||||
if (formId < _Forms.size())
|
if (formId < _Forms.size())
|
||||||
{
|
{
|
||||||
_PostNextTime = true;
|
_PostNextTime = true;
|
||||||
_PostFormId = formId;
|
_PostFormId = formId;
|
||||||
|
_PostFormSubmitType = submitButtonType;
|
||||||
_PostFormSubmitButton = submitButtonName;
|
_PostFormSubmitButton = submitButtonName;
|
||||||
|
_PostFormSubmitValue = submitButtonValue;
|
||||||
|
_PostFormSubmitX = x;
|
||||||
|
_PostFormSubmitY = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3918,9 +3930,22 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the button coordinates
|
if (_PostFormSubmitType == "image")
|
||||||
HTParseFormInput(formfields, (_PostFormSubmitButton + "_x=0").c_str());
|
{
|
||||||
HTParseFormInput(formfields, (_PostFormSubmitButton + "_y=0").c_str());
|
// Add the button coordinates
|
||||||
|
if (_PostFormSubmitButton.find_first_of("[") == string::npos)
|
||||||
|
{
|
||||||
|
HTParseFormInput(formfields, (_PostFormSubmitButton + "_x=" + NLMISC::toString(_PostFormSubmitX)).c_str());
|
||||||
|
HTParseFormInput(formfields, (_PostFormSubmitButton + "_y=" + NLMISC::toString(_PostFormSubmitY)).c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + NLMISC::toString(_PostFormSubmitX)).c_str());
|
||||||
|
HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + NLMISC::toString(_PostFormSubmitY)).c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + _PostFormSubmitValue).c_str());
|
||||||
|
|
||||||
// Add custom params
|
// Add custom params
|
||||||
addHTTPPostParams(formfields, _TrustedDomain);
|
addHTTPPostParams(formfields, _TrustedDomain);
|
||||||
|
|
|
@ -2207,7 +2207,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manage complex "Enter"
|
// Manage complex "Enter"
|
||||||
if (eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyRETURN)
|
if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyRETURN && !eventDesc.getKeyCtrl() )
|
||||||
{
|
{
|
||||||
// If the top window has Enter AH
|
// If the top window has Enter AH
|
||||||
CInterfaceGroup *tw= getTopWindow();
|
CInterfaceGroup *tw= getTopWindow();
|
||||||
|
|
|
@ -1117,6 +1117,11 @@ class CHandlerHTMLSubmitForm : public IActionHandler
|
||||||
fromString(getParam (sParams, "form"), form);
|
fromString(getParam (sParams, "form"), form);
|
||||||
|
|
||||||
string submit_button = getParam (sParams, "submit_button");
|
string submit_button = getParam (sParams, "submit_button");
|
||||||
|
string type = getParam (sParams, "submit_button_type");
|
||||||
|
string value = getParam (sParams, "submit_button_value");
|
||||||
|
|
||||||
|
sint32 x = pCaller->getEventX();
|
||||||
|
sint32 y = pCaller->getEventY();
|
||||||
|
|
||||||
CInterfaceElement *element = CWidgetManager::getInstance()->getElementFromId(container);
|
CInterfaceElement *element = CWidgetManager::getInstance()->getElementFromId(container);
|
||||||
{
|
{
|
||||||
|
@ -1125,7 +1130,7 @@ class CHandlerHTMLSubmitForm : public IActionHandler
|
||||||
if (groupHtml)
|
if (groupHtml)
|
||||||
{
|
{
|
||||||
// Submit the form the url
|
// Submit the form the url
|
||||||
groupHtml->submitForm (form, submit_button.c_str ());
|
groupHtml->submitForm (form, type.c_str(), submit_button.c_str(), value.c_str(), x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue