ui_node_text.c File Reference

#include "../ui_main.h"
#include "../ui_internal.h"
#include "../ui_font.h"
#include "../ui_actions.h"
#include "../ui_parse.h"
#include "../ui_render.h"
#include "ui_node_text.h"
#include "ui_node_abstractnode.h"
#include "../../client.h"
#include "../../../shared/parse.h"
Include dependency graph for ui_node_text.c:

Go to the source code of this file.

Defines

#define EXTRADATA_TYPE   textExtraData_t
#define EXTRADATA(node)   UI_EXTRADATA(node, EXTRADATA_TYPE)
#define EXTRADATACONST(node)   UI_EXTRADATACONST(node, EXTRADATA_TYPE)
#define UI_TEXTNODE_BUFFERSIZE   32768

Functions

static void UI_TextUpdateCache (uiNode_t *node)
static void UI_TextValidateCache (uiNode_t *node)
void UI_TextNodeSelectLine (uiNode_t *node, int num)
 Change the selected line.
void UI_TextScrollEnd (const char *nodePath)
 Scroll to the bottom.
static int UI_TextNodeGetLine (const uiNode_t *node, int x, int y)
 Get the line number under an absolute position.
static void UI_TextNodeMouseMove (uiNode_t *node, int x, int y)
static void UI_TextNodeDrawText (uiNode_t *node, const char *text, const linkedList_t *list, qboolean noDraw)
 Handles line breaks and drawing for shared data id.
static void UI_TextNodeDraw (uiNode_t *node)
 Draw a text node.
static void UI_TextNodeClick (uiNode_t *node, int x, int y)
 Calls the script command for a text node that is clickable.
static void UI_TextNodeRightClick (uiNode_t *node, int x, int y)
 Calls the script command for a text node that is clickable via right mouse button.
static void UI_TextNodeMouseWheel (uiNode_t *node, qboolean down, int x, int y)
static void UI_TextNodeLoading (uiNode_t *node)
static void UI_TextNodeLoaded (uiNode_t *node)
void UI_RegisterTextNode (uiBehaviour_t *behaviour)

Variables

static const value_t properties []

Detailed Description

Todo:
add getter/setter to cleanup access to extradata from cl_*.c files (check "u.text.")

Definition in file ui_node_text.c.


Define Documentation

#define EXTRADATA ( node   )     UI_EXTRADATA(node, EXTRADATA_TYPE)

Definition at line 39 of file ui_node_text.c.

#define EXTRADATA_TYPE   textExtraData_t

Definition at line 38 of file ui_node_text.c.

#define EXTRADATACONST ( node   )     UI_EXTRADATACONST(node, EXTRADATA_TYPE)

Definition at line 40 of file ui_node_text.c.

#define UI_TEXTNODE_BUFFERSIZE   32768

Definition at line 132 of file ui_node_text.c.

Referenced by UI_TextNodeDrawText().


Function Documentation

void UI_RegisterTextNode ( uiBehaviour_t behaviour  ) 
static void UI_TextNodeClick ( uiNode_t node,
int  x,
int  y 
) [static]

Calls the script command for a text node that is clickable.

See also:
UI_TextNodeRightClick

Definition at line 404 of file ui_node_text.c.

References EXTRADATA, uiNode_s::onClick, UI_ExecuteEventActions(), UI_TextNodeGetLine(), and UI_TextNodeSelectLine().

Referenced by UI_RegisterTextNode().

static void UI_TextNodeDraw ( uiNode_t node  )  [static]
static void UI_TextNodeDrawText ( uiNode_t node,
const char *  text,
const linkedList_t list,
qboolean  noDraw 
) [static]

Handles line breaks and drawing for shared data id.

Parameters:
[in] node The context node
[in] text The test to draw else NULL
[in] list The test to draw else NULL
[in] noDraw If true, calling of this function only update the cache (real number of lines)
Note:
text or list but be used, not both

Todo:
verry big, what about static, rendering is not multi threaded

< Nothing to draw

Todo:
what about multiline text that should be highlighted completely?

Definition at line 142 of file ui_node_text.c.

References uiNode_s::color, Com_sprintf(), linkedList_s::data, EXTRADATA, LONGLINES_PRETTYCHOP, MAX_VAR, linkedList_s::next, uiNode_s::padding, pos, Q_strncpyz(), qfalse, qtrue, R_Color(), R_FontTextSize(), uiNode_s::selectedColor, uiNode_s::size, uiNode_s::state, uiNode_s::textalign, UI_AbstractScrollableNodeIsSizeChange(), UI_AbstractScrollableNodeSetY(), UI_DrawString(), UI_FontGetHeight(), UI_GetFontFromNode(), UI_GetNodeAbsPos(), UI_TEXTNODE_BUFFERSIZE, and VectorScale.

Referenced by UI_TextNodeDraw(), and UI_TextUpdateCache().

static int UI_TextNodeGetLine ( const uiNode_t node,
int  x,
int  y 
) [static]

Get the line number under an absolute position.

Parameters:
[in] node a text node
[in] x position x on the screen
[in] y position y on the screen
Returns:
The line number under the position (0 = first line)

Definition at line 100 of file ui_node_text.c.

References EXTRADATACONST, int(), uiNode_s::padding, UI_FontGetHeight(), UI_GetFontFromNode(), UI_NodeAbsoluteToRelativePos(), and UI_NodeInstanceOf().

Referenced by UI_TextNodeClick(), UI_TextNodeMouseMove(), and UI_TextNodeRightClick().

static void UI_TextNodeLoaded ( uiNode_t node  )  [static]
static void UI_TextNodeLoading ( uiNode_t node  )  [static]

< Invalid/no line selected per default.

Definition at line 447 of file ui_node_text.c.

References uiNode_s::color, EXTRADATA, uiNode_s::selectedColor, and Vector4Set.

Referenced by UI_RegisterTextNode().

static void UI_TextNodeMouseMove ( uiNode_t node,
int  x,
int  y 
) [static]

Definition at line 127 of file ui_node_text.c.

References EXTRADATA, and UI_TextNodeGetLine().

Referenced by UI_RegisterTextNode().

static void UI_TextNodeMouseWheel ( uiNode_t node,
qboolean  down,
int  x,
int  y 
) [static]
static void UI_TextNodeRightClick ( uiNode_t node,
int  x,
int  y 
) [static]

Calls the script command for a text node that is clickable via right mouse button.

See also:
UI_TextNodeClick

Definition at line 421 of file ui_node_text.c.

References EXTRADATA, uiNode_s::onRightClick, UI_ExecuteEventActions(), UI_TextNodeGetLine(), and UI_TextNodeSelectLine().

Referenced by UI_RegisterTextNode().

void UI_TextNodeSelectLine ( uiNode_t node,
int  num 
)
void UI_TextScrollEnd ( const char *  nodePath  ) 

Scroll to the bottom.

Parameters:
[in] nodePath absolute path

Definition at line 72 of file ui_node_text.c.

References Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, EXTRADATA, UI_ExecuteEventActions(), UI_GetNodeByPath(), UI_NodeInstanceOf(), and UI_TextValidateCache().

Referenced by Irc_AppendToBuffer().

static void UI_TextUpdateCache ( uiNode_t node  )  [static]
static void UI_TextValidateCache ( uiNode_t node  )  [static]

Definition at line 44 of file ui_node_text.c.

References EXTRADATA, uiNode_s::text, TEXT_NULL, UI_GetDataVersion(), and UI_TextUpdateCache().

Referenced by UI_TextScrollEnd().


Variable Documentation

const value_t properties[] [static]
Initial value:
 {
    
    {"lineselected", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, textLineSelected), MEMBER_SIZEOF(textExtraData_t, textLineSelected)},
    
    {"dataid", V_UI_DATAID, UI_EXTRADATA_OFFSETOF(textExtraData_t, dataID), MEMBER_SIZEOF(textExtraData_t, dataID)},
    
    {"lineheight", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, lineHeight), MEMBER_SIZEOF(textExtraData_t, lineHeight)},
    
    {"tabwidth", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, tabWidth), MEMBER_SIZEOF(textExtraData_t, tabWidth)},
    
    {"longlines", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, longlines), MEMBER_SIZEOF(textExtraData_t, longlines)},

    
    {"rows", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, super.scrollY.viewSize), MEMBER_SIZEOF(textExtraData_t, super.scrollY.viewSize)},
    
    {"lines", V_INT, UI_EXTRADATA_OFFSETOF(textExtraData_t, super.scrollY.fullSize), MEMBER_SIZEOF(textExtraData_t, super.scrollY.fullSize)},

    
    {"mousefx", V_BOOL, UI_EXTRADATA_OFFSETOF(textExtraData_t, mousefx), MEMBER_SIZEOF(textExtraData_t, mousefx)},
    {NULL, V_NULL, 0, 0}
}

Definition at line 495 of file ui_node_text.c.


Generated by  doxygen 1.6.2