fix for linking on msvc with own recent changes.
[blender.git] / source / blender / editors / space_node / node_header.c
index ed6a45e97361184c0d7916d3c3978ab6585e39da..1ad5954b56eff256e2ad1220541775c92a7349ab 100644 (file)
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2008 Blender Foundation.
  * All rights reserved.
 
 #include "DNA_space_types.h"
 #include "DNA_node_types.h"
-#include "DNA_material_types.h"
-#include "DNA_texture_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
-#include "DNA_windowmanager_types.h"
 
 #include "MEM_guardedalloc.h"
 
 #include "BKE_screen.h"
 #include "BKE_node.h"
 #include "BKE_main.h"
-#include "BKE_utildefines.h"
 
-#include "ED_screen.h"
-#include "ED_types.h"
-#include "ED_util.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
 
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
 
 #include "UI_interface.h"
-#include "UI_resources.h"
 #include "UI_view2d.h"
 
 #include "node_intern.h"
 
 /* ************************ add menu *********************** */
 
-static void do_node_add(bContext *C, void *arg, int event)
+static void do_node_add(bContext *C, void *UNUSED(arg), int event)
 {
        SpaceNode *snode= CTX_wm_space_node(C);
        bNode *node;
@@ -136,7 +126,7 @@ static void node_auto_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclas
 
                for(tot=0, a=0; ngroup; ngroup= ngroup->id.next, tot++) {
                        if(ngroup->type==ntree->type) {
-                               uiItemV(layout, ngroup->id.name+2, 0, NODE_GROUP_MENU+tot);
+                               uiItemV(layout, ngroup->id.name+2, ICON_NULL, NODE_GROUP_MENU+tot);
                                a++;
                        }
                }
@@ -148,11 +138,11 @@ static void node_auto_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclas
                for(a=0, type= ntree->alltypes.first; type; type=type->next) {
                        if(type->nclass == nodeclass && type->name) {
                                if(type->type == NODE_DYNAMIC) {
-                                       uiItemV(layout, type->name, 0, NODE_DYNAMIC_MENU+script);
+                                       uiItemV(layout, type->name, ICON_NULL, NODE_DYNAMIC_MENU+script);
                                        script++;
                                }
                                else
-                                       uiItemV(layout, type->name, 0, type->type);
+                                       uiItemV(layout, type->name, ICON_NULL, type->type);
 
                                a++;
                        }
@@ -164,6 +154,18 @@ static void node_menu_add(const bContext *C, Menu *menu)
 {
        uiLayout *layout= menu->layout;
        SpaceNode *snode= CTX_wm_space_node(C);
+       ScrArea *sa= CTX_wm_area(C);
+       ARegion *ar;
+
+       /* get location to add node at mouse */
+       for(ar=sa->regionbase.first; ar; ar=ar->next) {
+               if(ar->regiontype == RGN_TYPE_WINDOW) {
+                       wmWindow *win= CTX_wm_window(C);
+                       UI_view2d_region_to_view(&ar->v2d,
+                               win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin, 
+                               &snode->mx, &snode->my);
+               }
+       }
 
        if(!snode->nodetree)
                uiLayoutSetActive(layout, 0);
@@ -200,7 +202,7 @@ static void node_menu_add(const bContext *C, Menu *menu)
        }
 }
 
-void node_menus_register(ARegionType *art)
+void node_menus_register(void)
 {
        MenuType *mt;