forked from Mirrors/openclonk
Fix sorting of script and engine functions in dropdown menu in editor.
parent
8073fb3c07
commit
d3ee2fac57
|
@ -857,7 +857,7 @@ static void SetComboItems(HWND hCombo, std::list<const char*> &items)
|
|||
for (std::list<const char*>::iterator it = items.begin(); it != items.end(); it++)
|
||||
{
|
||||
if (!*it)
|
||||
SendMessage(hCombo,CB_INSERTSTRING,0,(LPARAM)L"----------");
|
||||
SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)L"----------");
|
||||
else
|
||||
SendMessage(hCombo,CB_ADDSTRING,0,GetWideLPARAM(*it));
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ BEGIN
|
|||
PUSHBUTTON "P",IDC_BUTTONPLAY,107,100,13,11,BS_BITMAP | WS_GROUP
|
||||
PUSHBUTTON "P",IDC_BUTTONHALT,126,100,13,11,BS_BITMAP | WS_GROUP
|
||||
COMBOBOX IDC_COMBOINPUT,1,85,181,250,CBS_DROPDOWN |
|
||||
CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
|
||||
EDITTEXT IDC_EDITOUTPUT,1,1,211,82,ES_MULTILINE | ES_AUTOVSCROLL |
|
||||
ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL
|
||||
LTEXT "Frame: 0",IDC_STATICFRAME,1,100,52,11,SS_CENTERIMAGE,
|
||||
|
@ -129,7 +129,7 @@ BEGIN
|
|||
EDITTEXT IDC_EDITOUTPUT,1,1,165,45,ES_MULTILINE | ES_READONLY |
|
||||
WS_VSCROLL
|
||||
COMBOBOX IDC_COMBOINPUT,2,48,131,250,CBS_DROPDOWN |
|
||||
CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Reload Def",IDC_BUTTONRELOADDEF,2,22,45,12,NOT
|
||||
WS_VISIBLE
|
||||
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | NOT WS_VISIBLE,52,
|
||||
|
|
|
@ -246,6 +246,7 @@ std::list<const char*> C4AulScriptEngine::GetFunctionNames(C4PropList * p)
|
|||
{
|
||||
std::list<const char*> functions;
|
||||
std::list<const char*> global_functions;
|
||||
auto sort_alpha = [](const char * const &a, const char * const &b) -> bool { return strcmp(a, b) < 0; };
|
||||
if (!p) p = GetPropList();
|
||||
const C4ValueArray * a = p->GetProperties();
|
||||
for (int i = 0; i < a->GetSize(); ++i)
|
||||
|
@ -255,15 +256,15 @@ std::list<const char*> C4AulScriptEngine::GetFunctionNames(C4PropList * p)
|
|||
C4AulFunc * f = p->GetFunc(key);
|
||||
if (!f) continue;
|
||||
if (!f->GetPublic()) continue;
|
||||
if (p->HasProperty(key))
|
||||
if (!::ScriptEngine.GetPropList()->HasProperty(key))
|
||||
functions.push_back(key->GetCStr());
|
||||
else
|
||||
global_functions.push_back(key->GetCStr());
|
||||
}
|
||||
delete a;
|
||||
functions.sort();
|
||||
functions.push_back(0);
|
||||
global_functions.sort();
|
||||
functions.sort(sort_alpha);
|
||||
if (!functions.empty() && !global_functions.empty()) functions.push_back(0); // separator
|
||||
global_functions.sort(sort_alpha);
|
||||
functions.splice(functions.end(), global_functions);
|
||||
return functions;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue