Port of part of the Interface code to 2.50.

This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.

Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
  making it non-blocking. 
* interface_regions: this is a part of interface.c, split off, contains code to
  create regions for tooltips, menus, pupmenu (that one is crashing currently),
  color chooser, basically regions with buttons which is fairly independent of
  core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
  icons yet. Panels should probably become (free floating) regions? 
* text.c: (formerly language.c) for drawing text and translation. this works
  but is using bad globals still and could be cleaned up.

Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
  declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.

Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
  are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
  should be possible while editing a button. That means though that we need
  some sort of persistence even though the blender model is to recreate buttons
  for each redraw. So when a new block is created, some matching happens to
  find out which buttons correspond to buttons in the previously created block,
  and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
  in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
  would integrate here?
* Currently only full window redraws are used, this should become per region
  and maybe per button later.

Operators:
* Events are currently handled through two operators: button activate and menu
  handle. Operators may not be the best way to implement this, since there are
  currently some issues with events being missed, but they can become a special
  handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
  handle all interaction with that button until the button is not activated
  anymore. This means clicking, text editing, number dragging, opening menu
  blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
  non-blocking. That means variables that were previously on the stack, now
  need to be stored away in a struct such that they can be accessed again when
  the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
  needs to be set explicit in order to handle the right events in the right
  state. So an activated button can be in one of these states: init, highlight,
  wait_flash, wait_release, wait_key_event, num_editing, text_editing,
  text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
  from ui_do_but. This makes it possible to continuously apply the button as
  text is being typed for example, and there is an option in the code to enable
  this. Since the code non-blocking and can deal with the button being deleted
  even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
  being edited, since that would mean data is being edited without correct
  updates happening, while some other part of blender may be accessing that
  data in the meantime. So data values, strings, vectors are written to a
  temporary location and only flush in the apply function.

Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
  blocks give a handle to the button that creates it, which will contain the
  results of the menu block once a MESSAGE event is received from that menu
  block.
* For this type of menu block the coordinates used to be in window space. They
  are still created that way and ui_positionblock still works with window
  coordinates, but after that the block and buttons are brought back to region
  coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
  should have enough information with these screen level regions to have full
  control over what gets drawn when and to then do correct compositing.

Testing:
* The header in the time space currently has some buttons to test the UI code.
This commit is contained in:
Brecht Van Lommel 2008-11-11 18:31:32 +00:00
parent 44f94f7927
commit 78a1c27c4a
28 changed files with 12439 additions and 876 deletions

@ -1,72 +0,0 @@
/**
* $Id: BIF_interface_icons.h 11920 2007-09-02 17:25:03Z elubie $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifndef BIF_PREVIEW_ICONS_H
#define BIF_PREVIEW_ICONS_H
struct Image;
struct ImBuf;
struct World;
struct Tex;
struct Lamp;
struct Material;
typedef struct IconFile {
struct IconFile *next, *prev;
char filename[80]; // FILE_MAXFILE size
int index;
} IconFile;
#define ICON_DEFAULT_HEIGHT 16
#define PREVIEW_DEFAULT_HEIGHT 96
/*
Resizable Icons for Blender
*/
void BIF_icons_init(int first_dyn_id);
int BIF_icon_get_width(int icon_id);
int BIF_icon_get_height(int icon_id);
void BIF_icon_draw(float x, float y, int icon_id);
void BIF_icon_draw_preview(float x, float y, int icon_id, int nocreate);
void BIF_icon_draw_aspect(float x, float y, int icon_id, float aspect);
void BIF_icon_draw_aspect_blended(float x, float y, int icon_id, float aspect, int shade);
void BIF_icons_free();
void BIF_icons_free_drawinfo(void *drawinfo);
struct ListBase *BIF_iconfile_list(void);
int BIF_iconfile_get_index(char *filename);
#endif /* BIF_ICONS_H */

@ -1,600 +0,0 @@
/**
* $Id: BIF_resources.h 13057 2007-12-30 12:08:28Z aligorith $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifndef BIF_RESOURCES_H
#define BIF_RESOURCES_H
/* elubie: TODO: move the typedef for icons to BIF_interface_icons.h */
/* and add/replace include of BIF_resources.h by BIF_interface_icons.h */
typedef enum {
#define BIFICONID_FIRST (ICON_VIEW3D)
ICON_VIEW3D,
ICON_IPO,
ICON_OOPS,
ICON_BUTS,
ICON_FILESEL,
ICON_IMAGE_COL,
ICON_INFO,
ICON_SEQUENCE,
ICON_TEXT,
ICON_IMASEL,
ICON_SOUND,
ICON_ACTION,
ICON_NLA,
ICON_SCRIPTWIN,
ICON_TIME,
ICON_NODE,
ICON_SPACE2,
ICON_SPACE3,
ICON_SPACE4,
ICON_TRIA_LEFT,
ICON_TRIA_UP,
ICON_FONTPREVIEW,
ICON_BLANK4,
ICON_BLANK5,
ICON_BLANK6,
ICON_ORTHO,
ICON_PERSP,
ICON_CAMERA,
ICON_PARTICLES,
ICON_BBOX,
ICON_WIRE,
ICON_SOLID,
ICON_SMOOTH,
ICON_POTATO,
ICON_MARKER_HLT,
ICON_PMARKER_ACT,
ICON_PMARKER_SEL,
ICON_PMARKER,
ICON_VIEWZOOM,
ICON_SORTALPHA,
ICON_SORTTIME,
ICON_SORTSIZE,
ICON_LONGDISPLAY,
ICON_SHORTDISPLAY,
ICON_TRIA_DOWN,
ICON_TRIA_RIGHT,
ICON_BLANK7,
ICON_BLANK8,
ICON_BLANK9,
ICON_BLANK10,
ICON_VIEW_AXIS_ALL,
ICON_VIEW_AXIS_NONE,
ICON_VIEW_AXIS_NONE2,
ICON_VIEW_AXIS_TOP,
ICON_VIEW_AXIS_FRONT,
ICON_VIEW_AXIS_SIDE,
ICON_POSE_DEHLT,
ICON_POSE_HLT,
ICON_BORDERMOVE,
ICON_MAYBE_ITS_A_LASSO,
ICON_BLANK1, /* ATTENTION, someone decided to use this throughout blender
and didn't care to neither rename it nor update the PNG */
ICON_VERSE,
ICON_MOD_BOOLEAN,
ICON_ARMATURE,
ICON_PAUSE,
ICON_ALIGN,
ICON_REC,
ICON_PLAY,
ICON_FF,
ICON_REW,
ICON_PYTHON,
ICON_BLANK11,
ICON_BLANK12,
ICON_BLANK13,
ICON_BLANK14,
ICON_DOTSUP,
ICON_DOTSDOWN,
ICON_MENU_PANEL,
ICON_AXIS_SIDE,
ICON_AXIS_FRONT,
ICON_AXIS_TOP,
ICON_STICKY_UVS_LOC,
ICON_STICKY_UVS_DISABLE,
ICON_STICKY_UVS_VERT,
ICON_PREV_KEYFRAME,
ICON_NEXT_KEYFRAME,
ICON_ENVMAP,
ICON_TRANSP_HLT,
ICON_TRANSP_DEHLT,
ICON_CIRCLE_DEHLT,
ICON_CIRCLE_HLT,
ICON_TPAINT_DEHLT,
ICON_TPAINT_HLT,
ICON_WPAINT_DEHLT,
ICON_WPAINT_HLT,
ICON_MARKER,
ICON_BLANK15,
ICON_BLANK16,
ICON_BLANK17,
ICON_BLANK18,
ICON_X,
ICON_GO_LEFT,
ICON_NO_GO_LEFT,
ICON_UNLOCKED,
ICON_LOCKED,
ICON_PARLIB,
ICON_DATALIB,
ICON_AUTO,
ICON_MATERIAL_DEHLT2,
ICON_RING,
ICON_GRID,
ICON_PROPEDIT,
ICON_KEEPRECT,
ICON_DESEL_CUBE_VERTS,
ICON_EDITMODE_DEHLT,
ICON_EDITMODE_HLT,
ICON_VPAINT_DEHLT,
ICON_VPAINT_HLT,
ICON_FACESEL_DEHLT,
ICON_FACESEL_HLT,
ICON_EDIT_DEHLT,
ICON_BOOKMARKS,
ICON_BLANK20,
ICON_BLANK21,
ICON_BLANK22,
ICON_HELP,
ICON_ERROR,
ICON_FOLDER_DEHLT,
ICON_FOLDER_HLT,
ICON_BLUEIMAGE_DEHLT,
ICON_BLUEIMAGE_HLT,
ICON_BPIBFOLDER_DEHLT,
ICON_BPIBFOLDER_HLT,
ICON_BPIBFOLDER_ERR,
ICON_UGLY_GREEN_RING,
ICON_GHOST,
ICON_SORTBYEXT,
ICON_SCULPTMODE_HLT,
ICON_VERTEXSEL,
ICON_EDGESEL,
ICON_FACESEL,
ICON_PLUS,
ICON_BPIBFOLDER_X,
ICON_BPIBFOLDERGREY,
ICON_MAGNIFY,
ICON_INFO2,
ICON_BLANK23,
ICON_BLANK24,
ICON_BLANK25,
ICON_BLANK26,
ICON_RIGHTARROW,
ICON_DOWNARROW_HLT,
ICON_ROUNDBEVELTHING,
ICON_FULLTEXTURE,
ICON_HOOK,
ICON_DOT,
ICON_WORLD_DEHLT,
ICON_CHECKBOX_DEHLT,
ICON_CHECKBOX_HLT,
ICON_LINK,
ICON_INLINK,
ICON_ZOOMIN,
ICON_ZOOMOUT,
ICON_PASTEDOWN,
ICON_COPYDOWN,
ICON_CONSTANT,
ICON_LINEAR,
ICON_CYCLIC,
ICON_KEY_DEHLT,
ICON_KEY_HLT,
ICON_GRID2,
ICON_BLANK27,
ICON_BLANK28,
ICON_BLANK29,
ICON_BLANK30,
ICON_EYE,
ICON_LAMP,
ICON_MATERIAL,
ICON_TEXTURE,
ICON_ANIM,
ICON_WORLD,
ICON_SCENE,
ICON_EDIT,
ICON_GAME,
ICON_PAINT,
ICON_RADIO,
ICON_SCRIPT,
ICON_SPEAKER,
ICON_PASTEUP,
ICON_COPYUP,
ICON_PASTEFLIPUP,
ICON_PASTEFLIPDOWN,
ICON_CYCLICLINEAR,
ICON_PIN_DEHLT,
ICON_PIN_HLT,
ICON_LITTLEGRID,
ICON_BLANK31,
ICON_BLANK32,
ICON_BLANK33,
ICON_BLANK34,
ICON_FULLSCREEN,
ICON_SPLITSCREEN,
ICON_RIGHTARROW_THIN,
ICON_DISCLOSURE_TRI_RIGHT,
ICON_DISCLOSURE_TRI_DOWN,
ICON_SCENE_SEPIA,
ICON_SCENE_DEHLT,
ICON_OBJECT,
ICON_MESH,
ICON_CURVE,
ICON_MBALL,
ICON_LATTICE,
ICON_LAMP_DEHLT,
ICON_MATERIAL_DEHLT,
ICON_TEXTURE_DEHLT,
ICON_IPO_DEHLT,
ICON_LIBRARY_DEHLT,
ICON_IMAGE_DEHLT,
ICON_EYEDROPPER,
ICON_WINDOW_WINDOW,
ICON_PANEL_CLOSE,
ICON_PHYSICS,
ICON_BLANK36,
ICON_BLANK37,
ICON_BLANK38,
ICON_BLENDER,
ICON_PACKAGE,
ICON_UGLYPACKAGE,
ICON_MATPLANE,
ICON_MATSPHERE,
ICON_MATCUBE,
ICON_SCENE_HLT,
ICON_OBJECT_HLT,
ICON_MESH_HLT,
ICON_CURVE_HLT,
ICON_MBALL_HLT,
ICON_LATTICE_HLT,
ICON_LAMP_HLT,
ICON_MATERIAL_HLT,
ICON_TEXTURE_HLT,
ICON_IPO_HLT,
ICON_LIBRARY_HLT,
ICON_IMAGE_HLT,
ICON_CONSTRAINT,
ICON_CAMERA_DEHLT,
ICON_ARMATURE_DEHLT,
ICON_SNAP_GEAR,
ICON_SNAP_GEO,
ICON_BLANK41,
ICON_BLANK42,
ICON_SMOOTHCURVE,
ICON_SPHERECURVE,
ICON_ROOTCURVE,
ICON_SHARPCURVE,
ICON_LINCURVE,
ICON_NOCURVE,
ICON_RNDCURVE,
ICON_PROP_OFF,
ICON_PROP_ON,
ICON_PROP_CON,
ICON_SYNTAX,
ICON_SYNTAX_OFF,
ICON_MONKEY,
ICON_HAIR,
ICON_VIEWMOVE,
ICON_HOME,
ICON_CLIPUV_DEHLT,
ICON_CLIPUV_HLT,
ICON_BLANK2,
ICON_BLANK3,
ICON_VPAINT_COL,
ICON_RESTRICT_SELECT_OFF,
ICON_RESTRICT_SELECT_ON,
ICON_MUTE_IPO_OFF,
ICON_MUTE_IPO_ON,
ICON_MAN_TRANS,
ICON_MAN_ROT,
ICON_MAN_SCALE,
ICON_MANIPUL,
ICON_BLANK_47,
ICON_MODIFIER,
ICON_MOD_WAVE,
ICON_MOD_BUILD,
ICON_MOD_DECIM,
ICON_MOD_MIRROR,
ICON_MOD_SOFT,
ICON_MOD_SUBSURF,
ICON_SEQ_SEQUENCER,
ICON_SEQ_PREVIEW,
ICON_SEQ_LUMA_WAVEFORM,
ICON_SEQ_CHROMA_SCOPE,
ICON_ROTATE,
ICON_CURSOR,
ICON_ROTATECOLLECTION,
ICON_ROTATECENTER,
ICON_ROTACTIVE,
ICON_RESTRICT_VIEW_OFF,
ICON_RESTRICT_VIEW_ON,
ICON_RESTRICT_RENDER_OFF,
ICON_RESTRICT_RENDER_ON,
VICON_VIEW3D,
VICON_EDIT,
VICON_EDITMODE_DEHLT,
VICON_EDITMODE_HLT,
VICON_DISCLOSURE_TRI_RIGHT,
VICON_DISCLOSURE_TRI_DOWN,
VICON_MOVE_UP,
VICON_MOVE_DOWN,
VICON_X
#define BIFICONID_LAST (VICON_X)
#define BIFNICONIDS (BIFICONID_LAST-BIFICONID_FIRST + 1)
} BIFIconID;
typedef enum {
#define BIFCOLORSHADE_FIRST (COLORSHADE_DARK)
COLORSHADE_DARK,
COLORSHADE_GREY,
COLORSHADE_MEDIUM,
COLORSHADE_HILITE,
COLORSHADE_LIGHT,
COLORSHADE_WHITE
#define BIFCOLORSHADE_LAST (COLORSHADE_WHITE)
#define BIFNCOLORSHADES (BIFCOLORSHADE_LAST-BIFCOLORSHADE_FIRST + 1)
} BIFColorShade;
typedef enum {
#define BIFCOLORID_FIRST (BUTGREY)
BUTGREY = 0,
BUTGREEN,
BUTBLUE,
BUTSALMON,
MIDGREY,
BUTPURPLE,
BUTYELLOW,
REDALERT,
BUTRUST,
BUTWHITE,
BUTDBLUE,
BUTPINK,
BUTDPINK,
BUTMACTIVE,
BUTIPO,
BUTAUDIO,
BUTCAMERA,
BUTRANDOM,
BUTEDITOBJECT,
BUTPROPERTY,
BUTSCENE,
BUTMOTION,
BUTMESSAGE,
BUTACTION,
BUTCD,
BUTGAME,
BUTVISIBILITY,
BUTYUCK,
BUTSEASICK,
BUTCHOKE,
BUTIMPERIAL,
BUTTEXTCOLOR,
BUTTEXTPRESSED,
BUTSBACKGROUND,
VIEWPORTBACKCOLOR,
VIEWPORTGRIDCOLOR,
VIEWPORTACTIVECOLOR,
VIEWPORTSELECTEDCOLOR,
VIEWPORTUNSELCOLOR,
EDITVERTSEL,
EDITVERTUNSEL,
EDITEDGESEL,
EDITEDGEUNSEL
#define BIFCOLORID_LAST (EDITEDGEUNSEL)
#define BIFNCOLORIDS (BIFCOLORID_LAST-BIFCOLORID_FIRST + 1)
} BIFColorID;
/* XXX WARNING: this is saved in file, so do not change order! */
enum {
TH_AUTO, /* for buttons, to signal automatic color assignment */
// uibutton colors
TH_BUT_OUTLINE,
TH_BUT_NEUTRAL,
TH_BUT_ACTION,
TH_BUT_SETTING,
TH_BUT_SETTING1,
TH_BUT_SETTING2,
TH_BUT_NUM,
TH_BUT_TEXTFIELD,
TH_BUT_POPUP,
TH_BUT_TEXT,
TH_BUT_TEXT_HI,
TH_MENU_BACK,
TH_MENU_ITEM,
TH_MENU_HILITE,
TH_MENU_TEXT,
TH_MENU_TEXT_HI,
TH_BUT_DRAWTYPE,
TH_REDALERT,
TH_CUSTOM,
TH_BUT_TEXTFIELD_HI,
TH_ICONFILE,
TH_THEMEUI,
// common colors among spaces
TH_BACK,
TH_TEXT,
TH_TEXT_HI,
TH_HEADER,
TH_HEADERDESEL,
TH_PANEL,
TH_SHADE1,
TH_SHADE2,
TH_HILITE,
TH_GRID,
TH_WIRE,
TH_SELECT,
TH_ACTIVE,
TH_GROUP,
TH_GROUP_ACTIVE,
TH_TRANSFORM,
TH_VERTEX,
TH_VERTEX_SELECT,
TH_VERTEX_SIZE,
TH_EDGE,
TH_EDGE_SELECT,
TH_EDGE_SEAM,
TH_EDGE_FACESEL,
TH_FACE,
TH_FACE_SELECT,
TH_NORMAL,
TH_FACE_DOT,
TH_FACEDOT_SIZE,
TH_CFRAME,
TH_SYNTAX_B,
TH_SYNTAX_V,
TH_SYNTAX_C,
TH_SYNTAX_L,
TH_SYNTAX_N,
TH_BONE_SOLID,
TH_BONE_POSE,
TH_STRIP,
TH_STRIP_SELECT,
TH_LAMP,
TH_NODE,
TH_NODE_IN_OUT,
TH_NODE_OPERATOR,
TH_NODE_CONVERTOR,
TH_NODE_GROUP,
TH_SEQ_MOVIE,
TH_SEQ_IMAGE,
TH_SEQ_SCENE,
TH_SEQ_AUDIO,
TH_SEQ_EFFECT,
TH_SEQ_PLUGIN,
TH_SEQ_TRANSITION,
TH_SEQ_META,
TH_EDGE_SHARP,
TH_EDITMESH_ACTIVE,
};
/* XXX WARNING: previous is saved in file, so do not change order! */
/* theme drawtypes */
#define TH_MINIMAL 0
#define TH_SHADED 1
#define TH_ROUNDED 2
#define TH_OLDSKOOL 3
/* specific defines per space should have higher define values */
struct bTheme;
// THE CODERS API FOR THEMES:
// sets the color
void BIF_ThemeColor(int colorid);
// sets the color plus alpha
void BIF_ThemeColor4(int colorid);
// sets color plus offset for shade
void BIF_ThemeColorShade(int colorid, int offset);
// sets color plus offset for alpha
void BIF_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
// sets color, which is blend between two theme colors
void BIF_ThemeColorBlend(int colorid1, int colorid2, float fac);
// same, with shade offset
void BIF_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset);
// returns one value, not scaled
float BIF_GetThemeValuef(int colorid);
int BIF_GetThemeValue(int colorid);
// get three color values, scaled to 0.0-1.0 range
void BIF_GetThemeColor3fv(int colorid, float *col);
// get the 3 or 4 byte values
void BIF_GetThemeColor3ubv(int colorid, char *col);
void BIF_GetThemeColor4ubv(int colorid, char *col);
// get a theme color from specified space type
void BIF_GetThemeColorType4ubv(int colorid, int spacetype, char *col);
// blends and shades between two color pointers
void BIF_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset);
// get a 3 byte color, blended and shaded between two other char color pointers
void BIF_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset);
struct ScrArea;
// internal (blender) usage only, for init and set active
void BIF_InitTheme(void);
void BIF_SetTheme(struct ScrArea *sa);
void BIF_resources_init (void);
void BIF_resources_free (void);
void BIF_colors_init (void);
void BIF_load_ui_colors (void);
/* only for buttons in theme editor! */
char *BIF_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
char *BIF_ThemeColorsPup(int spacetype);
void BIF_def_color (BIFColorID colorid, unsigned char r, unsigned char g, unsigned char b);
#endif /* BIF_ICONS_H */

@ -1,68 +0,0 @@
/**
* $Id:
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef BIF_VIEW2D_H
#define BIF_VIEW2D_H
/* start of a generic 2d view with should allow drawing grids,
* panning, zooming, scrolling, .. */
#define V2D_UNIT_SECONDS 0
#define V2D_UNIT_FRAMES 1
#define V2D_GRID_CLAMP 0
#define V2D_GRID_NOCLAMP 1
#define V2D_IS_CLIPPED 12000
#define V2D_HORIZONTAL_LINES 1
#define V2D_VERTICAL_LINES 2
#define V2D_HORIZONTAL_AXIS 4
#define V2D_VERTICAL_AXIS 8
struct View2D;
struct View2DGrid;
struct bContext;
typedef struct View2DGrid View2DGrid;
/* opengl drawing setup */
void BIF_view2d_ortho(const struct bContext *C, struct View2D *v2d);
/* grid drawing */
View2DGrid *BIF_view2d_calc_grid(const struct bContext *C, struct View2D *v2d, int unit, int type, int winx, int winy);
void BIF_view2d_draw_grid(const struct bContext *C, struct View2D *v2d, View2DGrid *grid, int flag);
void BIF_view2d_free_grid(View2DGrid *grid);
/* coordinate conversion */
void BIF_view2d_region_to_view(struct View2D *v2d, short x, short y, float *viewx, float *viewy);
void BIF_view2d_view_to_region(struct View2D *v2d, float x, float y, short *regionx, short *regiony);
void BIF_view2d_to_region_no_clip(struct View2D *v2d, float x, float y, short *regionx, short *region_y);
#endif /* BIF_VIEW2D_H */

@ -0,0 +1,50 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef ED_DATAFILES_H
#define ED_DATAFILES_H
/* Datafiles embedded in Blender */
extern int datatoc_B_blend_size;
extern char datatoc_B_blend[];
extern int datatoc_blenderbuttons_size;
extern char datatoc_blenderbuttons[];
extern int datatoc_splash_jpg_size;
extern char datatoc_splash_jpg[];
extern int datatoc_Bfont_size;
extern char datatoc_Bfont;
extern int datatoc_bfont_ttf_size;
extern char datatoc_bfont_ttf[];
#endif /* ED_DATAFILES_H */

@ -1,33 +0,0 @@
/**
* $Id:
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef ED_INTERFACE_H
#define ED_INTERFACE_H
#endif /* ED_INTERFACE_H */

@ -0,0 +1,350 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef UI_INTERFACE_H
#define UI_INTERFACE_H
struct ID;
struct ListBase;
struct ARegion;
struct wmWindow;
struct wmWindowManager;
struct AutoComplete;
struct bContext;
/* uiBlock->dt */
#define UI_EMBOSS 0 /* use one of the themes for drawing */
#define UI_EMBOSSN 1 /* Nothing */
#define UI_EMBOSSM 2 /* Minimal builtin emboss, also for logic buttons */
#define UI_EMBOSSP 3 /* Pulldown */
#define UI_EMBOSSR 4 /* Rounded */
#define UI_EMBOSST 5 /* Table */
#define UI_EMBOSSX 0 /* for a python file, which i can't change.... duh! */
/* uiBlock->direction */
#define UI_TOP 1
#define UI_DOWN 2
#define UI_LEFT 4
#define UI_RIGHT 8
#define UI_DIRECTION 15
#define UI_CENTER 16
#define UI_SHIFT_FLIPPED 32
/* uiBlock->autofill */
#define UI_BLOCK_COLLUMNS 1
#define UI_BLOCK_ROWS 2
/* uiBlock->flag (controls) */
#define UI_BLOCK_LOOP 1
#define UI_BLOCK_REDRAW 2
#define UI_BLOCK_RET_1 4 /* XXX 2.5 not implemented */
#define UI_BLOCK_NUMSELECT 8
#define UI_BLOCK_ENTER_OK 16
#define UI_BLOCK_NOSHADOW 32
#define UI_BLOCK_NO_HILITE 64 /* XXX 2.5 not implemented */
#define UI_BLOCK_MOVEMOUSE_QUIT 128
#define UI_BLOCK_KEEP_OPEN 256
/* uiMenuBlockHandle->blockretval */
#define UI_RETURN_CANCEL 1 /* cancel all menus cascading */
#define UI_RETURN_OK 2 /* choice made */
#define UI_RETURN_OUT 4 /* left the menu */
/* block->flag bits 12-15 are identical to but->flag bits */
/* block->font, for now: bold = medium+1 */
#define UI_HELV 0
#define UI_HELVB 1
/* panel controls */
#define UI_PNL_TRANSP 1
#define UI_PNL_SOLID 2
#define UI_PNL_CLOSE 32
#define UI_PNL_STOW 64
#define UI_PNL_TO_MOUSE 128
#define UI_PNL_UNSTOW 256
#define UI_PNL_SCALE 512
/* warning the first 4 flags are internal */
/* but->flag */
#define UI_TEXT_LEFT 16
#define UI_ICON_LEFT 32
#define UI_ICON_RIGHT 64
/* control for button type block */
#define UI_MAKE_TOP 128
#define UI_MAKE_DOWN 256
#define UI_MAKE_LEFT 512
#define UI_MAKE_RIGHT 1024
/* dont draw hilite on mouse over */
#define UI_NO_HILITE 2048
/* button align flag, for drawing groups together */
#define UI_BUT_ALIGN (15<<12)
#define UI_BUT_ALIGN_TOP (1<<12)
#define UI_BUT_ALIGN_LEFT (1<<13)
#define UI_BUT_ALIGN_RIGHT (1<<14)
#define UI_BUT_ALIGN_DOWN (1<<15)
/* Button types, bits stored in 1 value... and a short even!
- bits 0-4: bitnr (0-31)
- bits 5-7: pointer type
- bit 8: for 'bit'
- bit 9-15: button type (now 6 bits, 64 types)
*/
#define CHA 32
#define SHO 64
#define INT 96
#define FLO 128
#define FUN 192
#define BIT 256
#define BUTPOIN (128+64+32)
#define BUT (1<<9)
#define ROW (2<<9)
#define TOG (3<<9)
#define SLI (4<<9)
#define NUM (5<<9)
#define TEX (6<<9)
#define TOG3 (7<<9)
#define TOGR (8<<9)
#define TOGN (9<<9)
#define LABEL (10<<9)
#define MENU (11<<9)
#define ICONROW (12<<9)
#define ICONTOG (13<<9)
#define NUMSLI (14<<9)
#define COL (15<<9)
#define IDPOIN (16<<9)
#define HSVSLI (17<<9)
#define SCROLL (18<<9)
#define BLOCK (19<<9)
#define BUTM (20<<9)
#define SEPR (21<<9)
#define LINK (22<<9)
#define INLINK (23<<9)
#define KEYEVT (24<<9)
#define ICONTEXTROW (25<<9)
#define HSVCUBE (26<<9)
#define PULLDOWN (27<<9)
#define ROUNDBOX (28<<9)
#define CHARTAB (29<<9)
#define BUT_COLORBAND (30<<9)
#define BUT_NORMAL (31<<9)
#define BUT_CURVE (32<<9)
#define BUT_TOGDUAL (33<<9)
#define ICONTOGN (34<<9)
#define FTPREVIEW (35<<9)
#define NUMABS (36<<9)
#define BUTTYPE (63<<9)
/* Menu Block Handle */
typedef struct uiMenuBlockHandle {
struct ARegion *region;
int butretval;
int blockretval;
float retvalue;
float retvec[3];
} uiMenuBlockHandle;
typedef struct uiBut uiBut;
typedef struct uiBlock uiBlock;
void uiEmboss(float x1, float y1, float x2, float y2, int sel);
void uiRoundBoxEmboss(float minx, float miny, float maxx, float maxy, float rad, int active);
void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad);
void uiSetRoundBox(int type);
void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad);
void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag);
void uiTextBoundsBlock(uiBlock *block, int addval);
void uiBoundsBlock(struct uiBlock *block, int addval);
void uiDrawBlock(struct uiBlock *block);
void uiGetMouse(int win, short *adr);
void uiComposeLinks(uiBlock *block);
void uiSetButLock(int val, char *lockstr);
uiBut *uiFindInlink(uiBlock *block, void *poin);
void uiClearButLock(void);
int uiDoBlocks(struct ListBase *lb, int event, int movemouse_quit);
void uiSetCurFont(uiBlock *block, int index);
void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small);
void uiFreeBlock(uiBlock *block);
void uiFreeBlocks(struct ListBase *lb);
uiBlock *uiBeginBlock(struct wmWindow *window, struct ARegion *region, char *name, short dt, short font);
void uiEndBlock(uiBlock *block);
uiBlock *uiGetBlock(char *name, struct ARegion *ar);
void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
/* automatic aligning, horiz or verical */
void uiBlockBeginAlign(uiBlock *block);
void uiBlockEndAlign(uiBlock *block);
uiBut *uiDefBut(uiBlock *block,
int type, int retval, char *str,
short x1, short y1,
short x2, short y2,
void *poin,
float min, float max,
float a1, float a2, char *tip);
uiBut *uiDefButF(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButI(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButS(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButC(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconBut(uiBlock *block,
int type, int retval, int icon,
short x1, short y1,
short x2, short y2,
void *poin,
float min, float max,
float a1, float a2, char *tip);
uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
typedef void (*uiIDPoinFuncFP) (char *str, struct ID **idpp);
uiBut *uiDefIDPoinBut(struct uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, char *str,
short x1, short y1, short x2, short y2, void *idpp, char *tip);
typedef uiBlock* (*uiBlockFuncFP) (struct wmWindow *window, struct uiMenuBlockHandle *handle, void *arg1);
uiBut *uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
uiBut *uiDefPulldownBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip);
void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip);
struct PointerRNA;
struct PropertyRNA;
uiBut *uiDefRNABut(uiBlock *block, int retval, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, short x1, short y1, short x2, short y2);
void uiButSetFunc3(uiBut *but, void (*func)(void *arg1, void *arg2, void *arg3), void *arg1, void *arg2, void *arg3);
void uiAutoBlock(struct uiBlock *block,
float minx, float miny,
float sizex, float sizey, int flag);
void uiSetButLink(struct uiBut *but,
void **poin,
void ***ppoin,
short *tot,
int from, int to);
int uiBlocksGetYMin (ListBase *lb);
int uiBlockGetCol (uiBlock *block);
void* uiBlockGetCurFont (uiBlock *block);
void uiBlockSetCol (uiBlock *block, int col);
void uiBlockSetEmboss (uiBlock *block, int emboss);
void uiBlockSetDirection (uiBlock *block, int direction);
void uiBlockFlipOrder (uiBlock *block);
void uiBlockSetFlag (uiBlock *block, int flag);
void uiBlockSetXOfs (uiBlock *block, int xofs);
int uiButGetRetVal (uiBut *but);
void uiButSetFlag (uiBut *but, int flag);
void uiButClearFlag (uiBut *but, int flag);
void uiBlockSetButmFunc (uiBlock *block, void (*butmfunc)(void *arg, int but_a2), void *arg);
void uiBlockSetFunc (uiBlock *block, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2);
void uiButSetFunc (uiBut *but, void (*func)(void *arg1, void *arg2), void *arg1, void *arg2);
void uiButSetCompleteFunc(uiBut *but, void (*func)(char *str, void *arg), void *arg);
void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(struct ScrArea *sa, uiBlock *block));
extern void pupmenu_set_active(int val);
extern uiMenuBlockHandle *pupmenu_col(struct bContext *C, char *instr, int mx, int my, int maxrow);
extern uiMenuBlockHandle *pupmenu(struct bContext *C, char *instr, int mx, int my);
extern void pupmenu_free(struct bContext *C, uiMenuBlockHandle *handle);
extern void uiFreePanels(struct ListBase *lb);
extern void uiNewPanelTabbed(char *, char *);
extern int uiNewPanel(struct ScrArea *sa, struct uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey);
extern void uiSetPanel_view2d(struct ScrArea *sa);
extern void uiMatchPanel_view2d(struct ScrArea *sa);
extern void uiDrawBlocksPanels(struct ScrArea *sa, int re_align);
extern void uiNewPanelHeight(struct uiBlock *block, int sizey);
extern void uiNewPanelTitle(struct uiBlock *block, char *str);
extern void uiPanelPush(struct uiBlock *block);
extern void uiPanelPop(struct uiBlock *block);
extern uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name);
extern int uiAlignPanelStep(struct ScrArea *sa, float fac);
extern void uiPanelControl(int);
extern void uiSetPanelHandler(int);
extern void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
extern void *uiSetCurFont_ext(float aspect);
typedef struct AutoComplete AutoComplete;
AutoComplete *autocomplete_begin(char *startname, int maxlen);
void autocomplete_do_name(AutoComplete *autocpl, const char *name);
void autocomplete_end(AutoComplete *autocpl, char *autoname);
void uiTestRegion(const struct bContext *C); /* XXX 2.50 temporary test */
void UI_keymap(struct wmWindowManager *wm);
void UI_init(void);
void UI_init_userdef(void);
void UI_exit(void);
#endif /* UI_INTERFACE_H */

@ -0,0 +1,595 @@
/**
* $Id: UI_resources.h 13057 2007-12-30 12:08:28Z aligorith $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifndef UI_RESOURCES_H
#define UI_RESOURCES_H
/* elubie: TODO: move the typedef for icons to UI_interface_icons.h */
/* and add/replace include of UI_resources.h by UI_interface_icons.h */
typedef enum {
#define BIFICONID_FIRST (ICON_VIEW3D)
ICON_VIEW3D,
ICON_IPO,
ICON_OOPS,
ICON_BUTS,
ICON_FILESEL,
ICON_IMAGE_COL,
ICON_INFO,
ICON_SEQUENCE,
ICON_TEXT,
ICON_IMASEL,
ICON_SOUND,
ICON_ACTION,
ICON_NLA,
ICON_SCRIPTWIN,
ICON_TIME,
ICON_NODE,
ICON_SPACE2,
ICON_SPACE3,
ICON_SPACE4,
ICON_TRIA_LEFT,
ICON_TRIA_UP,
ICON_FONTPREVIEW,
ICON_BLANK4,
ICON_BLANK5,
ICON_BLANK6,
ICON_ORTHO,
ICON_PERSP,
ICON_CAMERA,
ICON_PARTICLES,
ICON_BBOX,
ICON_WIRE,
ICON_SOLID,
ICON_SMOOTH,
ICON_POTATO,
ICON_MARKER_HLT,
ICON_PMARKER_ACT,
ICON_PMARKER_SEL,
ICON_PMARKER,
ICON_VIEWZOOM,
ICON_SORTALPHA,
ICON_SORTTIME,
ICON_SORTSIZE,
ICON_LONGDISPLAY,
ICON_SHORTDISPLAY,
ICON_TRIA_DOWN,
ICON_TRIA_RIGHT,
ICON_BLANK7,
ICON_BLANK8,
ICON_BLANK9,
ICON_BLANK10,
ICON_VIEW_AXIS_ALL,
ICON_VIEW_AXIS_NONE,
ICON_VIEW_AXIS_NONE2,
ICON_VIEW_AXIS_TOP,
ICON_VIEW_AXIS_FRONT,
ICON_VIEW_AXIS_SIDE,
ICON_POSE_DEHLT,
ICON_POSE_HLT,
ICON_BORDERMOVE,
ICON_MAYBE_ITS_A_LASSO,
ICON_BLANK1, /* ATTENTION, someone decided to use this throughout blender
and didn't care to neither rename it nor update the PNG */
ICON_VERSE,
ICON_MOD_BOOLEAN,
ICON_ARMATURE,
ICON_PAUSE,
ICON_ALIGN,
ICON_REC,
ICON_PLAY,
ICON_FF,
ICON_REW,
ICON_PYTHON,
ICON_BLANK11,
ICON_BLANK12,
ICON_BLANK13,
ICON_BLANK14,
ICON_DOTSUP,
ICON_DOTSDOWN,
ICON_MENU_PANEL,
ICON_AXIS_SIDE,
ICON_AXIS_FRONT,
ICON_AXIS_TOP,
ICON_STICKY_UVS_LOC,
ICON_STICKY_UVS_DISABLE,
ICON_STICKY_UVS_VERT,
ICON_PREV_KEYFRAME,
ICON_NEXT_KEYFRAME,
ICON_ENVMAP,
ICON_TRANSP_HLT,
ICON_TRANSP_DEHLT,
ICON_CIRCLE_DEHLT,
ICON_CIRCLE_HLT,
ICON_TPAINT_DEHLT,
ICON_TPAINT_HLT,
ICON_WPAINT_DEHLT,
ICON_WPAINT_HLT,
ICON_MARKER,
ICON_BLANK15,
ICON_BLANK16,
ICON_BLANK17,
ICON_BLANK18,
ICON_X,
ICON_GO_LEFT,
ICON_NO_GO_LEFT,
ICON_UNLOCKED,
ICON_LOCKED,
ICON_PARLIB,
ICON_DATALIB,
ICON_AUTO,
ICON_MATERIAL_DEHLT2,
ICON_RING,
ICON_GRID,
ICON_PROPEDIT,
ICON_KEEPRECT,
ICON_DESEL_CUBE_VERTS,
ICON_EDITMODE_DEHLT,
ICON_EDITMODE_HLT,
ICON_VPAINT_DEHLT,
ICON_VPAINT_HLT,
ICON_FACESEL_DEHLT,
ICON_FACESEL_HLT,
ICON_EDIT_DEHLT,
ICON_BOOKMARKS,
ICON_BLANK20,
ICON_BLANK21,
ICON_BLANK22,
ICON_HELP,
ICON_ERROR,
ICON_FOLDER_DEHLT,
ICON_FOLDER_HLT,
ICON_BLUEIMAGE_DEHLT,
ICON_BLUEIMAGE_HLT,
ICON_BPIBFOLDER_DEHLT,
ICON_BPIBFOLDER_HLT,
ICON_BPIBFOLDER_ERR,
ICON_UGLY_GREEN_RING,
ICON_GHOST,
ICON_SORTBYEXT,
ICON_SCULPTMODE_HLT,
ICON_VERTEXSEL,
ICON_EDGESEL,
ICON_FACESEL,
ICON_PLUS,
ICON_BPIBFOLDER_X,
ICON_BPIBFOLDERGREY,
ICON_MAGNIFY,
ICON_INFO2,
ICON_BLANK23,
ICON_BLANK24,
ICON_BLANK25,
ICON_BLANK26,
ICON_RIGHTARROW,
ICON_DOWNARROW_HLT,
ICON_ROUNDBEVELTHING,
ICON_FULLTEXTURE,
ICON_HOOK,
ICON_DOT,
ICON_WORLD_DEHLT,
ICON_CHECKBOX_DEHLT,
ICON_CHECKBOX_HLT,
ICON_LINK,
ICON_INLINK,
ICON_ZOOMIN,
ICON_ZOOMOUT,
ICON_PASTEDOWN,
ICON_COPYDOWN,
ICON_CONSTANT,
ICON_LINEAR,
ICON_CYCLIC,
ICON_KEY_DEHLT,
ICON_KEY_HLT,
ICON_GRID2,
ICON_BLANK27,
ICON_BLANK28,
ICON_BLANK29,
ICON_BLANK30,
ICON_EYE,
ICON_LAMP,
ICON_MATERIAL,
ICON_TEXTURE,
ICON_ANIM,
ICON_WORLD,
ICON_SCENE,
ICON_EDIT,
ICON_GAME,
ICON_PAINT,
ICON_RADIO,
ICON_SCRIPT,
ICON_SPEAKER,
ICON_PASTEUP,
ICON_COPYUP,
ICON_PASTEFLIPUP,
ICON_PASTEFLIPDOWN,
ICON_CYCLICLINEAR,
ICON_PIN_DEHLT,
ICON_PIN_HLT,
ICON_LITTLEGRID,
ICON_BLANK31,
ICON_BLANK32,
ICON_BLANK33,
ICON_BLANK34,
ICON_FULLSCREEN,
ICON_SPLITSCREEN,
ICON_RIGHTARROW_THIN,
ICON_DISCLOSURE_TRI_RIGHT,
ICON_DISCLOSURE_TRI_DOWN,
ICON_SCENE_SEPIA,
ICON_SCENE_DEHLT,
ICON_OBJECT,
ICON_MESH,
ICON_CURVE,
ICON_MBALL,
ICON_LATTICE,
ICON_LAMP_DEHLT,
ICON_MATERIAL_DEHLT,
ICON_TEXTURE_DEHLT,
ICON_IPO_DEHLT,
ICON_LIBRARY_DEHLT,
ICON_IMAGE_DEHLT,
ICON_EYEDROPPER,
ICON_WINDOW_WINDOW,
ICON_PANEL_CLOSE,
ICON_PHYSICS,
ICON_BLANK36,
ICON_BLANK37,
ICON_BLANK38,
ICON_BLENDER,
ICON_PACKAGE,
ICON_UGLYPACKAGE,
ICON_MATPLANE,
ICON_MATSPHERE,
ICON_MATCUBE,
ICON_SCENE_HLT,
ICON_OBJECT_HLT,
ICON_MESH_HLT,
ICON_CURVE_HLT,
ICON_MBALL_HLT,
ICON_LATTICE_HLT,
ICON_LAMP_HLT,
ICON_MATERIAL_HLT,
ICON_TEXTURE_HLT,
ICON_IPO_HLT,
ICON_LIBRARY_HLT,
ICON_IMAGE_HLT,
ICON_CONSTRAINT,
ICON_CAMERA_DEHLT,
ICON_ARMATURE_DEHLT,
ICON_SNAP_GEAR,
ICON_SNAP_GEO,
ICON_BLANK41,
ICON_BLANK42,
ICON_SMOOTHCURVE,
ICON_SPHERECURVE,
ICON_ROOTCURVE,
ICON_SHARPCURVE,
ICON_LINCURVE,
ICON_NOCURVE,
ICON_RNDCURVE,
ICON_PROP_OFF,
ICON_PROP_ON,
ICON_PROP_CON,
ICON_SYNTAX,
ICON_SYNTAX_OFF,
ICON_MONKEY,
ICON_HAIR,
ICON_VIEWMOVE,
ICON_HOME,
ICON_CLIPUV_DEHLT,
ICON_CLIPUV_HLT,
ICON_BLANK2,
ICON_BLANK3,
ICON_VPAINT_COL,
ICON_RESTRICT_SELECT_OFF,
ICON_RESTRICT_SELECT_ON,
ICON_MUTE_IPO_OFF,
ICON_MUTE_IPO_ON,
ICON_MAN_TRANS,
ICON_MAN_ROT,
ICON_MAN_SCALE,
ICON_MANIPUL,
ICON_BLANK_47,
ICON_MODIFIER,
ICON_MOD_WAVE,
ICON_MOD_BUILD,
ICON_MOD_DECIM,
ICON_MOD_MIRROR,
ICON_MOD_SOFT,
ICON_MOD_SUBSURF,
ICON_SEQ_SEQUENCER,
ICON_SEQ_PREVIEW,
ICON_SEQ_LUMA_WAVEFORM,
ICON_SEQ_CHROMA_SCOPE,
ICON_ROTATE,
ICON_CURSOR,
ICON_ROTATECOLLECTION,
ICON_ROTATECENTER,
ICON_ROTACTIVE,
ICON_RESTRICT_VIEW_OFF,
ICON_RESTRICT_VIEW_ON,
ICON_RESTRICT_RENDER_OFF,
ICON_RESTRICT_RENDER_ON,
VICON_VIEW3D,
VICON_EDIT,
VICON_EDITMODE_DEHLT,
VICON_EDITMODE_HLT,
VICON_DISCLOSURE_TRI_RIGHT,
VICON_DISCLOSURE_TRI_DOWN,
VICON_MOVE_UP,
VICON_MOVE_DOWN,
VICON_X
#define BIFICONID_LAST (VICON_X)
#define BIFNICONIDS (BIFICONID_LAST-BIFICONID_FIRST + 1)
} BIFIconID;
typedef enum {
#define BIFCOLORSHADE_FIRST (COLORSHADE_DARK)
COLORSHADE_DARK,
COLORSHADE_GREY,
COLORSHADE_MEDIUM,
COLORSHADE_HILITE,
COLORSHADE_LIGHT,
COLORSHADE_WHITE
#define BIFCOLORSHADE_LAST (COLORSHADE_WHITE)
#define BIFNCOLORSHADES (BIFCOLORSHADE_LAST-BIFCOLORSHADE_FIRST + 1)
} BIFColorShade;
typedef enum {
#define BIFCOLORID_FIRST (BUTGREY)
BUTGREY = 0,
BUTGREEN,
BUTBLUE,
BUTSALMON,
MIDGREY,
BUTPURPLE,
BUTYELLOW,
REDALERT,
BUTRUST,
BUTWHITE,
BUTDBLUE,
BUTPINK,
BUTDPINK,
BUTMACTIVE,
BUTIPO,
BUTAUDIO,
BUTCAMERA,
BUTRANDOM,
BUTEDITOBJECT,
BUTPROPERTY,
BUTSCENE,
BUTMOTION,
BUTMESSAGE,
BUTACTION,
BUTCD,
BUTGAME,
BUTVISIBILITY,
BUTYUCK,
BUTSEASICK,
BUTCHOKE,
BUTIMPERIAL,
BUTTEXTCOLOR,
BUTTEXTPRESSED,
BUTSBACKGROUND,
VIEWPORTBACKCOLOR,
VIEWPORTGRIDCOLOR,
VIEWPORTACTIVECOLOR,
VIEWPORTSELECTEDCOLOR,
VIEWPORTUNSELCOLOR,
EDITVERTSEL,
EDITVERTUNSEL,
EDITEDGESEL,
EDITEDGEUNSEL
#define BIFCOLORID_LAST (EDITEDGEUNSEL)
#define BIFNCOLORIDS (BIFCOLORID_LAST-BIFCOLORID_FIRST + 1)
} BIFColorID;
/* XXX WARNING: this is saved in file, so do not change order! */
enum {
TH_AUTO, /* for buttons, to signal automatic color assignment */
// uibutton colors
TH_BUT_OUTLINE,
TH_BUT_NEUTRAL,
TH_BUT_ACTION,
TH_BUT_SETTING,
TH_BUT_SETTING1,
TH_BUT_SETTING2,
TH_BUT_NUM,
TH_BUT_TEXTFIELD,
TH_BUT_POPUP,
TH_BUT_TEXT,
TH_BUT_TEXT_HI,
TH_MENU_BACK,
TH_MENU_ITEM,
TH_MENU_HILITE,
TH_MENU_TEXT,
TH_MENU_TEXT_HI,
TH_BUT_DRAWTYPE,
TH_REDALERT,
TH_CUSTOM,
TH_BUT_TEXTFIELD_HI,
TH_ICONFILE,
TH_THEMEUI,
// common colors among spaces
TH_BACK,
TH_TEXT,
TH_TEXT_HI,
TH_HEADER,
TH_HEADERDESEL,
TH_PANEL,
TH_SHADE1,
TH_SHADE2,
TH_HILITE,
TH_GRID,
TH_WIRE,
TH_SELECT,
TH_ACTIVE,
TH_GROUP,
TH_GROUP_ACTIVE,
TH_TRANSFORM,
TH_VERTEX,
TH_VERTEX_SELECT,
TH_VERTEX_SIZE,
TH_EDGE,
TH_EDGE_SELECT,
TH_EDGE_SEAM,
TH_EDGE_FACESEL,
TH_FACE,
TH_FACE_SELECT,
TH_NORMAL,
TH_FACE_DOT,
TH_FACEDOT_SIZE,
TH_CFRAME,
TH_SYNTAX_B,
TH_SYNTAX_V,
TH_SYNTAX_C,
TH_SYNTAX_L,
TH_SYNTAX_N,
TH_BONE_SOLID,
TH_BONE_POSE,
TH_STRIP,
TH_STRIP_SELECT,
TH_LAMP,
TH_NODE,
TH_NODE_IN_OUT,
TH_NODE_OPERATOR,
TH_NODE_CONVERTOR,
TH_NODE_GROUP,
TH_SEQ_MOVIE,
TH_SEQ_IMAGE,
TH_SEQ_SCENE,
TH_SEQ_AUDIO,
TH_SEQ_EFFECT,
TH_SEQ_PLUGIN,
TH_SEQ_TRANSITION,
TH_SEQ_META,
TH_EDGE_SHARP,
TH_EDITMESH_ACTIVE,
};
/* XXX WARNING: previous is saved in file, so do not change order! */
/* theme drawtypes */
#define TH_MINIMAL 0
#define TH_SHADED 1
#define TH_ROUNDED 2
#define TH_OLDSKOOL 3
/* specific defines per space should have higher define values */
struct bTheme;
// THE CODERS API FOR THEMES:
// sets the color
void UI_ThemeColor(int colorid);
// sets the color plus alpha
void UI_ThemeColor4(int colorid);
// sets color plus offset for shade
void UI_ThemeColorShade(int colorid, int offset);
// sets color plus offset for alpha
void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset);
// sets color, which is blend between two theme colors
void UI_ThemeColorBlend(int colorid1, int colorid2, float fac);
// same, with shade offset
void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset);
// returns one value, not scaled
float UI_GetThemeValuef(int colorid);
int UI_GetThemeValue(int colorid);
// get three color values, scaled to 0.0-1.0 range
void UI_GetThemeColor3fv(int colorid, float *col);
// get the 3 or 4 byte values
void UI_GetThemeColor3ubv(int colorid, char *col);
void UI_GetThemeColor4ubv(int colorid, char *col);
// get a theme color from specified space type
void UI_GetThemeColorType4ubv(int colorid, int spacetype, char *col);
// blends and shades between two color pointers
void UI_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset);
// get a 3 byte color, blended and shaded between two other char color pointers
void UI_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset);
struct ScrArea;
// internal (blender) usage only, for init and set active
void UI_SetTheme(struct ScrArea *sa);
void ui_theme_init_userdef (void);
void ui_resources_init (void);
void ui_resources_free (void);
/* only for buttons in theme editor! */
char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
char *UI_ThemeColorsPup(int spacetype);
#endif /* UI_ICONS_H */

@ -0,0 +1,67 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef UI_TEXT_H
#define UI_TEXT_H
struct BMF_Font;
int read_languagefile(void); /* usiblender.c */
void free_languagemenu(void); /* usiblender.c */
void set_interface_font(char *str); /* headerbuttons.c */
void start_interface_font(void); /* headerbuttons.c */
void lang_setlanguage(void); /* usiblender.c */
char *language_pup(void);
char *fontsize_pup(void);
int UI_DrawString(struct BMF_Font* font, char *str, int translate);
float UI_GetStringWidth(struct BMF_Font* font, char *str, int translate);
void UI_GetBoundingBox(struct BMF_Font* font, char* str, int translate, rctf* bbox);
void UI_set_international(int international);
int UI_get_international(void);
void UI_RasterPos(float x, float y);
void UI_SetScale(float aspect);
void ui_text_init_userdef(void);
struct LANGMenuEntry {
struct LANGMenuEntry *next;
char *line;
char *language;
char *code;
int id;
};
struct LANGMenuEntry *find_language(short langid);
#endif /* UI_TEXT_H */

@ -0,0 +1,69 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef UI_VIEW2D_H
#define UI_VIEW2D_H
/* start of a generic 2d view with should allow drawing grids,
* panning, zooming, scrolling, .. */
#define V2D_UNIT_SECONDS 0
#define V2D_UNIT_FRAMES 1
#define V2D_GRID_CLAMP 0
#define V2D_GRID_NOCLAMP 1
#define V2D_IS_CLIPPED 12000
#define V2D_HORIZONTAL_LINES 1
#define V2D_VERTICAL_LINES 2
#define V2D_HORIZONTAL_AXIS 4
#define V2D_VERTICAL_AXIS 8
struct View2D;
struct View2DGrid;
struct bContext;
typedef struct View2DGrid View2DGrid;
/* setup */
void UI_view2d_ortho(const struct bContext *C, struct View2D *v2d);
void UI_view2d_update_size(struct View2D *v2d, int winx, int winy);
/* grid drawing */
View2DGrid *UI_view2d_calc_grid(const struct bContext *C, struct View2D *v2d, int unit, int type, int winx, int winy);
void UI_view2d_draw_grid(const struct bContext *C, struct View2D *v2d, View2DGrid *grid, int flag);
void UI_view2d_free_grid(View2DGrid *grid);
/* coordinate conversion */
void UI_view2d_region_to_view(struct View2D *v2d, short x, short y, float *viewx, float *viewy);
void UI_view2d_view_to_region(struct View2D *v2d, float x, float y, short *regionx, short *regiony);
void UI_view2d_to_region_no_clip(struct View2D *v2d, float x, float y, short *regionx, short *region_y);
#endif /* UI_VIEW2D_H */

@ -45,7 +45,9 @@ CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenloader CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenlib CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../makesrna
CPPFLAGS += -I../../imbuf CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../ftfont
# own include # own include

@ -4,6 +4,6 @@ Import ('env')
sources = env.Glob('*.c') sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc' incs += ' ../../makesrna ../../windowmanager #/intern/guardedalloc #intern/bmfont'
env.BlenderLib ( 'bf_editors_interface', sources, Split(incs), [], libtype=['core','intern'], priority=[40, 45] ) env.BlenderLib ( 'bf_editors_interface', sources, Split(incs), [], libtype=['core','intern'], priority=[40, 45] )

File diff suppressed because it is too large Load Diff

@ -0,0 +1,292 @@
/**
* $Id: interface.h 14444 2008-04-16 22:40:48Z hos $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef INTERFACE_H
#define INTERFACE_H
#include "UI_resources.h"
#include "RNA_types.h"
struct uiActivateBut;
struct wmWindow;
struct ARegion;
/* general defines */
#define UI_MAX_DRAW_STR 400
#define UI_MAX_NAME_STR 64
#define UI_ARRAY 29
/* panel limits */
#define UI_PANEL_MINX 100
#define UI_PANEL_MINY 70
/* uiBut->flag */
#define UI_SELECT 1
#define UI_MOUSE_OVER 2
#define UI_ACTIVE 4
#define UI_HAS_ICON 8
/* warn: rest of uiBut->flag in BIF_interface.c */
/* uiBut->activateflag */
#define UI_ACTIVATE 1
#define UI_ACTIVATE_APPLY 2
#define UI_ACTIVATE_TEXT_EDITING 4
#define UI_ACTIVATE_OPEN 8
/* internal panel drawing defines */
#define PNL_GRID 4
#define PNL_DIST 8
#define PNL_SAFETY 8
#define PNL_HEADER 20
/* panel->flag */
#define PNL_SELECT 1
#define PNL_CLOSEDX 2
#define PNL_CLOSEDY 4
#define PNL_CLOSED 6
#define PNL_TABBED 8
#define PNL_OVERLAP 16
/* Button text selection:
* extension direction, selextend, inside ui_do_but_TEX */
#define EXTEND_LEFT 1
#define EXTEND_RIGHT 2
typedef struct {
short xim, yim;
unsigned int *rect;
short xofs, yofs;
} uiIconImage;
typedef struct {
short mval[2];
short qual, val;
int event;
} uiEvent;
typedef struct {
void *xl, *large, *medium, *small;
} uiFont;
typedef struct uiLinkLine { /* only for draw/edit */
struct uiLinkLine *next, *prev;
short flag, pad;
struct uiBut *from, *to;
} uiLinkLine;
typedef struct {
void **poin; /* pointer to original pointer */
void ***ppoin; /* pointer to original pointer-array */
short *totlink; /* if pointer-array, here is the total */
short maxlink, pad;
short fromcode, tocode;
ListBase lines;
} uiLink;
struct uiBut {
struct uiBut *next, *prev;
short type, pointype, bit, bitnr, retval, strwidth, ofs, pos, selsta, selend;
int flag;
char *str;
char strdata[UI_MAX_NAME_STR];
char drawstr[UI_MAX_DRAW_STR];
float x1, y1, x2, y2;
char *poin;
float min, max;
float a1, a2, hsv[3]; // hsv is temp memory for hsv buttons
float aspect;
void (*func)(void *, void *);
void (*func3)(void *, void *, void *); /* XXX remove */
void *func_arg1;
void *func_arg2;
void *func_arg3; /* XXX remove */
void (*embossfunc)(int , int , float, float, float, float, float, int);
void (*sliderfunc)(int , float, float, float, float, float, float, int);
void (*autocomplete_func)(char *, void *);
void *autofunc_arg;
uiLink *link;
char *tip, *lockstr;
int themecol; /* themecolor id */
void *font;
BIFIconID icon;
short but_align; /* aligning buttons, horiz/vertical */
short lock, win;
short iconadd, dt;
/* IDPOIN data */
uiIDPoinFuncFP idpoin_func;
ID **idpoin_idpp;
/* BLOCK data */
uiBlockFuncFP block_func;
/* BUTM data */
void (*butm_func)(void *arg, int event);
void *butm_func_arg;
/* RNA */
struct PointerRNA rnapoin;
struct PropertyRNA *rnaprop;
int rnaindex;
/* Activation data */
struct uiActivateBut *activate;
int activateflag;
char *editstr;
double *editval;
float *editvec;
void *editcoba;
void *editcumap;
/* pointer back */
uiBlock *block;
};
struct uiBlock {
uiBlock *next, *prev;
ListBase buttons;
Panel *panel;
uiBlock *oldblock;
char name[UI_MAX_NAME_STR];
float winmat[4][4];
float minx, miny, maxx, maxy;
float aspect;
void (*butm_func)(void *arg, int event);
void *butm_func_arg;
void (*func)(void *arg1, void *arg2);
void *func_arg1;
void *func_arg2;
/* extra draw function for custom blocks */
void (*drawextra)();
int themecol; /* themecolor id */
short font; /* indices */
int afterval, flag;
void *curfont;
short autofill, win, winq, direction, dt;
short auto_open, in_use, pad;
double auto_open_last;
int lock;
char *lockstr;
float xofs, yofs; // offset to parent button
rctf safety; // pulldowns, to detect outside, can differ per case how it is created
ListBase saferct; // uiSafetyRct list
uiMenuBlockHandle *handle; // handle
};
typedef struct uiSafetyRct {
struct uiSafetyRct *next, *prev;
rctf parent;
rctf safety;
} uiSafetyRct;
/* interface.c */
extern int ui_translate_buttons(void);
extern int ui_translate_menus(void);
extern int ui_translate_tooltips(void);
extern void ui_block_to_window_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
extern void ui_block_to_window(const struct ARegion *ar, uiBlock *block, int *x, int *y);
extern void ui_block_to_window_rct(const struct ARegion *ar, uiBlock *block, rctf *graph, rcti *winr);
extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y);
extern double ui_get_but_val(uiBut *but);
extern void ui_set_but_val(uiBut *but, double value);
extern void ui_set_but_hsv(uiBut *but);
extern void ui_get_but_vectorf(uiBut *but, float *vec);
extern void ui_set_but_vectorf(uiBut *but, float *vec);
extern void ui_get_but_string(uiBut *but, char *str, int maxlen);
extern void ui_set_but_string(uiBut *but, const char *str);
extern void ui_check_but(uiBut *but);
extern void ui_autofill(uiBlock *block);
extern int ui_is_but_float(uiBut *but);
extern void ui_update_block_buts_hsv(uiBlock *block, float *hsv);
/* interface_regions.c */
uiBlock *ui_block_func_MENU(struct wmWindow *window, uiMenuBlockHandle *handle, void *arg_but);
uiBlock *ui_block_func_ICONROW(struct wmWindow *window, uiMenuBlockHandle *handle, void *arg_but);
uiBlock *ui_block_func_ICONTEXTROW(struct wmWindow *window, uiMenuBlockHandle *handle, void *arg_but);
uiBlock *ui_block_func_COL(struct wmWindow *window, uiMenuBlockHandle *handle, void *arg_but);
struct ARegion *ui_tooltip_create(struct bContext *C, struct ARegion *butregion, uiBut *but);
void ui_tooltip_free(struct bContext *C, struct ARegion *ar);
uiMenuBlockHandle *ui_menu_block_create(struct bContext *C, struct ARegion *butregion, uiBut *but,
uiBlockFuncFP block_func, void *arg);
void ui_menu_block_free(struct bContext *C, uiMenuBlockHandle *handle);
void ui_set_name_menu(uiBut *but, int value);
/* interface_panel.c */
extern void ui_draw_panel(uiBlock *block);
extern void ui_do_panel(uiBlock *block, uiEvent *uevent);
extern void ui_scale_panel(uiBlock *block);
extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
extern void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown);
/* interface_draw.c */
extern void ui_set_embossfunc(uiBut *but, int drawtype);
extern void ui_draw_but(uiBut *but);
extern void ui_rasterpos_safe(float x, float y, float aspect);
extern void ui_draw_tria_icon(float x, float y, float aspect, char dir);
extern void ui_draw_anti_x(float x1, float y1, float x2, float y2);
extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -51,8 +51,9 @@
#include "BKE_utildefines.h" #include "BKE_utildefines.h"
#include "BIF_gl.h" #include "BIF_gl.h"
#include "BIF_resources.h"
#include "BIF_interface_icons.h" #include "UI_resources.h"
//#include "UI_icons.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
@ -63,14 +64,14 @@ static bTheme *theme_active=NULL;
static int theme_spacetype= SPACE_VIEW3D; static int theme_spacetype= SPACE_VIEW3D;
void BIF_resources_init(void) void ui_resources_init(void)
{ {
BIF_icons_init(BIFICONID_LAST+1); // XXX 2.50 missing UI_icons_init(BIFICONID_LAST+1);
} }
void BIF_resources_free(void) void ui_resources_free(void)
{ {
BIF_icons_free(); // XXX 2.50 missing UI_icons_free();
} }
@ -78,7 +79,7 @@ void BIF_resources_free(void)
/* THEMES */ /* THEMES */
/* ******************************************************** */ /* ******************************************************** */
char *BIF_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
{ {
ThemeSpace *ts= NULL; ThemeSpace *ts= NULL;
static char error[4]={240, 0, 240, 255}; static char error[4]={240, 0, 240, 255};
@ -328,7 +329,7 @@ char *BIF_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
Note: when you add new colors, created & saved themes need initialized Note: when you add new colors, created & saved themes need initialized
in usiblender.c, search for "versionfile" in usiblender.c, search for "versionfile"
*/ */
void BIF_InitTheme(void) void ui_theme_init_userdef(void)
{ {
bTheme *btheme= U.themes.first; bTheme *btheme= U.themes.first;
@ -343,7 +344,7 @@ void BIF_InitTheme(void)
strcpy(btheme->name, "Default"); strcpy(btheme->name, "Default");
} }
BIF_SetTheme(NULL); // make sure the global used in this file is set UI_SetTheme(NULL); // make sure the global used in this file is set
/* UI buttons (todo) */ /* UI buttons (todo) */
SETCOL(btheme->tui.outline, 0xA0,0xA0,0xA0, 255); SETCOL(btheme->tui.outline, 0xA0,0xA0,0xA0, 255);
@ -542,7 +543,7 @@ void BIF_InitTheme(void)
} }
char *BIF_ThemeColorsPup(int spacetype) char *UI_ThemeColorsPup(int spacetype)
{ {
char *cp= MEM_callocN(32*32, "theme pup"); char *cp= MEM_callocN(32*32, "theme pup");
char *str = cp; char *str = cp;
@ -713,7 +714,7 @@ char *BIF_ThemeColorsPup(int spacetype)
return cp; return cp;
} }
void BIF_SetTheme(ScrArea *sa) void UI_SetTheme(ScrArea *sa)
{ {
if(sa==NULL) { // called for safety, when delete themes if(sa==NULL) { // called for safety, when delete themes
theme_active= U.themes.first; theme_active= U.themes.first;
@ -728,32 +729,32 @@ void BIF_SetTheme(ScrArea *sa)
} }
// for space windows only // for space windows only
void BIF_ThemeColor(int colorid) void UI_ThemeColor(int colorid)
{ {
char *cp; char *cp;
cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
glColor3ub(cp[0], cp[1], cp[2]); glColor3ub(cp[0], cp[1], cp[2]);
} }
// plus alpha // plus alpha
void BIF_ThemeColor4(int colorid) void UI_ThemeColor4(int colorid)
{ {
char *cp; char *cp;
cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
glColor4ub(cp[0], cp[1], cp[2], cp[3]); glColor4ub(cp[0], cp[1], cp[2], cp[3]);
} }
// set the color with offset for shades // set the color with offset for shades
void BIF_ThemeColorShade(int colorid, int offset) void UI_ThemeColorShade(int colorid, int offset)
{ {
int r, g, b; int r, g, b;
char *cp; char *cp;
cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
r= offset + (int) cp[0]; r= offset + (int) cp[0];
CLAMP(r, 0, 255); CLAMP(r, 0, 255);
g= offset + (int) cp[1]; g= offset + (int) cp[1];
@ -763,12 +764,12 @@ void BIF_ThemeColorShade(int colorid, int offset)
//glColor3ub(r, g, b); //glColor3ub(r, g, b);
glColor4ub(r, g, b, cp[3]); glColor4ub(r, g, b, cp[3]);
} }
void BIF_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset) void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
{ {
int r, g, b, a; int r, g, b, a;
char *cp; char *cp;
cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
r= coloffset + (int) cp[0]; r= coloffset + (int) cp[0];
CLAMP(r, 0, 255); CLAMP(r, 0, 255);
g= coloffset + (int) cp[1]; g= coloffset + (int) cp[1];
@ -781,13 +782,13 @@ void BIF_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
} }
// blend between to theme colors, and set it // blend between to theme colors, and set it
void BIF_ThemeColorBlend(int colorid1, int colorid2, float fac) void UI_ThemeColorBlend(int colorid1, int colorid2, float fac)
{ {
int r, g, b; int r, g, b;
char *cp1, *cp2; char *cp1, *cp2;
cp1= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1); cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2); cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0; if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0;
r= floor((1.0-fac)*cp1[0] + fac*cp2[0]); r= floor((1.0-fac)*cp1[0] + fac*cp2[0]);
@ -798,13 +799,13 @@ void BIF_ThemeColorBlend(int colorid1, int colorid2, float fac)
} }
// blend between to theme colors, shade it, and set it // blend between to theme colors, shade it, and set it
void BIF_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset) void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
{ {
int r, g, b; int r, g, b;
char *cp1, *cp2; char *cp1, *cp2;
cp1= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1); cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
cp2= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2); cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0; if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0;
r= offset+floor((1.0-fac)*cp1[0] + fac*cp2[0]); r= offset+floor((1.0-fac)*cp1[0] + fac*cp2[0]);
@ -819,65 +820,65 @@ void BIF_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
} }
// get individual values, not scaled // get individual values, not scaled
float BIF_GetThemeValuef(int colorid) float UI_GetThemeValuef(int colorid)
{ {
char *cp; char *cp;
cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
return ((float)cp[0]); return ((float)cp[0]);
} }
// get individual values, not scaled // get individual values, not scaled
int BIF_GetThemeValue(int colorid) int UI_GetThemeValue(int colorid)
{ {
char *cp; char *cp;
cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
return ((int) cp[0]); return ((int) cp[0]);
} }
// get the color, range 0.0-1.0 // get the color, range 0.0-1.0
void BIF_GetThemeColor3fv(int colorid, float *col) void UI_GetThemeColor3fv(int colorid, float *col)
{ {
char *cp; char *cp;
cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0]= ((float)cp[0])/255.0; col[0]= ((float)cp[0])/255.0;
col[1]= ((float)cp[1])/255.0; col[1]= ((float)cp[1])/255.0;
col[2]= ((float)cp[2])/255.0; col[2]= ((float)cp[2])/255.0;
} }
// get the color, in char pointer // get the color, in char pointer
void BIF_GetThemeColor3ubv(int colorid, char *col) void UI_GetThemeColor3ubv(int colorid, char *col)
{ {
char *cp; char *cp;
cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0]= cp[0]; col[0]= cp[0];
col[1]= cp[1]; col[1]= cp[1];
col[2]= cp[2]; col[2]= cp[2];
} }
// get the color, in char pointer // get the color, in char pointer
void BIF_GetThemeColor4ubv(int colorid, char *col) void UI_GetThemeColor4ubv(int colorid, char *col)
{ {
char *cp; char *cp;
cp= BIF_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0]= cp[0]; col[0]= cp[0];
col[1]= cp[1]; col[1]= cp[1];
col[2]= cp[2]; col[2]= cp[2];
col[3]= cp[3]; col[3]= cp[3];
} }
void BIF_GetThemeColorType4ubv(int colorid, int spacetype, char *col) void UI_GetThemeColorType4ubv(int colorid, int spacetype, char *col)
{ {
char *cp; char *cp;
cp= BIF_ThemeGetColorPtr(theme_active, spacetype, colorid); cp= UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
col[0]= cp[0]; col[0]= cp[0];
col[1]= cp[1]; col[1]= cp[1];
col[2]= cp[2]; col[2]= cp[2];
@ -885,7 +886,7 @@ void BIF_GetThemeColorType4ubv(int colorid, int spacetype, char *col)
} }
// blends and shades between two char color pointers // blends and shades between two char color pointers
void BIF_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset) void UI_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset)
{ {
int r, g, b; int r, g, b;
@ -902,7 +903,7 @@ void BIF_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset)
} }
// get a 3 byte color, blended and shaded between two other char color pointers // get a 3 byte color, blended and shaded between two other char color pointers
void BIF_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset) void UI_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset)
{ {
int r, g, b; int r, g, b;
@ -919,3 +920,4 @@ void BIF_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, i
col[1] = g; col[1] = g;
col[2] = b; col[2] = b;
} }

@ -0,0 +1,442 @@
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is written by Rob Haarsma (phase)
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/* XXX 2.50 this file must be cleanup still, using globals etc. */
#include <string.h>
#include <stdlib.h>
#include "MEM_guardedalloc.h"
#include "DNA_listBase.h"
#include "DNA_userdef_types.h"
#include "DNA_vec_types.h"
#include "BKE_global.h" /* G */
#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h" /* linknode */
#include "BIF_gl.h"
#include "UI_text.h"
#include "ED_datafiles.h"
#include "BMF_Api.h"
#ifdef WITH_ICONV
#include "iconv.h"
void string_to_utf8(char *original, char *utf_8, char *code)
{
size_t inbytesleft=strlen(original);
size_t outbytesleft=512;
size_t rv=0;
iconv_t cd;
cd=iconv_open("UTF-8", code);
if (cd == (iconv_t)(-1)) {
printf("iconv_open Error");
*utf_8='\0';
return ;
}
rv=iconv(cd, &original, &inbytesleft, &utf_8, &outbytesleft);
if (rv == (size_t) -1) {
printf("iconv Error\n");
return ;
}
*utf_8 = '\0';
iconv_close(cd);
}
#endif // WITH_ICONV
#ifdef INTERNATIONAL
#include "FTF_Api.h"
static struct LANGMenuEntry *langmenu= 0;
static int tot_lang = 0;
#endif // INTERNATIONAL
void UI_RasterPos(float x, float y)
{
#ifdef INTERNATIONAL
FTF_SetPosition(x, y);
#endif // INTERNATIONAL
}
void UI_SetScale(float aspect)
{
#ifdef INTERNATIONAL
FTF_SetScale(aspect);
#endif // INTERNATIONAL
}
void ui_text_init_userdef(void)
{
#ifdef INTERNATIONAL
if(U.transopts & USER_DOTRANSLATE)
start_interface_font();
else
G.ui_international= FALSE;
#else // INTERNATIONAL
G.ui_international= FALSE;
#endif
}
int UI_DrawString(BMF_Font* font, char *str, int translate)
{
#ifdef INTERNATIONAL
if(G.ui_international == TRUE) {
if(translate)
{
#ifdef WITH_ICONV
if(translate & CONVERT_TO_UTF8) {
char utf_8[512];
struct LANGMenuEntry *lme;
lme = find_language(U.language);
if (lme !=NULL) {
if (!strcmp(lme->code, "ja_JP"))
string_to_utf8(str, utf_8, "Shift_JIS"); /* Japanese */
else if (!strcmp(lme->code, "zh_CN"))
string_to_utf8(str, utf_8, "GB2312"); /* Chinese */
}
return FTF_DrawString(utf_8, FTF_INPUT_UTF8);
}
else
#endif // WITH_ICONV
return FTF_DrawString(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
}
else
return FTF_DrawString(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
} else {
return BMF_DrawString(font, str);
}
#else // INTERNATIONAL
return BMF_DrawString(font, str);
#endif
}
float UI_GetStringWidth(BMF_Font* font, char *str, int translate)
{
float rt;
#ifdef INTERNATIONAL
if(G.ui_international == TRUE)
if(translate && (U.transopts & USER_TR_BUTTONS))
rt= FTF_GetStringWidth(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
else
rt= FTF_GetStringWidth(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
else
rt= BMF_GetStringWidth(font, str);
#else
rt= BMF_GetStringWidth(font, str);
#endif
return rt;
}
void UI_GetBoundingBox(struct BMF_Font* font, char* str, int translate, rctf *bbox)
{
#ifdef INTERNATIONAL
float dummy;
if(G.ui_international == TRUE)
if(translate && (U.transopts & USER_TR_BUTTONS))
FTF_GetBoundingBox(str, &bbox->xmin, &bbox->ymin, &dummy, &bbox->xmax, &bbox->ymax, &dummy, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
else
FTF_GetBoundingBox(str, &bbox->xmin, &bbox->ymin, &dummy, &bbox->xmax, &bbox->ymax, &dummy, FTF_NO_TRANSCONV | FTF_INPUT_UTF8);
else
BMF_GetStringBoundingBox(font, str, &bbox->xmin, &bbox->ymin, &bbox->xmax, &bbox->ymax);
#else
BMF_GetStringBoundingBox(font, str, &bbox->xmin, &bbox->ymin, &bbox->xmax, &bbox->ymax);
#endif
}
#ifdef INTERNATIONAL
char *fontsize_pup(void)
{
static char string[1024];
char formatstring[1024];
strcpy(formatstring, "Choose Font Size: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d");
sprintf(string, formatstring,
"Font Size: 8", 8,
"Font Size: 9", 9,
"Font Size: 10", 10,
"Font Size: 11", 11,
"Font Size: 12", 12,
"Font Size: 13", 13,
"Font Size: 14", 14,
"Font Size: 15", 15,
"Font Size: 16", 16
);
return (string);
}
char *language_pup(void)
{
struct LANGMenuEntry *lme = langmenu;
static char string[1024];
static char tmp[1024];
if(tot_lang == 0)
sprintf(string, "Choose Language: %%t|Language: English %%x0");
else {
sprintf(string, "Choose Language: %%t");
while(lme) {
sprintf(tmp, "|Language: %s %%x%d", lme->language, lme->id);
strcat(string, tmp);
lme= lme->next;
}
}
return string;
}
struct LANGMenuEntry *find_language(short langid)
{
struct LANGMenuEntry *lme = langmenu;
while(lme) {
if(lme->id == langid)
return lme;
lme=lme->next;
}
return NULL;
}
void lang_setlanguage(void)
{
struct LANGMenuEntry *lme;
lme = find_language(U.language);
if(lme) FTF_SetLanguage(lme->code);
else FTF_SetLanguage("en_US");
}
/* called from fileselector */
void set_interface_font(char *str)
{
/* this test needed because fileselect callback can happen after disable AA fonts */
if(U.transopts & USER_DOTRANSLATE) {
if(FTF_SetFont((unsigned char*)str, 0, U.fontsize)) {
lang_setlanguage();
if(strlen(str) < FILE_MAXDIR) strcpy(U.fontname, str);
G.ui_international = TRUE;
}
else {
U.fontname[0]= 0;
FTF_SetFont((unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
G.ui_international = TRUE; // this case will switch to standard font
/* XXX 2.50 bad call okee("Invalid font selection - reverting to built-in font."); */
}
/* XXX 2.50 bad call allqueue(REDRAWALL, 0); */
}
}
void start_interface_font(void)
{
int result = 0;
if(U.transopts & USER_USETEXTUREFONT)
FTF_SetMode(FTF_TEXTUREFONT);
else
FTF_SetMode(FTF_PIXMAPFONT);
if(U.fontsize && U.fontname[0] ) { // we have saved user settings + fontpath
// try loading font from U.fontname = full path to font in usersettings
result = FTF_SetFont((unsigned char*)U.fontname, 0, U.fontsize);
}
else if(U.fontsize) { // user settings, default
result = FTF_SetFont((unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
}
if(result==0) { // use default
U.language= 0;
U.fontsize= 11;
U.encoding= 0;
U.fontname[0]= 0;
result = FTF_SetFont((unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
}
if(result) {
lang_setlanguage();
G.ui_international = TRUE;
}
else {
printf("no font found for international support\n");
G.ui_international = FALSE;
U.transopts &= ~USER_DOTRANSLATE;
U.fontsize = 0;
}
/* XXX 2.50 bad call allqueue(REDRAWALL, 0); */
}
static char *first_dpointchar(char *string)
{
char *dpointchar;
dpointchar= strchr(string, ':');
return dpointchar;
}
static void splitlangline(char *line, struct LANGMenuEntry *lme)
{
char *dpointchar= first_dpointchar(line);
if (dpointchar) {
lme->code= BLI_strdup(dpointchar+1);
*(dpointchar)=0;
lme->language= BLI_strdup(line);
} else {
/* XXX 2.50 bad call error("Invalid language file"); */
}
}
static void puplang_insert_entry(char *line)
{
struct LANGMenuEntry *lme, *prev;
int sorted = 0;
prev= NULL;
lme= langmenu;
for (; lme; prev= lme, lme= lme->next) {
if (lme->line) {
if (BLI_streq(line, lme->line)) {
return;
} else if (sorted && strcmp(line, lme->line)<0) {
break;
}
}
}
lme= MEM_mallocN(sizeof(*lme), "lme");
lme->line = BLI_strdup(line);
splitlangline(line, lme);
lme->id = tot_lang;
tot_lang++;
if (prev) {
lme->next= prev->next;
prev->next= lme;
} else {
lme->next= langmenu;
langmenu= lme;
}
}
int read_languagefile(void)
{
char name[FILE_MAXDIR+FILE_MAXFILE];
LinkNode *l, *lines;
/* .Blanguages, http://www.blender3d.org/cms/Installation_Policy.352.0.html*/
#if defined (__APPLE__) || (WIN32)
BLI_make_file_string("/", name, BLI_gethome(), ".Blanguages");
#else
BLI_make_file_string("/", name, BLI_gethome(), ".blender/.Blanguages");
#endif
lines= BLI_read_file_as_lines(name);
if(lines == NULL) {
/* If not found in home, try current dir
* (Resources folder of app bundle on OS X) */
#if defined (__APPLE__)
char *bundlePath = BLI_getbundle();
strcpy(name, bundlePath);
strcat(name, "/Contents/Resources/.Blanguages");
#else
/* Check the CWD. Takes care of the case where users
* unpack blender tarball; cd blender-dir; ./blender */
strcpy(name, ".blender/.Blanguages");
#endif
lines= BLI_read_file_as_lines(name);
if(lines == NULL) {
/* If not found in .blender, try current dir */
strcpy(name, ".Blanguages");
lines= BLI_read_file_as_lines(name);
if(lines == NULL) {
if(G.f & G_DEBUG) printf("File .Blanguages not found\n");
return 0;
}
}
}
for (l= lines; l; l= l->next) {
char *line= l->link;
if (!BLI_streq(line, "")) {
puplang_insert_entry(line);
}
}
BLI_free_file_lines(lines);
return 1;
}
void free_languagemenu(void)
{
struct LANGMenuEntry *lme= langmenu;
while (lme) {
struct LANGMenuEntry *n= lme->next;
if (lme->line) MEM_freeN(lme->line);
if (lme->language) MEM_freeN(lme->language);
if (lme->code) MEM_freeN(lme->code);
MEM_freeN(lme);
lme= n;
}
}
#endif /* INTERNATIONAL */

@ -13,8 +13,9 @@
#include "WM_api.h" #include "WM_api.h"
#include "BIF_gl.h" #include "BIF_gl.h"
#include "BIF_resources.h"
#include "BIF_view2d.h" #include "UI_resources.h"
#include "UI_view2d.h"
/* minimum pixels per gridstep */ /* minimum pixels per gridstep */
#define IPOSTEP 35 #define IPOSTEP 35
@ -24,13 +25,67 @@ struct View2DGrid {
int machtx, machty; int machtx, machty;
}; };
/* OpenGL setup */ /* Setup */
void BIF_view2d_ortho(const bContext *C, View2D *v2d) void UI_view2d_ortho(const bContext *C, View2D *v2d)
{ {
wmOrtho2(C->window, v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax); wmOrtho2(C->window, v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
} }
void UI_view2d_update_size(View2D *v2d, int winx, int winy)
{
v2d->mask.xmin= v2d->mask.ymin= 0;
v2d->mask.xmax= winx;
v2d->mask.ymax= winy;
#if 0
if(sa->spacetype==SPACE_ACTION) {
if(sa->winx > ACTWIDTH+50) {
v2d->mask.xmin+= ACTWIDTH;
v2d->hor.xmin+=ACTWIDTH;
}
}
else if(sa->spacetype==SPACE_NLA){
if(sa->winx > NLAWIDTH+50) {
v2d->mask.xmin+= NLAWIDTH;
v2d->hor.xmin+=NLAWIDTH;
}
}
else if(sa->spacetype==SPACE_IPO) {
int ipobutx = calc_ipobuttonswidth(sa);
v2d->mask.xmax-= ipobutx;
if(v2d->mask.xmax<ipobutx)
v2d->mask.xmax= winx;
}
#endif
if(v2d->scroll) {
if(v2d->scroll & L_SCROLL) {
v2d->vert= v2d->mask;
v2d->vert.xmax= SCROLLB;
v2d->mask.xmin= SCROLLB;
}
else if(v2d->scroll & R_SCROLL) {
v2d->vert= v2d->mask;
v2d->vert.xmin= v2d->vert.xmax-SCROLLB;
v2d->mask.xmax= v2d->vert.xmin;
}
if((v2d->scroll & B_SCROLL) || (v2d->scroll & B_SCROLLO)) {
v2d->hor= v2d->mask;
v2d->hor.ymax= SCROLLH;
v2d->mask.ymin= SCROLLH;
}
else if(v2d->scroll & T_SCROLL) {
v2d->hor= v2d->mask;
v2d->hor.ymin= v2d->hor.ymax-SCROLLH;
v2d->mask.ymax= v2d->hor.ymin;
}
}
}
/* Grid */ /* Grid */
static void step_to_grid(float *step, int *macht, int unit) static void step_to_grid(float *step, int *macht, int unit)
@ -71,7 +126,7 @@ static void step_to_grid(float *step, int *macht, int unit)
} }
} }
View2DGrid *BIF_view2d_calc_grid(const bContext *C, View2D *v2d, int unit, int clamp, int winx, int winy) View2DGrid *UI_view2d_calc_grid(const bContext *C, View2D *v2d, int unit, int clamp, int winx, int winy)
{ {
View2DGrid *grid; View2DGrid *grid;
float space, pixels, seconddiv; float space, pixels, seconddiv;
@ -123,7 +178,7 @@ View2DGrid *BIF_view2d_calc_grid(const bContext *C, View2D *v2d, int unit, int c
return grid; return grid;
} }
void BIF_view2d_draw_grid(const bContext *C, View2D *v2d, View2DGrid *grid, int flag) void UI_view2d_draw_grid(const bContext *C, View2D *v2d, View2DGrid *grid, int flag)
{ {
float vec1[2], vec2[2]; float vec1[2], vec2[2];
int a, step; int a, step;
@ -136,7 +191,7 @@ void BIF_view2d_draw_grid(const bContext *C, View2D *v2d, View2DGrid *grid, int
step= (v2d->mask.xmax - v2d->mask.xmin+1)/IPOSTEP; step= (v2d->mask.xmax - v2d->mask.xmin+1)/IPOSTEP;
BIF_ThemeColor(TH_GRID); UI_ThemeColor(TH_GRID);
for(a=0; a<step; a++) { for(a=0; a<step; a++) {
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
@ -147,7 +202,7 @@ void BIF_view2d_draw_grid(const bContext *C, View2D *v2d, View2DGrid *grid, int
vec2[0]= vec1[0]-= 0.5*grid->dx; vec2[0]= vec1[0]-= 0.5*grid->dx;
BIF_ThemeColorShade(TH_GRID, 16); UI_ThemeColorShade(TH_GRID, 16);
step++; step++;
for(a=0; a<=step; a++) { for(a=0; a<=step; a++) {
@ -166,7 +221,7 @@ void BIF_view2d_draw_grid(const bContext *C, View2D *v2d, View2DGrid *grid, int
step= (C->area->winy+1)/IPOSTEP; step= (C->area->winy+1)/IPOSTEP;
BIF_ThemeColor(TH_GRID); UI_ThemeColor(TH_GRID);
for(a=0; a<=step; a++) { for(a=0; a<=step; a++) {
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
glVertex2fv(vec1); glVertex2fv(vec2); glVertex2fv(vec1); glVertex2fv(vec2);
@ -177,7 +232,7 @@ void BIF_view2d_draw_grid(const bContext *C, View2D *v2d, View2DGrid *grid, int
step++; step++;
} }
BIF_ThemeColorShade(TH_GRID, -50); UI_ThemeColorShade(TH_GRID, -50);
if(flag & V2D_HORIZONTAL_AXIS) { if(flag & V2D_HORIZONTAL_AXIS) {
/* horizontal axis */ /* horizontal axis */
@ -203,14 +258,14 @@ void BIF_view2d_draw_grid(const bContext *C, View2D *v2d, View2DGrid *grid, int
} }
} }
void BIF_view2d_free_grid(View2DGrid *grid) void UI_view2d_free_grid(View2DGrid *grid)
{ {
MEM_freeN(grid); MEM_freeN(grid);
} }
/* Coordinate conversion */ /* Coordinate conversion */
void BIF_view2d_region_to_view(View2D *v2d, short x, short y, float *viewx, float *viewy) void UI_view2d_region_to_view(View2D *v2d, short x, short y, float *viewx, float *viewy)
{ {
float div, ofs; float div, ofs;
@ -229,7 +284,7 @@ void BIF_view2d_region_to_view(View2D *v2d, short x, short y, float *viewx, floa
} }
} }
void BIF_view2d_view_to_region(View2D *v2d, float x, float y, short *regionx, short *regiony) void UI_view2d_view_to_region(View2D *v2d, float x, float y, short *regionx, short *regiony)
{ {
*regionx= V2D_IS_CLIPPED; *regionx= V2D_IS_CLIPPED;
*regiony= V2D_IS_CLIPPED; *regiony= V2D_IS_CLIPPED;
@ -247,7 +302,7 @@ void BIF_view2d_view_to_region(View2D *v2d, float x, float y, short *regionx, sh
} }
} }
void BIF_view2d_to_region_no_clip(View2D *v2d, float x, float y, short *regionx, short *regiony) void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, short *regionx, short *regiony)
{ {
x= (x - v2d->cur.xmin)/(v2d->cur.xmax-v2d->cur.xmin); x= (x - v2d->cur.xmin)/(v2d->cur.xmax-v2d->cur.xmin);
y= (x - v2d->cur.ymin)/(v2d->cur.ymax-v2d->cur.ymin); y= (x - v2d->cur.ymin)/(v2d->cur.ymax-v2d->cur.ymin);
@ -268,3 +323,4 @@ void BIF_view2d_to_region_no_clip(View2D *v2d, float x, float y, short *regionx,
} }
} }

@ -47,10 +47,11 @@
#include "WM_types.h" #include "WM_types.h"
#include "wm_subwindow.h" #include "wm_subwindow.h"
#include "BIF_resources.h"
#include "BIF_gl.h" #include "BIF_gl.h"
#include "BIF_glutil.h" #include "BIF_glutil.h"
#include "UI_resources.h"
#include "BPY_extern.h" #include "BPY_extern.h"
#include "screen_intern.h" #include "screen_intern.h"
@ -112,9 +113,9 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
wm_subwindow_set(C->window, ar->swinid); wm_subwindow_set(C->window, ar->swinid);
if(ar->swinid && at->draw) { if(ar->swinid && at->draw) {
BIF_SetTheme(C->area); UI_SetTheme(C->area);
at->draw(C, ar); at->draw(C, ar);
BIF_SetTheme(NULL); UI_SetTheme(NULL);
} }
else { else {
float fac= 0.1*ar->swinid; float fac= 0.1*ar->swinid;

@ -30,6 +30,8 @@
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_screen.h" #include "BKE_screen.h"
#include "UI_interface.h"
#include "BIF_gl.h" #include "BIF_gl.h"
#include "WM_api.h" #include "WM_api.h"
@ -68,6 +70,7 @@ void ED_spacetypes_keymap(wmWindowManager *wm)
SpaceType *type; SpaceType *type;
ED_keymap_screen(wm); ED_keymap_screen(wm);
UI_keymap(wm);
spacetypes = BKE_spacetypes_list(); spacetypes = BKE_spacetypes_list();
for(type=spacetypes->first; type; type=type->next) for(type=spacetypes->first; type; type=type->next)

@ -33,7 +33,6 @@ void blender_test_break() {}
void error() {} void error() {}
void set_timecursor() {} void set_timecursor() {}
void waitcursor() {} void waitcursor() {}
void pupmenu() {}
void mainqenter() {} void mainqenter() {}
void saveover() {} void saveover() {}
void BIF_icons_free() {} void BIF_icons_free() {}

@ -29,7 +29,6 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "DNA_object_types.h"
#include "DNA_space_types.h" #include "DNA_space_types.h"
#include "DNA_scene_types.h" #include "DNA_scene_types.h"
#include "DNA_screen_types.h" #include "DNA_screen_types.h"
@ -37,10 +36,6 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BLI_rand.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_screen.h" #include "BKE_screen.h"
@ -51,8 +46,10 @@
#include "BIF_gl.h" #include "BIF_gl.h"
#include "BIF_glutil.h" #include "BIF_glutil.h"
#include "BIF_resources.h"
#include "BIF_view2d.h" #include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "time_intern.h" #include "time_intern.h"
@ -64,14 +61,13 @@ static void time_draw_cfra_time(const bContext *C, SpaceTime *stime)
Scene *scene= C->scene; Scene *scene= C->scene;
float vec[2]; float vec[2];
vec[0]= scene->r.cfra; vec[0]= scene->r.cfra*scene->r.framelen;
vec[0]*= scene->r.framelen;
vec[1]= stime->v2d.cur.ymin; UI_ThemeColor(TH_CFRAME); // no theme, should be global color once...
BIF_ThemeColor(TH_CFRAME); // no theme, should be global color once...
glLineWidth(3.0); glLineWidth(3.0);
glBegin(GL_LINES); glBegin(GL_LINES);
vec[1]= stime->v2d.cur.ymin;
glVertex2fv(vec); glVertex2fv(vec);
vec[1]= stime->v2d.cur.ymax; vec[1]= stime->v2d.cur.ymax;
glVertex2fv(vec); glVertex2fv(vec);
@ -84,7 +80,7 @@ static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime)
{ {
/* draw darkened area outside of active timeline /* draw darkened area outside of active timeline
* frame range used is preview range or scene range */ * frame range used is preview range or scene range */
BIF_ThemeColorShade(TH_BACK, -25); UI_ThemeColorShade(TH_BACK, -25);
if (PSFRA < PEFRA) { if (PSFRA < PEFRA) {
glRectf(stime->v2d.cur.xmin, stime->v2d.cur.ymin, PSFRA, stime->v2d.cur.ymax); glRectf(stime->v2d.cur.xmin, stime->v2d.cur.ymin, PSFRA, stime->v2d.cur.ymax);
@ -94,7 +90,7 @@ static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime)
glRectf(stime->v2d.cur.xmin, stime->v2d.cur.ymin, stime->v2d.cur.xmax, stime->v2d.cur.ymax); glRectf(stime->v2d.cur.xmin, stime->v2d.cur.ymin, stime->v2d.cur.xmax, stime->v2d.cur.ymax);
} }
BIF_ThemeColorShade(TH_BACK, -60); UI_ThemeColorShade(TH_BACK, -60);
/* thin lines where the actual frames are */ /* thin lines where the actual frames are */
fdrawline(PSFRA, stime->v2d.cur.ymin, PSFRA, stime->v2d.cur.ymax); fdrawline(PSFRA, stime->v2d.cur.ymin, PSFRA, stime->v2d.cur.ymax);
fdrawline(PEFRA, stime->v2d.cur.ymin, PEFRA, stime->v2d.cur.ymax); fdrawline(PEFRA, stime->v2d.cur.ymin, PEFRA, stime->v2d.cur.ymax);
@ -121,21 +117,23 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
winx= ar->winrct.xmax-ar->winrct.xmin; winx= ar->winrct.xmax-ar->winrct.xmin;
winy= ar->winrct.ymax-ar->winrct.ymin; winy= ar->winrct.ymax-ar->winrct.ymin;
UI_view2d_update_size(&stime->v2d, winx, winy);
/* clear and setup matrix */ /* clear and setup matrix */
BIF_GetThemeColor3fv(TH_BACK, col); UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0); glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
BIF_view2d_ortho(C, &stime->v2d); UI_view2d_ortho(C, &stime->v2d);
/* start and end frame */ /* start and end frame */
time_draw_sfra_efra(C, stime); time_draw_sfra_efra(C, stime);
/* grid */ /* grid */
unit= (stime->flag & TIME_DRAWFRAMES)? V2D_UNIT_FRAMES: V2D_UNIT_SECONDS; unit= (stime->flag & TIME_DRAWFRAMES)? V2D_UNIT_FRAMES: V2D_UNIT_SECONDS;
grid= BIF_view2d_calc_grid(C, &stime->v2d, unit, V2D_GRID_CLAMP, winx, winy); grid= UI_view2d_calc_grid(C, &stime->v2d, unit, V2D_GRID_CLAMP, winx, winy);
BIF_view2d_draw_grid(C, &stime->v2d, grid, V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS); UI_view2d_draw_grid(C, &stime->v2d, grid, V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS);
BIF_view2d_free_grid(grid); UI_view2d_free_grid(grid);
/* current frame */ /* current frame */
time_draw_cfra_time(C, stime); time_draw_cfra_time(C, stime);
@ -146,6 +144,25 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
/* draw entirely, windowsize changes should be handled here */ /* draw entirely, windowsize changes should be handled here */
} }
/* ************************ header time area region *********************** */
static void time_header_area_draw(const bContext *C, ARegion *ar)
{
float col[3];
/* clear */
UI_GetThemeColor3fv(TH_HEADER, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
uiTestRegion(C);
}
static void time_header_area_free(ARegion *ar)
{
uiFreeBlocks(&ar->uiblocks);
}
/* ******************** default callbacks for time space ***************** */ /* ******************** default callbacks for time space ***************** */
static SpaceLink *time_new(void) static SpaceLink *time_new(void)
@ -219,6 +236,15 @@ static void time_init(wmWindowManager *wm, ScrArea *sa)
WM_event_remove_keymap_handler(&ar->handlers, &wm->timekeymap); WM_event_remove_keymap_handler(&ar->handlers, &wm->timekeymap);
WM_event_add_keymap_handler(&ar->handlers, &wm->timekeymap); WM_event_add_keymap_handler(&ar->handlers, &wm->timekeymap);
} }
else if(ar->regiontype == RGN_TYPE_HEADER) {
static ARegionType headerart={NULL, NULL, NULL, NULL, NULL};
headerart.draw= time_header_area_draw;
headerart.free= time_header_area_free;
ar->type= &headerart;
WM_event_add_keymap_handler(&ar->handlers, &wm->uikeymap);
}
else { else {
static ARegionType art={NULL, NULL, NULL, NULL, NULL}; static ARegionType art={NULL, NULL, NULL, NULL, NULL};

@ -39,7 +39,8 @@
#include "BKE_global.h" #include "BKE_global.h"
#include "BIF_view2d.h" #include "UI_interface.h"
#include "UI_view2d.h"
#include "WM_api.h" #include "WM_api.h"
#include "WM_types.h" #include "WM_types.h"
@ -110,10 +111,9 @@ static int frame_from_event(bContext *C, wmEvent *event)
int x, y; int x, y;
float viewx; float viewx;
/* XXX region->winrect isn't updated on window changes */
x= event->x - region->winrct.xmin; x= event->x - region->winrct.xmin;
y= event->y - region->winrct.ymin; y= event->y - region->winrct.ymin;
BIF_view2d_region_to_view(&stime->v2d, x, y, &viewx, NULL); UI_view2d_region_to_view(&stime->v2d, x, y, &viewx, NULL);
return (int)(viewx+0.5f); return (int)(viewx+0.5f);
} }
@ -157,7 +157,6 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL; return OPERATOR_RUNNING_MODAL;
} }
/* Operator for joining two areas (space types) */
void ED_TIME_OT_change_frame(wmOperatorType *ot) void ED_TIME_OT_change_frame(wmOperatorType *ot)
{ {
/* identifiers */ /* identifiers */

@ -67,6 +67,7 @@ typedef struct wmWindowManager {
/* custom keymaps */ /* custom keymaps */
ListBase windowkeymap; ListBase windowkeymap;
ListBase screenkeymap; ListBase screenkeymap;
ListBase uikeymap;
ListBase timekeymap; ListBase timekeymap;

@ -149,6 +149,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
} }
BLI_freelistN(&wm->timekeymap); BLI_freelistN(&wm->timekeymap);
BLI_freelistN(&wm->uikeymap);
BLI_freelistN(&wm->windowkeymap); BLI_freelistN(&wm->windowkeymap);
BLI_freelistN(&wm->screenkeymap); BLI_freelistN(&wm->screenkeymap);

@ -74,9 +74,10 @@
#include "BLO_readfile.h" #include "BLO_readfile.h"
#include "BLO_writefile.h" #include "BLO_writefile.h"
// XXX #include "BPY_extern.h" #include "ED_datafiles.h"
#include "UI_interface.h"
//XXX #include "datatoc.h" // XXX #include "BPY_extern.h"
#include "WM_api.h" #include "WM_api.h"
#include "WM_types.h" #include "WM_types.h"
@ -90,8 +91,8 @@
/* patching UserDef struct and Themes */ /* patching UserDef struct and Themes */
static void init_userdef_themes(void) static void init_userdef_themes(void)
{ {
// sets themes, fonts, .. from userdef
// XXX BIF_InitTheme(); // sets default again UI_init_userdef();
// countall(); // countall();
@ -556,8 +557,6 @@ int WM_read_homefile(bContext *C, int from_memory)
if (!from_memory && BLI_exists(tstr)) { if (!from_memory && BLI_exists(tstr)) {
success = BKE_read_file(C, tstr, NULL); success = BKE_read_file(C, tstr, NULL);
} else { } else {
extern int datatoc_B_blend_size;
extern char datatoc_B_blend[];
success = BKE_read_file_from_memory(C, datatoc_B_blend, datatoc_B_blend_size, NULL); success = BKE_read_file_from_memory(C, datatoc_B_blend, datatoc_B_blend_size, NULL);
/* outliner patch for 2.42 .b.blend */ /* outliner patch for 2.42 .b.blend */
outliner_242_patch(); outliner_242_patch();

@ -68,6 +68,8 @@
#include "SYS_System.h" #include "SYS_System.h"
#include "UI_interface.h"
#include "WM_api.h" #include "WM_api.h"
#include "WM_types.h" #include "WM_types.h"
#include "wm.h" #include "wm.h"
@ -78,16 +80,7 @@
static void initbuttons(void) static void initbuttons(void)
{ {
// uiDefFont(UI_HELVB, UI_init();
// BMF_GetFont(BMF_kHelveticaBold14),
// BMF_GetFont(BMF_kHelveticaBold12),
// BMF_GetFont(BMF_kHelveticaBold10),
// BMF_GetFont(BMF_kHelveticaBold8));
// uiDefFont(UI_HELV,
// BMF_GetFont(BMF_kHelvetica12),
// BMF_GetFont(BMF_kHelvetica12),
// BMF_GetFont(BMF_kHelvetica10),
// BMF_GetFont(BMF_kHelveticaBold8));
// glClearColor(.7f, .7f, .6f, 0.0); // glClearColor(.7f, .7f, .6f, 0.0);
@ -133,10 +126,7 @@ void WM_init(bContext *C)
// XXX BIF_preview_init_dbase(); // XXX BIF_preview_init_dbase();
// XXX UI_filelist_init_icons();
// XXX BIF_resources_init(); /* after homefile, to dynamically load an icon file based on theme settings */
// XXX BIF_filelist_init_icons();
// init_gl_stuff(); /* drawview.c, after homefile */ // init_gl_stuff(); /* drawview.c, after homefile */
read_Blog(); read_Blog();
@ -228,9 +218,7 @@ void WM_exit(bContext *C)
#endif #endif
if (!G.background) { if (!G.background) {
// XXX BIF_resources_free(); // XXX UI_filelist_free_icons();
// XXX BIF_filelist_free_icons();
} }
#ifdef INTERNATIONAL #ifdef INTERNATIONAL
@ -246,6 +234,7 @@ void WM_exit(bContext *C)
BKE_undo_save_quit(); // saves quit.blend if global undo is on BKE_undo_save_quit(); // saves quit.blend if global undo is on
BKE_reset_undo(); BKE_reset_undo();
UI_exit();
BLI_freelistN(&U.themes); BLI_freelistN(&U.themes);
// XXX BIF_preview_free_dbase(); // XXX BIF_preview_free_dbase();