doxygen: blender/editors tagged.
[blender.git] / source / blender / editors / gpencil / gpencil_buttons.c
index c1ac863b36255b429989cda51c5952c163fd5b2a..47a9c007951128bd9d981de79d87886e8146eff4 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * ***** END GPL LICENSE BLOCK *****
  */
+
+/** \file blender/editors/gpencil/gpencil_buttons.c
+ *  \ingroup edgpencil
+ */
+
  
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stddef.h>
 
-#include "MEM_guardedalloc.h"
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_gpencil.h"
-#include "BKE_utildefines.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
 
 #include "RNA_access.h"
 
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
 
 #include "ED_gpencil.h"
 
@@ -70,7 +71,7 @@
 /* These are just 'dummy wrappers' around gpencil api calls */
 
 /* make layer active one after being clicked on */
-void gp_ui_activelayer_cb (bContext *C, void *gpd, void *gpl)
+static void gp_ui_activelayer_cb (bContext *C, void *gpd, void *gpl)
 {
        gpencil_layer_setactive(gpd, gpl);
        
@@ -78,7 +79,7 @@ void gp_ui_activelayer_cb (bContext *C, void *gpd, void *gpl)
 }
 
 /* delete 'active' layer */
-void gp_ui_dellayer_cb (bContext *C, void *gpd, void *gpl)
+static void gp_ui_dellayer_cb (bContext *C, void *gpd, void *gpl)
 {
        /* make sure the layer we want to remove is the active one */
        gpencil_layer_setactive(gpd, gpl); 
@@ -142,10 +143,10 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl)
                        sprintf(name, "%s (Hidden)", gpl->info);
                else
                        sprintf(name, "%s (Locked)", gpl->info);
-               uiItemL(subrow, name, 0);
+               uiItemL(subrow, name, ICON_NONE);
                        
                /* delete button (only if hidden but not locked!) */
-               if ((gpl->flag & GP_LAYER_HIDE) & !(gpl->flag & GP_LAYER_LOCKED)) {
+               if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) {
                        /* right-align ............................... */
                        subrow= uiLayoutRow(row, 1);
                        uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
@@ -164,12 +165,12 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl)
                /* frame locking */
                // TODO: this needs its own icons...
                icon= (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION;
-               uiItemR(subrow, &ptr, "frame_lock", 0, "", icon); 
+               uiItemR(subrow, &ptr, "lock_frame", 0, "", icon); 
                
                uiBlockSetEmboss(block, UI_EMBOSS);
                
                /* name */
-               uiItemR(subrow, &ptr, "info", 0, "", 0);
+               uiItemR(subrow, &ptr, "info", 0, "", ICON_NONE);
                
                /* delete 'button' */
                uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -193,17 +194,17 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl)
                
                /* color */
                subcol= uiLayoutColumn(col, 1);
-                       uiItemR(subcol, &ptr, "color", 0, "", 0);
-                       uiItemR(subcol, &ptr, "opacity", UI_ITEM_R_SLIDER, NULL, 0);
+                       uiItemR(subcol, &ptr, "color", 0, "", ICON_NONE);
+                       uiItemR(subcol, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
                        
                /* stroke thickness */
                subcol= uiLayoutColumn(col, 1);
-                       uiItemR(subcol, &ptr, "line_thickness", UI_ITEM_R_SLIDER, NULL, 0);
+                       uiItemR(subcol, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
                
                /* debugging options */
                if (G.f & G_DEBUG) {
                        subcol= uiLayoutColumn(col, 1);
-                               uiItemR(subcol, &ptr, "show_points", 0, NULL, 0);
+                               uiItemR(subcol, &ptr, "show_points", 0, NULL, ICON_NONE);
                }
                
                /* right column ................... */
@@ -211,13 +212,9 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl)
                
                /* onion-skinning */
                subcol= uiLayoutColumn(col, 1);
-                       uiItemR(subcol, &ptr, "use_onion_skinning", 0, "Onion Skinning", 0);
-                       uiItemR(subcol, &ptr, "max_ghost_range", 0, "Frames", 0); // XXX shorter name here? i.e. GStep
+                       uiItemR(subcol, &ptr, "use_onion_skinning", 0, "Onion Skinning", ICON_NONE);
+                       uiItemR(subcol, &ptr, "ghost_range_max", 0, "Frames", ICON_NONE); // XXX shorter name here? i.e. GStep
                
-               /* additional options... */
-               subcol= uiLayoutColumn(col, 1);
-                       uiItemO(subcol, "Delete Frame", 0, "GPENCIL_OT_active_frame_delete");
-                       uiItemO(subcol, "Convert...", 0, "GPENCIL_OT_convert");
        }
 } 
 
@@ -243,11 +240,14 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi
        col= uiLayoutColumn(layout, 0);
                /* current Grease Pencil block */
                // TODO: show some info about who owns this?
-               uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_add", NULL, "GPENCIL_OT_data_unlink", NULL); 
+               uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_add", NULL, "GPENCIL_OT_data_unlink"); 
                
                /* add new layer button - can be used even when no data, since it can add a new block too */
-               uiItemO(col, NULL, 0, "GPENCIL_OT_layer_add");
-       
+               uiItemO(col, "New Layer", ICON_NONE, "GPENCIL_OT_layer_add");
+               row= uiLayoutRow(col, 1);
+               uiItemO(row, "Delete Frame", ICON_NONE, "GPENCIL_OT_active_frame_delete");
+               uiItemO(row, "Convert", ICON_NONE, "GPENCIL_OT_convert");
+               
        /* sanity checks... */
        if (gpd == NULL)
                return;
@@ -261,7 +261,7 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi
        /* draw gpd drawing settings first ------------------------------------- */
        col= uiLayoutColumn(layout, 1);
                /* label */
-               uiItemL(col, "Drawing Settings:", 0);
+               uiItemL(col, "Drawing Settings:", ICON_NONE);
                
                /* check whether advanced 3D-View drawing space options can be used */
                if (CTX_wm_view3d(C)) {
@@ -273,16 +273,16 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi
                
                /* drawing space options */
                row= uiLayoutRow(col, 1);
-                       uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "VIEW", NULL, 0);
-                       uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "CURSOR", NULL, 0);
+                       uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "VIEW", NULL, ICON_NONE);
+                       uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "CURSOR", NULL, ICON_NONE);
                row= uiLayoutRow(col, 1);
                        uiLayoutSetActive(row, v3d_stroke_opts);
-                       uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "SURFACE", NULL, 0);
-                       uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "STROKE", NULL, 0);
+                       uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "SURFACE", NULL, ICON_NONE);
+                       uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "STROKE", NULL, ICON_NONE);
                
                row= uiLayoutRow(col, 0);
                        uiLayoutSetActive(row, v3d_stroke_opts==STROKE_OPTS_V3D_ON);
-                       uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, 0);
+                       uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, ICON_NONE);
 }