forked from bartvdbraak/blender
2.5 filebrowser
- drawing code cleanup - use of BLF_font in own string drawing, needs to be aligned with uiStyles still. - thumbnail scaling now done on graphics card via new glaDrawPixelsTexScaled (slightly modified glaDrawPixelsTex)
This commit is contained in:
parent
03b6b14df4
commit
ba6bec56f9
@ -44,7 +44,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\..\lib\windows\QTDevWin\CIncludes;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\build\msvc_9\intern\bsp\include;..\..\..\..\build\msvc_9\intern\ghost\include;..\..\..\..\build\msvc_9\intern\elbeem\include;..\..\..\..\build\msvc_9\intern\opennl\include;..\..\..\..\build\msvc_9\intern\bmfont\include;..\..\..\..\build\msvc_9\intern\blenkey\include;..\..\..\..\build\msvc_9\intern\decimation\include;..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\source\blender;..\..\..\source\blender\img;..\..\..\source\blender\verify;..\..\..\source\blender\ftfont;..\..\..\source\blender\misc;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\editors\include;..\..\..\source\blender\renderui;..\..\..\source\blender\blenloader;..\..\..\source\blender\quicktime;..\..\..\source\blender\blenkernel;..\..\..\source\blender\blenfont;..\..\..\source\blender\makesdna;..\..\..\source\blender\makesrna;..\..\..\source\blender\nodes;..\..\..\source\blender\windowmanager;..\..\..\source\blender\blenpluginapi;..\..\..\source\blender\renderconverter;..\..\..\source\blender\readstreamglue;..\..\..\source\blender\render\extern\include;..\..\..\source\blender\radiosity\extern\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\network;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\..\build\msvc_9\extern\verse\include;..\..\..\..\lib\windows\pthreads\include;..\..\..\..\lib\windows\ffmpeg\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\blender\gpu"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;_CONSOLE;GAMEBLENDER=1;WITH_QUICKTIME;INTERNATIONAL;WITH_OPENEXR;WITH_DDS;WITH_BULLET=1;WITH_FFMPEG"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;_CONSOLE;GAMEBLENDER=1;WITH_QUICKTIME;INTERNATIONAL;WITH_FREETYPE2;WITH_INTERNATIONAL;WITH_OPENEXR;WITH_DDS;WITH_BULLET=1;WITH_FFMPEG"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
@ -119,7 +119,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\..\lib\windows\QTDevWin\CIncludes;..\..\..\..\lib\windows\sdl\include;..\..\..\..\lib\windows\python\include\python2.5;..\..\..\..\build\msvc_9\intern\bsp\include;..\..\..\..\build\msvc_9\intern\ghost\include;..\..\..\..\build\msvc_9\intern\elbeem\include;..\..\..\..\build\msvc_9\intern\opennl\include;..\..\..\..\build\msvc_9\intern\bmfont\include;..\..\..\..\build\msvc_9\intern\blenkey\include;..\..\..\..\build\msvc_9\intern\decimation\include;..\..\..\..\build\msvc_9\intern\memutil\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\..\build\msvc_9\intern\soundsystem\include;..\..\..\source\blender;..\..\..\source\blender\img;..\..\..\source\blender\verify;..\..\..\source\blender\ftfont;..\..\..\source\blender\misc;..\..\..\source\blender\imbuf;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\editors\include;..\..\..\source\blender\renderui;..\..\..\source\blender\blenloader;..\..\..\source\blender\quicktime;..\..\..\source\blender\blenkernel;..\..\..\source\blender\blenfont;..\..\..\source\blender\makesdna;..\..\..\source\blender\makesrna;..\..\..\source\blender\nodes;..\..\..\source\blender\windowmanager;..\..\..\source\blender\blenpluginapi;..\..\..\source\blender\renderconverter;..\..\..\source\blender\readstreamglue;..\..\..\source\blender\render\extern\include;..\..\..\source\blender\radiosity\extern\include;..\..\..\source\kernel\gen_system;..\..\..\source\gameengine\network;..\..\..\source\gameengine\soundsystem\snd_openal;..\..\..\..\build\msvc_9\extern\verse\include;..\..\..\..\lib\windows\pthreads\include;..\..\..\..\lib\windows\ffmpeg\include;..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\source\blender\gpu"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;_CONSOLE;GAMEBLENDER;WITH_QUICKTIME;INTERNATIONAL;WITH_OPENEXR;WITH_DDS;WITH_BULLET = 1;WITH_FFMPEG"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;_CONSOLE;GAMEBLENDER;WITH_QUICKTIME;INTERNATIONAL;WITH_BF_INTERNATIONAL;WITH_FREETYPE2;WITH_OPENEXR;WITH_DDS;WITH_BULLET = 1;WITH_FFMPEG"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
DefaultCharIsUnsigned="true"
|
||||
|
@ -137,6 +137,8 @@ void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w,
|
||||
|
||||
void glaDrawPixelsTex (float x, float y, int img_w, int img_h, int format, void *rect);
|
||||
|
||||
void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, void *rect, float scaleX, float scaleY);
|
||||
|
||||
/* 2D Drawing Assistance */
|
||||
|
||||
/** Define a 2D area (viewport, scissor, matrices) for OpenGL rendering.
|
||||
|
@ -62,6 +62,19 @@ typedef struct FileSelectParams {
|
||||
#define FILE_LAYOUT_HOR 1
|
||||
#define FILE_LAYOUT_VER 2
|
||||
|
||||
#define MAX_FILE_COLUMN 8
|
||||
|
||||
typedef enum FileListColumns {
|
||||
COLUMN_NAME = 0,
|
||||
COLUMN_DATE,
|
||||
COLUMN_TIME,
|
||||
COLUMN_SIZE,
|
||||
COLUMN_MODE1,
|
||||
COLUMN_MODE2,
|
||||
COLUMN_MODE3,
|
||||
COLUMN_OWNER
|
||||
} FileListColumns;
|
||||
|
||||
typedef struct FileLayout
|
||||
{
|
||||
/* view settings - XXX - move into own struct */
|
||||
@ -78,7 +91,7 @@ typedef struct FileLayout
|
||||
short width;
|
||||
short height;
|
||||
short flag;
|
||||
|
||||
float column_widths[MAX_FILE_COLUMN];
|
||||
} FileLayout;
|
||||
|
||||
FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile);
|
||||
|
@ -419,7 +419,7 @@ static int get_cached_work_texture(int *w_r, int *h_r)
|
||||
return texid;
|
||||
}
|
||||
|
||||
void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *rect)
|
||||
void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, void *rect, float scaleX, float scaleY)
|
||||
{
|
||||
unsigned char *uc_rect= (unsigned char*) rect;
|
||||
float *f_rect= (float *)rect;
|
||||
@ -460,13 +460,13 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *
|
||||
glVertex2f(rast_x, rast_y);
|
||||
|
||||
glTexCoord2f((float) (subpart_w-1)/tex_w, 0);
|
||||
glVertex2f(rast_x+subpart_w*xzoom, rast_y);
|
||||
glVertex2f(rast_x+subpart_w*xzoom*scaleX, rast_y);
|
||||
|
||||
glTexCoord2f((float) (subpart_w-1)/tex_w, (float) (subpart_h-1)/tex_h);
|
||||
glVertex2f(rast_x+subpart_w*xzoom, rast_y+subpart_h*yzoom);
|
||||
glVertex2f(rast_x+subpart_w*xzoom*scaleX, rast_y+subpart_h*yzoom*scaleY);
|
||||
|
||||
glTexCoord2f(0, (float) (subpart_h-1)/tex_h);
|
||||
glVertex2f(rast_x, rast_y+subpart_h*yzoom);
|
||||
glVertex2f(rast_x, rast_y+subpart_h*yzoom*scaleY);
|
||||
glEnd();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
@ -477,6 +477,11 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
}
|
||||
|
||||
void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *rect)
|
||||
{
|
||||
glaDrawPixelsTexScaled(x, y, img_w, img_h, format, rect, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf)
|
||||
{
|
||||
float *rf;
|
||||
|
@ -44,12 +44,16 @@
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "BLF_Api.h"
|
||||
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
#include "ED_datafiles.h"
|
||||
|
||||
#include "IMB_imbuf_types.h"
|
||||
#include "IMB_imbuf.h"
|
||||
|
||||
@ -88,8 +92,6 @@ enum {
|
||||
B_FS_PARENT,
|
||||
} eFile_ButEvents;
|
||||
|
||||
/* XXX very bad, need to check font code */
|
||||
static int gFontsize=12;
|
||||
|
||||
static void do_file_buttons(bContext *C, void *arg, int event)
|
||||
{
|
||||
@ -152,19 +154,6 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
|
||||
uiDefBut(block, BUT, B_FS_CANCEL, "Cancel", xmax-loadbutton, filebuty1, loadbutton, 21, params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* menu[0] = NULL happens when no .Bfs is there, and first time browse
|
||||
disallow external directory browsing for databrowse */
|
||||
|
||||
if(menu[0] && (params->type != FILE_MAIN)) {
|
||||
uiDefButS(block, MENU, 0 /* B_FS_DIR_MENU */, menu, xmin, filebuty2, fsmenubut_width, 21, ¶ms->menu, 0, 0, 0, 0, "");
|
||||
uiDefBut(block, BUT, 0 /* B_FS_BOOKMARK */, "B", xmin, filebuty1, bookmarkbut_width, 21, 0, 0, 0, 0, 0, "Bookmark current directory");
|
||||
}
|
||||
|
||||
MEM_freeN(menu);
|
||||
#endif
|
||||
|
||||
|
||||
uiEndBlock(C, block);
|
||||
uiDrawBlock(C, block);
|
||||
}
|
||||
@ -180,8 +169,6 @@ static void draw_tile(short sx, short sy, short width, short height, int colorid
|
||||
|
||||
UI_ThemeColorShade(colorid, shade);
|
||||
uiSetRoundBox(15);
|
||||
// glRecti(sx, sy - height, sx + width, sy);
|
||||
|
||||
uiRoundBox(sx, sy - height, sx + width, sy, 6);
|
||||
}
|
||||
|
||||
@ -195,14 +182,14 @@ static float shorten_string(char* string, float w, int flag)
|
||||
float sw = 0;
|
||||
float pad = 0;
|
||||
|
||||
sw = UI_GetStringWidth(string);
|
||||
sw = file_string_width(string);
|
||||
if (flag == FILE_SHORTEN_FRONT) {
|
||||
char *s = string;
|
||||
BLI_strncpy(temp, "...", 4);
|
||||
pad = UI_GetStringWidth(temp);
|
||||
pad = file_string_width(temp);
|
||||
while (s && (sw+pad>w)) {
|
||||
s++;
|
||||
sw = UI_GetStringWidth(s);
|
||||
sw = file_string_width(s);
|
||||
shortened = 1;
|
||||
}
|
||||
if (shortened) {
|
||||
@ -216,7 +203,7 @@ static float shorten_string(char* string, float w, int flag)
|
||||
while (sw>w) {
|
||||
int slen = strlen(string);
|
||||
string[slen-1] = '\0';
|
||||
sw = UI_GetStringWidth(s);
|
||||
sw = file_string_width(s);
|
||||
shortened = 1;
|
||||
}
|
||||
if (shortened) {
|
||||
@ -267,7 +254,8 @@ static void file_draw_icon(short sx, short sy, int icon, short width, short heig
|
||||
UI_icon_draw_aspect_blended(x, y, icon, 1.f, blend);
|
||||
}
|
||||
|
||||
static void file_draw_string(short sx, short sy, const char* string, short width, short height, int flag)
|
||||
|
||||
static void file_draw_string(short sx, short sy, const char* string, float width, short height, int flag)
|
||||
{
|
||||
short soffs;
|
||||
char fname[FILE_MAXFILE];
|
||||
@ -281,12 +269,8 @@ static void file_draw_string(short sx, short sy, const char* string, short width
|
||||
x = (float)(sx);
|
||||
y = (float)(sy-height);
|
||||
|
||||
/* XXX TODO: handling of international fonts.
|
||||
TODO: proper support for utf8 in languages different from ja_JP abd zh_CH
|
||||
needs update of iconv in lib/windows to support getting the system language string
|
||||
*/
|
||||
UI_DrawString(x, y, fname);
|
||||
|
||||
BLF_position(x, y, 0);
|
||||
BLF_draw(fname);
|
||||
}
|
||||
|
||||
void file_calc_previews(const bContext *C, ARegion *ar)
|
||||
@ -329,7 +313,7 @@ void file_draw_previews(const bContext *C, ARegion *ar)
|
||||
ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
|
||||
sx += v2d->tot.xmin+2;
|
||||
sy = v2d->tot.ymax - sy;
|
||||
file = filelist_file(files, i);
|
||||
file = filelist_file(files, i);
|
||||
|
||||
if (file->flags & ACTIVE) {
|
||||
colorid = TH_HILITE;
|
||||
@ -351,29 +335,54 @@ void file_draw_previews(const bContext *C, ARegion *ar)
|
||||
}
|
||||
|
||||
if (imb) {
|
||||
float fx = ((float)layout->prv_w - (float)imb->x)/2.0f;
|
||||
float fy = ((float)layout->prv_h - (float)imb->y)/2.0f;
|
||||
float dx = (fx + 0.5f + sfile->layout->prv_border_x);
|
||||
float dy = (fy + 0.5f - sfile->layout->prv_border_y);
|
||||
short xco = (float)sx + dx;
|
||||
short yco = (float)sy - sfile->layout->prv_h + dy;
|
||||
|
||||
float fx, fy;
|
||||
float dx, dy;
|
||||
short xco, yco;
|
||||
float scaledx, scaledy;
|
||||
float scale;
|
||||
short ex, ey;
|
||||
|
||||
if ( (imb->x > layout->prv_w) || (imb->y > layout->prv_h) ) {
|
||||
if (imb->x > imb->y) {
|
||||
scaledx = (float)layout->prv_w;
|
||||
scaledy = ( (float)imb->y/(float)imb->x )*layout->prv_w;
|
||||
scale = scaledx/imb->x;
|
||||
}
|
||||
else {
|
||||
scaledy = (float)layout->prv_h;
|
||||
scaledx = ( (float)imb->x/(float)imb->y )*layout->prv_h;
|
||||
scale = scaledy/imb->y;
|
||||
}
|
||||
} else {
|
||||
scaledx = (float)imb->x;
|
||||
scaledy = (float)imb->y;
|
||||
scale = 1.0;
|
||||
}
|
||||
ex = (short)scaledx;
|
||||
ey = (short)scaledy;
|
||||
fx = ((float)layout->prv_w - (float)ex)/2.0f;
|
||||
fy = ((float)layout->prv_h - (float)ey)/2.0f;
|
||||
dx = (fx + 0.5f + sfile->layout->prv_border_x);
|
||||
dy = (fy + 0.5f - sfile->layout->prv_border_y);
|
||||
xco = (float)sx + dx;
|
||||
yco = (float)sy - sfile->layout->prv_h + dy;
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
/* shadow */
|
||||
if (!is_icon && (file->flags & IMAGEFILE))
|
||||
uiDrawBoxShadow(220, xco, yco, xco + imb->x, yco + imb->y);
|
||||
uiDrawBoxShadow(220, xco, yco, xco + ex, yco + ey);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
/* the image */
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
glaDrawPixelsTex(xco, yco, imb->x, imb->y, GL_UNSIGNED_BYTE, imb->rect);
|
||||
glaDrawPixelsTexScaled(xco, yco, imb->x, imb->y, GL_UNSIGNED_BYTE, imb->rect, scale, scale);
|
||||
|
||||
/* border */
|
||||
if (!is_icon && (file->flags & IMAGEFILE)) {
|
||||
glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
|
||||
fdrawbox(xco, yco, xco + imb->x, yco + imb->y);
|
||||
fdrawbox(xco, yco, xco + ex, yco + ey);
|
||||
}
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
@ -443,17 +452,14 @@ void file_draw_list(const bContext *C, ARegion *ar)
|
||||
if (offset<0) offset=0;
|
||||
|
||||
/* alternating flat shade background */
|
||||
for (i=0; (i <= layout->rows); ++i)
|
||||
for (i=0; (i <= layout->rows); i+=2)
|
||||
{
|
||||
sx = v2d->cur.xmin;
|
||||
sy = v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y;
|
||||
|
||||
if (i % 2) {
|
||||
UI_ThemeColor(TH_BACK);
|
||||
} else {
|
||||
UI_ThemeColorShade(TH_BACK, -7);
|
||||
}
|
||||
|
||||
UI_ThemeColorShade(TH_BACK, -7);
|
||||
glRectf(v2d->cur.xmin, sy, v2d->cur.xmax, sy+layout->tile_h+2*layout->tile_border_y);
|
||||
|
||||
}
|
||||
|
||||
/* vertical column dividers */
|
||||
@ -493,15 +499,14 @@ void file_draw_list(const bContext *C, ARegion *ar)
|
||||
|
||||
UI_ThemeColor4(TH_TEXT);
|
||||
|
||||
|
||||
sw = UI_GetStringWidth(file->relname);
|
||||
sw = file_string_width(file->relname);
|
||||
file_draw_string(spos, sy, file->relname, sw, layout->tile_h, FILE_SHORTEN_END);
|
||||
spos += filelist_column_len(sfile->files, COLUMN_NAME) + 10;
|
||||
spos += layout->column_widths[COLUMN_NAME] + 12;
|
||||
if (params->display == FILE_SHOWSHORT) {
|
||||
if (!(file->type & S_IFDIR)) {
|
||||
sw = UI_GetStringWidth(file->size);
|
||||
spos += filelist_column_len(sfile->files, COLUMN_SIZE) + 10 - sw;
|
||||
file_draw_string(spos, sy, file->size, sw, layout->tile_h, FILE_SHORTEN_END);
|
||||
sw = file_string_width(file->size);
|
||||
spos += layout->column_widths[COLUMN_SIZE] + 12 - sw;
|
||||
file_draw_string(spos, sy, file->size, sw+1, layout->tile_h, FILE_SHORTEN_END);
|
||||
}
|
||||
} else {
|
||||
#if 0 // XXX TODO: add this for non-windows systems
|
||||
@ -524,17 +529,17 @@ void file_draw_list(const bContext *C, ARegion *ar)
|
||||
#endif
|
||||
|
||||
|
||||
sw = UI_GetStringWidth(file->date);
|
||||
sw = file_string_width(file->date);
|
||||
file_draw_string(spos, sy, file->date, sw, layout->tile_h, FILE_SHORTEN_END);
|
||||
spos += filelist_column_len(sfile->files, COLUMN_DATE) + 10;
|
||||
spos += layout->column_widths[COLUMN_DATE] + 12;
|
||||
|
||||
sw = UI_GetStringWidth(file->time);
|
||||
sw = file_string_width(file->time);
|
||||
file_draw_string(spos, sy, file->time, sw, layout->tile_h, FILE_SHORTEN_END);
|
||||
spos += filelist_column_len(sfile->files, COLUMN_TIME) + 10;
|
||||
spos += layout->column_widths[COLUMN_TIME] + 12;
|
||||
|
||||
if (!(file->type & S_IFDIR)) {
|
||||
sw = UI_GetStringWidth(file->size);
|
||||
spos += filelist_column_len(sfile->files, COLUMN_SIZE) + 10 - sw;
|
||||
sw = file_string_width(file->size);
|
||||
spos += layout->column_widths[COLUMN_SIZE] + 12 - sw;
|
||||
file_draw_string(spos, sy, file->size, sw, layout->tile_h, FILE_SHORTEN_END);
|
||||
}
|
||||
}
|
||||
@ -546,10 +551,10 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate
|
||||
struct FSMenu* fsmenu = fsmenu_get();
|
||||
char bookmark[FILE_MAX];
|
||||
int nentries = fsmenu_get_nentries(fsmenu, category);
|
||||
int linestep = gFontsize*2.0f;
|
||||
|
||||
short sx, sy, xpos, ypos;
|
||||
int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*TILE_BORDER_X - ICON_DEFAULT_WIDTH - 4;
|
||||
int fontsize = gFontsize;
|
||||
int fontsize = file_font_pointsize();
|
||||
int cat_icon;
|
||||
int i;
|
||||
|
||||
@ -559,7 +564,7 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
file_draw_string(sx, sy, category_name, bmwidth, fontsize, FILE_SHORTEN_END);
|
||||
|
||||
sy -= linestep;
|
||||
sy -= fontsize*2.0f;
|
||||
|
||||
switch(category) {
|
||||
case FS_CATEGORY_SYSTEM:
|
||||
@ -579,17 +584,15 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate
|
||||
|
||||
sl = strlen(bookmark)-1;
|
||||
if (sl > 1) {
|
||||
while (bookmark[sl] == '\\' || bookmark[sl] == '/') {
|
||||
bookmark[sl] = '\0';
|
||||
sl--;
|
||||
}
|
||||
while (bookmark[sl] == '\\' || bookmark[sl] == '/') {
|
||||
bookmark[sl] = '\0';
|
||||
sl--;
|
||||
}
|
||||
}
|
||||
|
||||
if (fsmenu_is_selected(fsmenu, category, i) ) {
|
||||
UI_ThemeColor(TH_HILITE);
|
||||
//uiSetRoundBox(15);
|
||||
uiRoundBox(sx, sy - linestep, ar->v2d.cur.xmax - TILE_BORDER_X, sy, 4.0f);
|
||||
// glRectf(ar->v2d.cur.xmin, sy-linestep, ar->v2d.cur.xmax + 2*TILE_BORDER_X, sy);
|
||||
uiRoundBox(sx, sy - fontsize*2.0f, ar->v2d.cur.xmax - TILE_BORDER_X, sy, 4.0f);
|
||||
UI_ThemeColor(TH_TEXT);
|
||||
} else {
|
||||
UI_ThemeColor(TH_TEXT_HI);
|
||||
@ -601,7 +604,7 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate
|
||||
file_draw_icon(xpos, ypos, cat_icon, ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH);
|
||||
xpos += ICON_DEFAULT_WIDTH + 4;
|
||||
file_draw_string(xpos, ypos, bookmark, bmwidth, fontsize, FILE_SHORTEN_FRONT);
|
||||
sy -= linestep;
|
||||
sy -= fontsize*2.0;
|
||||
fsmenu_set_pos(fsmenu, category, i, xpos, ypos);
|
||||
}
|
||||
}
|
||||
@ -611,9 +614,9 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate
|
||||
|
||||
void file_draw_fsmenu(const bContext *C, ARegion *ar)
|
||||
{
|
||||
int linestep = gFontsize*2.0f;
|
||||
int linestep = file_font_pointsize()*2.0f;
|
||||
short sy= ar->v2d.cur.ymax-2*TILE_BORDER_Y;
|
||||
|
||||
|
||||
file_draw_fsmenu_category(C, ar, FS_CATEGORY_SYSTEM, "SYSTEM", &sy);
|
||||
sy -= linestep;
|
||||
file_draw_fsmenu_category(C, ar, FS_CATEGORY_BOOKMARKS, "BOOKMARKS", &sy);
|
||||
|
@ -154,19 +154,20 @@ void file_header_buttons(const bContext *C, ARegion *ar)
|
||||
xco+=XIC;
|
||||
}
|
||||
*/
|
||||
|
||||
uiDefIconButBitS(block, TOG, FILE_FILTER, B_FILTERIMASELDIR, ICON_FILTER,xco+=XIC,yco,XIC,YIC, ¶ms->flag, 0, 0, 0, 0, "Filter files");
|
||||
|
||||
uiDefIconButBitS(block, TOG, FILE_FILTER, B_FILTERIMASELDIR, ICON_FILTER,xco+=XIC,0,XIC,YIC, ¶ms->flag, 0, 0, 0, 0, "Filter files");
|
||||
if (params->flag & FILE_FILTER) {
|
||||
xco+=4;
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconButBitS(block, TOG, IMAGEFILE, B_FILTERIMASELDIR, ICON_FILE_IMAGE,xco+=XIC,0,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show images");
|
||||
uiDefIconButBitS(block, TOG, BLENDERFILE, B_FILTERIMASELDIR, ICON_FILE_BLEND,xco+=XIC,0,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show .blend files");
|
||||
uiDefIconButBitS(block, TOG, MOVIEFILE, B_FILTERIMASELDIR, ICON_FILE_MOVIE,xco+=XIC,0,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show movies");
|
||||
uiDefIconButBitS(block, TOG, PYSCRIPTFILE, B_FILTERIMASELDIR, ICON_FILE_SCRIPT,xco+=XIC,0,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show python scripts");
|
||||
uiDefIconButBitS(block, TOG, FTFONTFILE, B_FILTERIMASELDIR, ICON_FILE_FONT,xco+=XIC,0,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show fonts");
|
||||
uiDefIconButBitS(block, TOG, SOUNDFILE, B_FILTERIMASELDIR, ICON_FILE_SOUND,xco+=XIC,0,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show sound files");
|
||||
uiDefIconButBitS(block, TOG, TEXTFILE, B_FILTERIMASELDIR, ICON_FILE_BLANK,xco+=XIC,0,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show text files");
|
||||
uiDefIconButBitS(block, TOG, FOLDERFILE, B_FILTERIMASELDIR, ICON_FILE_FOLDER,xco+=XIC,0,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show folders");
|
||||
uiDefIconButBitS(block, TOG, IMAGEFILE, B_FILTERIMASELDIR, ICON_FILE_IMAGE,xco+=XIC,yco,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show images");
|
||||
uiDefIconButBitS(block, TOG, BLENDERFILE, B_FILTERIMASELDIR, ICON_FILE_BLEND,xco+=XIC,yco,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show .blend files");
|
||||
uiDefIconButBitS(block, TOG, MOVIEFILE, B_FILTERIMASELDIR, ICON_FILE_MOVIE,xco+=XIC,yco,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show movies");
|
||||
uiDefIconButBitS(block, TOG, PYSCRIPTFILE, B_FILTERIMASELDIR, ICON_FILE_SCRIPT,xco+=XIC,yco,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show python scripts");
|
||||
uiDefIconButBitS(block, TOG, FTFONTFILE, B_FILTERIMASELDIR, ICON_FILE_FONT,xco+=XIC,yco,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show fonts");
|
||||
uiDefIconButBitS(block, TOG, SOUNDFILE, B_FILTERIMASELDIR, ICON_FILE_SOUND,xco+=XIC,yco,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show sound files");
|
||||
uiDefIconButBitS(block, TOG, TEXTFILE, B_FILTERIMASELDIR, ICON_FILE_BLANK,xco+=XIC,yco,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show text files");
|
||||
uiDefIconButBitS(block, TOG, FOLDERFILE, B_FILTERIMASELDIR, ICON_FILE_FOLDER,xco+=XIC,yco,XIC,YIC, ¶ms->filter, 0, 0, 0, 0, "Show folders");
|
||||
uiBlockEndAlign(block);
|
||||
xco+=XIC;
|
||||
}
|
||||
|
@ -68,5 +68,9 @@ int file_cancel_exec(bContext *C, struct wmOperator *unused);
|
||||
int file_parent_exec(bContext *C, struct wmOperator *unused);
|
||||
int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my);
|
||||
|
||||
/* filesel.c */
|
||||
float file_string_width(const char* str);
|
||||
float file_font_pointsize();
|
||||
|
||||
#endif /* ED_FILE_INTERN_H */
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
||||
|
||||
/* ---------- FILE SELECTION ------------ */
|
||||
|
||||
static int find_file_mouse_hor(SpaceFile *sfile, struct ARegion* ar, short x, short y)
|
||||
static int find_file_mouse(SpaceFile *sfile, struct ARegion* ar, short x, short y)
|
||||
{
|
||||
float fx,fy;
|
||||
int active_file = -1;
|
||||
@ -77,7 +77,6 @@ static int find_file_mouse_hor(SpaceFile *sfile, struct ARegion* ar, short x, sh
|
||||
|
||||
active_file = ED_fileselect_layout_offset(sfile->layout, v2d->tot.xmin + fx, v2d->tot.ymax - fy);
|
||||
|
||||
printf("FINDFILE %d\n", active_file);
|
||||
if ( (active_file < 0) || (active_file >= numfiles) )
|
||||
{
|
||||
active_file = -1;
|
||||
@ -86,24 +85,6 @@ static int find_file_mouse_hor(SpaceFile *sfile, struct ARegion* ar, short x, sh
|
||||
}
|
||||
|
||||
|
||||
static int find_file_mouse_vert(SpaceFile *sfile, struct ARegion* ar, short x, short y)
|
||||
{
|
||||
float fx,fy;
|
||||
int active_file = -1;
|
||||
int numfiles = filelist_numfiles(sfile->files);
|
||||
View2D* v2d = &ar->v2d;
|
||||
|
||||
UI_view2d_region_to_view(v2d, x, y, &fx, &fy);
|
||||
|
||||
active_file = ED_fileselect_layout_offset(sfile->layout, v2d->tot.xmin + fx, v2d->tot.ymax - fy);
|
||||
|
||||
if ( (active_file < 0) || (active_file >= numfiles) )
|
||||
{
|
||||
active_file = -1;
|
||||
}
|
||||
return active_file;
|
||||
}
|
||||
|
||||
static void file_deselect_all(SpaceFile* sfile)
|
||||
{
|
||||
int numfiles = filelist_numfiles(sfile->files);
|
||||
@ -129,13 +110,8 @@ static void file_select(SpaceFile* sfile, ARegion* ar, const rcti* rect, short v
|
||||
int numfiles = filelist_numfiles(sfile->files);
|
||||
|
||||
params->selstate = NOTACTIVE;
|
||||
if ( (layout->flag == FILE_LAYOUT_HOR) ) {
|
||||
first_file = find_file_mouse_hor(sfile, ar, rect->xmin, rect->ymax);
|
||||
last_file = find_file_mouse_hor(sfile, ar, rect->xmax, rect->ymin);
|
||||
} else {
|
||||
first_file = find_file_mouse_vert(sfile, ar, rect->xmin, rect->ymax);
|
||||
last_file = find_file_mouse_vert(sfile, ar, rect->xmax, rect->ymin);
|
||||
}
|
||||
first_file = find_file_mouse(sfile, ar, rect->xmin, rect->ymax);
|
||||
last_file = find_file_mouse(sfile, ar, rect->xmax, rect->ymin);
|
||||
|
||||
/* select all valid files between first and last indicated */
|
||||
if ( (first_file >= 0) && (first_file < numfiles) && (last_file >= 0) && (last_file < numfiles) ) {
|
||||
@ -147,8 +123,6 @@ static void file_select(SpaceFile* sfile, ARegion* ar, const rcti* rect, short v
|
||||
file->flags &= ~ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Selecting %d %d\n", first_file, last_file);
|
||||
|
||||
/* make the last file active */
|
||||
if (last_file >= 0 && last_file < numfiles) {
|
||||
@ -318,30 +292,11 @@ void FILE_OT_select_all_toggle(wmOperatorType *ot)
|
||||
|
||||
/* ---------- BOOKMARKS ----------- */
|
||||
|
||||
#define MARK_HEIGHT 22
|
||||
|
||||
static void set_active_bookmark(FileSelectParams* params, struct ARegion* ar, short x, short y)
|
||||
{
|
||||
int nentries = fsmenu_get_nentries(fsmenu_get(), FS_CATEGORY_BOOKMARKS);
|
||||
float fx, fy;
|
||||
short posy;
|
||||
|
||||
UI_view2d_region_to_view(&ar->v2d, x, y, &fx, &fy);
|
||||
|
||||
posy = ar->v2d.cur.ymax - 2*TILE_BORDER_Y - fy;
|
||||
posy -= MARK_HEIGHT; /* header */
|
||||
|
||||
params->active_bookmark = ((float)posy / (MARK_HEIGHT));
|
||||
if (params->active_bookmark < 0 || params->active_bookmark > nentries) {
|
||||
params->active_bookmark = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int file_select_bookmark_category(SpaceFile* sfile, ARegion* ar, short x, short y, FSMenuCategory category)
|
||||
{
|
||||
struct FSMenu* fsmenu = fsmenu_get();
|
||||
int nentries = fsmenu_get_nentries(fsmenu, category);
|
||||
int linestep = MARK_HEIGHT;
|
||||
int linestep = file_font_pointsize()*2.0f;
|
||||
short xs, ys;
|
||||
int i;
|
||||
int selected = -1;
|
||||
@ -450,25 +405,20 @@ void FILE_OT_loadimages(wmOperatorType *ot)
|
||||
int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
|
||||
{
|
||||
FileSelectParams* params;
|
||||
FileLayout* layout;
|
||||
int numfiles, actfile;
|
||||
|
||||
if(sfile==NULL || sfile->files==NULL) return 0;
|
||||
|
||||
numfiles = filelist_numfiles(sfile->files);
|
||||
params = ED_fileselect_get_params(sfile);
|
||||
layout = ED_fileselect_get_layout(sfile, ar);
|
||||
|
||||
if ( (layout->flag == FILE_LAYOUT_HOR)) {
|
||||
actfile = find_file_mouse_hor(sfile, ar, mx , my);
|
||||
} else {
|
||||
actfile = find_file_mouse_vert(sfile, ar, mx, my);
|
||||
}
|
||||
actfile = find_file_mouse(sfile, ar, mx , my);
|
||||
|
||||
if (params && (actfile >= 0) && (actfile < numfiles) ) {
|
||||
params->active_file=actfile;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
params->active_file= -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,6 @@ typedef struct FileList
|
||||
short hide_dot;
|
||||
unsigned int filter;
|
||||
short changed;
|
||||
int columns[MAX_FILE_COLUMN];
|
||||
ListBase loadimages;
|
||||
ListBase threads;
|
||||
} FileList;
|
||||
@ -531,7 +530,7 @@ void filelist_loadimage(struct FileList* filelist, int index)
|
||||
dx = imgwidth - ex;
|
||||
dy = imgheight - ey;
|
||||
|
||||
IMB_scaleImBuf(imb, ex, ey);
|
||||
// IMB_scaleImBuf(imb, ex, ey);
|
||||
filelist->filelist[fidx].image = imb;
|
||||
} else {
|
||||
/* prevent loading image twice */
|
||||
@ -622,6 +621,7 @@ struct direntry * filelist_file(struct FileList* filelist, int index)
|
||||
return &filelist->filelist[fidx];
|
||||
}
|
||||
|
||||
|
||||
int filelist_find(struct FileList* filelist, char *file)
|
||||
{
|
||||
int index = -1;
|
||||
@ -658,15 +658,9 @@ void filelist_setfilter(struct FileList* filelist, unsigned int filter)
|
||||
filelist->filter = filter;
|
||||
}
|
||||
|
||||
int filelist_column_len(struct FileList* filelist, FileListColumns column)
|
||||
{
|
||||
return filelist->columns[column];
|
||||
}
|
||||
|
||||
void filelist_readdir(struct FileList* filelist)
|
||||
{
|
||||
char wdir[FILE_MAX];
|
||||
int i;
|
||||
|
||||
if (!filelist) return;
|
||||
filelist->fidx = 0;
|
||||
@ -685,34 +679,6 @@ void filelist_readdir(struct FileList* filelist)
|
||||
if (!filelist->threads.first) {
|
||||
BLI_init_threads(&filelist->threads, exec_loadimages, 2);
|
||||
}
|
||||
|
||||
for (i=0; i<MAX_FILE_COLUMN; ++i) {
|
||||
filelist->columns[i] = 0;
|
||||
}
|
||||
|
||||
for (i=0; (i < filelist->numfiles); ++i)
|
||||
{
|
||||
struct direntry* file = filelist_file(filelist, i);
|
||||
if (file) {
|
||||
int len;
|
||||
len = UI_GetStringWidth(file->relname);
|
||||
if (len > filelist->columns[COLUMN_NAME]) filelist->columns[COLUMN_NAME] = len;
|
||||
len = UI_GetStringWidth(file->date);
|
||||
if (len > filelist->columns[COLUMN_DATE]) filelist->columns[COLUMN_DATE] = len;
|
||||
len = UI_GetStringWidth(file->time);
|
||||
if (len > filelist->columns[COLUMN_TIME]) filelist->columns[COLUMN_TIME] = len;
|
||||
len = UI_GetStringWidth(file->size);
|
||||
if (len > filelist->columns[COLUMN_SIZE]) filelist->columns[COLUMN_SIZE] = len;
|
||||
len = UI_GetStringWidth(file->mode1);
|
||||
if (len > filelist->columns[COLUMN_MODE1]) filelist->columns[COLUMN_MODE1] = len;
|
||||
len = UI_GetStringWidth(file->mode2);
|
||||
if (len > filelist->columns[COLUMN_MODE2]) filelist->columns[COLUMN_MODE2] = len;
|
||||
len = UI_GetStringWidth(file->mode3);
|
||||
if (len > filelist->columns[COLUMN_MODE3]) filelist->columns[COLUMN_MODE3] = len;
|
||||
len = UI_GetStringWidth(file->owner);
|
||||
if (len > filelist->columns[COLUMN_OWNER]) filelist->columns[COLUMN_OWNER] = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int filelist_empty(struct FileList* filelist)
|
||||
|
@ -41,19 +41,7 @@ struct FileList;
|
||||
struct direntry;
|
||||
struct BlendHandle;
|
||||
struct Scene;
|
||||
|
||||
#define MAX_FILE_COLUMN 8
|
||||
|
||||
typedef enum FileListColumns {
|
||||
COLUMN_NAME = 0,
|
||||
COLUMN_DATE,
|
||||
COLUMN_TIME,
|
||||
COLUMN_SIZE,
|
||||
COLUMN_MODE1,
|
||||
COLUMN_MODE2,
|
||||
COLUMN_MODE3,
|
||||
COLUMN_OWNER
|
||||
} FileListColumns;
|
||||
struct rcti;
|
||||
|
||||
struct FileList * filelist_new();
|
||||
void filelist_init_icons();
|
||||
@ -78,7 +66,6 @@ struct ImBuf * filelist_getimage(struct FileList* filelist, int index);
|
||||
struct ImBuf * filelist_geticon(struct FileList* filelist, int index);
|
||||
short filelist_changed(struct FileList* filelist);
|
||||
void filelist_readdir(struct FileList* filelist);
|
||||
int filelist_column_len(struct FileList* filelist, FileListColumns column);
|
||||
|
||||
int filelist_empty(struct FileList* filelist);
|
||||
void filelist_parent(struct FileList* filelist);
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
@ -58,6 +59,8 @@
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_global.h"
|
||||
|
||||
#include "BLF_Api.h"
|
||||
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
@ -144,14 +147,13 @@ int ED_fileselect_layout_offset(FileLayout* layout, int x, int y)
|
||||
offsetx = (x)/(layout->tile_w + 2*layout->tile_border_x);
|
||||
offsety = (y)/(layout->tile_h + 2*layout->tile_border_y);
|
||||
|
||||
if (offsetx > layout->columns-1) offsetx = layout->columns-1 ;
|
||||
if (offsety > layout->rows-1) offsety = layout->rows-1 ;
|
||||
if (offsetx > layout->columns-1) offsetx = -1 ;
|
||||
if (offsety > layout->rows-1) offsety = -1 ;
|
||||
|
||||
if (layout->flag & FILE_LAYOUT_HOR)
|
||||
active_file = layout->rows*offsetx + offsety;
|
||||
else
|
||||
active_file = offsetx + layout->columns*offsety;
|
||||
printf("OFFSET %d %d %d %d %d\n", x,y, offsetx, offsety, active_file);
|
||||
return active_file;
|
||||
}
|
||||
|
||||
@ -166,6 +168,56 @@ void ED_fileselect_layout_tilepos(FileLayout* layout, int tile, short *x, short
|
||||
}
|
||||
}
|
||||
|
||||
float file_string_width(const char* str)
|
||||
{
|
||||
uiStyle *style= U.uistyles.first;
|
||||
uiStyleFontSet(&style->widget);
|
||||
return BLF_width(str);
|
||||
}
|
||||
|
||||
float file_font_pointsize()
|
||||
{
|
||||
float s;
|
||||
char tmp[2] = "X";
|
||||
uiStyle *style= U.uistyles.first;
|
||||
uiStyleFontSet(&style->widget);
|
||||
s = BLF_height(tmp);
|
||||
return style->widget.points;
|
||||
}
|
||||
|
||||
static void column_widths(struct FileList* files, struct FileLayout* layout)
|
||||
{
|
||||
int i;
|
||||
int numfiles = filelist_numfiles(files);
|
||||
|
||||
for (i=0; i<MAX_FILE_COLUMN; ++i) {
|
||||
layout->column_widths[i] = 0;
|
||||
}
|
||||
|
||||
for (i=0; (i < numfiles); ++i)
|
||||
{
|
||||
struct direntry* file = filelist_file(files, i);
|
||||
if (file) {
|
||||
int len;
|
||||
len = file_string_width(file->relname);
|
||||
if (len > layout->column_widths[COLUMN_NAME]) layout->column_widths[COLUMN_NAME] = len;
|
||||
len = file_string_width(file->date);
|
||||
if (len > layout->column_widths[COLUMN_DATE]) layout->column_widths[COLUMN_DATE] = len;
|
||||
len = file_string_width(file->time);
|
||||
if (len > layout->column_widths[COLUMN_TIME]) layout->column_widths[COLUMN_TIME] = len;
|
||||
len = file_string_width(file->size);
|
||||
if (len > layout->column_widths[COLUMN_SIZE]) layout->column_widths[COLUMN_SIZE] = len;
|
||||
len = file_string_width(file->mode1);
|
||||
if (len > layout->column_widths[COLUMN_MODE1]) layout->column_widths[COLUMN_MODE1] = len;
|
||||
len = file_string_width(file->mode2);
|
||||
if (len > layout->column_widths[COLUMN_MODE2]) layout->column_widths[COLUMN_MODE2] = len;
|
||||
len = file_string_width(file->mode3);
|
||||
if (len > layout->column_widths[COLUMN_MODE3]) layout->column_widths[COLUMN_MODE3] = len;
|
||||
len = file_string_width(file->owner);
|
||||
if (len > layout->column_widths[COLUMN_OWNER]) layout->column_widths[COLUMN_OWNER] = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
|
||||
{
|
||||
@ -173,11 +225,10 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
|
||||
View2D *v2d= &ar->v2d;
|
||||
int maxlen = 0;
|
||||
int numfiles = filelist_numfiles(sfile->files);
|
||||
|
||||
int textheight = file_font_pointsize();
|
||||
if (sfile->layout == 0) {
|
||||
sfile->layout = MEM_callocN(sizeof(struct FileLayout), "file_layout");
|
||||
}
|
||||
|
||||
if (params->display == FILE_IMGDISPLAY) {
|
||||
sfile->layout->prv_w = 96;
|
||||
sfile->layout->prv_h = 96;
|
||||
@ -186,7 +237,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
|
||||
sfile->layout->prv_border_x = 6;
|
||||
sfile->layout->prv_border_y = 6;
|
||||
sfile->layout->tile_w = sfile->layout->prv_w + 2*sfile->layout->prv_border_x;
|
||||
sfile->layout->tile_h = sfile->layout->prv_h + 2*sfile->layout->prv_border_y + 12; // XXX 12 = font h
|
||||
sfile->layout->tile_h = sfile->layout->prv_h + 2*sfile->layout->prv_border_y + textheight;
|
||||
sfile->layout->width= (v2d->cur.xmax - v2d->cur.xmin - 2*sfile->layout->tile_border_x);
|
||||
sfile->layout->columns= sfile->layout->width / (sfile->layout->tile_w + 2*sfile->layout->tile_border_x);
|
||||
if(sfile->layout->columns > 0)
|
||||
@ -204,23 +255,22 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
|
||||
sfile->layout->tile_border_y = 2;
|
||||
sfile->layout->prv_border_x = 0;
|
||||
sfile->layout->prv_border_y = 0;
|
||||
sfile->layout->tile_h = 12*3/2; // XXX 12 = font h
|
||||
sfile->layout->tile_h = textheight*3/2;
|
||||
sfile->layout->height= v2d->cur.ymax - v2d->cur.ymin;
|
||||
sfile->layout->rows = sfile->layout->height / (sfile->layout->tile_h + 2*sfile->layout->tile_border_y);;
|
||||
|
||||
column_widths(sfile->files, sfile->layout);
|
||||
|
||||
if (params->display == FILE_SHORTDISPLAY) {
|
||||
maxlen = filelist_column_len(sfile->files, COLUMN_NAME) +
|
||||
filelist_column_len(sfile->files, COLUMN_SIZE);
|
||||
maxlen = sfile->layout->column_widths[COLUMN_NAME] +
|
||||
sfile->layout->column_widths[COLUMN_SIZE];
|
||||
maxlen += 20+2*10; // for icon and space between columns
|
||||
} else {
|
||||
maxlen = filelist_column_len(sfile->files, COLUMN_NAME) +
|
||||
filelist_column_len(sfile->files, COLUMN_DATE) +
|
||||
filelist_column_len(sfile->files, COLUMN_TIME) +
|
||||
filelist_column_len(sfile->files, COLUMN_SIZE) /* +
|
||||
filelist_column_len(sfile->files, COLUMN_MODE1) +
|
||||
filelist_column_len(sfile->files, COLUMN_MODE2) +
|
||||
filelist_column_len(sfile->files, COLUMN_MODE3) +
|
||||
filelist_column_len(sfile->files, COLUMN_OWNER) */ ;
|
||||
maxlen = sfile->layout->column_widths[COLUMN_NAME] +
|
||||
sfile->layout->column_widths[COLUMN_DATE] +
|
||||
sfile->layout->column_widths[COLUMN_TIME] +
|
||||
sfile->layout->column_widths[COLUMN_SIZE];
|
||||
/* XXX add mode1, mode2, mode3, owner columns for non-windows platforms */
|
||||
maxlen += 20+4*10; // for icon and space between columns
|
||||
}
|
||||
sfile->layout->tile_w = maxlen + 40;
|
||||
|
Loading…
Reference in New Issue
Block a user