Revision: 15148
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15148
Author:   quorn
Date:     2008-06-06 13:32:45 +0200 (Fri, 06 Jun 2008)

Log Message:
-----------
Added file info to header. Also reopen was marking text dirty (different from 
disk) which it isn't.

Modified Paths:
--------------
    branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c
    branches/soc-2008-quorn/source/blender/src/header_text.c

Modified: branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c
===================================================================
--- branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c     
2008-06-06 11:00:32 UTC (rev 15147)
+++ branches/soc-2008-quorn/source/blender/blenkernel/intern/text.c     
2008-06-06 11:32:45 UTC (rev 15148)
@@ -243,7 +243,7 @@
        text->undo_len= TXT_INIT_UNDO;
        text->undo_buf= MEM_mallocN(text->undo_len, "undo buf");
        
-       text->flags= TXT_ISDIRTY | TXT_ISTMP; 
+       text->flags= TXT_ISTMP; 
        
        fseek(fp, 0L, SEEK_END);
        len= ftell(fp);

Modified: branches/soc-2008-quorn/source/blender/src/header_text.c
===================================================================
--- branches/soc-2008-quorn/source/blender/src/header_text.c    2008-06-06 
11:00:32 UTC (rev 15147)
+++ branches/soc-2008-quorn/source/blender/src/header_text.c    2008-06-06 
11:32:45 UTC (rev 15148)
@@ -52,6 +52,7 @@
 #include "DNA_constraint_types.h"
 #include "DNA_action_types.h"
 
+#include "BIF_gl.h" /* for glRasterPos2i */
 #include "BIF_drawtext.h"
 #include "BIF_interface.h"
 #include "BIF_resources.h"
@@ -715,13 +716,15 @@
 }
 
 /* header */
+#define PATH_MAX       260
 void text_buttons(void)
 {
        uiBlock *block;
        SpaceText *st= curarea->spacedata.first;
        Text *text;
        short xco, xmax;
-       char naam[256];
+       char naam[256], fname[PATH_MAX], headtxt[PATH_MAX+17];
+       int len;
        
        if (st==NULL || st->spacetype != SPACE_TEXT) return;
        
@@ -804,9 +807,30 @@
        uiDefButI(block, MENU, B_TEXTFONT, "Screen 12 %x0|Screen 15%x1", 
xco,0,100,YIC, &st->font_id, 0, 0, 0, 0, "Displays available fonts");
        xco+=110;
        
-       uiDefButI(block, NUM, B_TAB_NUMBERS, "Tab:",            xco, 0, XIC+50, 
YIC, &st->tabnumber, 2, 8, 0, 0, "Set spacing of Tab");
+       uiDefButI(block, NUM, B_TAB_NUMBERS, "Tab:", xco, 0, XIC+50, YIC, 
&st->tabnumber, 2, 8, 0, 0, "Set spacing of Tab");
        xco+= XIC+50;
-       
+
+       /* File info */
+       if (text) {
+               if (text->name) {
+                       len = strlen(text->name);
+                       if (len > PATH_MAX-1)
+                               len = PATH_MAX-1;
+                       strncpy(fname, text->name, len);
+                       fname[len]='\0';
+               } else {
+                       strcpy(fname, "Internal");
+               }
+               BIF_ThemeColor(TH_MENU_TEXT);
+               if (text->flags & TXT_ISDIRTY)
+                       sprintf(headtxt, "File: *%s (unsaved)", fname);
+               else
+                       sprintf(headtxt, "File: %s", fname);
+               glRasterPos2i(xco+=XIC, 5);
+               BMF_DrawString(G.font, headtxt);
+               xco += BMF_GetStringWidth(G.font, headtxt);
+       }
+
        /* always as last  */
        curarea->headbutlen= xco+2*XIC;
 


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to