~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/src/header_info.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 * Functions to draw the "User Preferences" window header
5
5
 * and handle user events sent to it.
6
6
 * 
7
 
 * $Id: header_info.c,v 1.32 2004/04/20 22:00:32 ton Exp $
 
7
 * $Id: header_info.c,v 1.60 2005/05/23 18:20:20 lukep Exp $
8
8
 *
9
9
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
10
10
 *
43
43
#include <config.h>
44
44
#endif
45
45
 
46
 
#ifdef WIN32
47
 
#include "BLI_winstuff.h"
48
 
#endif
49
 
 
50
 
#include "BMF_Api.h"
51
 
#include "BIF_language.h"
52
 
#ifdef INTERNATIONAL
53
 
#include "FTF_Api.h"
54
 
#endif
55
 
 
56
46
#include "DNA_ID.h"
57
47
#include "DNA_image_types.h"
 
48
#include "DNA_lamp_types.h"
58
49
#include "DNA_object_types.h"
59
50
#include "DNA_packedFile_types.h"
60
51
#include "DNA_scene_types.h"
110
101
#include "BPY_extern.h"
111
102
#include "BPY_menus.h"
112
103
 
113
 
#include "render.h" // for R - should use BKE_bad_level_calls.h instead?
114
 
 
115
104
#include "blendef.h"
 
105
#include "interface.h"
116
106
#include "mydevice.h"
117
107
 
118
108
extern char versionstr[]; /* from blender.c */
201
191
        }
202
192
        else {
203
193
                if(videosc_dir[0]==0) strcpy(videosc_dir, G.sce);
204
 
                activate_fileselect(FILE_SPECIAL, "Save Videoscape", videosc_dir,
 
194
                activate_fileselect(FILE_SPECIAL, "Export Videoscape", videosc_dir,
205
195
                                                                                write_videoscape);
206
196
        }
207
197
}
214
204
        else {
215
205
                if(videosc_dir[0]==0) strcpy(videosc_dir, G.sce);
216
206
        
217
 
                activate_fileselect(FILE_SPECIAL, "Save VRML 1", videosc_dir, write_vrml);
 
207
                activate_fileselect(FILE_SPECIAL, "Export VRML 1.0", videosc_dir, write_vrml);
218
208
        }  
219
209
}
220
210
 
227
217
 
228
218
                if(videosc_dir[0]==0) strcpy(videosc_dir, G.sce);
229
219
 
230
 
                activate_fileselect(FILE_SPECIAL, "Save DXF", videosc_dir, write_dxf);  
 
220
                activate_fileselect(FILE_SPECIAL, "Export DXF", videosc_dir, write_dxf);        
231
221
        }
232
222
}
233
223
 
240
230
 
241
231
                if(videosc_dir[0]==0) strcpy(videosc_dir, G.sce);
242
232
 
243
 
                activate_fileselect(FILE_SPECIAL, "SAVE STL", videosc_dir, write_stl);
 
233
                activate_fileselect(FILE_SPECIAL, "Export STL", videosc_dir, write_stl);
244
234
        }
245
235
}
246
236
/* ------------ */
318
308
 
319
309
        scen->ed= 0;
320
310
        scen->radio= 0;
 
311
        scen->theDag= NULL;
 
312
        scen->dagisvalid= 0;
321
313
 
322
314
        obase= sce->base.first;
323
315
        base= scen->base.first;
380
372
        int nr;
381
373
 
382
374
        switch(event) {
383
 
 
384
375
        case B_INFOSCR:         /* menu select screen */
385
376
 
386
377
                if( G.curscreen->screennr== -2) {
429
420
                break;
430
421
        case B_INFOSCE:         /* menu select scene */
431
422
 
432
 
                if( G.obedit) {
433
 
                        error("Unable to perform function in EditMode");
434
 
                        return;
435
 
                }
436
423
                if( G.curscreen->scenenr== -2) {
437
424
                        if(curarea->winy <50) {
438
425
                                sa= closest_bigger_area();
532
519
        }
533
520
}
534
521
 
535
 
int write_runtime(char *str, char *exename)
 
522
static int write_runtime(char *str, char *exename)
536
523
{
537
524
        char *freestr= NULL;
538
525
        char *ext = 0;
586
573
/************************** MAIN MENU *****************************/
587
574
/************************** FILE *****************************/
588
575
 
589
 
void do_info_file_optionsmenu(void *arg, int event)
 
576
#if 0
 
577
static void do_info_file_optionsmenu(void *arg, int event)
590
578
{
591
579
        G.fileflags ^= (1 << event);
592
580
 
593
581
        // allqueue(REDRAWINFO, 0);
594
582
}
 
583
#endif
595
584
 
596
585
#if GAMEBLENDER == 1
 
586
 
 
587
#if 0
597
588
static uiBlock *info_file_optionsmenu(void *arg_unused)
598
589
{
599
590
        uiBlock *block;
670
661
}
671
662
#endif
672
663
 
 
664
#endif
 
665
 
673
666
static void do_info_file_importmenu(void *arg, int event)
674
667
{
675
 
        extern int BPY_menu_do_python(short menutype, int event);       // BPY_interface.c
676
668
        ScrArea *sa;
677
669
 
678
670
        if(curarea->spacetype==SPACE_INFO) {
681
673
                areawinset(sa->win);
682
674
        }
683
675
 
684
 
        BPY_menu_do_python(PYMENU_IMPORT, event);
 
676
        /* events >=4 are registered bpython scripts */
 
677
        if (event >= 4) {
 
678
                BPY_menu_do_python(PYMENU_IMPORT, event - 4);
 
679
                BIF_undo_push("Import file");
 
680
        }
 
681
        else {
 
682
                switch(event) {
 
683
                                                                        
 
684
                case 0: /* DXF */
 
685
                        activate_fileselect(FILE_BLENDER, "Import DXF", G.sce, BIF_read_file);
 
686
                        break;
 
687
                case 1: /* VRML 1.0 */
 
688
                        activate_fileselect(FILE_BLENDER, "Import VRML 1.0", G.sce, BIF_read_file);
 
689
                        break;
 
690
                case 2: /* VideoScape */
 
691
                        activate_fileselect(FILE_BLENDER, "Import VideoScape", G.sce, BIF_read_file);
 
692
                        break;
 
693
                case 3: /* STL */
 
694
                        activate_fileselect(FILE_BLENDER, "Import STL", G.sce, BIF_read_file);
 
695
                        break;
685
696
 
 
697
                }
 
698
        }
686
699
        allqueue(REDRAWINFO, 0);
687
700
}
688
701
 
696
709
        block= uiNewBlock(&curarea->uiblocks, "importmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
697
710
        uiBlockSetButmFunc(block, do_info_file_importmenu, NULL);
698
711
        //uiBlockSetXOfs(block, -50);  // offset to parent button
 
712
        
 
713
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "VRML 1.0...",
 
714
                         0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 1, "");
 
715
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "DXF...",
 
716
                         0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 0, "");
 
717
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "VideoScape...",
 
718
                         0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 2, "");
 
719
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "STL...",
 
720
                         0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 3, "");
 
721
 
 
722
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
699
723
 
700
724
        for (pym = BPyMenuTable[PYMENU_IMPORT]; pym; pym = pym->next, i++) {
701
 
                uiDefBut(block, BUTM, 1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
 
725
                uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+4, pym->tooltip?pym->tooltip:pym->filename);
702
726
        }
703
727
 
704
 
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
705
 
 
706
728
        uiBlockSetDirection(block, UI_RIGHT);
707
729
        uiTextBoundsBlock(block, 60);
708
730
 
711
733
 
712
734
static void do_info_file_exportmenu(void *arg, int event)
713
735
{
714
 
        extern int BPY_menu_do_python(short menutype, int event);       // BPY_interface.c
715
736
        ScrArea *sa;
716
737
 
717
738
        if(curarea->spacetype==SPACE_INFO) {
720
741
                areawinset(sa->win);
721
742
        }
722
743
 
723
 
        /* events >=3 are registered bpython scripts */
724
 
        if (event >= 3) BPY_menu_do_python(PYMENU_EXPORT, event - 3);
725
 
 
726
 
        /* these are no defines, easier this way, the codes are in the function below */
 
744
        /* events >=4 are registered bpython scripts */
 
745
        if (event >= 4) BPY_menu_do_python(PYMENU_EXPORT, event - 4);
727
746
 
728
747
        else switch(event) {
729
748
                                                                        
736
755
        case 2:
737
756
                write_videoscape_fs();
738
757
                break;
 
758
        case 3:
 
759
                write_stl_fs();
 
760
                break;
739
761
        }
740
762
        allqueue(REDRAWINFO, 0);
741
763
}
751
773
        uiBlockSetButmFunc(block, do_info_file_exportmenu, NULL);
752
774
        //uiBlockSetXOfs(block, -50);  // offset to parent button
753
775
 
754
 
        uiDefBut(block, BUTM, 1, "VRML 1.0...|Ctrl F2",
 
776
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "VRML 1.0...|Ctrl F2",
755
777
                         0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 0, "");
756
 
        uiDefBut(block, BUTM, 1, "DXF...|Shift F2",
 
778
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "DXF...|Shift F2",
757
779
                         0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 1, "");
758
 
        uiDefBut(block, BUTM, 1, "Videoscape...|Alt W",
 
780
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Videoscape...|Alt W",
759
781
                         0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 2, "");
 
782
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "STL...",
 
783
                         0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 3, "");
760
784
 
761
 
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 
762
 
                         0.0, 0.0, 0, 0, "");
 
785
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
763
786
 
764
787
        /* note that we acount for the 3 previous entries with i+3: */
765
788
        for (pym = BPyMenuTable[PYMENU_EXPORT]; pym; pym = pym->next, i++) {
766
 
                uiDefBut(block, BUTM, 1, pym->name, 0, yco-=20, menuwidth, 19, 
767
 
                                 NULL, 0.0, 0.0, 1, i+3, 
 
789
                uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, 
 
790
                                 NULL, 0.0, 0.0, 1, i+4, 
768
791
                                 pym->tooltip?pym->tooltip:pym->filename);
769
792
        }
770
793
 
775
798
        return block;
776
799
}
777
800
 
778
 
static void do_info_file_exportselmenu(void *arg, int event)
779
 
{
780
 
        ScrArea *sa;
781
 
 
782
 
        if(curarea->spacetype==SPACE_INFO) {
783
 
                sa= closest_bigger_area();
784
 
                areawinset(sa->win);
785
 
        }
786
 
 
787
 
        /* these are no defines, easier this way (yeah right!), 
788
 
           the codes are in the function below */
789
 
        switch(event) {
790
 
                                                                        
791
 
        case 0:
792
 
                write_stl_fs();
793
 
                break;
794
 
        }
795
 
        allqueue(REDRAWINFO, 0);
796
 
}
797
 
 
798
 
static uiBlock *info_file_exportselmenu(void *arg_unused)
799
 
{
800
 
        uiBlock *block;
801
 
        short yco = 20;
802
 
 
803
 
        block= uiNewBlock(&curarea->uiblocks, "exportselectedmenu", UI_EMBOSSP, 
804
 
                                          UI_HELV, G.curscreen->mainwin);
805
 
        uiBlockSetButmFunc(block, do_info_file_exportselmenu, NULL);
806
 
        //uiBlockSetXOfs(block, -50);  // offset to parent button
807
 
        
808
 
        uiDefBut(block, BUTM, 1, "STL...",
809
 
                         0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 0, "");
810
 
 
811
 
        uiBlockSetDirection(block, UI_RIGHT);
812
 
        uiTextBoundsBlock(block, 60);
813
 
 
814
 
        return block;
815
 
}
816
 
 
817
801
static void do_info_filemenu(void *arg, int event)
818
802
{
819
803
        ScrArea *sa;
862
846
                }
863
847
                break;
864
848
        case 6: /* save image */
865
 
                mainqenter(F3KEY, 1);
866
 
                break;
867
 
/*
868
 
        case 20:
869
 
                strcpy(dir, G.sce);
870
 
                activate_fileselect(FILE_SPECIAL, "INSTALL LICENSE KEY", dir, loadKeyboard);
871
 
                break;
872
 
        case 21:
873
 
                SHOW_LICENSE_KEY();
874
 
                break;
875
 
*/
 
849
                BIF_save_rendered_image();
 
850
                break;
876
851
        case 22: /* save runtime */
877
852
                activate_fileselect(FILE_SPECIAL, "Save Runtime", "", write_runtime_check);
878
853
                break;
879
854
        case 23: /* save dynamic runtime */
880
855
                activate_fileselect(FILE_SPECIAL, "Save Dynamic Runtime", "", write_runtime_check_dynamic);
881
856
                break;
 
857
        case 24:
 
858
                BIF_screendump(0);
 
859
                break;
 
860
        case 25:
 
861
                BIF_screendump(1);
 
862
                break;
882
863
        case 10: /* pack data */
883
864
                check_packAll();
884
865
                break;
895
876
        case 13:
896
877
                exit_usiblender();
897
878
                break;
 
879
        case 15:        /* recover previous session */
 
880
                {
 
881
                        extern short winqueue_break; /* editscreen.c */
 
882
                        int save_over;
 
883
                        char str[FILE_MAXDIR+FILE_MAXFILE];
 
884
                        char scestr[FILE_MAXDIR+FILE_MAXFILE];
 
885
                        
 
886
                        strcpy(scestr, G.sce);  /* temporal store */
 
887
                        save_over = G.save_over;
 
888
                        BLI_make_file_string("/", str, U.tempdir, "quit.blend");
 
889
                        BKE_read_file(str, NULL);
 
890
                        G.save_over = save_over;
 
891
                        strcpy(G.sce, scestr);
 
892
 
 
893
                        winqueue_break= 1;      /* leave queues everywhere */
 
894
                
 
895
                        BKE_reset_undo();
 
896
                        BKE_write_undo("original");     /* save current state */
 
897
                        refresh_interface_font();
 
898
                }
 
899
                break;
898
900
        case 31: /* save default settings */
899
901
                BIF_write_homefile();
900
902
                break;
901
903
        }
902
904
        allqueue(REDRAWINFO, 0);
903
905
}
 
906
 
904
907
static uiBlock *info_filemenu(void *arg_unused)
905
908
{
906
909
        uiBlock *block;
913
916
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "New|Ctrl X",                             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
914
917
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Open...|F1",                             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
915
918
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reopen Last|Ctrl O",                             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
 
919
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recover Last Session",                           0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
916
920
 
917
921
        uiDefBut(block, SEPR, 0, "",                                    0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
918
922
 
922
926
        uiDefBut(block, SEPR, 0, "",                                    0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
923
927
 
924
928
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Image...|F3",                       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
 
929
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Dump 3DView|Ctrl F3",                    0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 24, "");
 
930
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Dump Screen|Ctrl Shift F3",                      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 25, "");
925
931
#if GAMEBLENDER == 1
926
932
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Runtime...",                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
927
933
#ifdef _WIN32
932
938
 
933
939
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Save Default Settings|Ctrl U",                   0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 31, "");
934
940
 
 
941
 
935
942
        uiDefBut(block, SEPR, 0, "",                                    0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
936
943
 
937
944
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Append...|Shift F1",     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
938
945
        uiDefIconTextBlockBut(block, info_file_importmenu, NULL, ICON_RIGHTARROW_THIN, "Import", 0, yco-=20, menuwidth, 19, "");
939
946
        uiDefIconTextBlockBut(block, info_file_exportmenu, NULL, ICON_RIGHTARROW_THIN, "Export", 0, yco-=20, menuwidth, 19, "");
940
 
        uiDefIconTextBlockBut(block, info_file_exportselmenu, NULL, ICON_RIGHTARROW_THIN, "Export Selected", 0, yco-=20, menuwidth, 19, "");
941
947
        
942
948
        uiDefBut(block, SEPR, 0, "",                                    0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
943
949
 
1193
1199
        return block;
1194
1200
}
1195
1201
 
 
1202
void do_info_add_lampmenu(void *arg, int event)
 
1203
{
 
1204
 
 
1205
        switch(event) {         
 
1206
                case 0: /* lamp */
 
1207
                        add_objectLamp(LA_LOCAL);
 
1208
                        break;
 
1209
                case 1: /* sun */
 
1210
                        add_objectLamp(LA_SUN);
 
1211
                        break;
 
1212
                case 2: /* spot */
 
1213
                        add_objectLamp(LA_SPOT);
 
1214
                        break;
 
1215
                case 3: /* hemi */
 
1216
                        add_objectLamp(LA_HEMI);
 
1217
                        break;
 
1218
                case 4: /* area */
 
1219
                        add_objectLamp(LA_AREA);
 
1220
                        break;
 
1221
                case 5: /* YafRay photon lamp */
 
1222
                        if (G.scene->r.renderer==R_YAFRAY)
 
1223
                                add_objectLamp(LA_YF_PHOTON);
 
1224
                        break;
 
1225
                default:
 
1226
                        break;
 
1227
        }
 
1228
        allqueue(REDRAWINFO, 0);
 
1229
}
 
1230
 
 
1231
static uiBlock *info_add_lampmenu(void *arg_unused)
 
1232
{
 
1233
/*              static short tog=0; */
 
1234
        uiBlock *block;
 
1235
        short yco= 0;
 
1236
        
 
1237
        block= uiNewBlock(&curarea->uiblocks, "add_lampmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
 
1238
        uiBlockSetButmFunc(block, do_info_add_lampmenu, NULL);
 
1239
        
 
1240
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp|",                          0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
 
1241
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Sun|",                           0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
 
1242
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Spot|",                          0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "");
 
1243
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hemi|",                          0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "");
 
1244
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Area|",                          0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 4, "");
 
1245
        if (G.scene->r.renderer==R_YAFRAY)
 
1246
                uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Photon|",                                0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 5, "");
 
1247
        
 
1248
        uiBlockSetDirection(block, UI_RIGHT);
 
1249
        uiTextBoundsBlock(block, 50);
 
1250
                
 
1251
        return block;
 
1252
}
1196
1253
 
1197
1254
void do_info_addmenu(void *arg, int event)
1198
1255
{
1223
1280
                        break;
1224
1281
                case 7:
1225
1282
                        /* Lamp */
1226
 
                        add_object_draw(OB_LAMP);
 
1283
                //      add_object_draw(OB_LAMP);
1227
1284
                        break;
1228
1285
                case 8:
1229
1286
                        /* Armature */
1255
1312
        uiDefIconTextBlockBut(block, info_add_metamenu, NULL, ICON_RIGHTARROW_THIN, "Meta", 0, yco-=20, 120, 19, "");
1256
1313
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Text",                           0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 4, "");
1257
1314
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Empty",                          0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 5, "");
 
1315
        
1258
1316
        uiDefBut(block, SEPR, 0, "",                                    0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
 
1317
        
1259
1318
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera",                         0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 6, "");
1260
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp",                           0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 7, "");
 
1319
//      uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp",                           0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 7, "");
 
1320
        uiDefIconTextBlockBut(block, info_add_lampmenu, NULL, ICON_RIGHTARROW_THIN, "Lamp", 0, yco-=20, 120, 19, "");
 
1321
        
1261
1322
        uiDefBut(block, SEPR, 0, "",                                    0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
 
1323
        
1262
1324
        /* armature needs 3d window to draw */
1263
1325
        //uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature",                     0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 8, "");
1264
1326
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice",                        0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 9, "");
1303
1365
        if(G.fileflags & (1 << G_FILE_ENABLE_ALL_FRAMES_BIT)) {
1304
1366
                uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Enable All Frames",         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_ENABLE_ALL_FRAMES_BIT, "");
1305
1367
        } else {
1306
 
                                        uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Enable All Frames",       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_ENABLE_ALL_FRAMES_BIT, "");
 
1368
                uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Enable All Frames",       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_ENABLE_ALL_FRAMES_BIT, "");
1307
1369
        }
1308
1370
 
1309
1371
        if(G.fileflags & (1 << G_FILE_SHOW_FRAMERATE_BIT)) {
1457
1519
        char str[FILE_MAXDIR+FILE_MAXFILE];
1458
1520
        int pos[2], size[2];
1459
1521
 
1460
 
        calc_renderwin_rectangle(R.winpos, pos, size);
 
1522
        calc_renderwin_rectangle(G.winpos, pos, size);
1461
1523
 
1462
1524
        sprintf(str, "%s -a -p %d %d \"%s\"", bprogname, pos[0], pos[1], file);
1463
1525
        system(str);
1562
1624
 
1563
1625
static void do_info_help_websitesmenu(void *arg, int event)
1564
1626
{
1565
 
        /* these are no defines, easier this way, the codes are in the function below */
1566
 
        switch(event) {
1567
 
        case 0: /*      */
 
1627
        BPY_menu_do_python(PYMENU_HELPWEBSITES, event);
1568
1628
 
1569
 
                break;
1570
 
                }
1571
1629
        allqueue(REDRAWVIEW3D, 0);
1572
1630
}
1573
1631
 
1575
1633
static uiBlock *info_help_websitesmenu(void *arg_unused)
1576
1634
{
1577
1635
        uiBlock *block;
 
1636
        BPyMenu *pym;
1578
1637
        short yco = 20, menuwidth = 120;
 
1638
        int i = 0;
1579
1639
 
1580
1640
        block= uiNewBlock(&curarea->uiblocks, "info_help_websitesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
1581
1641
        uiBlockSetButmFunc(block, do_info_help_websitesmenu, NULL);
1582
1642
        
1583
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Blender Website *",                      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
1584
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Blender E-shop *",               0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
1585
 
        
1586
 
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
1587
 
        
1588
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Development Community *",                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
1589
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "User Community *",               0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
1590
 
        
1591
 
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
1592
 
        
1593
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "...? *",         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
1594
 
        
1595
 
        uiBlockSetDirection(block, UI_RIGHT);
1596
 
        uiTextBoundsBlock(block, 60);
1597
 
                
1598
 
        return block;
1599
 
}
1600
 
 
 
1643
        for (pym = BPyMenuTable[PYMENU_HELPWEBSITES]; pym; pym = pym->next, i++) {
 
1644
                uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
 
1645
        }
 
1646
        
 
1647
        uiBlockSetDirection(block, UI_RIGHT);
 
1648
        uiTextBoundsBlock(block, 60);
 
1649
                
 
1650
        return block;
 
1651
}
 
1652
 
 
1653
static void do_info_help_systemmenu(void *arg, int event)
 
1654
{
 
1655
        /* events >=10 are registered bpython scripts */
 
1656
        if (event >= 10) BPY_menu_do_python(PYMENU_HELPSYSTEM, event - 10);
 
1657
        else {
 
1658
                switch(event) {
 
1659
 
 
1660
                case 1: /* Benchmark */
 
1661
                        /* dodgy hack turning on CTRL ALT SHIFT key to do a benchmark 
 
1662
                         *      rather than copying lines and lines of code from toets.c :( 
 
1663
                         */
 
1664
        
 
1665
                        if(select_area(SPACE_VIEW3D)) {
 
1666
                                mainqenter(LEFTSHIFTKEY, 1);
 
1667
                                mainqenter(LEFTCTRLKEY, 1);
 
1668
                                mainqenter(LEFTALTKEY, 1);
 
1669
                                mainqenter(TKEY, 1);
 
1670
                                mainqenter(TKEY, 0);
 
1671
                                mainqenter(EXECUTE, 1);
 
1672
                                mainqenter(LEFTSHIFTKEY, 0);
 
1673
                                mainqenter(LEFTCTRLKEY, 0);
 
1674
                                mainqenter(LEFTALTKEY, 0);
 
1675
                        }
 
1676
                        break;
 
1677
                }
 
1678
        }
 
1679
 
 
1680
        allqueue(REDRAWVIEW3D, 0);
 
1681
}
 
1682
 
 
1683
 
 
1684
static uiBlock *info_help_systemmenu(void *arg_unused)
 
1685
{
 
1686
        uiBlock *block;
 
1687
        BPyMenu *pym;
 
1688
        short yco = 20, menuwidth = 120;
 
1689
        int i = 0;
 
1690
 
 
1691
        block= uiNewBlock(&curarea->uiblocks, "info_help_systemmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
 
1692
        uiBlockSetButmFunc(block, do_info_help_systemmenu, NULL);
 
1693
        
 
1694
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Benchmark",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
 
1695
        
 
1696
        for (pym = BPyMenuTable[PYMENU_HELPSYSTEM]; pym; pym = pym->next, i++) {
 
1697
                uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename);
 
1698
        }
 
1699
        
 
1700
        uiBlockSetDirection(block, UI_RIGHT);
 
1701
        uiTextBoundsBlock(block, 60);
 
1702
                
 
1703
        return block;
 
1704
}
1601
1705
 
1602
1706
static void do_info_helpmenu(void *arg, int event)
1603
1707
{
1604
 
        switch(event) {
1605
 
                
1606
 
        case 0:
1607
 
                break;
1608
 
        case 1:
1609
 
                /* dodgy hack turning on CTRL ALT SHIFT key to do a benchmark 
1610
 
                 *      rather than copying lines and lines of code from toets.c :( 
1611
 
                 */
1612
 
 
1613
 
                if(select_area(SPACE_VIEW3D)) {
1614
 
                        mainqenter(LEFTSHIFTKEY, 1);
1615
 
                        mainqenter(LEFTCTRLKEY, 1);
1616
 
                        mainqenter(LEFTALTKEY, 1);
1617
 
                        mainqenter(TKEY, 1);
1618
 
                        mainqenter(TKEY, 0);
1619
 
                        mainqenter(EXECUTE, 1);
1620
 
                        mainqenter(LEFTSHIFTKEY, 0);
1621
 
                        mainqenter(LEFTCTRLKEY, 0);
1622
 
                        mainqenter(LEFTALTKEY, 0);
 
1708
        ScrArea *sa;
 
1709
 
 
1710
        if(curarea->spacetype==SPACE_INFO) {
 
1711
                sa= find_biggest_area_of_type(SPACE_SCRIPT);
 
1712
                if (!sa) sa= closest_bigger_area();
 
1713
                areawinset(sa->win);
 
1714
        }
 
1715
 
 
1716
        /* events >=10 are registered bpython scripts */
 
1717
        if (event >= 10) BPY_menu_do_python(PYMENU_HELP, event - 10);
 
1718
        else {
 
1719
                switch(event) {
 
1720
                                                                        
 
1721
                case 0: /* About Blender */
 
1722
                        break;
1623
1723
                }
1624
 
                break;
1625
1724
        }
 
1725
 
1626
1726
        allqueue(REDRAWINFO, 0);
1627
1727
}
1628
1728
 
1632
1732
        uiBlock *block;
1633
1733
        short yco= 0;
1634
1734
        short menuwidth=120;
 
1735
        BPyMenu *pym;
 
1736
        int i = 0;
1635
1737
        
1636
1738
        block= uiNewBlock(&curarea->uiblocks, "info_helpmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
1637
1739
        uiBlockSetButmFunc(block, do_info_helpmenu, NULL);
1640
1742
        
1641
1743
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
1642
1744
        
1643
 
        /*      uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "-- Placeholders only --",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
1644
 
        
1645
 
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
1646
 
        
1647
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tutorials *",    0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
1648
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "User Manual *",  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
1649
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Python Scripting Reference *",   0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
 
1745
        for (pym = BPyMenuTable[PYMENU_HELP]; pym; pym = pym->next, i++) {
 
1746
                uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename);
 
1747
        }
1650
1748
        
1651
1749
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
1652
1750
        
1653
1751
        uiDefIconTextBlockBut(block, info_help_websitesmenu, NULL, ICON_RIGHTARROW_THIN, "Websites", 0, yco-=20, 120, 19, "");
1654
 
 
 
1752
        
1655
1753
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
1656
 
*/
1657
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Benchmark",      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
1658
1754
        
1659
 
/*      uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
 
1755
        uiDefIconTextBlockBut(block, info_help_systemmenu, NULL, ICON_RIGHTARROW_THIN, "System", 0, yco-=20, 120, 19, "");
1660
1756
 
1661
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Release Notes *",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
1662
 
*/
1663
1757
        uiBlockSetDirection(block, UI_DOWN);
1664
1758
        uiTextBoundsBlock(block, 80);
1665
1759
 
1667
1761
}
1668
1762
 
1669
1763
/************************** END MAIN MENU *****************************/
 
1764
/* ugly global yes, for renderwin.c to write to */
 
1765
char info_time_str[32]="";
1670
1766
 
1671
1767
static void info_text(int x, int y)
1672
1768
{
1679
1775
        char *headerstr;
1680
1776
        int hsize;
1681
1777
 
1682
 
 
1683
1778
        if(G.obedit) {
1684
 
                sprintf(infostr,"Ve:%d-%d | Fa:%d-%d | Mem:%.2fM ",
1685
 
                G.totvertsel, G.totvert, G.totfacesel, G.totface,
1686
 
                (mem_in_use>>10)/1024.0);
 
1779
                if(G.obedit->type==OB_MESH) {
 
1780
                        if(G.scene->selectmode & SCE_SELECT_VERTEX)
 
1781
                                sprintf(infostr,"Ve:%d-%d | Ed:%d-%d | Fa:%d-%d | Mem:%.2fM ",
 
1782
                                                G.totvertsel, G.totvert, G.totedgesel, G.totedge, G.totfacesel, G.totface, (mem_in_use>>10)/1024.0);
 
1783
                        else if(G.scene->selectmode & SCE_SELECT_EDGE)
 
1784
                                sprintf(infostr,"Ed:%d-%d | Fa:%d-%d | Mem:%.2fM ",
 
1785
                                                G.totedgesel, G.totedge, G.totfacesel, G.totface, (mem_in_use>>10)/1024.0);
 
1786
                        else 
 
1787
                                sprintf(infostr,"Fa:%d-%d | Mem:%.2fM ",
 
1788
                                                G.totfacesel, G.totface, (mem_in_use>>10)/1024.0);
 
1789
                }
 
1790
                else {
 
1791
                        sprintf(infostr,"Ve:%d-%d | Mem:%.2fM ",
 
1792
                                        G.totvertsel, G.totvert, (mem_in_use>>10)/1024.0);
 
1793
                }
1687
1794
        }
1688
1795
        else {
1689
 
                sprintf(infostr,"Ve:%d | Fa:%d | Ob:%d-%d | La:%d | Mem:%.2fM | ",
1690
 
                        G.totvert, G.totface, G.totobj, G.totobjsel, G.totlamp,  (mem_in_use>>10)/1024.0);
 
1796
                sprintf(infostr,"Ve:%d | Fa:%d | Ob:%d-%d | La:%d | Mem:%.2fM | Time:%s | ",
 
1797
                        G.totvert, G.totface, G.totobj, G.totobjsel, G.totlamp,  (mem_in_use>>10)/1024.0, info_time_str);
1691
1798
        }
1692
1799
        ob= OBACT;
1693
1800
        if(ob) {
1694
1801
                strcat(infostr, ob->id.name+2);
1695
1802
        }
1696
1803
 
 
1804
        if (g_progress_bar && g_progress_info) {
 
1805
                headerstr= g_progress_info;
 
1806
        } else {
 
1807
                headerstr= versionstr; 
 
1808
        }
 
1809
 
1697
1810
        if      (g_progress_bar) {
1698
1811
                hsize = 4 + (138.0 * g_done);
1699
1812
                fac1 = 0.5 * g_done; // do some rainbow colours on progress
1700
1813
                fac2 = 1.0;
1701
1814
                fac3 = 0.9;
1702
1815
        } else {
1703
 
                hsize = 142;
 
1816
                hsize= 30+BIF_GetStringWidth(G.font, headerstr, (U.transopts & USER_TR_BUTTONS));
 
1817
 
1704
1818
                /* promise! Never change these lines again! (zr & ton did!) */
1705
1819
                fac1= fabs(hashvectf[ 2*G.version+4]);
1706
1820
                fac2= 0.5+0.1*hashvectf[ G.version+3];
1707
1821
                fac3= 0.7;
1708
1822
        }
1709
 
 
1710
 
        if (g_progress_bar && g_progress_info) {
1711
 
                headerstr= g_progress_info;
1712
 
        } else {
1713
 
                headerstr= versionstr; 
1714
 
        }
1715
1823
        
1716
1824
        swatch_color= hsv_to_cpack(fac1, fac2, fac3);
1717
1825
 
1718
1826
        cpack( swatch_color );
1719
 
        glRecti(x-24,  y-6,  x-22+hsize,        y+14);
 
1827
        glRecti(x-24,  y-6,  x-30+hsize,        y+14);
1720
1828
 
1721
1829
        glColor3ub(0, 0, 0);
1722
1830
 
1723
1831
        glRasterPos2i(x, y);
 
1832
        BIF_RasterPos(x, y);
1724
1833
 
1725
1834
        BIF_DrawString(G.font, headerstr, (U.transopts & USER_TR_MENUS));
1726
 
                
1727
 
        glRasterPos2i(x+122,    y);
 
1835
        hsize= BIF_GetStringWidth(G.font, headerstr, (U.transopts & USER_TR_BUTTONS));
 
1836
        
 
1837
        glRasterPos2i(x+hsize+10,       y);
 
1838
        BIF_RasterPos(x+hsize+10,       y);
1728
1839
 
1729
1840
        BIF_DrawString(G.font, infostr, (U.transopts & USER_TR_MENUS));
1730
1841
}
1759
1870
                 * menu is drawn wider than it should be. The ypos of -1 is to make it properly fill the
1760
1871
                 * height of the header */
1761
1872
                xmax= GetButStringLength("File");
1762
 
                uiDefBlockBut(block, info_filemenu, NULL, "File",       xco, -1, xmax-3, 22, "");
 
1873
                uiDefPulldownBut(block, info_filemenu, NULL, "File",    xco, -1, xmax-3, 22, "");
1763
1874
                xco+= xmax;
1764
1875
 
1765
1876
                xmax= GetButStringLength("Add");
1766
 
                uiDefBlockBut(block, info_addmenu, NULL, "Add", xco, -1, xmax-3, 22, "");
 
1877
                uiDefPulldownBut(block, info_addmenu, NULL, "Add",      xco, -1, xmax-3, 22, "");
1767
1878
                xco+= xmax;
1768
1879
 
1769
1880
                xmax= GetButStringLength("Timeline");
1770
 
                uiDefBlockBut(block, info_timelinemenu, NULL, "Timeline",       xco, -1, xmax-3, 22, "");
 
1881
                uiDefPulldownBut(block, info_timelinemenu, NULL, "Timeline",    xco, -1, xmax-3, 22, "");
1771
1882
                xco+= xmax;
1772
1883
 
1773
1884
                xmax= GetButStringLength("Game");
1774
 
                uiDefBlockBut(block, info_gamemenu, NULL, "Game",       xco, -1, xmax-3, 22, "");
 
1885
                uiDefPulldownBut(block, info_gamemenu, NULL, "Game",    xco, -1, xmax-3, 22, "");
1775
1886
                xco+= xmax;
1776
1887
 
1777
1888
                xmax= GetButStringLength("Render");
1778
 
                uiDefBlockBut(block, info_rendermenu, NULL, "Render",   xco, -1, xmax-3, 22, "");
 
1889
                uiDefPulldownBut(block, info_rendermenu, NULL, "Render",        xco, -1, xmax-3, 22, "");
1779
1890
                xco+= xmax;
1780
1891
 
1781
1892
                xmax= GetButStringLength("Help");
1782
 
                uiDefBlockBut(block, info_helpmenu, NULL, "Help",       xco, -1, xmax-3, 22, "");
 
1893
                uiDefPulldownBut(block, info_helpmenu, NULL, "Help",    xco, -1, xmax-3, 22, "");
1783
1894
                xco+= xmax;
1784
1895
 
1785
1896
        }
1807
1918
        }
1808
1919
        else xco= 430;
1809
1920
        
 
1921
BIF_SetScale(block->aspect);
1810
1922
        info_text(xco+24, 6);
1811
1923
        
1812
1924
        uiBlockSetEmboss(block, UI_EMBOSSN);
1815
1927
        /* always do as last */
1816
1928
        curarea->headbutlen= xco+2*XIC;
1817
1929
 
1818
 
#ifdef _WIN32   // FULLSCREEN
 
1930
#if 0
 
1931
// #ifdef _WIN32        // FULLSCREEN
1819
1932
        if(U.uiflag & USER_FLIPFULLSCREEN) {
1820
1933
                uiDefIconBut(block, BUT, B_FLIPFULLSCREEN, ICON_WINDOW_WINDOW,
1821
1934
                                (short)(curarea->winx-XIC-5), 0,XIC,YIC,