Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Wed, 20 Jun 2018 13:50:54 +0000 (15:50 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 20 Jun 2018 13:50:54 +0000 (15:50 +0200)
1  2 
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_intern.h
source/blender/editors/screen/screen_ops.c

index 8c9182abad000a98608761f93fbc718b8ef758c7,3306003f18cfd57020cd5d1eaf87286fe6cc123f..53abe3ed4eaba58db2d3b5da92733d852fcda5a7
@@@ -991,24 -1093,21 +991,24 @@@ static void screen_cursor_set(wmWindow 
  
  /* called in wm_event_system.c. sets state vars in screen, cursors */
  /* event type is mouse move */
 -void ED_screen_set_subwinactive(bContext *C, const wmEvent *event)
 +void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
  {
 -      wmWindow *win = CTX_wm_window(C);
 +      bScreen *scr = WM_window_get_active_screen(win);
  
 -      if (win->screen) {
 -              bScreen *scr = win->screen;
 -              ScrArea *sa;
 +      if (scr) {
 +              ScrArea *sa = NULL;
                ARegion *ar;
 -              int oldswin = scr->subwinactive;
 +              ARegion *old_ar = scr->active_region;
  
 -              for (sa = scr->areabase.first; sa; sa = sa->next) {
 -                      if (event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
 -                              if (event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
 -                                      if (NULL == ED_area_actionzone_refresh_xy(sa, &event->x))
 +              ED_screen_areas_iter(win, scr, area_iter) {
 +                      if (xy[0] > area_iter->totrct.xmin && xy[0] < area_iter->totrct.xmax) {
 +                              if (xy[1] > area_iter->totrct.ymin && xy[1] < area_iter->totrct.ymax) {
-                                       if (ED_area_actionzone_find_xy(area_iter, xy) == NULL) {
++                                      if (ED_area_actionzone_refresh_xy(area_iter, xy) == NULL) {
 +                                              sa = area_iter;
                                                break;
 +                                      }
 +                              }
 +                      }
                }
                if (sa) {
                        /* make overlap active when mouse over */
index 89c2b1563c4f7046a894f43bb15c909d69509f04,63d616e986e8474ab20e3e3016310a7389218bd0..2c343fb9d70fd97acbae5585221594a5db59f2fb
@@@ -56,18 -50,19 +56,19 @@@ bScreen    *screen_change_prepare(bScre
  ScrArea    *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge);
  int         screen_area_join(struct bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2);
  int         area_getorientation(ScrArea *sa, ScrArea *sb);
 -void        select_connected_scredge(bScreen *sc, ScrEdge *edge);
 +void        select_connected_scredge(const wmWindow *win, ScrEdge *edge);
  
 -void        removenotused_scrverts(bScreen *sc);
 -void        removedouble_scrverts(bScreen *sc);
 -void        removedouble_scredges(bScreen *sc);
 -void        removenotused_scredges(bScreen *sc);
  bool        scredge_is_horizontal(ScrEdge *se);
 -ScrEdge    *screen_find_active_scredge(bScreen *sc,
 -                                       const int winsize_x, const int winsize_y,
 -                                       const int mx, const int my);
 +ScrEdge     *screen_area_map_find_active_scredge(
 +        const struct ScrAreaMap *area_map,
 +        const rcti *bounds_rect,
 +        const int mx, const int my);
 +ScrEdge    *screen_find_active_scredge(
 +        const wmWindow *win, const bScreen *screen,
 +        const int mx, const int my);
  
  struct AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2]);
+ struct AZone *ED_area_actionzone_refresh_xy(ScrArea *sa, const int xy[2]);
  
  /* screen_context.c */
  int ed_screen_context(
index df52ce696d95320eb05eca48449aa2a1e872835a,a77307af1928d1074d97ef72cc443a6a969b25a7..6ca037bfb5c23d88878a0a9314d9cf9865097b9c
@@@ -686,94 -682,50 +686,110 @@@ static AZone *area_actionzone_refresh_x
                                break;
                        }
                        else if (az->type == AZONE_FULLSCREEN) {
-                               int mouse_radius, spot_radius, fadein_radius, fadeout_radius;
                                rcti click_rect;
                                fullscreen_click_rcti_init(&click_rect, az->x1, az->y1, az->x2, az->y2);
+                               const bool click_isect = BLI_rcti_isect_pt_v(&click_rect, xy);
  
-                               if (BLI_rcti_isect_pt_v(&click_rect, xy)) {
-                                       az->alpha = 1.0f;
+                               if (test_only) {
+                                       if (click_isect) {
+                                               break;
+                                       }
                                }
                                else {
-                                       mouse_radius = (xy[0] - az->x2) * (xy[0] - az->x2) + (xy[1] - az->y2) * (xy[1] - az->y2);
-                                       spot_radius = AZONESPOT * AZONESPOT;
-                                       fadein_radius = AZONEFADEIN * AZONEFADEIN;
-                                       fadeout_radius = AZONEFADEOUT * AZONEFADEOUT;
 -                                      int mouse_radius, spot_radius, fadein_radius, fadeout_radius;
--
-                                       if (mouse_radius < spot_radius) {
 -                                      fullscreen_click_rcti_init(&click_rect, az->x1, az->y1, az->x2, az->y2);
+                                       if (click_isect) {
                                                az->alpha = 1.0f;
                                        }
-                                       else if (mouse_radius < fadein_radius) {
-                                               az->alpha = 1.0f;
-                                       }
-                                       else if (mouse_radius < fadeout_radius) {
-                                               az->alpha = 1.0f - ((float)(mouse_radius - fadein_radius)) / ((float)(fadeout_radius - fadein_radius));
-                                       }
                                        else {
-                                               az->alpha = 0.0f;
++                                              int mouse_radius, spot_radius, fadein_radius, fadeout_radius;
+                                               mouse_radius = (xy[0] - az->x2) * (xy[0] - az->x2) + (xy[1] - az->y2) * (xy[1] - az->y2);
+                                               spot_radius = AZONESPOT * AZONESPOT;
+                                               fadein_radius = AZONEFADEIN * AZONEFADEIN;
+                                               fadeout_radius = AZONEFADEOUT * AZONEFADEOUT;
+                                               if (mouse_radius < spot_radius) {
+                                                       az->alpha = 1.0f;
+                                               }
+                                               else if (mouse_radius < fadein_radius) {
+                                                       az->alpha = 1.0f;
+                                               }
+                                               else if (mouse_radius < fadeout_radius) {
+                                                       az->alpha = 1.0f - ((float)(mouse_radius - fadein_radius)) / ((float)(fadeout_radius - fadein_radius));
+                                               }
+                                               else {
+                                                       az->alpha = 0.0f;
+                                               }
+                                               /* fade in/out but no click */
+                                               az = NULL;
                                        }
  
-                                       /* fade in/out but no click */
-                                       az = NULL;
+                                       /* XXX force redraw to show/hide the action zone */
+                                       ED_area_tag_redraw(sa);
+                                       break;
                                }
-                               /* XXX force redraw to show/hide the action zone */
-                               ED_area_tag_redraw_no_rebuild(sa);
-                               break;
                        }
-                               bool redraw = false;
-                               if (isect_value == 'h') {
-                                       if (az->direction == AZ_SCROLL_HOR) {
-                                               az->alpha = 1.0f;
-                                               v2d->alpha_hor = 255;
-                                               v2d->size_hor = V2D_SCROLL_HEIGHT;
-                                               redraw = true;
-                                       }
-                               }
-                               else if (isect_value == 'v') {
-                                       if (az->direction == AZ_SCROLL_VERT) {
-                                               az->alpha = 1.0f;
-                                               v2d->alpha_vert = 255;
-                                               v2d->size_vert = V2D_SCROLL_WIDTH;
-                                               redraw = true;
 +                      else if (az->type == AZONE_REGION_SCROLL) {
 +                              ARegion *ar = az->ar;
 +                              View2D *v2d = &ar->v2d;
 +                              const short isect_value = UI_view2d_mouse_in_scrollers(ar, v2d, xy[0], xy[1]);
-                                       const int local_xy[2] = {xy[0] - ar->winrct.xmin, xy[1] - ar->winrct.ymin};
-                                       float dist_fac = 0.0f, alpha = 0.0f;
-                                       if (az->direction == AZ_SCROLL_HOR) {
-                                               dist_fac = BLI_rcti_length_y(&v2d->hor, local_xy[1]) / AZONEFADEIN;
-                                               CLAMP(dist_fac, 0.0f, 1.0f);
-                                               alpha = 1.0f - dist_fac;
-                                               v2d->alpha_hor = alpha * 255;
-                                               v2d->size_hor = round_fl_to_int(V2D_SCROLL_HEIGHT -
-                                                                               ((V2D_SCROLL_HEIGHT - V2D_SCROLL_HEIGHT_MIN) * dist_fac));
++                              if (test_only) {
++                                      if (isect_value != 0) {
++                                              break;
 +                                      }
 +                              }
 +                              else {
-                                       else if (az->direction == AZ_SCROLL_VERT) {
-                                               dist_fac = BLI_rcti_length_x(&v2d->vert, local_xy[0]) / AZONEFADEIN;
-                                               CLAMP(dist_fac, 0.0f, 1.0f);
-                                               alpha = 1.0f - dist_fac;
-                                               v2d->alpha_vert = alpha * 255;
-                                               v2d->size_vert = round_fl_to_int(V2D_SCROLL_WIDTH -
-                                                                                ((V2D_SCROLL_WIDTH - V2D_SCROLL_WIDTH_MIN) * dist_fac));
++                                      bool redraw = false;
++
++                                      if (isect_value == 'h') {
++                                              if (az->direction == AZ_SCROLL_HOR) {
++                                                      az->alpha = 1.0f;
++                                                      v2d->alpha_hor = 255;
++                                                      v2d->size_hor = V2D_SCROLL_HEIGHT;
++                                                      redraw = true;
++                                              }
 +                                      }
-                                       az->alpha = alpha;
-                                       redraw = true;
-                               }
++                                      else if (isect_value == 'v') {
++                                              if (az->direction == AZ_SCROLL_VERT) {
++                                                      az->alpha = 1.0f;
++                                                      v2d->alpha_vert = 255;
++                                                      v2d->size_vert = V2D_SCROLL_WIDTH;
++                                                      redraw = true;
++                                              }
++                                      }
++                                      else {
++                                              const int local_xy[2] = {xy[0] - ar->winrct.xmin, xy[1] - ar->winrct.ymin};
++                                              float dist_fac = 0.0f, alpha = 0.0f;
++
++                                              if (az->direction == AZ_SCROLL_HOR) {
++                                                      dist_fac = BLI_rcti_length_y(&v2d->hor, local_xy[1]) / AZONEFADEIN;
++                                                      CLAMP(dist_fac, 0.0f, 1.0f);
++                                                      alpha = 1.0f - dist_fac;
++
++                                                      v2d->alpha_hor = alpha * 255;
++                                                      v2d->size_hor = round_fl_to_int(
++                                                              V2D_SCROLL_HEIGHT -
++                                                              ((V2D_SCROLL_HEIGHT - V2D_SCROLL_HEIGHT_MIN) * dist_fac));
++                                              }
++                                              else if (az->direction == AZ_SCROLL_VERT) {
++                                                      dist_fac = BLI_rcti_length_x(&v2d->vert, local_xy[0]) / AZONEFADEIN;
++                                                      CLAMP(dist_fac, 0.0f, 1.0f);
++                                                      alpha = 1.0f - dist_fac;
++
++                                                      v2d->alpha_vert = alpha * 255;
++                                                      v2d->size_vert = round_fl_to_int(
++                                                              V2D_SCROLL_WIDTH -
++                                                              ((V2D_SCROLL_WIDTH - V2D_SCROLL_WIDTH_MIN) * dist_fac));
++                                              }
++                                              az->alpha = alpha;
++                                              redraw = true;
 +                                      }
-                               if (redraw) {
-                                       ED_area_tag_redraw_no_rebuild(sa);
 +
-                               /* Don't return! */
++                                      if (redraw) {
++                                              ED_area_tag_redraw_no_rebuild(sa);
++                                      }
++                                      /* Don't return! */
 +                              }
 +                      }
                }
        }