Revision: 18369
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18369
Author:   elubie
Date:     2009-01-06 17:47:01 +0100 (Tue, 06 Jan 2009)

Log Message:
-----------
2.5 filebrowser
- some more cleanup, use UI_text functions for text output rather than BMF_ 
directly
- removed some debug prints and some unused variables

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c
    branches/blender2.5/blender/source/blender/editors/space_file/file_header.c
    branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c

Modified: 
branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c   
2009-01-06 16:15:43 UTC (rev 18368)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c   
2009-01-06 16:47:01 UTC (rev 18369)
@@ -43,12 +43,11 @@
 #include "BKE_global.h"
 #include "BKE_utildefines.h"
 
-#include "BMF_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_fileselect.h"
 
@@ -148,7 +147,7 @@
        */
 
        /* space available for load/save buttons? */
-       slen = BMF_GetStringWidth(G.font, sfile->params->title);
+       slen = UI_GetStringWidth(G.font, sfile->params->title, 0);
        loadbutton= slen > 60 ? slen + 20 : MAX2(80, 
20+UI_GetStringWidth(G.font, params->title, 0));
        if(ar->v2d.mask.xmax-ar->v2d.mask.xmin > loadbutton+20) {
                /* XXX
@@ -194,7 +193,7 @@
 }
 
 
-static void draw_tile(SpaceFile *sfile, short sx, short sy, short width, short 
height, int colorid)
+static void draw_tile(short sx, short sy, short width, short height, int 
colorid)
 {
        /* TODO: BIF_ThemeColor seems to need this to show the color, not sure 
why? - elubie */
        glEnable(GL_BLEND);
@@ -275,7 +274,6 @@
        View2D *v2d= &ar->v2d;
        int width=0, height=0;
        int rows, columns;
-//     int linestep = U.fontsize*3/2;
 
        if (params->display) {
                sfile->prv_w = 96;
@@ -356,10 +354,10 @@
 
                if (params->active_file == i) {
                        colorid = TH_ACTIVE;
-                       draw_tile(sfile, sx, sy, sfile->tile_w, sfile->tile_h, 
colorid);
+                       draw_tile(sx, sy, sfile->tile_w, sfile->tile_h, 
colorid);
                } else if (file->flags & ACTIVE) {
                        colorid = TH_HILITE;
-                       draw_tile(sfile, sx, sy+sfile->tile_border_y, 
sfile->tile_w, sfile->tile_h-sfile->tile_border_y, colorid);
+                       draw_tile(sx, sy+sfile->tile_border_y, sfile->tile_w, 
sfile->tile_h-sfile->tile_border_y, colorid);
                } else {
                        /*
                        colorid = TH_PANEL;
@@ -507,14 +505,14 @@
 
                if (params->active_file == i) {
                        colorid = TH_ACTIVE;
-                       draw_tile(sfile, sx, sy, sfile->tile_w, sfile->tile_h, 
colorid);
+                       draw_tile(sx, sy, sfile->tile_w, sfile->tile_h, 
colorid);
                } else if (file->flags & ACTIVE) {
                        colorid = TH_HILITE;
-                       draw_tile(sfile, sx, sy, sfile->tile_w, sfile->tile_h, 
colorid);
+                       draw_tile(sx, sy, sfile->tile_w, sfile->tile_h, 
colorid);
                } else {
                        /*
                        colorid = TH_PANEL;
-                       draw_tile(simasel, sx, sy, sfile->tile_w, 
sfile->tile_h, colorid);
+                       draw_tile(sx, sy, sfile->tile_w, sfile->tile_h, 
colorid);
                        */
                }
                if (type == FILE_MAIN) {
@@ -597,4 +595,4 @@
                        sy -= linestep;
                }
        }
-}
\ No newline at end of file
+}

Modified: 
branches/blender2.5/blender/source/blender/editors/space_file/file_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_header.c 
2009-01-06 16:15:43 UTC (rev 18368)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_header.c 
2009-01-06 16:47:01 UTC (rev 18369)
@@ -53,11 +53,10 @@
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
 
-#include "BMF_Api.h"
-
 #include "UI_interface.h"
 #include "UI_resources.h"
 #include "UI_view2d.h"
+#include "UI_text.h"
 
 #include "file_intern.h"
 #include "filelist.h"
@@ -156,7 +155,7 @@
                xco+=XIC+10;
        } 
        xcotitle= xco;
-       xco+= BMF_GetStringWidth(G.font, params->title);
+       xco+= UI_GetStringWidth(G.font, params->title, 0);
 
        uiBlockSetEmboss(block, UI_EMBOSS);
 

Modified: 
branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c    
2009-01-06 16:15:43 UTC (rev 18368)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c    
2009-01-06 16:47:01 UTC (rev 18369)
@@ -65,7 +65,6 @@
 {
        float x,y;
        int active_file = -1;
-//     int stridex, stridey;
        struct direntry* file;
        int offsetx, offsety;
        int numfiles = filelist_numfiles(params->files);
@@ -77,17 +76,13 @@
        offsetx = (x - (v2d->cur.xmin+sfile->tile_border_x))/(sfile->tile_w + 
sfile->tile_border_x);
        offsety = (-y+sfile->tile_border_y)/(sfile->tile_h + 
sfile->tile_border_y);
        columns = (v2d->cur.xmax - v2d->cur.xmin) / (sfile->tile_w+ 
sfile->tile_border_x);
-
-       printf("tile (%d, %d, %d)\n", offsetx, offsety, columns);
        active_file = offsetx + columns*offsety;
 
        if (active_file >= 0 && active_file < numfiles )
        {
-               printf("active file: %d\n", active_file);
                params->active_file = active_file;
                if (params->selstate & ACTIVATE) {
                        file = filelist_file(params->files, 
params->active_file);
-                       printf("active file: %s\n", file->relname);
                        file->flags |= ACTIVE;
                }                       
        }
@@ -110,8 +105,6 @@
        offsety = (v2d->cur.ymax-y-sfile->tile_border_y)/(sfile->tile_h + 
sfile->tile_border_y);
        rows = (v2d->cur.ymax - v2d->cur.ymin - 2*sfile->tile_border_y) / 
(sfile->tile_h+sfile->tile_border_y);
        active_file = rows*offsetx + offsety;
-       printf("offsets (%d, %d)\n", offsetx, offsety);
-       printf("active_file (%d)\n", active_file);
        if ( (active_file >= 0) && (active_file < numfiles) )
        {
                params->active_file = active_file;
@@ -128,7 +121,6 @@
        int nentries = fsmenu_get_nentries();
        short posy = ar->v2d.mask.ymax - TILE_BORDER_Y - y;
        params->active_bookmark = ((float)posy / (U.fontsize*3.0f/2.0f));
-       printf("active bookmark: %d\n", params->active_bookmark);
        if (params->active_bookmark < 0 || params->active_bookmark > nentries) {
                params->active_bookmark = -1;
        }
@@ -193,10 +185,8 @@
 static void mouse_select_bookmark(SpaceFile* sfile, ARegion* ar, short *mval)
 {
        if(mval[0]>ar->v2d.mask.xmin && mval[0]<ar->v2d.mask.xmax
-       && mval[1]>ar->v2d.mask.ymin && mval[1]<ar->v2d.mask.ymax) {            
        
-               //int nentries = fsmenu_get_nentries();
+       && mval[1]>ar->v2d.mask.ymin && mval[1]<ar->v2d.mask.ymax) {
                char *selected;
-               printf("selecting...\n");
                set_active_bookmark(sfile, sfile->params, ar, mval[1]);
                selected= fsmenu_get_entry(sfile->params->active_bookmark);     
                
                /* which string */
@@ -214,7 +204,6 @@
 
 static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-//     ScrArea *sa= CTX_wm_area(C);
        ARegion *ar= CTX_wm_region(C);
        SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
        short mval[2];


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to