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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: editscreen.c,v 1.150 2007/02/09 09:38:30 ton Exp $
 
2
 * $Id: editscreen.c,v 1.158 2007/04/22 17:14:23 campbellbarton Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
382
382
        if(active) BIF_ThemeColor(TH_HEADER);
383
383
        else BIF_ThemeColor(TH_HEADERDESEL);
384
384
 
385
 
        /* weird values here... is because of window matrix that centres buttons */
 
385
        /* weird values here... is because of window matrix that centers buttons */
386
386
        if(area->headertype==HEADERTOP) {
387
387
                uiSetRoundBox(3);
388
388
                uiRoundBoxEmboss(-0.5+area->headbutofs, -10.0, width-1.5+area->headbutofs, HEADERY-2.0, SCR_ROUND, active);
745
745
static void moveareas(ScrEdge *edge);
746
746
static void joinarea_interactive(ScrArea *area, ScrEdge *onedge);
747
747
static void splitarea_interactive(ScrArea *area, ScrEdge *onedge);
 
748
static ScrArea *test_edge_area(ScrArea *sa, ScrEdge *se);
 
749
static ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2);
 
750
 
 
751
static int isjoinable(ScrArea *area, ScrEdge *onedge)
 
752
{
 
753
        struct ScrArea *sa1 = area, *sa2;
 
754
        struct ScrEdge *se;
 
755
        
 
756
        sa1 = test_edge_area(sa1, onedge);
 
757
        if(sa1==0) return 0;
 
758
 
 
759
        /* find directions with same edge */
 
760
        sa2= G.curscreen->areabase.first;
 
761
        while(sa2) {
 
762
                if(sa2 != sa1) {
 
763
                        se= screen_findedge(G.curscreen, sa2->v1, sa2->v2);
 
764
                        if(onedge==se) return 1;
 
765
                        se= screen_findedge(G.curscreen, sa2->v2, sa2->v3);
 
766
                        if(onedge==se) return 1;
 
767
                        se= screen_findedge(G.curscreen, sa2->v3, sa2->v4);
 
768
                        if(onedge==se) return 1;
 
769
                        se= screen_findedge(G.curscreen, sa2->v4, sa2->v1);
 
770
                        if(onedge==se) return 1;
 
771
                }
 
772
                sa2= sa2->next;
 
773
        }
 
774
        
 
775
        return 0;               
 
776
}
748
777
 
749
778
static void screen_edge_edit_event(ScrArea *actarea, ScrEdge *actedge, short evt, short val) 
750
779
{
751
780
        if (val) {
752
781
                        // don't allow users to edit full screens
753
 
                if (actarea && actarea->full) {
 
782
                if (actarea && actarea->full)
754
783
                        return;
755
 
                }
756
784
        
757
785
                if (evt==LEFTMOUSE) {
758
786
                        moveareas(actedge);
759
787
                } else if (evt==MIDDLEMOUSE || evt==RIGHTMOUSE) {
760
788
                        int edgeop;
761
 
                
762
 
                        if (!actarea->headertype) {
763
 
                                edgeop= pupmenu("Split Area|Join Areas|Add Header");
764
 
                        } else {
765
 
                                edgeop= pupmenu("Split Area|Join Areas|No Header");
766
 
                        }
767
 
 
768
 
                        if (edgeop==1) {
769
 
                                splitarea_interactive(actarea, actedge);
770
 
                        } else if (edgeop==2) {
771
 
                                joinarea_interactive(actarea, actedge);
772
 
                        } else if (edgeop==3) {
773
 
                                scrarea_change_headertype(actarea, actarea->headertype?0:HEADERDOWN);
774
 
                        }
 
789
                        char str[64] = "Split Area%x1|";
 
790
                        
 
791
                        if(isjoinable(actarea, actedge))        strcat(str, "Join Areas%x2|");
 
792
                        if (actarea->headertype)                        strcat(str, "No Header%x3");
 
793
                        else                                                            strcat(str, "Add Header%x3");
 
794
                        
 
795
                        edgeop= pupmenu(str);
 
796
                        if      (edgeop==1)     splitarea_interactive(actarea, actedge);
 
797
                        else if (edgeop==2)     joinarea_interactive(actarea, actedge);
 
798
                        else if (edgeop==3)     scrarea_change_headertype(actarea,
 
799
                                                                                actarea->headertype?0:HEADERDOWN);
775
800
                }
776
801
                else blenderqread(evt, val);    // global hotkeys
777
802
        }
1054
1079
static void animated_screen(bScreen *sc, short val)
1055
1080
{
1056
1081
        if (U.mixbufsize && (val & TIME_WITH_SEQ_AUDIO)) {
1057
 
                if(CFRA>=EFRA) {
1058
 
                        CFRA= SFRA;
 
1082
                if(CFRA>=PEFRA) {
 
1083
                        CFRA= PSFRA;
1059
1084
                        audiostream_stop();
1060
1085
                        audiostream_start( CFRA );
1061
1086
                }
1067
1092
        }
1068
1093
        else {
1069
1094
                CFRA++;
1070
 
                if(CFRA > EFRA) CFRA= SFRA;
 
1095
                if(CFRA > PEFRA) CFRA= PSFRA;
1071
1096
        }
1072
1097
        
1073
1098
        update_for_newframe_nodraw(1);
1370
1395
                                towin= 0;
1371
1396
                        }
1372
1397
                }
1373
 
                else if(ELEM(event, LEFTARROWKEY, RIGHTARROWKEY)) {
1374
 
                        if(textediting==0 && val && (G.qual & LR_CTRLKEY)) {
1375
 
                                bScreen *sc= (event==LEFTARROWKEY)?G.curscreen->id.prev:G.curscreen->id.next;
1376
 
                                if(is_allowed_to_change_screen(sc)) setscreen(sc);
 
1398
                else if (event==RIGHTARROWKEY) {
 
1399
                        if(textediting==0 && val && (G.qual & LR_CTRLKEY)) {
 
1400
                                bScreen *sc= G.curscreen->id.next;
 
1401
 
 
1402
                                /* if screen is last, set it to first */
 
1403
                                if(sc == NULL)
 
1404
                                        sc= G.main->screen.first;
 
1405
                                
 
1406
                                setscreen(sc);
 
1407
                                g_activearea= NULL;
 
1408
                                towin= 0;
 
1409
                        }
 
1410
                }
 
1411
                else if (event==LEFTARROWKEY) {
 
1412
                        if(textediting==0 && val && (G.qual & LR_CTRLKEY)) {
 
1413
                                bScreen *sc= G.curscreen->id.prev;
 
1414
                                
 
1415
                                /* if screen is first, set it to last */
 
1416
                                if(sc == NULL)
 
1417
                                        sc= G.main->screen.last;
 
1418
                                
 
1419
                                setscreen(sc);
1377
1420
                                g_activearea= NULL;
1378
1421
                                towin= 0;
1379
1422
                        }
1546
1589
 
1547
1590
/* *********  AREAS  ************* */
1548
1591
 
1549
 
void setprefsize(int stax, int stay, int sizx, int sizy)
 
1592
void setprefsize(int stax, int stay, int sizx, int sizy, int maximized)
1550
1593
{
1551
1594
        int scrwidth, scrheight;
1552
1595
        
1570
1613
        prefsizx= sizx;
1571
1614
        prefsizy= sizy;
1572
1615
 
1573
 
        start_maximized= 0;
 
1616
        start_maximized= maximized;
1574
1617
}
1575
1618
 
1576
1619
 
2047
2090
                                
2048
2091
                                len= MIN4(len, len1, len2, len3);
2049
2092
                                
2050
 
                                /* plus centre */
 
2093
                                /* plus center */
2051
2094
                                vec[0]= (sa->v2->vec.x+sa->v3->vec.x)/2;
2052
2095
                                vec[1]= (sa->v1->vec.y+sa->v2->vec.y)/2;
2053
2096
 
2101
2144
        winlay_process_events(0);
2102
2145
        return window_get_mbut(mainwin);
2103
2146
}
2104
 
const GHOST_TabletData* get_tablet_data()
2105
 
{
2106
 
        winlay_process_events(0);
2107
 
        return window_get_tablet_data(mainwin);
 
2147
 
 
2148
/* return values of tablet data related functions are documented 
 
2149
 * in the Window struct, ghostwinlay.c */
 
2150
float get_pressure(void)
 
2151
{
 
2152
        winlay_process_events(0);
 
2153
        return window_get_pressure(mainwin);
 
2154
}
 
2155
void get_tilt(float *xtilt, float *ytilt)
 
2156
{
 
2157
        winlay_process_events(0);
 
2158
        window_get_tilt(mainwin, xtilt, ytilt);
 
2159
}
 
2160
short get_activedevice(void)
 
2161
{
 
2162
        winlay_process_events(0);
 
2163
        return window_get_activedevice(mainwin);
2108
2164
}
2109
2165
 
2110
2166
void add_to_mainqueue(Window *win, void *user_data, short evt, short val, char ascii)
2160
2216
        sc->scene= G.scene;
2161
2217
        
2162
2218
        if (!mainwin) {
2163
 
#if 0
2164
 
//#ifdef _WIN32 // FULLSCREEN
2165
2219
                if (G.windowstate == G_WINDOWSTATE_FULLSCREEN)
2166
2220
                        mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, G_WINDOWSTATE_FULLSCREEN);
2167
2221
                else
2168
2222
                        mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, start_maximized);
2169
 
#else
2170
 
                mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, start_maximized);
2171
 
#endif
2172
2223
                
2173
2224
                if (!mainwin) {
2174
2225
                        printf("ERROR: Unable to open Blender window\n");
3627
3678
        
3628
3679
        cpack(0x0);
3629
3680
        
 
3681
        /* Simple hack to make sure round corners arntdrawn with the minimal theme,
 
3682
         * Nothing wrong with it IMHO, but just be aware its used so the following
 
3683
         * if's never compare true with HEADERTOP or HEADERDOWN */
 
3684
        if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
 
3685
                sa->headertype = -sa->headertype;
 
3686
        
3630
3687
        /* right border area */
3631
3688
        if(sa->headertype==HEADERTOP) sdrawline(x2, y1, x2, y2-SCR_ROUND+1);
3632
3689
        else if(sa->headertype==HEADERDOWN) sdrawline(x2, y1+SCR_ROUND-1, x2, y2);
3646
3703
        if(sa->headertype==HEADERDOWN) sdrawline(x1+SCR_ROUND-3, y1, x2-SCR_ROUND+3, y1);
3647
3704
        else sdrawline(x1, y1, x2, y1);
3648
3705
        
 
3706
        /* restore real header type */
 
3707
        if (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
 
3708
                sa->headertype = -sa->headertype;
3649
3709
}
3650
3710
 
3651
3711
/* ********************************* */
3745
3805
        window_set_custom_cursor(mainwin, mask, bitmap, 7, 7);
3746
3806
        BIF_renderwin_set_custom_cursor(mask, bitmap);
3747
3807
}
3748