- added another load of items to new toolbox... yeez, what an
authorTon Roosendaal <ton@blender.org>
Wed, 29 Oct 2003 00:23:16 +0000 (00:23 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 29 Oct 2003 00:23:16 +0000 (00:23 +0000)
  ENORMOUS job Matt has done with the menus! :)
- followed as much as possible order and options in pulldowns, but since
  toolbox has more categories, it is split up sometimes.
- did some minor changes in pulldowns to make it more consistant
- not yet: armature & text options...
- not yet: toolbox in other window types

(warning; shift+a now is new... eek!)

source/blender/include/BIF_editmesh.h
source/blender/include/BIF_toolbox.h
source/blender/include/BSE_headerbuttons.h
source/blender/src/buttons_editing.c
source/blender/src/editmesh.c
source/blender/src/header_info.c
source/blender/src/header_view3d.c
source/blender/src/space.c
source/blender/src/toolbox.c

index 7fa501a79304a848fbed017abed2a58bb98b0238..4c9c89b9abbc698b2fb04808fc379cd00ddbbbdf 100644 (file)
@@ -105,7 +105,7 @@ void righthandfaces(int select);
 
 void mouse_mesh(void);
 
-void selectconnected_mesh(void);
+void selectconnected_mesh(int qual);
 short extrudeflag(short flag,short type);
 void rotateflag(short flag, float *cent, float rotmat[][3]);
 void translateflag(short flag, float *vec);
index d4e4a76cbcf1b495cc5defaf4f0f5600b355c666..e5db9d8ac0f06c1fde2e0c13a90f461d579c5874 100644 (file)
@@ -104,6 +104,7 @@ void drawtoolbox (void);
 void toolbox (void);
 
 void toolbox_n(void);
+void toolbox_n_add(void);
 
 void notice (char *str, ...);
 void error (char *fmt, ...);
index 889ce57fea63c61606b6a76fa20a9bdecaedcf80..4a4770a1317be850671f40d7250d85668c82d5a4 100644 (file)
@@ -112,4 +112,14 @@ void do_info_add_surfacemenu(void *arg, int event);
 void do_info_add_metamenu(void *arg, int event);
 void do_info_addmenu(void *arg, int event);
 
+/* header_view3d.c */
+void do_view3d_select_meshmenu(void *arg, int event);
+void do_view3d_select_curvemenu(void *arg, int event);
+void do_view3d_edit_mesh_normalsmenu(void *arg, int event);
+void do_view3d_edit_mesh_verticesmenu(void *arg, int event);
+void do_view3d_edit_mesh_edgesmenu(void *arg, int event);
+void do_view3d_edit_curve_segmentsmenu(void *arg, int event);
+
+
+
 #endif /*  BSE_HEADERBUTTONS_H */
index f9f343f271e4fa4da706b1923890bd8cab2f9bf3..7148921209e4337e98134061e679926fbc86d445 100644 (file)
@@ -1754,8 +1754,9 @@ static void editing_panel_links(Object *ob)
                        alone= B_LATTALONE;
                        local= B_LATTLOCAL;
                }
+               uiBlockSetCol(block, TH_BUT_SETTING2);
                xco= std_libbuttons(block, 143, 180, 0, NULL, browse, id, idfrom, &(G.buts->menunr), alone, local, 0, 0, B_KEEPDATA);
-                       
+               uiBlockSetCol(block, TH_AUTO);  
        }
        if(ob) {
                but = uiDefBut(block, TEX, B_IDNAME, "OB:",     xco, 180, 454-xco, YIC, ob->id.name+2, 0.0, 19.0, 0, 0, "Displays Active Object name. Click to change.");
index 789d6ac921200881b1f03f0ee5c335c38d3bdf19..0e6e661dddc87e571b1ec53628cfb64cd62fa56b 100644 (file)
@@ -2719,7 +2719,7 @@ static void selectconnectedAll(void)
 
 }
 
-void selectconnected_mesh(void)
+void selectconnected_mesh(int qual)
 {
        EditVert *eve,*v1,*v2,*act= 0;
        EditEdge *eed;
@@ -2727,14 +2727,14 @@ void selectconnected_mesh(void)
 
        if(G.eded.first==0) return;
 
-       if(G.qual & LR_CTRLKEY) {
+       if(qual & LR_CTRLKEY) {
                selectconnectedAll();
                return;
        }
 
        sel= 3;
-       if(G.qual & LR_SHIFTKEY) sel=2;
-
+       if(qual & LR_SHIFTKEY) sel=2;
+       
        act= findnearestvert(sel-2);
        if(act==0) {
                error(" Nothing indicated ");
index 711129a22ffbfe81481329e96d6261a6c9190bcd..084e1f4ea9e95ff87b9c833a382fdc50e86e3cdc 100644 (file)
@@ -495,10 +495,6 @@ void do_info_buttons(unsigned short event)
                        set_scene(sce);
                }
 
-               break;
-       case B_FILEMENU:
-               tbox_setmain(9);
-               toolbox();
                break;
        }
 }
@@ -1119,7 +1115,6 @@ static uiBlock *info_add_metamenu(void *arg_unused)
 
 void do_info_addmenu(void *arg, int event)
 {
-printf("event %d\n", event);
        switch(event) {         
                case 0:
                        /* Mesh */
@@ -1746,11 +1741,6 @@ void info_buttons(void)
 
        /* always do as last */
        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, "Displays Toolbox menu (SPACE)");
 
 #ifdef _WIN32  // FULLSCREEN
        if(U.uiflag & FLIPFULLSCREEN) {
@@ -1764,7 +1754,5 @@ void info_buttons(void)
        }
 #endif
        
-       }
-       
        uiDrawBlock(block);
 }
index b2a724ee68d21c080bb41df2a168751696756fab..20fec718658b5d3874102f890b2314be6fdb4d37 100644 (file)
@@ -559,7 +559,7 @@ static uiBlock *view3d_select_objectmenu(void *arg_unused)
        return block;
 }
 
-static void do_view3d_select_meshmenu(void *arg, int event)
+void do_view3d_select_meshmenu(void *arg, int event)
 {
 //     extern void borderselect(void);
 
@@ -575,9 +575,7 @@ static void do_view3d_select_meshmenu(void *arg, int event)
                        selectswap_mesh();
                        break;
                case 4: /* select linked vertices */
-                       G.qual |= LR_CTRLKEY;
-                       selectconnected_mesh();
-                       G.qual &= ~LR_CTRLKEY;
+                       selectconnected_mesh(LR_CTRLKEY);
                        break;
                case 5: /* select random */
                        // selectrandom_mesh();
@@ -608,8 +606,8 @@ static uiBlock *view3d_select_meshmenu(void *arg_unused)
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
        
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Faceloop|Shift R",                               0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Random Vertices...",                             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Connected Vertices|Ctrl L",                              0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+//     uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Random Vertices...",                             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked Vertices|Ctrl L",                         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
                
        if(curarea->headertype==HEADERTOP) {
                uiBlockSetDirection(block, UI_DOWN);
@@ -623,7 +621,7 @@ static uiBlock *view3d_select_meshmenu(void *arg_unused)
        return block;
 }
 
-static void do_view3d_select_curvemenu(void *arg, int event)
+void do_view3d_select_curvemenu(void *arg, int event)
 {
 //     extern void borderselect(void);
 
@@ -687,7 +685,6 @@ static uiBlock *view3d_select_curvemenu(void *arg_unused)
 
 static void do_view3d_select_metaballmenu(void *arg, int event)
 {
-//XXX  extern void borderselect(void);
 
        switch(event) {
                case 0: /* border select */
@@ -1009,7 +1006,7 @@ static void do_view3d_edit_objectmenu(void *arg, int event)
        switch(event) {
         
        case 0: /* transform    properties*/
-                       blenderqread(NKEY, 1);
+               mainqenter(NKEY, 1);
                break;
        case 1: /* delete */
                delete_context_selected();
@@ -1196,7 +1193,7 @@ static uiBlock *view3d_edit_mesh_undohistorymenu(void *arg_unused)
        return block;
 }
 
-static void do_view3d_edit_mesh_verticesmenu(void *arg, int event)
+void do_view3d_edit_mesh_verticesmenu(void *arg, int event)
 {
        extern float doublimit;
        
@@ -1250,7 +1247,7 @@ static uiBlock *view3d_edit_mesh_verticesmenu(void *arg_unused)
        return block;
 }
 
-static void do_view3d_edit_mesh_edgesmenu(void *arg, int event)
+void do_view3d_edit_mesh_edgesmenu(void *arg, int event)
 {
        extern short editbutflag;
        float fac;
@@ -1279,6 +1276,9 @@ static void do_view3d_edit_mesh_edgesmenu(void *arg, int event)
        case 4: /* Loop subdivide */
                loop('c');
                break;
+       case 5: /* Make Edge/Face */
+               addedgevlak_mesh();
+               break;
        }
        allqueue(REDRAWVIEW3D, 0);
 }
@@ -1291,6 +1291,8 @@ static uiBlock *view3d_edit_mesh_edgesmenu(void *arg_unused)
        block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mesh_edgesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
        uiBlockSetButmFunc(block, do_view3d_edit_mesh_edgesmenu, NULL);
        
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F",                       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
+       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Loop Subdivide...|Ctrl R",                       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Knife Subdivide...|Shift K",                     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
        
@@ -1326,7 +1328,10 @@ static void do_view3d_edit_mesh_facesmenu(void *arg, int event)
        case 4: /* Flip triangle edges */
                edge_flip();
                break;
-               }
+       case 5: /* Make Edge/Face */
+               addedgevlak_mesh();
+               break;
+       }
        allqueue(REDRAWVIEW3D, 0);
 }
 
@@ -1338,6 +1343,7 @@ static uiBlock *view3d_edit_mesh_facesmenu(void *arg_unused)
        block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mesh_facesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
        uiBlockSetButmFunc(block, do_view3d_edit_mesh_facesmenu, NULL);
        
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F",               0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Fill|Shift F",                   0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Beauty Fill|Alt F",              0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
        
@@ -1352,7 +1358,7 @@ static uiBlock *view3d_edit_mesh_facesmenu(void *arg_unused)
        return block;
 }
 
-static void do_view3d_edit_mesh_normalsmenu(void *arg, int event)
+void do_view3d_edit_mesh_normalsmenu(void *arg, int event)
 {
        switch(event) {
        case 0: /* flip */
@@ -1414,9 +1420,9 @@ static uiBlock *view3d_edit_mesh_showhidemenu(void *arg_unused)
        block= uiNewBlock(&curarea->uiblocks, "view3d_edit_mesh_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
        uiBlockSetButmFunc(block, do_view3d_edit_mesh_showhidemenu, NULL);
        
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden Vertices",                   0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected Vertices|H",               0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected Vertices|Shift H",               0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H",                      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H",                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected|Shift H",                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
 
        uiBlockSetDirection(block, UI_RIGHT);
        uiTextBoundsBlock(block, 60);
@@ -1447,9 +1453,6 @@ static void do_view3d_edit_meshmenu(void *arg, int event)
        case 6: /* duplicate */
                duplicate_context_selected();
                break;
-       case 7: /* Make Edge/Face */
-               addedgevlak_mesh();
-               break;
        case 8: /* delete */
                delete_context_selected();
                break;
@@ -1584,12 +1587,10 @@ static uiBlock *view3d_edit_curve_controlpointsmenu(void *arg_unused)
                
                uiDefBut(block, SEPR, 0, "",                    0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
                
+               uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Autmatic|Shift H",                               0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
                uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Toggle Free/Aligned|H",                  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
                uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Vector|V",                       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
                
-               uiDefBut(block, SEPR, 0, "",                    0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-               
-               uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Smooth|Shift H",                         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
        }
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Vertex Parent|Ctrl P",              0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
        
@@ -1598,7 +1599,7 @@ static uiBlock *view3d_edit_curve_controlpointsmenu(void *arg_unused)
        return block;
 }
 
-static void do_view3d_edit_curve_segmentsmenu(void *arg, int event)
+void do_view3d_edit_curve_segmentsmenu(void *arg, int event)
 {
        switch(event) {
        case 0: /* subdivide */
@@ -1651,8 +1652,8 @@ static uiBlock *view3d_edit_curve_showhidemenu(void *arg_unused)
        block= uiNewBlock(&curarea->uiblocks, "view3d_edit_curve_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
        uiBlockSetButmFunc(block, do_view3d_edit_curve_showhidemenu, NULL);
        
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden Control Points|Alt H",                       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected Control Points|H",         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H",                      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H",                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
        if (OBACT->type == OB_SURF) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected Control Points|Shift H",             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
        
 
@@ -1668,7 +1669,7 @@ static void do_view3d_edit_curvemenu(void *arg, int event)
                remake_editNurb();
                break;
        case 1: /* transformation properties */
-               blenderqread(NKEY, 1);
+               mainqenter(NKEY, 1);
                break;
        case 2: /* insert keyframe */
                common_insertkey();
@@ -1718,11 +1719,11 @@ static uiBlock *view3d_edit_curvemenu(void *arg_unused)
        block= uiNewBlock(&curarea->uiblocks, "view3d_edit_curvemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
        uiBlockSetButmFunc(block, do_view3d_edit_curvemenu, NULL);
        
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U",         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reload Original|U",              0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
        
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
        
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Transform Properties...|N",              0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties...|N",          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Snap...|Shift S",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
        
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -2041,7 +2042,7 @@ static void do_view3d_edit_armaturemenu(void *arg, int event)
                remake_editArmature();
                break;
        case 1: /* transformation properties */
-               blenderqread(NKEY, 1);
+               mainqenter(NKEY, 1);
                break;
        case 2: /* snap */
                snapmenu();
@@ -2077,7 +2078,7 @@ static uiBlock *view3d_edit_armaturemenu(void *arg_unused)
        
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
        
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Snap...|Shift S",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
        
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -2146,7 +2147,7 @@ static void do_view3d_pose_armaturemenu(void *arg, int event)
        switch(event) {
        
        case 0: /* transform properties */
-               blenderqread(NKEY, 1);
+               mainqenter(NKEY, 1);
                break;
        case 1: /* copy current pose */
                copy_posebuf();
@@ -2172,7 +2173,7 @@ static uiBlock *view3d_pose_armaturemenu(void *arg_unused)
        block= uiNewBlock(&curarea->uiblocks, "view3d_pose_armaturemenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
        uiBlockSetButmFunc(block, do_view3d_pose_armaturemenu, NULL);
        
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
        uiDefIconTextBlockBut(block, view3d_pose_armature_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
        
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
index 484d5007ab58da546332d9f0f3e3059df449ee32..c4c8c6bd93e018f5438ae704650cd59300a40d06 100644 (file)
@@ -878,8 +878,7 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                        case AKEY:
                                if(G.qual & LR_CTRLKEY) apply_object(); // also with shift!
                                else if((G.qual==LR_SHIFTKEY)) {
-                                       tbox_setmain(0);
-                                       toolbox();
+                                       toolbox_n_add();
                                }
                                else {
                                        if(G.obedit) {
index 240856328ff5ee556c8ab7313c306389d79b8867..9ef61cee5ec24689fe693a11a05a34ed8a5f6a89 100644 (file)
@@ -58,6 +58,7 @@
 
 #include "DNA_image_types.h"
 #include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_userdef_types.h"
@@ -69,6 +70,8 @@
 
 #include "BKE_plugin_types.h"
 #include "BKE_utildefines.h"
+#include "BKE_mesh.h"
+#include "BKE_displist.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
 
 #include "BSE_editipo.h"
 #include "BSE_buttons.h"
 #include "BSE_filesel.h"
+#include "BSE_edit.h"
 #include "BSE_headerbuttons.h"
 
 #include "IMB_imbuf.h"
@@ -1539,14 +1543,14 @@ static void tb_do_hotkey(void *arg, int event)
        else if(event & TB_PAD) {
                event &= ~TB_PAD;
                switch(event) {
-               case '0': event= PAD0; break;
-               case '5': event= PAD5; break;
-               case '/': event= PADSLASHKEY; break;
-               case '.': event= PADPERIOD; break;
-               case '*': event= PADASTERKEY; break;
-               case 'h': event= HOMEKEY; break;
-               case 'u': event= PAGEUPKEY; break;
-               case 'd': event= PAGEDOWNKEY; break;
+               case '0': key= PAD0; break;
+               case '5': key= PAD5; break;
+               case '/': key= PADSLASHKEY; break;
+               case '.': key= PADPERIOD; break;
+               case '*': key= PADASTERKEY; break;
+               case 'h': key= HOMEKEY; break;
+               case 'u': key= PAGEUPKEY; break;
+               case 'd': key= PAGEDOWNKEY; break;
                }
        }
        else asciitoraw(event, &key, &qual2);
@@ -1571,18 +1575,120 @@ static TBitem tb_object_select[]= {
 {  -1, "",                     0, tb_do_hotkey}};
 
 
+static TBitem tb_mesh_select[]= {
+{      0, "Border Select|B",   1, NULL},
+{      0, "SEPR",                              0, NULL},
+{      0, "(De)select All|A",  2, NULL},
+{      0, "Inverse",   3, NULL},
+{      0, "SEPR",                              0, NULL},
+{      0, "Face Loop|Shift R",         4, NULL},
+{      0, "Linked Vertices|Ctrl L", 5, NULL},
+{  -1, "",                     0, do_view3d_select_meshmenu}};
+
+
+static TBitem tb_curve_select[]= {
+{      0, "Border Select|B",   0, NULL},
+{      0, "SEPR",                              0, NULL},
+{      0, "(De)select All|A",  2, NULL},
+{      0, "Inverse",                   3, NULL},
+{      0, "Row",                       5, NULL},
+{  -1, "",                             0, do_view3d_select_curvemenu}};
+
+static TBitem tb__select[]= {
+{      0, "Border Select|B",   'b', NULL},
+{      0, "(De)select All|A",  'a', NULL},
+{  -1, "",                     0, tb_do_hotkey}};
+
+
 /* *************Edit ********** */
 
+static TBitem tb_edit[]= {
+{      0, "Exit Editmode|Tab",         TB_TAB, NULL},
+{  -1, "",                     0, tb_do_hotkey}};
+
+static TBitem tb_edit_hide[]= {
+{      0, "Show Hidden|Alt H",                 TB_ALT|'h',             NULL},
+{      0, "Hide Selected|H",                   'h',            NULL},
+{      0, "Hide Deselected|Shift H",   'H',            NULL},
+{  -1, "",                     0, tb_do_hotkey}};
+
+static TBitem tb_curve_edit_seg[]= {
+{      0, "Subdivide",                 0, NULL},
+{      0, "Switch directoin",  1, NULL},
+{  -1, "",                     0, do_view3d_edit_curve_segmentsmenu}};
+
+static TBitem tb_curve_edit_cv[]= {
+{      0, "Tilt|T",    't', NULL},
+{      0, "Clear Tilt|Alt T",                  TB_ALT|'t', NULL},
+{      0, "SEPR",                                                              0, NULL},
+{      0, "Automatic|Shift H",                 'H', NULL},
+{      0, "Toggle Free/Aligned|H",     'h', NULL},
+{      0, "Vector|V",                                  TB_ALT|'t', NULL},
+{      0, "SEPR",                                                              0, NULL},
+{      0, "Make Vertex Parent|Ctrl P", TB_CTRL|'p', NULL},
+{  -1, "",                     0, tb_do_hotkey}};
+
+
+static TBitem tb_curve_edit[]= {
+{      0, "Exit Editmode|Tab",         TB_TAB, NULL},
+{      0, "Extrude|E",                 'e',            NULL},
+{      0, "Make Segment|F",    'f',            NULL},
+{      0, "Toggle Cyclic|F",   'c',            NULL},
+{      0, "SEPR",                                                              0, NULL},
+{      0, "Control Points",    0,              tb_curve_edit_cv},
+{      0, "Segments",  0,              tb_curve_edit_seg},
+{      0, "SEPR",                                                              0, NULL},
+{      0, "Show/Hide",         0,              tb_curve_edit_seg},
+{  -1, "",                     0, tb_do_hotkey}};
+
+
+static TBitem tb_mesh_edit_vertex[]= {
+{      0, "Merge...|Alt M",            5, NULL},
+{      0, "Split|Y",                           4,              NULL},
+{      0, "Separate|P",                        3,              NULL},
+{      0, "Smooth|Alt M",                      2, NULL},
+{      0, "Remove Doubles|Alt M",                      1, NULL},
+{      0, "Make Vertex Parent|Ctrl P",         0, NULL},
+{  -1, "",                     0, do_view3d_edit_mesh_verticesmenu}};
+
+static TBitem tb_mesh_edit_edge[]= {
+{      0, "Make Edge/Face|F",                  5,              NULL},
+{      0, "Loop SubdivideCtrl R",              4,              NULL},
+{      0, "Knife Subdivide...|Shift K",        3,              NULL},
+{      0, "SEPR",                                                              0, NULL},
+{      0, "Subdivide",                         2,              NULL},
+{      0, "Subdivide Fractal",         1,              NULL},
+{      0, "Subdivide Smooth",          0,              NULL},
+{  -1, "",                     0, do_view3d_edit_mesh_edgesmenu}};
+
+static TBitem tb_mesh_edit_face[]= {
+{      0, "Make Edge/Face|F",                  'f',            NULL},
+{      0, "Fill|Shift F",                              'F',            NULL},
+{      0, "Beaty Fill|Alt F",                  TB_ALT|'f',             NULL},
+{      0, "Convert to Triangles|Ctrl T",       TB_CTRL|'t',            NULL},
+{      0, "Convert to Quads|Alt J",            TB_ALT|'j',             NULL},
+{      0, "Flip Triangle Edges|Ctrl F",        TB_CTRL|'f',            NULL},
+{  -1, "",                     0, tb_do_hotkey}};
+
+
+static TBitem tb_mesh_edit_normal[]= {
+{      0, "Flip",                              1,              NULL},
+{      0, "Recalc Inside",     1,              NULL},
+{      0, "Recalc Outside",    1,              NULL},
+{  -1, "",                     0, do_view3d_edit_mesh_normalsmenu}};
+
 
 static TBitem tb_mesh_edit[]= {
 {      0, "Exit Editmode|Tab",         TB_TAB, NULL},
 {      0, "Undo|U",                    'u',            NULL},
 {      0, "Redo|Shift U",              'U',            NULL},
-{      0, "Make Edge/Face|F",  'f',            NULL},
 {      0, "Extrude|E",         'e',            NULL},
-{      0, "Split|Y",   'y',            NULL},
-{      0, "Separate|P",        'p',            NULL},
-{      0, "Tools Menu|W",      'w',            NULL},
+{      0, "Vertices",          0,              tb_mesh_edit_vertex},
+{      0, "Edges",             0,              tb_mesh_edit_edge},
+{      0, "Faces",             0,              tb_mesh_edit_face},
+{      0, "Normals",           0,              tb_mesh_edit_normal},
+{      0, "SEPR",                      0, NULL},
+{      0, "Show/Hide",         0,              tb_edit_hide},
 {  -1, "",                     0, tb_do_hotkey}};
 
 
@@ -1595,26 +1701,51 @@ static TBitem tb_object_ipo[]= {
 
 static TBitem tb_object_edit[]= {
 {      0, "Enter Editmode|Tab",        TB_TAB, NULL},
+{      0, "SEPR",                                                              0, NULL},
 {      0, "Insert Key...|I",   'i', NULL},
 {      0, "Object Keys",       0, tb_object_ipo},
+{      0, "SEPR",                                                              0, NULL},
 {      0, "Boolean...|W",                      'w', NULL},
 {      0, "Join Objects|Ctrl J",       TB_CTRL|'j', NULL},
-{      0, "Convert Object...|Alt C", 'i', NULL},
+{      0, "Convert Object...|Alt C", TB_ALT|'c', NULL},
 {  -1, "",                     0, tb_do_hotkey}};
 
 
-/* *************Mesh ********** */
+/* ************* Type  ********** */
+
+static void tb_do_mesh(void *arg, int event){
+       Mesh *me= get_mesh(OBACT);
+       switch(event) {
+       case 1: duplicate_context_selected(); break;
+       case 2: delete_context_selected(); break;
+       case 3: G.f ^= G_DRAWEDGES; break;
+       case 4: G.f ^= G_DRAWFACES; break;
+       case 5: G.f ^= G_DRAWNORMALS; break;
+       case 6: me->flag ^= ME_SUBSURF; makeDispList(OBACT); break;
+       case 7: me->flag ^= ME_OPT_EDGES; makeDispList(OBACT); break;
+       }
+       addqueue(curarea->win, REDRAW, 1);
+}
 
 static TBitem tb_mesh[]= {
+{      0, "Duplicate|Shift D",                 1,              NULL},
+{      0, "Delete|X",                                  2,              NULL},
+{      0, "SEPR",                                              0, NULL},
+{      0, "Show/Hide Edges",                   3,              NULL},
+{      0, "Show/Hide Faces",                   4,              NULL},
+{      0, "Show/Hide Normals",                 5,              NULL},
+{      0, "SEPR",                                              0, NULL},
+{      0, "Subdivision Surface",               6,              NULL},
+{      0, "Subd.Surf. Optimal",                7,              NULL},
+{  -1, "",                     0, tb_do_mesh}};
+
+static TBitem tb_obdata[]= {
 {      0, "Duplicate|Shift D",                 'D',            NULL},
 {      0, "Delete|X",                                  'x',            NULL},
 
 {  -1, "",                     0, tb_do_hotkey}};
 
 
-
-/* *************Object ********** */
-
 static TBitem tb_object[]= {
 {      0, "Duplicate|Shift D",                 'D',            NULL},
 {      0, "Duplicate Linked|Alt D",    TB_ALT|'D', NULL},
@@ -1626,6 +1757,7 @@ static TBitem tb_object[]= {
 {      0, "Clear Parent|Alt P",                TB_ALT|'p', NULL},
 {      0, "Make Track|Ctrl T",                 TB_CTRL|'t', NULL},
 {      0, "Clear Track|Alt T",                 TB_ALT|'t', NULL},
+{      0, "SEPR",                                                              0, NULL},
 {      0, "Copy Properties...|Ctrl C", TB_CTRL|'c', NULL},
 {      0, "Move to Layer...|M",                'm', NULL},
 {  -1, "",                     0, tb_do_hotkey}};
@@ -1662,18 +1794,45 @@ static TBitem tb_view[]= {
 /* *************TRANSFORM ********** */
 
 static TBitem tb_transform[]= {
-{      0, "Grabber|g", 'g', NULL},
-{      0, "Rotate|r",  'r', NULL},
-{      0, "Scale|s",   's', NULL},
-{      0, "SEPR",              0, NULL},
+{      0, "Grabber|g",         'g', NULL},
+{      0, "Rotate|r",          'r', NULL},
+{      0, "Scale|s",           's', NULL},
+{      0, "SEPR",                                      0, NULL},
 {      ICON_MENU_PANEL, "Properties|n", 'n', NULL},
-{      0, "Snap...|Shift S", 'S', NULL},
-{      0, "SEPR",              0, NULL},
-{      0, "Clear Location", TB_ALT|'g', NULL},
-{      0, "Clear Rotation", TB_ALT|'r', NULL},
-{      0, "Clear Size",        TB_ALT|'s', NULL},
+{      0, "Snap...|Shift S",           'S', NULL},
+{      0, "SEPR",                                      0, NULL},
+{      0, "Clear Location",            TB_ALT|'g', NULL},
+{      0, "Clear Rotation",            TB_ALT|'r', NULL},
+{      0, "Clear Size",                        TB_ALT|'s', NULL},
+{      0, "Apply Rot/Size|Ctrl A", TB_CTRL|'a', NULL},
+{      0, "Apply Deform|Shift Ctrl A",         TB_CTRL|'A', NULL},
+{  -1, "",                     0, tb_do_hotkey}};
+
+static TBitem tb_transform_editmode1[]= {
+{      0, "Grabber|g",         'g', NULL},
+{      0, "Rotate|r",          'r', NULL},
+{      0, "Scale|s",           's', NULL},
+{      0, "SEPR",                                      0, NULL},
+{      0, "Shrink/Fatten|Alt S", TB_ALT|'s', NULL},
+{      0, "Shear|Ctrl S", TB_CTRL|'s', NULL},
+{      0, "Warp|Shift W",      'W', NULL},
+{      0, "SEPR",                                      0, NULL},
+{      ICON_MENU_PANEL, "Properties|n", 'n', NULL},
+{      0, "Snap...|Shift S",           'S', NULL},
+{      0, "Proportional Edit|O",       'o',            NULL},
+{  -1, "",                     0, tb_do_hotkey}};
+
+
+static TBitem tb_transform_editmode2[]= {
+{      0, "Grabber|g",         'g', NULL},
+{      0, "Rotate|r",          'r', NULL},
+{      0, "Scale|s",           's', NULL},
+{      0, "SEPR",                                      0, NULL},
+{      ICON_MENU_PANEL, "Properties|n", 'n', NULL},
+{      0, "Snap...|Shift S",           'S', NULL},
 {  -1, "",                     0, tb_do_hotkey}};
 
+
 /* *************ADD ********** */
 
 static TBitem addmenu_mesh[]= {
@@ -1730,12 +1889,8 @@ static TBitem tb_add[]= {
 {      0, "Lattice",   9, NULL},
 {  -1, "",                     0, do_info_addmenu}};
 
-static TBitem tb_test[]= {
-{      0, "test",      0, NULL},
-{      0, "test",      1, NULL},
-{      0, "test",      2, NULL},
-{      0, "test", 3, NULL},
-{      0, "test",      4, NULL},
+static TBitem tb_empty[]= {
+{      0, "Nothing...",        0, NULL},
 {  -1, "",             0, NULL}};
 
 
@@ -1822,20 +1977,45 @@ void toolbox_n(void)
                if(G.obedit) {
                        if(G.obedit->type==OB_MESH) {
                                menu1= tb_mesh; str1= "Mesh";
-                               menu2= addmenu_mesh; str2= "Add";
-                               menu4= tb_mesh_edit; str4= "Edit";
+                               menu2= addmenu_mesh; 
+                               menu3= tb_mesh_select;
+                               menu4= tb_mesh_edit; 
+                               menu5= tb_transform_editmode1;
                        }
                        else if(G.obedit->type==OB_CURVE) {
-                               menu1= tb_test; str1= "Curve";
-                               menu2= addmenu_curve; str2= "Add";
+                               menu1= tb_obdata; str1= "Curve";
+                               menu2= addmenu_curve;
+                               menu3= tb_curve_select;
+                               menu4= tb_curve_edit;
+                               menu5= tb_transform_editmode1;
                        }
                        else if(G.obedit->type==OB_SURF) {
-                               menu1= tb_test; str1= "Surface";
-                               menu2= addmenu_surf; str2= "Add";
+                               menu1= tb_obdata; str1= "Surface";
+                               menu2= addmenu_surf; 
+                               menu3= tb_curve_select;
+                               menu4= tb_curve_edit;
+                               menu5= tb_transform_editmode1;
                        }
                        else if(G.obedit->type==OB_MBALL) {
-                               menu1= tb_test; str1= "Meta";
-                               menu2= addmenu_meta; str2= "Add";
+                               menu1= tb_obdata; str1= "Meta";
+                               menu2= addmenu_meta;
+                               menu3= tb__select;
+                               menu4= tb_edit;
+                               menu5= tb_transform_editmode2;
+                       }
+                       else if(G.obedit->type==OB_ARMATURE) {
+                               menu1= tb_obdata;str1= "Armature";
+                               menu2= tb_empty;
+                               menu3= tb__select;
+                               menu4= tb_edit;
+                               menu5= tb_transform_editmode2;
+                       }
+                       else if(G.obedit->type==OB_LATTICE) {
+                               menu1= tb_empty;str1= "Lattice";
+                               menu2= tb_empty;
+                               menu3= tb__select;
+                               menu4= tb_edit;
+                               menu5= tb_transform_editmode1;
                        }
                        
                }
@@ -1848,6 +2028,16 @@ void toolbox_n(void)
        
        /* create the main buttons menu */
        if(tot==6) {
+       
+               /* check if it fits */
+               if(mval[0]-1.5*dx+tb_mainx < 6) mval[0]= 6 + 1.5*dx -tb_mainx;
+               else if(mval[0]+1.5*dx+tb_mainx > G.curscreen->sizex-6) 
+                       mval[0]= G.curscreen->sizex-6-1.5*dx-tb_mainx;
+
+               if(mval[1]-20+tb_mainy < 6) mval[1]= 6+20 -tb_mainy;
+               else if(mval[1]+20+tb_mainy > G.curscreen->sizey-6) 
+                       mval[1]= G.curscreen->sizey-6-20-tb_mainy;
+       
                but=uiDefBlockBut(block, tb_makemenu, menu1, str1,      mval[0]-1.5*dx+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
                uiButSetFlag(but, UI_MAKE_TOP|UI_MAKE_RIGHT);
                uiButSetFunc(but, store_main, (void *)dx, (void *)-5);
@@ -1879,5 +2069,10 @@ void toolbox_n(void)
        mywinset(curarea->win);
 }
 
-
+void toolbox_n_add(void)
+{
+       tb_mainx= 0;
+       tb_mainy= -5;
+       toolbox_n();
+}