4 new function, boundbox, width, height and rotation.
[blender-staging.git] / source / blender / editors / space_info / space_info.c
index 7ef08495ae1341f71f9df8fd411ea3033316fbdc..f1968114b1448f4fece1ac005982bb6f3aec6606 100644 (file)
 #include "BLI_arithb.h"
 #include "BLI_rand.h"
 
+#include "BKE_context.h"
 #include "BKE_colortools.h"
-#include "BKE_global.h"
 #include "BKE_screen.h"
 
 #include "ED_space_api.h"
 #include "ED_screen.h"
 
 #include "BIF_gl.h"
+#include "BLF_api.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -62,7 +63,7 @@
 
 /* ******************** default callbacks for info space ***************** */
 
-static SpaceLink *info_new(void)
+static SpaceLink *info_new(const bContext *C)
 {
        ARegion *ar;
        SpaceInfo *sinfo;
@@ -129,10 +130,11 @@ static void info_main_area_init(wmWindowManager *wm, ARegion *ar)
 static void info_main_area_draw(const bContext *C, ARegion *ar)
 {
        /* draw entirely, view changes should be handled here */
-       // SpaceInfo *sinfo= C->area->spacedata.first;
+       // SpaceInfo *sinfo= (SpaceInfo*)CTX_wm_space_data(C);
        View2D *v2d= &ar->v2d;
        float col[3];
-       
+       float width, height;
+
        /* clear and setup matrix */
        UI_GetThemeColor3fv(TH_BACK, col);
        glClearColor(col[0], col[1], col[2], 0.0);
@@ -141,8 +143,38 @@ static void info_main_area_draw(const bContext *C, ARegion *ar)
        UI_view2d_view_ortho(C, v2d);
                
        /* data... */
-       
-       
+       // XXX 2.50 Testing new font library - Diego
+       glColor3f(1.0, 0.0, 0.0);
+       BLF_aspect(1.0);
+
+       BLF_size(14, 96);
+       BLF_position(5.0, 5.0, 0.0);
+
+       width= BLF_width("Hello Blender, size 14, dpi 96");
+       height= BLF_height("Hello Blender, size 14, dpi 96");
+
+       glRectf(7.0, 20.0, 7.0+width, 20.0+height);
+       glRectf(5.0+width+10.0, 3.0, 5.0+width+10.0+width, 3.0+height);
+       BLF_draw("Hello Blender, size 14, dpi 96");
+
+       glColor3f(0.0, 0.0, 1.0);
+       BLF_size(11, 96);
+       BLF_position(200.0, 50.0, 0.0);
+       BLF_rotation(45.0f);
+       BLF_draw("Another Hello Blender, size 11 and dpi 96!!");
+
+       glColor3f(0.8, 0.0, 0.7);
+       BLF_size(12, 72);
+       BLF_position(200.0, 100.0, 0.0);
+       BLF_rotation(180.0f);
+       BLF_draw("Hello World, size 12, dpi 72");
+       
+       glColor3f(0.8, 0.7, 0.5);
+       BLF_size(12, 96);
+       BLF_position(5.0, 200.0, 0.0);
+       BLF_rotation(0.0f);
+       BLF_draw("And this make a new glyph cache!!");
+
        /* reset view matrix */
        UI_view2d_view_restore(C);
        
@@ -192,6 +224,22 @@ static void info_main_area_listener(ARegion *ar, wmNotifier *wmn)
        /* context changes */
 }
 
+static void info_header_listener(ARegion *ar, wmNotifier *wmn)
+{
+       /* context changes */
+       switch(wmn->category) {
+               case NC_SCREEN:
+                       if(wmn->data==ND_SCREENCAST)
+                               ED_region_tag_redraw(ar);
+                       break;
+               case NC_SCENE:
+                       if(wmn->data==ND_RENDER_RESULT)
+                               ED_region_tag_redraw(ar);
+                       break;
+       }
+       
+}
+
 /* only called once, from space/spacetypes.c */
 void ED_spacetype_info(void)
 {
@@ -222,7 +270,7 @@ void ED_spacetype_info(void)
        art->regionid = RGN_TYPE_HEADER;
        art->minsizey= HEADERY;
        art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
-       
+       art->listener= info_header_listener;
        art->init= info_header_area_init;
        art->draw= info_header_area_draw;