Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions

interface_regions.c File Reference

#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "MEM_guardedalloc.h"
#include "DNA_userdef_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_dynstr.h"
#include "BLI_ghash.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "WM_api.h"
#include "WM_types.h"
#include "wm_draw.h"
#include "wm_subwindow.h"
#include "wm_window.h"
#include "RNA_access.h"
#include "BIF_gl.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_view2d.h"
#include "BLF_api.h"
#include "BLF_translation.h"
#include "ED_screen.h"
#include "interface_intern.h"

Go to the source code of this file.

Classes

struct  MenuEntry
struct  MenuData
struct  uiTooltipData
struct  uiSearchItems
struct  uiSearchboxData
struct  uiPopupMenu

Defines

#define MENU_SEPR_HEIGHT   6
#define B_NOP   -1
#define MENU_SHADOW_SIDE   8
#define MENU_SHADOW_BOTTOM   10
#define MENU_TOP   8
#define MAX_TOOLTIP_LINES   8
#define TIP_MARGIN_Y   2
#define TIP_BORDER_X   16.0f
#define TIP_BORDER_Y   6.0f
#define SEARCH_ITEMS   10
#define SPICK   110.0
#define FPICK   180.0
#define DPICK   6.0
#define BPICK   24.0
#define SPICK1   150.0
#define DPICK1   6.0
#define PICKER_H   150
#define PICKER_W   150
#define PICKER_SPACE   6
#define PICKER_BAR   14
#define PICKER_TOTAL_W   (PICKER_W+PICKER_SPACE+PICKER_BAR)

Typedefs

typedef struct MenuEntry MenuEntry
typedef struct MenuData MenuData
typedef struct uiTooltipData uiTooltipData
typedef struct uiSearchboxData uiSearchboxData

Functions

static MenuDatamenudata_new (const char *instr)
static void menudata_set_title (MenuData *md, const char *title, int titleicon)
static void menudata_add_item (MenuData *md, const char *str, int retval, int icon, int sepr)
static void menudata_free (MenuData *md)
static MenuDatadecompose_menu_string (const char *str)
void ui_set_name_menu (uiBut *but, int value)
int ui_step_name_menu (uiBut *but, int step)
static ARegionui_add_temporary_region (bScreen *sc)
static void ui_remove_temporary_region (bContext *C, bScreen *sc, ARegion *ar)
static void ui_tooltip_region_draw_cb (const bContext *UNUSED(C), ARegion *ar)
static void ui_tooltip_region_free_cb (ARegion *ar)
ARegionui_tooltip_create (bContext *C, ARegion *butregion, uiBut *but)
void ui_tooltip_free (bContext *C, ARegion *ar)
int uiSearchItemAdd (uiSearchItems *items, const char *name, void *poin, int iconid)
int uiSearchBoxhHeight (void)
static void ui_searchbox_select (bContext *C, ARegion *ar, uiBut *but, int step)
static void ui_searchbox_butrect (rcti *rect, uiSearchboxData *data, int itemnr)
int ui_searchbox_inside (ARegion *ar, int x, int y)
void ui_searchbox_apply (uiBut *but, ARegion *ar)
void ui_searchbox_event (bContext *C, ARegion *ar, uiBut *but, wmEvent *event)
void ui_searchbox_update (bContext *C, ARegion *ar, uiBut *but, int reset)
void ui_searchbox_autocomplete (bContext *C, ARegion *ar, uiBut *but, char *str)
static void ui_searchbox_region_draw_cb (const bContext *UNUSED(C), ARegion *ar)
static void ui_searchbox_region_free_cb (ARegion *ar)
ARegionui_searchbox_create (bContext *C, ARegion *butregion, uiBut *but)
void ui_searchbox_free (bContext *C, ARegion *ar)
void ui_but_search_test (uiBut *but)
static void ui_block_position (wmWindow *window, ARegion *butregion, uiBut *but, uiBlock *block)
static void ui_block_region_draw (const bContext *C, ARegion *ar)
static void ui_popup_block_clip (wmWindow *window, uiBlock *block)
void ui_popup_block_scrolltest (uiBlock *block)
uiPopupBlockHandleui_popup_block_create (bContext *C, ARegion *butregion, uiBut *but, uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg)
void ui_popup_block_free (bContext *C, uiPopupBlockHandle *handle)
static void ui_block_func_MENUSTR (bContext *UNUSED(C), uiLayout *layout, void *arg_str)
void ui_block_func_ICONROW (bContext *UNUSED(C), uiLayout *layout, void *arg_but)
void ui_block_func_ICONTEXTROW (bContext *UNUSED(C), uiLayout *layout, void *arg_but)
void ui_set_but_hsv (uiBut *but)
static void ui_update_block_buts_rgb (uiBlock *block, float *rgb)
static void do_picker_rna_cb (bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
static void do_hsv_rna_cb (bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
static void do_hex_rna_cb (bContext *UNUSED(C), void *bt1, void *hexcl)
static void close_popup_cb (bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
static void picker_new_hide_reveal (uiBlock *block, short colormode)
static void do_picker_new_mode_cb (bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
static void circle_picker (uiBlock *block, PointerRNA *ptr, PropertyRNA *prop)
static void square_picker (uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int type)
static void uiBlockPicker (uiBlock *block, float *rgb, PointerRNA *ptr, PropertyRNA *prop)
static int ui_picker_small_wheel_cb (const bContext *UNUSED(C), uiBlock *block, wmEvent *event)
uiBlockui_block_func_COL (bContext *C, uiPopupBlockHandle *handle, void *arg_but)
static int ui_popup_string_hash (char *str)
static int ui_popup_menu_hash (const char *str)
uiButui_popup_menu_memory (uiBlock *block, uiBut *but)
static uiBlockui_block_func_POPUP (bContext *C, uiPopupBlockHandle *handle, void *arg_pup)
uiPopupBlockHandleui_popup_menu_create (bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg, char *str)
uiPopupMenuuiPupMenuBegin (bContext *C, const char *title, int icon)
void uiPupMenuEnd (bContext *C, uiPopupMenu *pup)
uiLayoutuiPupMenuLayout (uiPopupMenu *pup)
static void operator_name_cb (bContext *C, void *arg, int retval)
static void operator_cb (bContext *C, void *arg, int retval)
static void confirm_cancel_operator (void *opv)
static void vconfirm_opname (bContext *C, const char *opname, const char *title, const char *itemfmt, va_list ap)
static void confirm_operator (bContext *C, wmOperator *op, const char *title, const char *item)
void uiPupMenuOkee (bContext *C, const char *opname, const char *str,...)
void uiPupMenuSaveOver (bContext *C, wmOperator *op, const char *filename)
void uiPupMenuNotice (bContext *C, const char *str,...)
void uiPupMenuError (bContext *C, const char *str,...)
void uiPupMenuReports (bContext *C, ReportList *reports)
void uiPupMenuInvoke (bContext *C, const char *idname)
void uiPupBlockO (bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext)
void uiPupBlock (bContext *C, uiBlockCreateFunc func, void *arg)
void uiPupBlockEx (bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg)
void uiPupBlockClose (bContext *C, uiBlock *block)
float * ui_block_hsv_get (uiBlock *block)

Detailed Description

Definition in file interface_regions.c.


Define Documentation

#define B_NOP   -1
#define BPICK   24.0

Definition at line 1752 of file interface_regions.c.

#define DPICK   6.0

Definition at line 1751 of file interface_regions.c.

#define DPICK1   6.0

Definition at line 1931 of file interface_regions.c.

#define FPICK   180.0

Definition at line 1750 of file interface_regions.c.

#define MAX_TOOLTIP_LINES   8

Definition at line 310 of file interface_regions.c.

Referenced by ui_tooltip_create().

#define MENU_SEPR_HEIGHT   6

Definition at line 71 of file interface_regions.c.

#define MENU_SHADOW_BOTTOM   10
#define MENU_SHADOW_SIDE   8
#define MENU_TOP   8
#define PICKER_BAR   14

Definition at line 1936 of file interface_regions.c.

Referenced by circle_picker(), and square_picker().

#define PICKER_H   150

Definition at line 1933 of file interface_regions.c.

Referenced by circle_picker(), and square_picker().

#define PICKER_SPACE   6

Definition at line 1935 of file interface_regions.c.

Referenced by circle_picker(), and square_picker().

#define PICKER_TOTAL_W   (PICKER_W+PICKER_SPACE+PICKER_BAR)

Definition at line 1938 of file interface_regions.c.

Referenced by square_picker(), and uiBlockPicker().

#define PICKER_W   150

Definition at line 1934 of file interface_regions.c.

Referenced by circle_picker().

#define SEARCH_ITEMS   10
#define SPICK   110.0

Definition at line 1749 of file interface_regions.c.

#define SPICK1   150.0

Definition at line 1930 of file interface_regions.c.

#define TIP_BORDER_X   16.0f

Referenced by ui_tooltip_create().

#define TIP_BORDER_Y   6.0f

Referenced by ui_tooltip_create().

#define TIP_MARGIN_Y   2

Referenced by ui_tooltip_create().


Typedef Documentation

typedef struct MenuData MenuData
typedef struct MenuEntry MenuEntry
typedef struct uiTooltipData uiTooltipData

Function Documentation

static void circle_picker ( uiBlock block,
PointerRNA ptr,
PropertyRNA prop 
) [static]
static void close_popup_cb ( bContext UNUSEDC,
void *  bt1,
void *  UNUSEDarg 
) [static]
static void confirm_cancel_operator ( void *  opv) [static]

Definition at line 2436 of file interface_regions.c.

References WM_operator_free().

Referenced by confirm_operator().

static void confirm_operator ( bContext C,
wmOperator op,
const char *  title,
const char *  item 
) [static]
static MenuData* decompose_menu_string ( const char *  str) [static]

Parse menu description strings, string is of the form "[sss%t|]{(sss[%xNN]|), (%l|), (sss%l|)}", sssst indicates the menu title, sss or sssxNN indicates an option, if xNN is given then NN is the return value if that option is selected otherwise the return value is the index of the option (starting with 1). l indicates a seperator, sssl indicates a label and new column.

Parameters:
strString to be parsed.
Return values:
newmenudata structure, free with menudata_free()

Definition at line 159 of file interface_regions.c.

References BLI_strdup(), menudata_add_item(), menudata_new(), menudata_set_title(), MenuData::nitems, and NULL.

Referenced by ui_block_func_ICONTEXTROW(), ui_block_func_MENUSTR(), ui_set_name_menu(), and ui_step_name_menu().

static void do_hex_rna_cb ( bContext UNUSEDC,
void *  bt1,
void *  hexcl 
) [static]
static void do_hsv_rna_cb ( bContext UNUSEDC,
void *  bt1,
void *  UNUSEDarg 
) [static]
static void do_picker_new_mode_cb ( bContext UNUSEDC,
void *  bt1,
void *  UNUSEDarg 
) [static]

Definition at line 1922 of file interface_regions.c.

References uiBut::block, picker_new_hide_reveal(), and ui_get_but_val().

Referenced by uiBlockPicker().

static void do_picker_rna_cb ( bContext UNUSEDC,
void *  bt1,
void *  UNUSEDarg 
) [static]
static void menudata_add_item ( MenuData md,
const char *  str,
int  retval,
int  icon,
int  sepr 
) [static]
static void menudata_free ( MenuData md) [static]
static MenuData* menudata_new ( const char *  instr) [static]
static void menudata_set_title ( MenuData md,
const char *  title,
int  titleicon 
) [static]

Definition at line 108 of file interface_regions.c.

References MenuData::title, and MenuData::titleicon.

Referenced by decompose_menu_string().

static void operator_cb ( bContext C,
void *  arg,
int  retval 
) [static]

Definition at line 2426 of file interface_regions.c.

References WM_operator_call(), and WM_operator_free().

Referenced by confirm_operator().

static void operator_name_cb ( bContext C,
void *  arg,
int  retval 
) [static]

Definition at line 2418 of file interface_regions.c.

References NULL, WM_OP_EXEC_DEFAULT, and WM_operator_name_call().

Referenced by vconfirm_opname().

static void picker_new_hide_reveal ( uiBlock block,
short  colormode 
) [static]
static void square_picker ( uiBlock block,
PointerRNA ptr,
PropertyRNA prop,
int  type 
) [static]
static ARegion* ui_add_temporary_region ( bScreen sc) [static]
uiBlock* ui_block_func_COL ( bContext C,
uiPopupBlockHandle handle,
void *  arg_but 
)
void ui_block_func_ICONROW ( bContext UNUSEDC,
uiLayout layout,
void *  arg_but 
)
void ui_block_func_ICONTEXTROW ( bContext UNUSEDC,
uiLayout layout,
void *  arg_but 
)
static void ui_block_func_MENUSTR ( bContext UNUSEDC,
uiLayout layout,
void *  arg_str 
) [static]
static uiBlock* ui_block_func_POPUP ( bContext C,
uiPopupBlockHandle handle,
void *  arg_pup 
) [static]
float* ui_block_hsv_get ( uiBlock block)
static void ui_block_position ( wmWindow window,
ARegion butregion,
uiBut but,
uiBlock block 
) [static]
static void ui_block_region_draw ( const bContext C,
ARegion ar 
) [static]

Definition at line 1423 of file interface_regions.c.

References ListBase::first, uiBlock::next, ARegion::uiblocks, and uiDrawBlock().

Referenced by ui_popup_block_create().

void ui_but_search_test ( uiBut but)
static int ui_picker_small_wheel_cb ( const bContext UNUSEDC,
uiBlock block,
wmEvent event 
) [static]
static void ui_popup_block_clip ( wmWindow window,
uiBlock block 
) [static]
uiPopupBlockHandle* ui_popup_block_create ( bContext C,
ARegion butregion,
uiBut but,
uiBlockCreateFunc  create_func,
uiBlockHandleCreateFunc  handle_create_func,
void *  arg 
)
void ui_popup_block_free ( bContext C,
uiPopupBlockHandle handle 
)
void ui_popup_block_scrolltest ( uiBlock block)
uiPopupBlockHandle* ui_popup_menu_create ( bContext C,
ARegion butregion,
uiBut but,
uiMenuCreateFunc  menu_func,
void *  arg,
char *  str 
)
static int ui_popup_menu_hash ( const char *  str) [static]

Definition at line 2154 of file interface_regions.c.

References BLI_ghashutil_strhash().

Referenced by uiPupMenuBegin().

uiBut* ui_popup_menu_memory ( uiBlock block,
uiBut but 
)
static int ui_popup_string_hash ( char *  str) [static]

Definition at line 2141 of file interface_regions.c.

References BLI_ghashutil_strhash(), and hash.

Referenced by ui_popup_menu_memory().

static void ui_remove_temporary_region ( bContext C,
bScreen sc,
ARegion ar 
) [static]
void ui_searchbox_apply ( uiBut but,
ARegion ar 
)
void ui_searchbox_autocomplete ( bContext C,
ARegion ar,
uiBut but,
char *  str 
)
static void ui_searchbox_butrect ( rcti rect,
uiSearchboxData data,
int  itemnr 
) [static]
ARegion* ui_searchbox_create ( bContext C,
ARegion butregion,
uiBut but 
)
void ui_searchbox_event ( bContext C,
ARegion ar,
uiBut but,
wmEvent event 
)
void ui_searchbox_free ( bContext C,
ARegion ar 
)

Definition at line 1145 of file interface_regions.c.

References CTX_wm_screen(), and ui_remove_temporary_region().

Referenced by ui_textedit_end().

int ui_searchbox_inside ( ARegion ar,
int  x,
int  y 
)
static void ui_searchbox_region_draw_cb ( const bContext UNUSEDC,
ARegion ar 
) [static]
static void ui_searchbox_region_free_cb ( ARegion ar) [static]
static void ui_searchbox_select ( bContext C,
ARegion ar,
uiBut but,
int  step 
) [static]
void ui_searchbox_update ( bContext C,
ARegion ar,
uiBut but,
int  reset 
)
void ui_set_but_hsv ( uiBut but)
void ui_set_name_menu ( uiBut but,
int  value 
)
int ui_step_name_menu ( uiBut but,
int  step 
)
ARegion* ui_tooltip_create ( bContext C,
ARegion butregion,
uiBut but 
) [read]

Definition at line 352 of file interface_regions.c.

References uiFontStyle::align, uiBlock::aspect, assert, uiTooltipData::bbox, BLF_height_max(), BLF_width(), BLI_snprintf(), BLI_strncpy(), uiBut::block, uiTooltipData::color, CTX_wm_operator_poll_msg_get(), CTX_wm_operator_poll_msg_set(), CTX_wm_screen(), CTX_wm_window(), View2D::cur, data, PointerRNA::data, EnumPropertyItem::description, ARegionType::draw, ED_region_init(), ED_region_tag_redraw(), ELEM, ELEM3, uiBut::flag, UserDef::flag, uiBlock::flag, ARegionType::free, addon::engine::free(), uiTooltipData::fstyle, uiBut::hardmax, i, PointerRNA::id, wmOperatorType::idname, MenuType::idname, IDPOIN, ID::lib, uiTooltipData::lineh, uiTooltipData::lines, MAX2, MAX_TOOLTIP_LINES, MEM_callocN(), MEM_freeN(), MENU, MENU_SHADOW_BOTTOM, MENU_SHADOW_SIDE, MENU_TOP, mt, Library::name, EnumPropertyItem::name, NULL, Panel::ofsx, Panel::ofsy, uiBut::opcontext, uiBut::opptr, uiBut::optype, uiBlock::panel, PROP_ENUM, PROP_FLOAT, PROP_UNIT_ROTATION, PULLDOWN, ARegion::regiondata, RNA_property_array_check(), RNA_property_description(), RNA_property_enum_items_gettexted(), RNA_property_float_get(), RNA_property_float_get_index(), RNA_property_identifier(), RNA_property_type(), RNA_struct_identifier(), uiBut::rnaindex, uiBut::rnapoin, uiBut::rnaprop, ROW, SEARCH_MENU, uiTooltipData::spaceh, str, TEX, uiBut::tip, TIP_, TIP_BORDER_X, TIP_BORDER_Y, TIP_MARGIN_Y, uiTooltipData::toth, uiTooltipData::totline, TRUE, PointerRNA::type, ARegion::type, uiBut::type, U, ui_add_temporary_region(), UI_BLOCK_LOOP, ui_but_anim_expression_get(), UI_BUT_DISABLED, UI_BUT_DRIVEN, UI_BUT_NO_TOOLTIP, ui_get_but_string(), ui_get_but_val(), UI_GetStyle(), UI_STYLE_TEXT_CENTER, ui_tooltip_region_draw_cb(), ui_tooltip_region_free_cb(), UI_view2d_to_region_no_clip(), uiButGetMenuType(), uiButGetOperatorPtrRNA(), uiButGetUnitType(), uiFontStyle::uifont_id, uiStyleFontSet(), USER_TOOLTIPS_PYTHON, ARegion::v2d, simple_enum_gen::w, uiStyle::widget, ARegion::winrct, WM_key_event_operator_string(), WM_operator_poll_context(), WM_operator_pystring(), wm_window_get_size(), uiBut::x1, uiBut::x2, rcti::xmax, rctf::xmax, rcti::xmin, rctf::xmin, uiBut::y1, rcti::ymax, and rcti::ymin.

Referenced by ui_handle_button_event().

void ui_tooltip_free ( bContext C,
ARegion ar 
)

Definition at line 621 of file interface_regions.c.

References CTX_wm_screen(), and ui_remove_temporary_region().

Referenced by button_timers_tooltip_remove().

static void ui_tooltip_region_draw_cb ( const bContext UNUSEDC,
ARegion ar 
) [static]
static void ui_tooltip_region_free_cb ( ARegion ar) [static]

Definition at line 343 of file interface_regions.c.

References data, MEM_freeN(), NULL, and ARegion::regiondata.

Referenced by ui_tooltip_create().

static void ui_update_block_buts_rgb ( uiBlock block,
float *  rgb 
) [static]
static void uiBlockPicker ( uiBlock block,
float *  rgb,
PointerRNA ptr,
PropertyRNA prop 
) [static]
void uiPupBlock ( bContext C,
uiBlockCreateFunc  func,
void *  arg 
)
void uiPupBlockClose ( bContext C,
uiBlock block 
)
void uiPupBlockEx ( bContext C,
uiBlockCreateFunc  func,
uiBlockHandleFunc  popup_func,
uiBlockCancelFunc  cancel_func,
void *  arg 
)
void uiPupBlockO ( bContext C,
uiBlockCreateFunc  func,
void *  arg,
const char *  opname,
int  opcontext 
)
uiPopupMenu* uiPupMenuBegin ( bContext C,
const char *  title,
int  icon 
)
void uiPupMenuEnd ( bContext C,
uiPopupMenu pup 
)
void uiPupMenuError ( bContext C,
const char *  str,
  ... 
)

Definition at line 2504 of file interface_regions.c.

References BLI_snprintf(), BLI_strncpy(), NULL, and vconfirm_opname().

void uiPupMenuInvoke ( bContext C,
const char *  idname 
)
uiLayout* uiPupMenuLayout ( uiPopupMenu pup) [read]
void uiPupMenuNotice ( bContext C,
const char *  str,
  ... 
)

Definition at line 2495 of file interface_regions.c.

References NULL, and vconfirm_opname().

void uiPupMenuOkee ( bContext C,
const char *  opname,
const char *  str,
  ... 
)

Definition at line 2473 of file interface_regions.c.

References BLI_snprintf(), and vconfirm_opname().

Referenced by node_group_edit_invoke(), and pack_all_invoke().

void uiPupMenuReports ( bContext C,
ReportList reports 
)
void uiPupMenuSaveOver ( bContext C,
wmOperator op,
const char *  filename 
)

Definition at line 2490 of file interface_regions.c.

References confirm_operator().

Referenced by wm_handler_fileselect_call(), and wm_save_mainfile_invoke().

int uiSearchBoxhHeight ( void  )
int uiSearchItemAdd ( uiSearchItems items,
const char *  name,
void *  poin,
int  iconid 
)
static void vconfirm_opname ( bContext C,
const char *  opname,
const char *  title,
const char *  itemfmt,
va_list  ap 
) [static]