Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2012-12-12 22:58:11 +0400
committerTon Roosendaal <ton@blender.org>2012-12-12 22:58:11 +0400
commit12b642062c6fcef70151bd2424c2ebbc6a1a6843 (patch)
treecefb983f370b982f5e8b606c21ac884eb32a35a2 /source/blender/windowmanager/intern/wm_draw.c
parent26ae649b01c1147ec2fbb147bb652a8bc49a0019 (diff)
Holiday coding log :)
Nice formatted version (pictures soon): http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability Short list of main changes: - Transparent region option (over main region), added code to blend in/out such panels. - Min size window now 640 x 480 - Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake. - Macbook retina support, use command line --no-native-pixels to disable it - Timeline Marker label was drawing wrong - Trackpad and magic mouse: supports zoom (hold ctrl) - Fix for splash position: removed ghost function and made window size update after creation immediate - Fast undo buffer save now adds UI as well. Could be checked for regular file save even... Quit.blend and temp file saving use this now. - Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)" - New Userpref option "Keep Session" - this always saves quit.blend, and loads on start. This allows keeping UI and data without actual saves, until you actually save. When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header) - Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v). Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards. - User preferences (themes, keymaps, user settings) now can be saved as a separate file. Old option is called "Save Startup File" the new one "Save User Settings". To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still. - OSX: fixed bug that stopped giving mouse events outside window. This also fixes "Continuous Grab" for OSX. (error since 2009)
Diffstat (limited to 'source/blender/windowmanager/intern/wm_draw.c')
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c83
1 files changed, 63 insertions, 20 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index a92ed65392c..11cf1088280 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -49,6 +49,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_screen.h"
#include "GHOST_C-api.h"
@@ -431,22 +432,22 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
triple->target = GL_TEXTURE_RECTANGLE_ARB;
triple->nx = 1;
triple->ny = 1;
- triple->x[0] = win->sizex;
- triple->y[0] = win->sizey;
+ triple->x[0] = WM_window_pixels_x(win);
+ triple->y[0] = WM_window_pixels_y(win);
}
else if (GPU_non_power_of_two_support()) {
triple->target = GL_TEXTURE_2D;
triple->nx = 1;
triple->ny = 1;
- triple->x[0] = win->sizex;
- triple->y[0] = win->sizey;
+ triple->x[0] = WM_window_pixels_x(win);
+ triple->y[0] = WM_window_pixels_y(win);
}
else {
triple->target = GL_TEXTURE_2D;
triple->nx = 0;
triple->ny = 0;
- split_width(win->sizex, MAX_N_TEX, triple->x, &triple->nx);
- split_width(win->sizey, MAX_N_TEX, triple->y, &triple->ny);
+ split_width(WM_window_pixels_x(win), MAX_N_TEX, triple->x, &triple->nx);
+ split_width(WM_window_pixels_y(win), MAX_N_TEX, triple->y, &triple->ny);
}
/* generate texture names */
@@ -491,7 +492,7 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
return 1;
}
-static void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple)
+static void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
{
float halfx, halfy, ratiox, ratioy;
int x, y, sizex, sizey, offx, offy;
@@ -500,8 +501,8 @@ static void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple)
for (y = 0, offy = 0; y < triple->ny; offy += triple->y[y], y++) {
for (x = 0, offx = 0; x < triple->nx; offx += triple->x[x], x++) {
- sizex = (x == triple->nx - 1) ? win->sizex - offx : triple->x[x];
- sizey = (y == triple->ny - 1) ? win->sizey - offy : triple->y[y];
+ sizex = (x == triple->nx - 1) ? WM_window_pixels_x(win) - offx : triple->x[x];
+ sizey = (y == triple->ny - 1) ? WM_window_pixels_y(win) - offy : triple->y[y];
/* wmOrtho for the screen has this same offset */
ratiox = sizex;
@@ -519,7 +520,7 @@ static void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple)
glBindTexture(triple->target, triple->bind[x + y * triple->nx]);
- glColor3f(1.0f, 1.0f, 1.0f);
+ glColor4f(1.0f, 1.0f, 1.0f, alpha);
glBegin(GL_QUADS);
glTexCoord2f(halfx, halfy);
glVertex2f(offx, offy);
@@ -546,8 +547,8 @@ static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple)
for (y = 0, offy = 0; y < triple->ny; offy += triple->y[y], y++) {
for (x = 0, offx = 0; x < triple->nx; offx += triple->x[x], x++) {
- sizex = (x == triple->nx - 1) ? win->sizex - offx : triple->x[x];
- sizey = (y == triple->ny - 1) ? win->sizey - offy : triple->y[y];
+ sizex = (x == triple->nx - 1) ? WM_window_pixels_x(win) - offx : triple->x[x];
+ sizey = (y == triple->ny - 1) ? WM_window_pixels_y(win) - offy : triple->y[y];
glBindTexture(triple->target, triple->bind[x + y * triple->nx]);
glCopyTexSubImage2D(triple->target, 0, 0, 0, offx, offy, sizex, sizey);
@@ -557,6 +558,20 @@ static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple)
glBindTexture(triple->target, 0);
}
+static void wm_draw_region_blend(wmWindow *win, ARegion *ar)
+{
+ float fac = ED_region_blend_factor(ar);
+
+ /* region blend always is 1, except when blend timer is running */
+ if (fac < 1.0f) {
+ wmSubWindowScissorSet(win, win->screen->mainwin, &ar->winrct);
+
+ glEnable(GL_BLEND);
+ wm_triple_draw_textures(win, win->drawdata, 1.0f - fac);
+ glDisable(GL_BLEND);
+ }
+}
+
static void wm_method_draw_triple(bContext *C, wmWindow *win)
{
wmWindowManager *wm = CTX_wm_manager(C);
@@ -572,7 +587,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
wmSubWindowSet(win, screen->mainwin);
- wm_triple_draw_textures(win, win->drawdata);
+ wm_triple_draw_textures(win, win->drawdata, 1.0f);
}
else {
win->drawdata = MEM_callocN(sizeof(wmDrawTriple), "wmDrawTriple");
@@ -591,11 +606,13 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->swinid && ar->do_draw) {
- CTX_wm_region_set(C, ar);
- ED_region_do_draw(C, ar);
- ED_area_overdraw_flush(sa, ar);
- CTX_wm_region_set(C, NULL);
- copytex = 1;
+ if (ar->overlap == 0) {
+ CTX_wm_region_set(C, ar);
+ ED_region_do_draw(C, ar);
+ ED_area_overdraw_flush(sa, ar);
+ CTX_wm_region_set(C, NULL);
+ copytex = 1;
+ }
}
}
@@ -610,10 +627,28 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
wm_triple_copy_textures(win, triple);
}
+ /* draw overlapping area regions (always like popups) */
+ for (sa = screen->areabase.first; sa; sa = sa->next) {
+ CTX_wm_area_set(C, sa);
+
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->swinid && ar->overlap) {
+ CTX_wm_region_set(C, ar);
+ ED_region_do_draw(C, ar);
+ ED_area_overdraw_flush(sa, ar);
+ CTX_wm_region_set(C, NULL);
+
+ wm_draw_region_blend(win, ar);
+ }
+ }
+
+ CTX_wm_area_set(C, NULL);
+ }
+
/* after area regions so we can do area 'overlay' drawing */
ED_screen_draw(win);
- /* draw overlapping regions */
+ /* draw floating regions (menus) */
for (ar = screen->regionbase.first; ar; ar = ar->next) {
if (ar->swinid) {
CTX_wm_menu_set(C, ar);
@@ -652,9 +687,9 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
if (wm->drags.first) {
wm_drags_draw(C, win, NULL);
}
-
}
+
/****************** main update call **********************/
/* quick test to prevent changing window drawable */
@@ -734,6 +769,14 @@ static int wm_automatic_draw_method(wmWindow *win)
return win->drawmethod;
}
+int WM_is_draw_triple(wmWindow *win)
+{
+ /* function can get called before this variable is set in drawing code below */
+ if (win->drawmethod != U.wmdrawmethod)
+ win->drawmethod = U.wmdrawmethod;
+ return USER_DRAW_TRIPLE == wm_automatic_draw_method(win);
+}
+
void wm_tag_redraw_overlay(wmWindow *win, ARegion *ar)
{
/* for draw triple gestures, paint cursors don't need region redraw */