Page MenuHome

dynicons.txt

Authored By
Matt Ebb (broken)
Nov 13 2013, 1:11 PM
Size
12 KB
Subscribers
None

dynicons.txt

Index: source/blender/include/BIF_interface_icons.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/BIF_interface_icons.h,v
retrieving revision 1.3
diff -u -r1.3 BIF_interface_icons.h
--- source/blender/include/BIF_interface_icons.h 29 Jun 2006 09:44:08 -0000 1.3
+++ source/blender/include/BIF_interface_icons.h 30 Nov 2006 23:47:23 -0000
@@ -40,6 +40,13 @@
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
/*
@@ -54,5 +61,9 @@
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 */
Index: source/blender/include/BIF_resources.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/BIF_resources.h,v
retrieving revision 1.61
diff -u -r1.61 BIF_resources.h
--- source/blender/include/BIF_resources.h 20 Nov 2006 05:12:55 -0000 1.61
+++ source/blender/include/BIF_resources.h 30 Nov 2006 23:47:23 -0000
@@ -460,6 +460,7 @@
TH_CUSTOM,
TH_BUT_TEXTFIELD_HI,
+ TH_ICONFILE,
TH_THEMEUI,
// common colors among spaces
Index: source/blender/include/BIF_space.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/BIF_space.h,v
retrieving revision 1.40
diff -u -r1.40 BIF_space.h
--- source/blender/include/BIF_space.h 6 Nov 2006 01:08:22 -0000 1.40
+++ source/blender/include/BIF_space.h 30 Nov 2006 23:47:23 -0000
@@ -83,6 +83,7 @@
#define B_CHANGE_THEME 3306
#define B_THEME_COPY 3307
#define B_THEME_PASTE 3308
+#define B_UPDATE_THEME_ICONS 3309
#define B_RECALCLIGHT 3310
Index: source/blender/makesdna/DNA_userdef_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_userdef_types.h,v
retrieving revision 1.61
diff -u -r1.61 DNA_userdef_types.h
--- source/blender/makesdna/DNA_userdef_types.h 8 Nov 2006 12:46:41 -0000 1.61
+++ source/blender/makesdna/DNA_userdef_types.h 30 Nov 2006 23:47:23 -0000
@@ -61,7 +61,8 @@
char menu_text_hi[4];
char but_drawtype;
- char pad1[3];
+ char pad[3];
+ char iconfile[80]; // FILE_MAXFILE length
} ThemeUI;
Index: source/blender/src/interface_icons.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/interface_icons.c,v
retrieving revision 1.16
diff -u -r1.16 interface_icons.c
--- source/blender/src/interface_icons.c 20 Nov 2006 05:12:57 -0000 1.16
+++ source/blender/src/interface_icons.c 30 Nov 2006 23:47:26 -0000
@@ -45,6 +45,8 @@
#include "MEM_guardedalloc.h"
#include "BLI_arithb.h"
+#include "BLI_blenlib.h"
+#include "BLI_storage_types.h"
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
@@ -59,6 +61,7 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+#include "DNA_userdef_types.h"
#include "BKE_global.h"
#include "BKE_material.h"
@@ -111,6 +114,15 @@
unsigned int *rect;
} DrawInfo;
+
+/* ******************* STATIC LOCAL VARS ******************* */
+/* static here to cache results of icon directory scan, so it's not
+ * scanning the filesystem each time the menu is drawn */
+static struct ListBase iconfilelist = {0, 0};
+
+
+/* **************************************************** */
+
static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs)
{
Icon *new_icon = NULL;
@@ -513,9 +525,26 @@
static void init_internal_icons()
{
- ImBuf *bbuf= IMB_ibImageFromMemory((int *)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect);
+ bTheme *btheme= U.themes.first;
+ ImBuf *bbuf;
+ char iconfilestr[FILE_MAXDIR+FILE_MAXFILE];
+ char filenamestr[FILE_MAXFILE+16]; // 16 == strlen(".blender/icons/")+1
int x, y;
-
+
+ if ((btheme!=NULL) && (strlen(btheme->tui.iconfile) > 0)) {
+ sprintf(filenamestr, ".blender/icons/%s", btheme->tui.iconfile);
+
+ BLI_make_file_string("/", iconfilestr, BLI_gethome(), filenamestr);
+
+ if (BLI_exists(iconfilestr)) {
+ bbuf = IMB_loadiffname(iconfilestr, IB_rect);
+ } else {
+ bbuf = IMB_ibImageFromMemory((int *)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect);
+ }
+ } else {
+ bbuf = IMB_ibImageFromMemory((int *)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect);
+ }
+
prepare_internal_icons(bbuf);
for (y=0; y<ICON_GRID_ROWS; y++) {
@@ -540,9 +569,82 @@
}
+static void init_iconfile_list(struct ListBase *list)
+{
+ char icondirstr[FILE_MAXDIR];
+ IconFile *ifile;
+ struct direntry *dir;
+ int totfile, i, index=1;
+
+ list->first = list->last = NULL;
+
+ BLI_make_file_string("/", icondirstr, BLI_gethome(), "icons");
+
+ totfile = BLI_getdir(icondirstr, &dir);
+
+ for(i=0; i<totfile; i++) {
+ if( (dir[i].type & S_IFREG) ) {
+ char *filename = dir[i].relname;
+
+ if(BLI_testextensie(filename, ".png")) {
+ /* found a potential icon file, so make an entry for it in the cache list */
+ ifile = MEM_callocN(sizeof(IconFile), "IconFile");
+
+ BLI_strncpy(ifile->filename, filename, sizeof(ifile->filename));
+ ifile->index = index;
+
+ BLI_addtail(list, ifile);
+
+ index++;
+ }
+ }
+ }
+
+ /* free temporary direntry structure that's been created by BLI_getdir() */
+ i= totfile-1;
+
+ for(; i>=0; i--){
+ MEM_freeN(dir[i].relname);
+ if (dir[i].string) MEM_freeN(dir[i].string);
+ }
+ free(dir);
+ dir= 0;
+}
+
+static void free_iconfile_list(struct ListBase *list)
+{
+ IconFile *ifile;
+
+ for(ifile=list->first; ifile; ifile=ifile->next) {
+ BLI_freelinkN(list, ifile);
+ }
+}
+
+int BIF_iconfile_get_index(char *filename)
+{
+ IconFile *ifile;
+ ListBase *list=&(iconfilelist);
+
+ for(ifile=list->first; ifile; ifile=ifile->next) {
+ if ( BLI_streq(filename, ifile->filename)) {
+ return ifile->index;
+ }
+ }
+
+ return 0;
+}
+
+ListBase *BIF_iconfile_list(void)
+{
+ ListBase *list=&(iconfilelist);
+
+ return list;
+}
+
void BIF_icons_free()
{
+ free_iconfile_list(&iconfilelist);
BKE_icons_free();
}
@@ -625,7 +727,7 @@
void BIF_icons_init(int first_dyn_id)
{
-
+ init_iconfile_list(&iconfilelist);
BKE_icons_init(first_dyn_id);
init_internal_icons();
}
Index: source/blender/src/resources.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/resources.c,v
retrieving revision 1.61
diff -u -r1.61 resources.c
--- source/blender/src/resources.c 28 Oct 2006 13:21:02 -0000 1.61
+++ source/blender/src/resources.c 30 Nov 2006 23:47:27 -0000
@@ -133,7 +133,10 @@
case TH_BUT_DRAWTYPE:
cp= &btheme->tui.but_drawtype; break;
-
+
+ case TH_ICONFILE:
+ cp= btheme->tui.iconfile; break;
+
case TH_REDALERT:
cp= alert; break;
case TH_CUSTOM:
@@ -360,6 +363,8 @@
SETCOL(btheme->tui.menu_text_hi, 255, 255, 255, 255);
btheme->tui.but_drawtype= TH_SHADED;
+ BLI_strncpy(btheme->tui.iconfile, "", sizeof(btheme->tui.iconfile));
+
/* space view3d */
SETCOL(btheme->tv3d.back, 115, 115, 115, 255);
SETCOL(btheme->tv3d.text, 0, 0, 0, 255);
@@ -547,6 +552,8 @@
str += sprintf(str, "Menu Text Highlight %%x%d|", TH_MENU_TEXT_HI);
str += sprintf(str, "%%l|");
str += sprintf(str, "Drawtype %%x%d|", TH_BUT_DRAWTYPE);
+ str += sprintf(str, "%%l|");
+ str += sprintf(str, "Icon File %%x%d|", TH_ICONFILE);
}
else {
// first defaults for each space
Index: source/blender/src/space.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/space.c,v
retrieving revision 1.412
diff -u -r1.412 space.c
--- source/blender/src/space.c 30 Nov 2006 05:29:05 -0000 1.412
+++ source/blender/src/space.c 30 Nov 2006 23:47:31 -0000
@@ -112,6 +112,7 @@
#include "BIF_gl.h"
#include "BIF_imasel.h"
#include "BIF_interface.h"
+#include "BIF_interface_icons.h"
#include "BIF_meshtools.h"
#include "BIF_mywindow.h"
#include "BIF_oops.h"
@@ -2576,6 +2577,42 @@
}
#endif
+
+static char *iconfile_menu(void)
+{
+ static char string[512];
+ char *str = string;
+ IconFile *ifile;
+ ListBase *iconfilelist = BIF_iconfile_list();
+
+ str += sprintf(str, "Built-in %%x0|%%l|");
+
+ for(ifile=iconfilelist->first; ifile; ifile=ifile->next) {
+ str += sprintf(str, "%s %%x%d|", ifile->filename, ifile->index);
+ }
+
+ return string;
+}
+
+static void set_userdef_iconfile_cb(void *menuindex, void *unused2)
+{
+ bTheme *btheme= U.themes.first;
+ IconFile *ifile;
+ ListBase *iconfilelist = BIF_iconfile_list();
+ int index = *((int *)menuindex);
+
+ if (index==0) {
+ BLI_strncpy(btheme->tui.iconfile, "", sizeof(btheme->tui.iconfile));
+ return;
+ }
+
+ for(ifile=iconfilelist->first; ifile; ifile=ifile->next) {
+ if (index == ifile->index) {
+ BLI_strncpy(btheme->tui.iconfile, ifile->filename, sizeof(btheme->tui.iconfile));
+ }
+ }
+}
+
/* needed for event; choose new 'curmain' resets it... */
static short th_curcol= TH_BACK;
static char *th_curcol_ptr= NULL;
@@ -2588,6 +2625,8 @@
static short cur=1, curmain=2;
short a, tot=0, isbuiltin= 0;
char string[21*32], *strp, *col;
+ /* for choosing an icon image based on index in the cached list */
+ static int iconfileindex=0;
y3= y2+23; /* exception! */
@@ -2618,7 +2657,8 @@
strcat(string, bt->name);
if(btheme->next) strcat(string, " |");
}
- uiDefButS(block, MENU, B_UPDATE_THEME, string, 45,y3,200,20, &cur, 0, 0, 0, 0, "Current theme");
+ uiDefButS(block, MENU, B_UPDATE_THEME_ICONS, string, 45,y3,200,20, &cur, 0, 0, 0, 0, "Current theme");
+
/* add / delete / name */
@@ -2677,11 +2717,22 @@
}
else if(th_curcol==TH_BUT_DRAWTYPE) {
uiBlockBeginAlign(block);
- uiDefButC(block, ROW, B_UPDATE_THEME, "Minimal", 465,y3,100,20, col, 2.0, (float) TH_MINIMAL, 0, 0, "");
- uiDefButC(block, ROW, B_UPDATE_THEME, "Shaded", 565,y3,100,20, col, 2.0, (float) TH_SHADED, 0, 0, "");
- uiDefButC(block, ROW, B_UPDATE_THEME, "Rounded", 465,y2,100,20, col, 2.0, (float) TH_ROUNDED, 0, 0, "");
- uiDefButC(block, ROW, B_UPDATE_THEME, "OldSkool", 565,y2,100,20, col, 2.0, (float) TH_OLDSKOOL, 0, 0, "");
- uiBlockEndAlign(block);
+ uiDefButC(block, ROW, B_UPDATE_THEME, "Shaded", 465,y2,80,20, col, 2.0, (float) TH_SHADED, 0, 0, "");
+ uiDefButC(block, ROW, B_UPDATE_THEME, "Rounded", 545,y2,80,20, col, 2.0, (float) TH_ROUNDED, 0, 0, "");
+ uiDefButC(block, ROW, B_UPDATE_THEME, "Minimal", 625,y2,80,20, col, 2.0, (float) TH_MINIMAL, 0, 0, "");
+ uiDefButC(block, ROW, B_UPDATE_THEME, "OldSkool", 705,y2,80,20, col, 2.0, (float) TH_OLDSKOOL, 0, 0, "");
+ uiBlockEndAlign(block);
+ }
+ else if(th_curcol==TH_ICONFILE) {
+ uiBut *but;
+
+ /* set the icon file menu to the correct icon file index for what's stored in the theme values */
+ iconfileindex= BIF_iconfile_get_index(btheme->tui.iconfile);
+
+ but = uiDefButI(block, MENU, B_UPDATE_THEME_ICONS, iconfile_menu(),
+ 465,y2,200,20, &iconfileindex, 0, 0, 0, 0, "The icon PNG file to use");
+ uiButSetFunc(but, set_userdef_iconfile_cb, &iconfileindex, NULL);
+
}
else {
uiBlockBeginAlign(block);
@@ -3533,6 +3584,11 @@
}
}
else if(val==B_UPDATE_THEME) {
+ allqueue(REDRAWALL, 0);
+ }
+ else if(val==B_UPDATE_THEME_ICONS) {
+ BIF_icons_free();
+ BIF_icons_init(BIFICONID_LAST+1);
allqueue(REDRAWALL, 0);
}
else if(val==B_CHANGE_THEME) {
Index: source/blender/src/usiblender.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/usiblender.c,v
retrieving revision 1.131
diff -u -r1.131 usiblender.c
--- source/blender/src/usiblender.c 8 Nov 2006 12:46:41 -0000 1.131
+++ source/blender/src/usiblender.c 30 Nov 2006 23:47:32 -0000
@@ -318,6 +318,9 @@
SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
SETCOL(btheme->tseq.meta, 109, 145, 131, 255);
}
+ if(!(btheme->tui.iconfile)) {
+ BLI_strncpy(btheme->tui.iconfile, "", sizeof(btheme->tui.iconfile));
+ }
}
/* set defaults for 3D View rotating axis indicator */
@@ -802,8 +805,6 @@
BMF_GetFont(BMF_kHelvetica12),
BMF_GetFont(BMF_kHelvetica10),
BMF_GetFont(BMF_kHelveticaBold8));
-
- BIF_resources_init();
glClearColor(.7f, .7f, .6f, 0.0);
@@ -836,11 +837,12 @@
BIF_preview_init_dbase();
BIF_read_homefile();
+
+ BIF_resources_init(); /* after homefile, to dynamically load an icon file based on theme settings */
init_gl_stuff(); /* drawview.c, after homefile */
readBlog();
strcpy(G.lib, G.sce);
-
}
/***/

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4a/fd/f0d768e0aefc37971757d94731fb

Event Timeline