Blender V2.61 - r43446
|
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "MEM_guardedalloc.h"
#include "PIL_time.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLF_translation.h"
#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "interface_intern.h"
Go to the source code of this file.
Classes | |
struct | uiHandlePanelData |
struct | PanelSort |
Defines | |
#define | ANIMATION_TIME 0.30 |
#define | ANIMATION_INTERVAL 0.02 |
#define | PNL_LAST_ADDED 1 |
#define | PNL_ACTIVE 2 |
#define | PNL_WAS_ACTIVE 4 |
#define | PNL_ANIM_ALIGN 8 |
#define | PNL_NEW_ADDED 16 |
#define | PNL_FIRST 32 |
#define | PNL_ICON UI_UNIT_X |
Typedefs | |
typedef enum uiHandlePanelState | uiHandlePanelState |
typedef struct uiHandlePanelData | uiHandlePanelData |
typedef struct PanelSort | PanelSort |
Enumerations | |
enum | uiHandlePanelState { PANEL_STATE_DRAG, PANEL_STATE_DRAG_SCALE, PANEL_STATE_WAIT_UNTAB, PANEL_STATE_ANIMATION, PANEL_STATE_EXIT } |
Functions | |
static void | panel_activate_state (const bContext *C, Panel *pa, uiHandlePanelState state) |
static int | panel_aligned (ScrArea *sa, ARegion *ar) |
static int | panels_re_align (ScrArea *sa, ARegion *ar, Panel **r_pa) |
static void | ui_panel_copy_offset (Panel *pa, Panel *papar) |
Panel * | uiBeginPanel (ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int *open) |
void | uiEndPanel (uiBlock *block, int width, int height) |
static void | ui_offset_panel_block (uiBlock *block) |
void | UI_DrawTriIcon (float x, float y, char dir) |
static void | ui_draw_tria_rect (rctf *rect, char dir) |
static void | ui_draw_anti_x (float x1, float y1, float x2, float y2) |
static void | ui_draw_x_icon (float x, float y) |
static void | ui_draw_panel_scalewidget (rcti *rect) |
static void | ui_draw_panel_dragwidget (rctf *rect) |
static void | ui_draw_aligned_panel_header (uiStyle *style, uiBlock *block, rcti *rect, char dir) |
static void | rectf_scale (rctf *rect, float scale) |
void | ui_draw_aligned_panel (uiStyle *style, uiBlock *block, rcti *rect) |
static int | get_panel_header (Panel *pa) |
static int | get_panel_size_y (Panel *pa) |
static int | get_panel_real_ofsy (Panel *pa) |
static int | get_panel_real_ofsx (Panel *pa) |
static int | find_leftmost_panel (const void *a1, const void *a2) |
static int | find_highest_panel (const void *a1, const void *a2) |
static int | compare_panel (const void *a1, const void *a2) |
static int | uiAlignPanelStep (ScrArea *sa, ARegion *ar, float fac, int drag) |
static void | ui_panels_size (ScrArea *sa, ARegion *ar, int *x, int *y) |
static void | ui_do_animate (const bContext *C, Panel *panel) |
void | uiBeginPanels (const bContext *UNUSED(C), ARegion *ar) |
void | uiEndPanels (const bContext *C, ARegion *ar, int *x, int *y) |
void | uiDrawPanels (const bContext *C, ARegion *ar) |
static void | check_panel_overlap (ARegion *ar, Panel *panel) |
static void | ui_do_drag (const bContext *C, wmEvent *event, Panel *panel) |
static void | ui_handle_panel_header (const bContext *C, uiBlock *block, int mx, int my, int event) |
int | ui_handler_panel_region (bContext *C, wmEvent *event) |
static int | ui_handler_panel (bContext *C, wmEvent *event, void *userdata) |
static void | ui_handler_remove_panel (bContext *C, void *userdata) |
Definition in file interface_panel.c.
#define ANIMATION_INTERVAL 0.02 |
Definition at line 69 of file interface_panel.c.
Referenced by panel_activate_state().
#define ANIMATION_TIME 0.30 |
Definition at line 68 of file interface_panel.c.
Referenced by ui_do_animate().
#define PNL_ACTIVE 2 |
Definition at line 72 of file interface_panel.c.
Referenced by check_panel_overlap(), panels_re_align(), ui_panels_size(), uiAlignPanelStep(), uiBeginPanel(), uiBeginPanels(), and uiEndPanels().
#define PNL_ANIM_ALIGN 8 |
Definition at line 74 of file interface_panel.c.
Referenced by panels_re_align(), and uiEndPanel().
#define PNL_FIRST 32 |
Definition at line 76 of file interface_panel.c.
Referenced by ui_draw_aligned_panel(), and uiEndPanels().
#define PNL_ICON UI_UNIT_X |
Definition at line 386 of file interface_panel.c.
Referenced by ui_draw_aligned_panel_header(), and ui_handle_panel_header().
#define PNL_LAST_ADDED 1 |
Definition at line 71 of file interface_panel.c.
Referenced by uiBeginPanel().
#define PNL_NEW_ADDED 16 |
Definition at line 75 of file interface_panel.c.
Referenced by uiBeginPanel(), and uiEndPanel().
#define PNL_WAS_ACTIVE 4 |
Definition at line 73 of file interface_panel.c.
Referenced by panels_re_align(), and uiBeginPanels().
typedef struct uiHandlePanelData uiHandlePanelData |
typedef enum uiHandlePanelState uiHandlePanelState |
enum uiHandlePanelState |
PANEL_STATE_DRAG | |
PANEL_STATE_DRAG_SCALE | |
PANEL_STATE_WAIT_UNTAB | |
PANEL_STATE_ANIMATION | |
PANEL_STATE_EXIT |
Definition at line 78 of file interface_panel.c.
Definition at line 930 of file interface_panel.c.
References ListBase::first, Panel::flag, Panel::next, NULL, Panel::ofsx, Panel::ofsy, ARegion::panels, Panel::paneltab, PNL_ACTIVE, PNL_CLOSEDX, PNL_CLOSEDY, PNL_OVERLAP, Panel::runtime_flag, Panel::sizex, and Panel::sizey.
Referenced by panel_activate_state(), and ui_do_drag().
static int compare_panel | ( | const void * | a1, |
const void * | a2 | ||
) | [static] |
Definition at line 676 of file interface_panel.c.
References PanelSort::pa, and Panel::sortorder.
Referenced by uiAlignPanelStep().
static int find_highest_panel | ( | const void * | a1, |
const void * | a2 | ||
) | [static] |
Definition at line 660 of file interface_panel.c.
References PanelType::flag, Panel::ofsy, PanelSort::pa, PNL_NO_HEADER, Panel::sizey, Panel::sortorder, and Panel::type.
Referenced by uiAlignPanelStep().
static int find_leftmost_panel | ( | const void * | a1, |
const void * | a2 | ||
) | [static] |
Definition at line 647 of file interface_panel.c.
References Panel::ofsx, PanelSort::pa, and Panel::sortorder.
Referenced by uiAlignPanelStep().
static int get_panel_header | ( | Panel * | pa | ) | [static] |
Definition at line 604 of file interface_panel.c.
References PanelType::flag, PNL_HEADER, PNL_NO_HEADER, and Panel::type.
Referenced by get_panel_real_ofsx().
static int get_panel_real_ofsx | ( | Panel * | pa | ) | [static] |
Definition at line 630 of file interface_panel.c.
References Panel::flag, get_panel_header(), Panel::ofsx, Panel::paneltab, PNL_CLOSEDX, and Panel::sizex.
Referenced by ui_panels_size(), and uiAlignPanelStep().
static int get_panel_real_ofsy | ( | Panel * | pa | ) | [static] |
Definition at line 622 of file interface_panel.c.
References Panel::flag, Panel::ofsy, Panel::paneltab, PNL_CLOSEDY, and Panel::sizey.
Referenced by ui_panels_size(), and uiAlignPanelStep().
static int get_panel_size_y | ( | Panel * | pa | ) | [static] |
Definition at line 612 of file interface_panel.c.
References PanelType::flag, PNL_HEADER, PNL_NO_HEADER, Panel::sizey, and Panel::type.
Referenced by ui_panels_size(), and uiAlignPanelStep().
static void panel_activate_state | ( | const bContext * | C, |
Panel * | pa, | ||
uiHandlePanelState | state | ||
) | [static] |
Definition at line 1239 of file interface_panel.c.
References Panel::activedata, ANIMATION_INTERVAL, uiHandlePanelData::animtimer, check_panel_overlap(), CTX_wm_manager(), CTX_wm_region(), CTX_wm_window(), data, ED_region_tag_redraw(), ELEM, wmWindow::eventstate, Panel::flag, MEM_callocN(), MEM_freeN(), wmWindow::modalhandlers, NULL, Panel::ofsx, Panel::ofsy, PANEL_STATE_ANIMATION, PANEL_STATE_DRAG, PANEL_STATE_EXIT, PIL_check_seconds_timer(), PNL_SELECT, Panel::sizex, Panel::sizey, uiHandlePanelData::startofsx, uiHandlePanelData::startofsy, uiHandlePanelData::startsizex, uiHandlePanelData::startsizey, uiHandlePanelData::starttime, uiHandlePanelData::startx, uiHandlePanelData::starty, state, uiHandlePanelData::state, TIMER, ui_handler_panel(), ui_handler_remove_panel(), WM_event_add_timer(), WM_event_add_ui_handler(), WM_event_remove_timer(), WM_event_remove_ui_handler(), wmEvent::x, and wmEvent::y.
Referenced by ui_do_animate(), ui_handle_panel_header(), ui_handler_panel(), ui_handler_panel_region(), ui_handler_remove_panel(), and uiEndPanels().
Definition at line 104 of file interface_panel.c.
References SpaceButs::align, BUT_VERTICAL, ELEM3, ListBase::first, ARegion::regiontype, RGN_TYPE_CHANNELS, RGN_TYPE_PREVIEW, RGN_TYPE_TOOL_PROPS, RGN_TYPE_TOOLS, RGN_TYPE_UI, RGN_TYPE_WINDOW, SPACE_BUTS, SPACE_FILE, SPACE_IMAGE, SPACE_USERPREF, ScrArea::spacedata, and ScrArea::spacetype.
Referenced by ui_do_drag(), ui_handle_panel_header(), ui_handler_panel(), ui_panels_size(), uiAlignPanelStep(), and uiBeginPanel().
Definition at line 122 of file interface_panel.c.
References Panel::activedata, SpaceButs::align, ListBase::first, SpaceButs::mainb, SpaceButs::mainbo, Panel::next, NULL, ARegion::panels, PNL_ACTIVE, PNL_ANIM_ALIGN, PNL_WAS_ACTIVE, SpaceButs::re_align, ARegion::regiontype, RGN_TYPE_CHANNELS, RGN_TYPE_PREVIEW, RGN_TYPE_UI, RGN_TYPE_WINDOW, Panel::runtime_flag, SPACE_BUTS, SPACE_FILE, SPACE_IMAGE, ScrArea::spacedata, and ScrArea::spacetype.
Referenced by uiEndPanels().
static void rectf_scale | ( | rctf * | rect, |
float | scale | ||
) | [static] |
Definition at line 469 of file interface_panel.c.
References rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by ui_draw_aligned_panel().
Definition at line 812 of file interface_panel.c.
References Panel::activedata, ANIMATION_TIME, CTX_wm_area(), CTX_wm_region(), data, ED_region_tag_redraw(), MIN2, panel_activate_state(), PANEL_STATE_EXIT, PIL_check_seconds_timer(), sqrt(), uiHandlePanelData::starttime, and uiAlignPanelStep().
Referenced by ui_handler_panel().
Definition at line 959 of file interface_panel.c.
References Panel::activedata, BLI_in_rcti(), check_panel_overlap(), CTX_wm_area(), CTX_wm_region(), View2D::cur, data, ED_region_tag_redraw(), MAX2, Panel::ofsx, Panel::ofsy, panel_aligned(), PANEL_STATE_DRAG_SCALE, PNL_GRID, PNL_SNAP_NONE, Panel::sizex, Panel::sizey, Panel::snap, uiHandlePanelData::startofsx, uiHandlePanelData::startofsy, uiHandlePanelData::startsizex, uiHandlePanelData::startsizey, uiHandlePanelData::startx, uiHandlePanelData::starty, uiHandlePanelData::state, UI_PANEL_MINX, UI_PANEL_MINY, uiAlignPanelStep(), ARegion::v2d, ARegion::winrct, wmEvent::x, rcti::xmax, rctf::xmax, rcti::xmin, rctf::xmin, wmEvent::y, rcti::ymax, rctf::ymax, rcti::ymin, and rctf::ymin.
Referenced by ui_handler_panel().
Definition at line 483 of file interface_panel.c.
References uiBlock::aspect, Panel::control, fdrawline(), PanelType::flag, Panel::flag, uiPanelColors::header, ThemeUI::panel, uiBlock::panel, Panel::paneltab, PNL_CLOSEDX, PNL_CLOSEDY, PNL_FIRST, PNL_HEADER, PNL_NO_HEADER, PNL_SELECT, rectf_scale(), Panel::runtime_flag, uiPanelColors::show_header, TH_BACK, TH_TEXT, bTheme::tui, Panel::type, UI_CNR_ALL, UI_CNR_NONE, ui_draw_aligned_panel_header(), ui_draw_panel_dragwidget(), ui_draw_panel_scalewidget(), ui_draw_tria_rect(), ui_draw_x_icon(), UI_GetTheme(), UI_PNL_CLOSE, UI_PNL_SCALE, UI_PNL_SOLID, UI_ThemeColor(), UI_ThemeColorShade(), uiRoundRect(), uiSetRoundBox(), rcti::xmax, rctf::xmax, rcti::xmin, rctf::xmin, rcti::ymax, rctf::ymax, rcti::ymin, and rctf::ymin.
Referenced by uiDrawBlock().
static void ui_draw_aligned_panel_header | ( | uiStyle * | style, |
uiBlock * | block, | ||
rcti * | rect, | ||
char | dir | ||
) | [static] |
Definition at line 439 of file interface_panel.c.
References uiBlock::aspect, Panel::control, Panel::drawname, IFACE_, Panel::labelofs, uiBlock::panel, Panel::panelname, uiStyle::paneltitle, PNL_ICON, TH_TITLE, UI_PNL_CLOSE, UI_ThemeColor(), uiStyleFontDraw(), uiStyleFontDrawRotated(), rcti::xmin, and rcti::ymin.
Referenced by ui_draw_aligned_panel().
static void ui_draw_anti_x | ( | float | x1, |
float | y1, | ||
float | x2, | ||
float | y2 | ||
) | [static] |
Definition at line 359 of file interface_panel.c.
References fdrawline().
Referenced by ui_draw_x_icon().
static void ui_draw_panel_dragwidget | ( | rctf * | rect | ) | [static] |
Definition at line 412 of file interface_panel.c.
References fdrawline(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by ui_draw_aligned_panel().
static void ui_draw_panel_scalewidget | ( | rcti * | rect | ) | [static] |
Definition at line 388 of file interface_panel.c.
References fdrawline(), PNL_HEADER, rcti::xmax, and rcti::ymin.
Referenced by ui_draw_aligned_panel().
static void ui_draw_tria_rect | ( | rctf * | rect, |
char | dir | ||
) | [static] |
Definition at line 347 of file interface_panel.c.
References ui_draw_anti_tria(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by ui_draw_aligned_panel().
static void ui_draw_x_icon | ( | float | x, |
float | y | ||
) | [static] |
Definition at line 379 of file interface_panel.c.
References ui_draw_anti_x().
Referenced by ui_draw_aligned_panel().
void UI_DrawTriIcon | ( | float | x, |
float | y, | ||
char | dir | ||
) |
Definition at line 333 of file interface_panel.c.
References ui_draw_anti_tria().
Referenced by node_draw_basis(), node_draw_hidden(), and ui_draw_menu_back().
static void ui_handle_panel_header | ( | const bContext * | C, |
uiBlock * | block, | ||
int | mx, | ||
int | my, | ||
int | event | ||
) | [static] |
Definition at line 1004 of file interface_panel.c.
References AKEY, BUT_HORIZONTAL, Panel::control, CTX_wm_area(), CTX_wm_region(), ED_region_tag_redraw(), ListBase::first, Panel::flag, uiBlock::maxx, uiBlock::maxy, Panel::next, Panel::ofsy, uiBlock::panel, panel_activate_state(), panel_aligned(), PANEL_STATE_ANIMATION, PANEL_STATE_DRAG, ARegion::panels, Panel::paneltab, PNL_CLOSED, PNL_CLOSEDX, PNL_CLOSEDY, PNL_ICON, PNL_SNAP_BOTTOM, RETKEY, Panel::sizey, Panel::snap, and UI_PNL_CLOSE.
Referenced by ui_handler_panel_region().
Definition at line 1197 of file interface_panel.c.
References Panel::activedata, uiHandlePanelData::animtimer, CTX_wm_area(), CTX_wm_region(), wmEvent::customdata, data, KM_PRESS, LEFTMOUSE, MOUSEMOVE, panel_activate_state(), panel_aligned(), PANEL_STATE_ANIMATION, PANEL_STATE_DRAG, PANEL_STATE_EXIT, uiHandlePanelData::state, TIMER, wmEvent::type, ui_do_animate(), ui_do_drag(), wmEvent::val, WM_UI_HANDLER_BREAK, and WM_UI_HANDLER_CONTINUE.
Referenced by panel_activate_state().
Definition at line 1074 of file interface_panel.c.
References AKEY, wmEvent::alt, CLAMP(), Panel::control, wmEvent::ctrl, CTX_wm_area(), CTX_wm_region(), ED_region_tag_redraw(), ELEM, ELEM4, ESCKEY, ListBase::first, PanelType::flag, Panel::flag, KM_MOD_FIRST, KM_PRESS, ListBase::last, LEFTMOUSE, uiBlock::maxx, uiBlock::maxy, uiBlock::minx, uiBlock::miny, NULL, wmEvent::oskey, PADENTER, PADMINUS, PADPLUSKEY, uiBlock::panel, panel_activate_state(), PANEL_STATE_DRAG_SCALE, Panel::paneltab, PNL_CLOSED, PNL_CLOSEDX, PNL_CLOSEDY, PNL_HEADER, PNL_NO_HEADER, uiBlock::prev, RETKEY, wmEvent::shift, SPACE_BUTS, ScrArea::spacedata, ScrArea::spacetype, wmEvent::type, Panel::type, ui_button_is_active(), ui_handle_panel_header(), UI_PNL_SCALE, ui_window_to_block(), ARegion::uiblocks, wmEvent::val, WM_UI_HANDLER_BREAK, and WM_UI_HANDLER_CONTINUE.
Referenced by ui_handler_region().
static void ui_handler_remove_panel | ( | bContext * | C, |
void * | userdata | ||
) | [static] |
Definition at line 1232 of file interface_panel.c.
References panel_activate_state(), and PANEL_STATE_EXIT.
Referenced by panel_activate_state().
static void ui_offset_panel_block | ( | uiBlock * | block | ) | [static] |
Definition at line 293 of file interface_panel.c.
References uiBlock::buttons, ListBase::first, uiBlock::maxx, uiBlock::maxy, uiBlock::minx, uiBlock::miny, uiBut::next, uiBlock::panel, uiStyle::panelspace, Panel::sizex, Panel::sizey, ui_bounds_block(), UI_GetStyle(), uiBut::y1, and uiBut::y2.
Referenced by uiEndPanels().
Definition at line 167 of file interface_panel.c.
References Panel::ofsx, Panel::ofsy, and Panel::sizey.
Referenced by uiAlignPanelStep(), and uiBeginPanel().
Definition at line 782 of file interface_panel.c.
References BUT_VERTICAL, ListBase::first, get_panel_real_ofsx(), get_panel_real_ofsy(), get_panel_size_y(), MAX2, MIN2, Panel::next, Panel::ofsx, Panel::ofsy, panel_aligned(), ARegion::panels, PNL_ACTIVE, Panel::runtime_flag, Panel::sizex, and UI_PANEL_WIDTH.
Referenced by uiEndPanels().
Definition at line 688 of file interface_panel.c.
References BUT_HORIZONTAL, BUT_VERTICAL, compare_panel(), find_highest_panel(), find_leftmost_panel(), ListBase::first, Panel::flag, floorf, get_panel_real_ofsx(), get_panel_real_ofsy(), get_panel_size_y(), MEM_callocN(), MEM_dupallocN(), MEM_freeN(), Panel::next, NULL, Panel::ofsx, Panel::ofsy, PanelSort::orig, PanelSort::pa, panel_aligned(), ARegion::panels, Panel::paneltab, PNL_ACTIVE, PNL_CLOSED, PNL_CLOSEDX, PNL_CLOSEDY, PNL_SELECT, Panel::runtime_flag, Panel::sortorder, and ui_panel_copy_offset().
Referenced by ui_do_animate(), ui_do_drag(), and uiEndPanels().
Panel* uiBeginPanel | ( | ScrArea * | sa, |
ARegion * | ar, | ||
uiBlock * | block, | ||
PanelType * | pt, | ||
int * | open | ||
) | [read] |
Definition at line 175 of file interface_panel.c.
References BLI_addtail(), BLI_strncpy(), BUT_VERTICAL, Panel::drawname, ListBase::first, Panel::flag, PanelType::flag, PanelType::idname, PanelType::label, MEM_callocN(), Panel::next, NULL, Panel::ofsx, Panel::ofsy, uiBlock::panel, panel_aligned(), Panel::panelname, ARegion::panels, Panel::paneltab, PNL_ACTIVE, PNL_CLOSED, PNL_CLOSEDX, PNL_CLOSEDY, PNL_DEFAULT_CLOSED, PNL_LAST_ADDED, PNL_NEW_ADDED, Panel::runtime_flag, Panel::sizex, Panel::sizey, Panel::sortorder, Panel::tabname, Panel::type, UI_MAX_NAME_STR, and ui_panel_copy_offset().
Referenced by ED_region_panels().
Definition at line 835 of file interface_panel.c.
References ListBase::first, Panel::next, ARegion::panels, PNL_ACTIVE, PNL_WAS_ACTIVE, and Panel::runtime_flag.
Definition at line 908 of file interface_panel.c.
References uiBlock::active, ListBase::first, Panel::flag, uiBlock::next, uiBlock::panel, PNL_SELECT, TH_BACK, UI_ThemeClearColor(), ARegion::uiblocks, and uiDrawBlock().
void uiEndPanel | ( | uiBlock * | block, |
int | width, | ||
int | height | ||
) |
Definition at line 268 of file interface_panel.c.
References ELEM, Panel::ofsy, uiBlock::panel, PNL_ANIM_ALIGN, PNL_NEW_ADDED, Panel::runtime_flag, Panel::sizex, and Panel::sizey.
Referenced by ED_region_panels().
Definition at line 850 of file interface_panel.c.
References uiBlock::active, CTX_wm_area(), ED_region_tag_redraw(), ListBase::first, Panel::next, uiBlock::next, NULL, uiBlock::panel, panel_activate_state(), PANEL_STATE_ANIMATION, ARegion::panels, panels_re_align(), Panel::paneltab, PNL_ACTIVE, PNL_FIRST, Panel::runtime_flag, Panel::sortorder, ui_offset_panel_block(), ui_panels_size(), uiAlignPanelStep(), and ARegion::uiblocks.