added a fullscreen button in the top header (windows only)
authorRob Haarsma <phaseIV@zonnet.nl>
Thu, 8 May 2003 16:24:58 +0000 (16:24 +0000)
committerRob Haarsma <phaseIV@zonnet.nl>
Thu, 8 May 2003 16:24:58 +0000 (16:24 +0000)
written by Florian Eggenberger.

13 files changed:
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/intern/blender.c
source/blender/include/BIF_screen.h
source/blender/include/BIF_space.h
source/blender/include/blendef.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/quicktime/apple/quicktime_export.c
source/blender/src/editscreen.c
source/blender/src/ghostwinlay.c
source/blender/src/headerbuttons.c
source/blender/src/toets.c
source/blender/src/usiblender.c
source/blender/src/winlay.h

index 43db9f08914aa1ccae273e14eaddfc773b480ef1..ebdd008847c82e94ac861547669369c26e8d8549 100644 (file)
@@ -121,6 +121,9 @@ typedef struct Global {
     /* this variable is written to / read from FileGlobal->fileflags */
     int fileflags;
     
+       /* save the allowed windowstate of blender when using -W or -w */
+       int windowstate;
+
        /* Janco's playing ground */
        struct bSoundListener* listener;
 
@@ -189,6 +192,11 @@ typedef struct Global {
 #define G_FILE_SIGN              (1 << G_FILE_SIGN_BIT)
 #define G_FILE_PUBLISH                  (1 << G_FILE_PUBLISH_BIT)
 
+/* G.windowstate */
+#define G_WINDOWSTATE_USERDEF          0
+#define G_WINDOWSTATE_BORDER           1
+#define G_WINDOWSTATE_FULLSCREEN       2
+
 /* G.simulf */
 #define G_LOADFILE     2
 #define G_RESTART      4
index 6c5d5f2fff81a5a5810069d513e7fa9c67444f17..11a98227925c6149cfecbf2a1222eba41df43c32 100644 (file)
@@ -207,6 +207,10 @@ void initglobals(void)
 
        sprintf(versionstr, "www.blender.org %d", G.version);
 
+#ifdef _WIN32  // FULLSCREEN
+       G.windowstate = G_WINDOWSTATE_USERDEF;
+#endif
+
        clear_workob(); /* object.c */
 }
 
index 7c61896cd7f24e01454aef35991842f7a5108958..416df442e7c7f522b6a0f6dc56d0817fb047a26a 100644 (file)
@@ -95,7 +95,6 @@ int is_allowed_to_change_screen(struct bScreen *newp);
 void splash(void * data, int datasizei, char * string);
 void screenmain(void);
 void getdisplaysize(void);
-void setfullscreen(void);
 void setprefsize(int stax, int stay, int sizx, int sizy);
 void calc_arearcts(struct ScrArea *sa);
 void resize_screen(int x, int y, int w, int h);
index 2c6f6f1ecee2ca07f48819d3d4b03599b4176693..fc1d6ab23120e362ffb51f9af61ef98612c28cd1 100644 (file)
@@ -85,6 +85,10 @@ extern       void winqreadseqspace(struct ScrArea *sa, void *spacedata, struct B
 extern       void test_butspace(void);
 extern       void start_game(void);
 
+#ifdef _WIN32  // FULLSCREEN
+extern          void mainwindow_toggle_fullscreen(int fullscreen);
+#endif
+
 extern          void mainwindow_raise(void);
 extern          void mainwindow_make_active(void);
 extern          void mainwindow_close(void);
index 66dd7e1b8bf514b494196ba57f8f5ac1cead44a0..064cdc4dee61f1ae3c5b9a01f6e609a08519088b 100644 (file)
 #define B_DRAWINFO                     62
 #define B_REDRCURW3D           63
 #define B_FLIPINFOMENU         64
+#define B_FLIPFULLSCREEN       65
 
 
 #define B_SHOWSPLASH           70
index 7fac5a7dd68c7e8655d055ec3567907034af25bb..9357d1e6f8db3790d43cd046535c233a88ab45c2 100644 (file)
@@ -88,6 +88,7 @@ extern UserDef U; /* from usiblender.c !!!! */
 #define DRAWVIEWINFO   16
 #define EVTTOCONSOLE   32              //print ghost events, here for tuhopuu compat. --phase
 #define FLIPINFOMENU   64
+#define FLIPFULLSCREEN 128
 
 /* transopts */
 
index b88c72bfb5425f5a9099a1838fd97bfd8e9a9978..5863a5339005fde0f9786e2cf6dd48f2d1f1f98c 100644 (file)
@@ -574,6 +574,7 @@ int get_qtcodec_settings(void)
 //     cd.componentManufacturer = 0;
 //     cd.componentFlags = 0;
 //     cd.componentFlagsMask = 0;
+Handle                     *theText;
 
        if(qcdx == NULL) {
                qcdx = MEM_callocN(sizeof(QuicktimeCodecDataExt), "QuicktimeCodecDataExt");
@@ -629,6 +630,10 @@ int get_qtcodec_settings(void)
        SCGetInfo(qcdx->theComponent, scSpatialSettingsType,    &qcdx->gSpatialSettings);
        SCGetInfo(qcdx->theComponent, scDataRateSettingsType,   &qcdx->aDataRateSetting);
 
+//GraphicsExportGetSettingsAsText (qcdx->theComponent,theText );
+
+//printf("%s\n", theText);
+
        // framerate jugglin'
 
        if(qcdx->gTemporalSettings.frameRate == 1571553) {                      // 23.98 fps
index 60bf34a04f893c6371da048681358cfb573984bd..fd89b8400acf5a5b3607a2bc1f03e7327e31f8cc 100644 (file)
@@ -118,7 +118,7 @@ static void wait_for_event(void);
 /* ********* Globals *********** */
 
 static Window *mainwin= NULL;
-static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, start_maximized= 1, start_fullscreen = 0;
+static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, start_maximized= 1;
 static short dodrawscreen= 0;
 static ScrArea *areawinar[MAXWIN];
 static ScrArea *g_activearea= NULL;
@@ -1111,6 +1111,15 @@ void screenmain(void)
        }
 }
 
+#ifdef _WIN32  // FULLSCREEN
+void mainwindow_toggle_fullscreen(int fullscreen){
+       if (fullscreen) U.uiflag |= FLIPFULLSCREEN;
+       else U.uiflag &= ~FLIPFULLSCREEN;
+
+       window_toggle_fullscreen(mainwin, fullscreen);
+}
+#endif
+
 void mainwindow_raise(void) {
        window_raise(mainwin);
 }
@@ -1124,11 +1133,6 @@ void mainwindow_close(void) {
 
 /* *********  AREAS  ************* */
 
-void setfullscreen()
-{
-       start_fullscreen = 1;   
-}
-
 void setprefsize(int stax, int stay, int sizx, int sizy)
 {
        int scrwidth, scrheight;
@@ -1680,10 +1684,14 @@ static bScreen *addscreen(char *name)           /* use setprefsize() if you want somethin
        sc->scene= G.scene;
        
        if (!mainwin) {
-               if (start_fullscreen)
-                       mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, 2);
+#ifdef _WIN32  // FULLSCREEN
+               if (G.windowstate == G_WINDOWSTATE_FULLSCREEN)
+                       mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, G_WINDOWSTATE_FULLSCREEN);
                else
                        mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, start_maximized);
+#else
+               mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, start_maximized);
+#endif
                
                if (!mainwin) {
                        printf("ERROR: Unable to open Blender window\n");
index 73cb6cb9f403ddb62fa99dd216cf61ab129042fd..0345f77cf2860c744cc77d5bf6461f6e41a28493 100644 (file)
@@ -234,10 +234,14 @@ Window *window_open(char *title, int posx, int posy, int sizex, int sizey, int s
        inital_state= start_maximized?
                GHOST_kWindowStateFullScreen:GHOST_kWindowStateNormal;
 #else
-       if (start_maximized == 2)
+#ifdef _WIN32  // FULLSCREEN
+       if (start_maximized == G_WINDOWSTATE_FULLSCREEN)
                inital_state= GHOST_kWindowStateFullScreen;
        else
                inital_state= start_maximized?GHOST_kWindowStateMaximized:GHOST_kWindowStateNormal;
+#else
+       inital_state= start_maximized?GHOST_kWindowStateMaximized:GHOST_kWindowStateNormal;
+#endif
 #endif
 
        ghostwin= GHOST_CreateWindow(g_system, 
@@ -568,6 +572,15 @@ void window_raise(Window *win) {
        GHOST_SetWindowOrder(win->ghostwin, GHOST_kWindowOrderTop);
 }
 
+#ifdef _WIN32  //FULLSCREEN
+void window_toggle_fullscreen(Window *win, int fullscreen) {
+       if(fullscreen)
+               GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateFullScreen);
+       else
+               GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateMaximized);
+}
+#endif
+
 void window_warp_pointer(Window *win, int x, int y) {
        y= win->size[1] - y - 1;
        GHOST_ClientToScreen(win->ghostwin, x, y, &x, &y);
index f6a47eb3023d11c277359ef83a6a27c22a50c2f9..f370a2cc834be3b3b2eabdaa0bffc1a940477970 100644 (file)
@@ -1407,6 +1407,12 @@ void do_global_buttons(unsigned short event)
                scrarea_queue_headredraw(curarea);
                break;
 
+#ifdef _WIN32  // FULLSCREEN
+       case B_FLIPFULLSCREEN:
+               mainwindow_toggle_fullscreen((U.uiflag & FLIPFULLSCREEN));
+               break;
+#endif
+
        /* Fileselect windows for user preferences file paths */
 
        case B_FONTDIRFILESEL:  /* is button from space.c  *info* */
@@ -3408,6 +3414,7 @@ void info_buttons(void)
                                &(U.uiflag), 0, 0, 0, 0, "Hide pulldown menus");/* dir   */
        }
        xco+=XIC;
+
        if(U.uiflag & FLIPINFOMENU) {
        } else {
                uiBlockSetEmboss(block, UI_EMBOSSP);
@@ -3481,7 +3488,22 @@ void info_buttons(void)
        curarea->headbutlen= xco+2*XIC;
        
        if(curarea->headbutlen + 4*XIC < curarea->winx) {
-               uiDefIconBut(block, BUT, B_FILEMENU, ICON_HELP, (short)(curarea->winx-XIC-2), 0,XIC,YIC, 0, 0, 0, 0, 0, "Toolbox menu, hotkey: SPACE");
+               uiDefIconBut(block, BUT, B_FILEMENU, ICON_HELP,
+                       (short)(curarea->winx-XIC-2), 0,XIC,YIC,
+                       0, 0, 0, 0, 0, "Toolbox menu, hotkey: SPACE");
+
+#ifdef _WIN32  // FULLSCREEN
+       if(U.uiflag & FLIPFULLSCREEN) {
+               uiDefIconButS(block, TOG|BIT|7, B_FLIPFULLSCREEN, ICON_SPLITSCREEN,
+                               (short)(curarea->winx-(XIC*2)-2), 0,XIC,YIC,
+                               &(U.uiflag), 0, 0, 0, 0, "Toggle Blender fullscreen");/* dir   */
+       } else {
+               uiDefIconButS(block, TOG|BIT|7, B_FLIPFULLSCREEN, ICON_FULLSCREEN,
+                               (short)(curarea->winx-(XIC*2)-2), 0,XIC,YIC,
+                               &(U.uiflag), 0, 0, 0, 0, "Toggle Blender fullscreen");/* dir   */
+       }
+#endif
+       
        }
        
        uiDrawBlock(block);
index 91b1c39db7ae13579c6d5e6aa03bfd1772920402..6394959dd0c37d34a0dd66dff5b65d6af59810de 100644 (file)
@@ -643,7 +643,15 @@ int blenderqread(unsigned short event, short val)
        case LEFTARROWKEY:
        case DOWNARROWKEY:
                if(textediting==0 && textspace==0) {
+
+#ifdef _WIN32  // FULLSCREEN
+                       if(event==DOWNARROWKEY){
+                               if (G.qual & LR_ALTKEY) mainwindow_toggle_fullscreen(0);
+                               else CFRA-= 10;
+                       }
+#else
                        if(event==DOWNARROWKEY) CFRA-= 10;
+#endif
                        else CFRA--;
                        
                        if(G.qual & LR_SHIFTKEY) CFRA= SFRA;
@@ -657,8 +665,17 @@ int blenderqread(unsigned short event, short val)
        case RIGHTARROWKEY:
        case UPARROWKEY:
                if(textediting==0 && textspace==0) {
+
+#ifdef _WIN32  // FULLSCREEN
+                       if(event==UPARROWKEY){ 
+                               if(G.qual & LR_ALTKEY) mainwindow_toggle_fullscreen(1);
+                               else CFRA+= 10;
+                       }
+#else
                        if(event==UPARROWKEY) CFRA+= 10;
+#endif
                        else CFRA++;
+
                        if(G.qual & LR_SHIFTKEY) CFRA= EFRA;
                        
                        update_for_newframe();
index 8f8d635905cc4bfcc80cec0a267b11024952c68e..8b3254c346b06dd2eff8fdfe9e6f509d3458f7ac 100644 (file)
@@ -182,7 +182,21 @@ int BIF_read_homefile(void)
 
                /*  disable autoplay in .B.blend... */
                G.fileflags &= ~G_FILE_AUTOPLAY;
-                       
+
+#ifdef _WIN32  // FULLSCREEN
+               /* choose window startmode */
+               switch (G.windowstate){
+                       case G_WINDOWSTATE_USERDEF: /* use the usersetting */
+                               break;
+                       case G_WINDOWSTATE_FULLSCREEN: /* force fullscreen */
+                               U.uiflag |= FLIPFULLSCREEN;
+                               break;
+                       case G_WINDOWSTATE_BORDER: /* force with borders */
+                               U.uiflag &= ~FLIPFULLSCREEN;
+               }
+               mainwindow_toggle_fullscreen ((U.uiflag & FLIPFULLSCREEN));
+#endif
+
                if (BLI_streq(U.tempdir, "/")) {
                        char *tmp= getenv("TEMP");
                                
index fb2a2fcb89dd74aa10f57e6af7bb74009d0dccc4..2f5cc3ce3868e06e0a616b989fc5597ef3e6fe33 100644 (file)
@@ -44,6 +44,10 @@ void window_set_timer        (Window *win, int delay_ms, int event);
 void   window_make_active      (Window *win);
 void   window_swap_buffers     (Window *win);
 
+#ifdef _WIN32  // FULLSCREEN
+void   window_toggle_fullscreen(Window *win, int fullscreen);
+#endif
+
 void   window_raise            (Window *win);
 void   window_lower            (Window *win);