#include "../client.h"
#include "ui_parse.h"
#include "ui_main.h"
#include "ui_data.h"
#include "ui_internal.h"
#include "ui_actions.h"
#include "ui_icon.h"
#include "ui_components.h"
#include "node/ui_node_window.h"
#include "node/ui_node_selectbox.h"
#include "node/ui_node_abstractnode.h"
#include "node/ui_node_abstractoption.h"
#include "../../shared/parse.h"
Go to the source code of this file.
Functions | |
static qboolean | UI_ParseProperty (void *object, const value_t *property, const char *objectName, const char **text, const char **token) |
Parse a property value. | |
static uiAction_t * | UI_ParseActionList (uiNode_t *node, const char **text, const const char **token) |
Parse actions and return action list. | |
static uiNode_t * | UI_ParseNode (uiNode_t *parent, const char **text, const char **token, const char *errhead) |
parse a node | |
static qboolean | UI_TokenIsReserved (const char *name) |
static qboolean | UI_TokenIsValue (const char *name, qboolean isQuoted) |
static qboolean | UI_TokenIsName (const char *name, qboolean isQuoted) |
const value_t * | UI_FindPropertyByName (const value_t *propertyList, const char *name) |
Find a value_t by name into a array of value_t. | |
float * | UI_AllocStaticFloat (int count) |
Allocate a float into the UI static memory. | |
vec4_t * | UI_AllocStaticColor (int count) |
Allocate a color into the UI static memory. | |
char * | UI_AllocStaticString (const char *string, int size) |
Allocate a string into the UI static memory. | |
uiAction_t * | UI_AllocStaticAction (void) |
Allocate an action. | |
qboolean | UI_InitRawActionValue (uiAction_t *action, uiNode_t *node, const value_t *property, const char *string) |
static qboolean | UI_ParseSetAction (uiNode_t *node, uiAction_t *action, const char **text, const char **token, const char *errhead) |
Parser for setter command. | |
static qboolean | UI_ParseCallAction (uiNode_t *node, uiAction_t *action, const char **text, const char **token, const char *errhead) |
Parser for c command. | |
static qboolean | UI_ParseExcludeRect (uiNode_t *node, const char **text, const char **token, const char *errhead) |
static qboolean | UI_ParseEventProperty (uiNode_t *node, const value_t *event, const char **text, const char **token, const char *errhead) |
static qboolean | UI_ParseFunction (uiNode_t *node, const char **text, const char **token) |
static qboolean | UI_ParseNodeProperties (uiNode_t *node, const char **text, const char **token) |
parse all sequencial properties into a block | |
static qboolean | UI_ParseNodeBody (uiNode_t *node, const char **text, const char **token, const char *errhead) |
Read a node body. | |
void | UI_ParseUIModel (const char *name, const char **text) |
parses the models.ufo and all files where UI models (menu_model) are defined | |
void | UI_ParseIcon (const char *name, const char **text) |
void | UI_ParseComponent (const char *type, const char **text) |
Parse a component. | |
void | UI_ParseWindow (const char *type, const char *name, const char **text) |
Parse a window. | |
const char * | UI_GetReferenceString (const uiNode_t *const node, const char *ref) |
float | UI_GetReferenceFloat (const uiNode_t *const node, const void *ref) |
Variables | |
static const value_t | uiModelProperties [] |
valid properties for a UI model definition | |
static const char * | reserved_tokens [] |
reserved token preventing calling a node with it |
remove all "token" param from function and use Com_UnParseLastToken
reduce use of uiGlobal (create global functions to add/get/... entities)
Definition in file ui_parse.c.
uiAction_t* UI_AllocStaticAction | ( | void | ) | [read] |
Allocate an action.
Definition at line 225 of file ui_parse.c.
References uiGlobal_s::actions, Com_Error(), ERR_FATAL, uiGlobal_s::numActions, ui_global, and UI_MAX_ACTIONS.
Referenced by UI_AllocStaticCommandAction(), UI_ParseActionList(), UI_ParseExpression(), UI_ParseSetAction(), and UI_ParseValueExpression().
vec4_t* UI_AllocStaticColor | ( | int | count | ) |
Allocate a color into the UI static memory.
[in] | count | number of element need to allocate |
Definition at line 185 of file ui_parse.c.
References uiGlobal_s::adata, uiGlobal_s::adataize, Com_Error(), uiGlobal_s::curadata, ERR_FATAL, and ui_global.
float* UI_AllocStaticFloat | ( | int | count | ) |
Allocate a float into the UI static memory.
[in] | count | number of element need to allocate |
Definition at line 167 of file ui_parse.c.
References uiGlobal_s::adata, uiGlobal_s::adataize, Com_Error(), uiGlobal_s::curadata, ERR_FATAL, and ui_global.
Referenced by UI_CloneCvarOrFloat(), and UI_InitCvarOrFloat().
char* UI_AllocStaticString | ( | const char * | string, | |
int | size | |||
) |
Allocate a string into the UI static memory.
[in] | string | Use to initialize the string |
[in] | size | request a fixed memory size, if 0 the string size is used |
Definition at line 204 of file ui_parse.c.
References uiGlobal_s::adata, uiGlobal_s::adataize, Com_Error(), uiGlobal_s::curadata, ERR_FATAL, and ui_global.
Referenced by UI_AutoGenerateIcon(), UI_InitRawActionValue(), UI_ModelNodeClone(), UI_ModelNodeLoaded(), UI_ParseActionList(), UI_ParseSetAction(), and UI_ParseValueExpression().
Find a value_t by name into a array of value_t.
[in] | propertyList | Array of value_t, with null termination |
[in] | name | Property name we search |
Definition at line 150 of file ui_parse.c.
References Q_strcasecmp, and value_s::string.
Referenced by UI_GetPropertyFromBehaviour(), UI_MaterialEditorChangeValue_f(), UI_ParseIcon(), and UI_ParseUIModel().
float UI_GetReferenceFloat | ( | const uiNode_t *const | node, | |
const void * | ref | |||
) |
Definition at line 1413 of file ui_parse.c.
References byte, Cvar_GetValue(), uiNode_s::name, value_s::ofs, uiNode_s::root, Sys_Error(), value_s::type, UI_GetNode(), UI_GetPropertyFromBehaviour(), and V_FLOAT.
Referenced by UI_BarNodeCapturedMouseMove(), UI_BarNodeDraw(), UI_CheckBoxNodeActivate(), UI_CheckBoxNodeDraw(), UI_GetStringFromNodeProperty(), UI_RadioButtonNodeActivate(), UI_RadioButtonNodeDraw(), UI_SpinnerNodeDraw(), UI_SpinnerNodeStep(), and UI_TBarNodeDraw().
const char* UI_GetReferenceString | ( | const uiNode_t *const | node, | |
const char * | ref | |||
) |
< maybe this code is never used
Definition at line 1354 of file ui_parse.c.
References _, ca_active, cls, Com_MacroExpandString(), Com_Parse(), Com_ValueToStr(), Key_GetBinding(), KEYSPACE_GAME, KEYSPACE_UI, value_s::ofs, uiNode_s::root, client_static_s::state, Sys_Error(), uiNode_s::text, value_s::type, UI_GetNode(), UI_GetPropertyFromBehaviour(), and V_BASETYPEMASK.
Referenced by UI_AbstractOptionGetCurrentValue(), UI_ButtonNodeDraw(), UI_CheckBoxNodeDraw(), UI_CustomButtonNodeDraw(), UI_DrawModelNode(), UI_DrawModelNodeWithUIModel(), UI_EKGNodeDraw(), UI_GetFontFromNode(), UI_GetStringFromNodeProperty(), UI_ImageNodeDraw(), UI_ItemNodeDraw(), UI_KeyBindingNodeDraw(), UI_ModelNodeDraw(), UI_OptionListNodeDraw(), UI_OptionTreeNodeDraw(), UI_PanelNodeDraw(), UI_RadioButtonNodeDraw(), UI_SelectBoxNodeDraw(), UI_SelectBoxNodeDrawOverWindow(), UI_SpinnerNodeDraw(), UI_StringNodeDraw(), UI_StringNodeDrawTooltip(), UI_TabNodeDraw(), UI_TBarNodeDraw(), UI_TextEntryNodeDraw(), UI_TextNodeDraw(), UI_TextNodeGenerateLineSplit(), UI_TodoNodeDrawTooltip(), UI_Tooltip(), UI_VScrollbarNodeDraw(), and UI_WindowNodeDraw().
qboolean UI_InitRawActionValue | ( | uiAction_t * | action, | |
uiNode_t * | node, | |||
const value_t * | property, | |||
const char * | string | |||
) |
Parse a string according to a property type, and allocate a raw value to the static memory
action | Action to initialize | |
node | Current node we are parsing, only used for error message | |
property | Type of the value to parse, if NULL the string is not stored as string | |
string | String value to parse |
Definition at line 242 of file ui_parse.c.
References Com_AlignPtr(), Com_EParseValue(), Com_Printf(), uiGlobal_s::curadata, uiAction_s::d, EA_VALUE_RAW, EA_VALUE_STRING, qfalse, qtrue, value_s::size, value_s::string, uiAction_s::terminal, value_s::type, uiAction_s::type, UI_AllocStaticString(), UI_GetIconByName(), UI_GetPath(), ui_global, V_BASETYPEMASK, V_UI_CVAR, V_UI_ICONREF, and V_UI_MASK.
Referenced by UI_NodeSetPropertyFromActionValue(), and UI_ParseSetAction().
static uiAction_t * UI_ParseActionList | ( | uiNode_t * | node, | |
const char ** | text, | |||
const const char ** | token | |||
) | [static] |
Parse actions and return action list.
Definition at line 431 of file ui_parse.c.
References Com_EParse(), Com_Printf(), uiAction_s::d, EA_ACTION, EA_ASSIGN, EA_CALL, EA_CMD, EA_DELETE, EA_ELIF, EA_ELSE, EA_IF, EA_NULL, EA_VALUE_CVARNAME, EA_WHILE, uiAction_s::next, uiAction_s::nonTerminal, qfalse, qtrue, uiAction_s::terminal, uiAction_s::type, type, UI_AllocStaticAction(), UI_AllocStaticString(), UI_GetActionTokenType(), UI_GetPath(), UI_ParseCallAction(), UI_ParseExpression(), and UI_ParseSetAction().
Referenced by UI_ParseEventProperty(), UI_ParseFunction(), and UI_ParseSetAction().
static qboolean UI_ParseCallAction | ( | uiNode_t * | node, | |
uiAction_t * | action, | |||
const char ** | text, | |||
const char ** | token, | |||
const char * | errhead | |||
) | [static] |
Parser for c command.
Definition at line 365 of file ui_parse.c.
References Com_EParse(), Com_Printf(), Com_UnParseLastToken(), uiAction_s::d, EA_VALUE_PATHNODE, EA_VALUE_PATHNODE_WITHINJECTION, EA_VALUE_PATHPROPERTY, EA_VALUE_PATHPROPERTY_WITHINJECTION, uiAction_s::next, uiAction_s::nonTerminal, qfalse, qtrue, uiAction_s::type, UI_GetPath(), and UI_ParseExpression().
Referenced by UI_ParseActionList().
void UI_ParseComponent | ( | const char * | type, | |
const char ** | text | |||
) |
Parse a component.
component panel componentName { }
Definition at line 1256 of file ui_parse.c.
References Com_Error(), Com_Parse(), Com_UnParseLastToken(), ERR_FATAL, UI_InsertComponent(), and UI_ParseNode().
Referenced by CL_ParseClientData().
static qboolean UI_ParseEventProperty | ( | uiNode_t * | node, | |
const value_t * | event, | |||
const char ** | text, | |||
const char ** | token, | |||
const char * | errhead | |||
) | [static] |
Definition at line 641 of file ui_parse.c.
References byte, Com_EnableFunctionScriptToken(), Com_EParse(), Com_Printf(), uiNode_s::name, uiAction_s::next, qfalse, qtrue, value_s::string, UI_GetPath(), and UI_ParseActionList().
Referenced by UI_ParseProperty().
static qboolean UI_ParseExcludeRect | ( | uiNode_t * | node, | |
const char ** | text, | |||
const char ** | token, | |||
const char * | errhead | |||
) | [static] |
Definition at line 591 of file ui_parse.c.
References Com_EParse(), Com_EParseValue(), Com_Printf(), uiNode_s::excludeRect, uiGlobal_s::excludeRect, uiNode_s::excludeRectNum, uiNode_s::name, uiGlobal_s::numExcludeRect, pos, qfalse, qtrue, UI_GetPath(), ui_global, UI_MAX_EXLUDERECTS, and V_POS.
Referenced by UI_ParseProperty().
static qboolean UI_ParseFunction | ( | uiNode_t * | node, | |
const char ** | text, | |||
const char ** | token | |||
) | [static] |
Definition at line 871 of file ui_parse.c.
References uiNode_s::behaviour, Com_EnableFunctionScriptToken(), uiBehaviour_s::isFunction, uiNode_s::onClick, qfalse, qtrue, and UI_ParseActionList().
Referenced by UI_ParseNodeBody().
void UI_ParseIcon | ( | const char * | name, | |
const char ** | text | |||
) |
Definition at line 1207 of file ui_parse.c.
References Com_Parse(), Com_Printf(), mn_iconProperties, uiIcon_s::name, qtrue, UI_AllocStaticIcon(), UI_FindPropertyByName(), and UI_ParseProperty().
Referenced by CL_ParseClientData().
static uiNode_t * UI_ParseNode | ( | uiNode_t * | parent, | |
const char ** | text, | |||
const char ** | token, | |||
const char * | errhead | |||
) | [static] |
parse a node
Definition at line 1045 of file ui_parse.c.
References uiNode_s::behaviour, Com_DPrintf(), Com_EParse(), Com_ParsedTokenIsQuoted(), Com_Printf(), DEBUG_CLIENT, uiBehaviour_s::loaded, uiBehaviour_s::name, uiNode_s::parent, Q_strcasecmp, qfalse, qtrue, uiNode_s::root, UI_AllocNode(), UI_AppendNode(), UI_CloneNode(), UI_GetComponent(), UI_GetNode(), UI_GetNodeBehaviour(), UI_GetPath(), UI_ParseNodeBody(), UI_TokenIsName(), UI_TokenIsReserved(), and UI_UpdateRoot().
Referenced by UI_ParseComponent(), and UI_ParseNodeBody().
static qboolean UI_ParseNodeBody | ( | uiNode_t * | node, | |
const char ** | text, | |||
const char ** | token, | |||
const char * | errhead | |||
) | [static] |
Read a node body.
Allowed syntax { properties } OR { nodes } OR { { properties } nodes }
Definition at line 964 of file ui_parse.c.
References uiNode_s::behaviour, Com_EParse(), Com_Printf(), uiBehaviour_s::isFunction, uiNode_s::name, uiGlobal_s::numNodes, qfalse, qtrue, UI_GetPath(), UI_GetPropertyFromBehaviour(), ui_global, UI_ParseFunction(), UI_ParseNode(), and UI_ParseNodeProperties().
Referenced by UI_ParseNode(), and UI_ParseWindow().
static qboolean UI_ParseNodeProperties | ( | uiNode_t * | node, | |
const char ** | text, | |||
const char ** | token | |||
) | [static] |
parse all sequencial properties into a block
foobehaviour foonode { { properties } // the function stop reading here nodes } foobehaviour foonode { properties // the function stop reading here nodes }
Definition at line 905 of file ui_parse.c.
References uiNode_s::behaviour, Com_EParse(), Com_Printf(), uiNode_s::name, qfalse, qtrue, value_s::string, UI_GetPath(), UI_GetPropertyFromBehaviour(), and UI_ParseProperty().
Referenced by UI_ParseNodeBody().
static qboolean UI_ParseProperty | ( | void * | object, | |
const value_t * | property, | |||
const char * | objectName, | |||
const char ** | text, | |||
const char ** | token | |||
) | [static] |
Parse a property value.
prototypes
Definition at line 677 of file ui_parse.c.
References byte, Com_AlignPtr(), Com_EParse(), Com_GetLastParseError(), Com_ParsedTokenIsQuoted(), Com_ParseValue(), Com_Printf(), uiGlobal_s::curadata, MAX_VAR, value_s::ofs, Q_strncpyz(), qfalse, qtrue, RESULT_OK, value_s::size, value_s::string, value_s::type, UI_AllocStaticStringCondition(), UI_GetDataIDByName(), UI_GetIconByName(), ui_global, UI_ParseEventProperty(), UI_ParseExcludeRect(), UI_TokenIsValue(), V_BASETYPEMASK, V_NOT_UI, V_NULL, V_STRING, V_TRANSLATION_STRING, V_UI, V_UI_ACTION, V_UI_CVAR, V_UI_DATAID, V_UI_EXCLUDERECT, V_UI_ICONREF, V_UI_IF, V_UI_MASK, and V_UI_REF.
Referenced by UI_ParseIcon(), and UI_ParseNodeProperties().
static qboolean UI_ParseSetAction | ( | uiNode_t * | node, | |
uiAction_t * | action, | |||
const char ** | text, | |||
const char ** | token, | |||
const char * | errhead | |||
) | [static] |
Parser for setter command.
Definition at line 280 of file ui_parse.c.
References Com_EParse(), Com_Printf(), Com_UnParseLastToken(), uiAction_s::d, EA_VALUE_CVARNAME, EA_VALUE_CVARNAME_WITHINJECTION, EA_VALUE_PATHPROPERTY, EA_VALUE_PATHPROPERTY_WITHINJECTION, EA_VALUE_RAW, EA_VALUE_STRING_WITHINJECTION, uiAction_s::nonTerminal, qfalse, qtrue, value_s::string, uiAction_s::terminal, uiAction_s::type, value_s::type, type, UI_AllocStaticAction(), UI_AllocStaticString(), UI_GetPath(), UI_InitRawActionValue(), UI_IsInjectedString(), UI_ParseActionList(), UI_ParseExpression(), and V_UI_ACTION.
Referenced by UI_ParseActionList().
void UI_ParseUIModel | ( | const char * | name, | |
const char ** | text | |||
) |
parses the models.ufo and all files where UI models (menu_model) are defined
Definition at line 1131 of file ui_parse.c.
References uiModel_s::color, Com_DPrintf(), Com_EParse(), Com_EParseValue(), Com_Parse(), Com_Printf(), DEBUG_CLIENT, i, uiModel_s::id, Mem_PoolStrDup, Mem_PoolStrDupTo, uiGlobal_s::models, uiModel_s::need, uiModel_s::next, uiGlobal_s::numModels, value_s::ofs, value_s::size, value_s::string, value_s::type, UI_FindPropertyByName(), UI_GetUIModel(), ui_global, UI_MAX_MODELS, ui_sysPool, V_CLIENT_HUNK_STRING, V_NULL, and Vector4Set.
Referenced by CL_ParseClientData().
void UI_ParseWindow | ( | const char * | type, | |
const char * | name, | |||
const char ** | text | |||
) |
Parse a window.
window windowName { }
Definition at line 1285 of file ui_parse.c.
References uiNode_s::behaviour, Com_Error(), Com_Parse(), Com_ParsedTokenIsQuoted(), Com_Printf(), ERR_FATAL, i, uiBehaviour_s::loaded, uiNode_s::name, uiGlobal_s::numWindows, qfalse, qtrue, uiNode_s::root, Sys_Error(), UI_AllocNode(), UI_CloneNode(), UI_GetWindow(), ui_global, UI_InsertWindow(), UI_MAX_WINDOWS, UI_ParseNodeBody(), UI_TokenIsName(), UI_TokenIsReserved(), and uiGlobal_s::windows.
Referenced by CL_ParseClientData().
Definition at line 122 of file ui_parse.c.
Referenced by UI_ParseNode(), and UI_ParseWindow().
static qboolean UI_TokenIsReserved | ( | const char * | name | ) | [static] |
Definition at line 78 of file ui_parse.c.
Referenced by UI_ParseNode(), and UI_ParseWindow().
Definition at line 89 of file ui_parse.c.
Referenced by UI_ParseProperty().
const char* reserved_tokens[] [static] |
{ "this", "parent", "root", "null", "super", "node", "cvar", "int", "float", "string", "var", NULL }
reserved token preventing calling a node with it
Definition at line 63 of file ui_parse.c.
const value_t uiModelProperties[] [static] |
{ {"model", V_CLIENT_HUNK_STRING, offsetof(uiModel_t, model), 0}, {"need", V_NULL, 0, 0}, {"anim", V_CLIENT_HUNK_STRING, offsetof(uiModel_t, anim), 0}, {"skin", V_INT, offsetof(uiModel_t, skin), sizeof(int)}, {"color", V_COLOR, offsetof(uiModel_t, color), sizeof(vec4_t)}, {"tag", V_CLIENT_HUNK_STRING, offsetof(uiModel_t, tag), 0}, {"parent", V_CLIENT_HUNK_STRING, offsetof(uiModel_t, parent), 0}, {NULL, V_NULL, 0, 0}, }
valid properties for a UI model definition
Definition at line 48 of file ui_parse.c.