2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2007-12-24 18:27:28 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2007-12-24 18:27:28 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2007 Blender Foundation but based
|
|
|
|
* on ghostwinlay.c (C) 2001-2002 by NaN Holding BV
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
2008-11-18 13:51:02 +00:00
|
|
|
* Contributor(s): Blender Foundation, 2008
|
2007-12-24 18:27:28 +00:00
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-25 14:04:21 +00:00
|
|
|
/** \file blender/windowmanager/intern/wm_window.c
|
|
|
|
* \ingroup wm
|
2014-01-19 23:14:24 +11:00
|
|
|
*
|
|
|
|
* Window management, wrap GHOST.
|
2011-02-25 14:04:21 +00:00
|
|
|
*/
|
|
|
|
|
2009-08-21 16:28:49 +00:00
|
|
|
#include <math.h>
|
2007-12-24 18:27:28 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2009-02-13 13:33:01 +00:00
|
|
|
#include <string.h>
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
#include "DNA_listBase.h"
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "GHOST_C-api.h"
|
|
|
|
|
2013-02-07 14:41:08 +00:00
|
|
|
#include "BLI_math.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BLI_blenlib.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2011-06-15 11:41:15 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_blender.h"
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2010-11-09 14:54:59 +00:00
|
|
|
#include "BKE_library.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_global.h"
|
2010-10-18 06:41:16 +00:00
|
|
|
#include "BKE_main.h"
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "WM_api.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "WM_types.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "wm.h"
|
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
|
|
|
#include "wm_draw.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "wm_window.h"
|
2008-01-01 15:53:38 +00:00
|
|
|
#include "wm_subwindow.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "wm_event_system.h"
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
#include "ED_screen.h"
|
2010-12-17 19:05:34 +00:00
|
|
|
#include "ED_fileselect.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2016-08-04 01:05:27 +02:00
|
|
|
#include "UI_interface.h"
|
2018-03-21 16:00:18 +01:00
|
|
|
#include "UI_resources.h"
|
2016-08-04 01:05:27 +02:00
|
|
|
|
2008-12-22 12:57:53 +00:00
|
|
|
#include "PIL_time.h"
|
|
|
|
|
2008-12-19 17:26:15 +00:00
|
|
|
#include "GPU_draw.h"
|
2010-10-22 00:29:56 +00:00
|
|
|
#include "GPU_extensions.h"
|
2014-10-07 15:46:19 -05:00
|
|
|
#include "GPU_init_exit.h"
|
|
|
|
#include "GPU_glew.h"
|
2017-03-11 03:27:08 +01:00
|
|
|
#include "BLF_api.h"
|
2008-12-19 17:26:15 +00:00
|
|
|
|
2013-01-22 02:21:21 +00:00
|
|
|
/* for assert */
|
|
|
|
#ifndef NDEBUG
|
|
|
|
# include "BLI_threads.h"
|
|
|
|
#endif
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* the global to talk to ghost */
|
2012-03-27 01:24:16 +00:00
|
|
|
static GHOST_SystemHandle g_system = NULL;
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2012-03-13 15:44:48 +00:00
|
|
|
typedef enum WinOverrideFlag {
|
|
|
|
WIN_OVERRIDE_GEOM = (1 << 0),
|
|
|
|
WIN_OVERRIDE_WINSTATE = (1 << 1)
|
|
|
|
} WinOverrideFlag;
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* set by commandline */
|
2012-03-13 15:44:48 +00:00
|
|
|
static struct WMInitStruct {
|
|
|
|
/* window geometry */
|
|
|
|
int size_x, size_y;
|
|
|
|
int start_x, start_y;
|
|
|
|
|
|
|
|
int windowstate;
|
|
|
|
WinOverrideFlag override_flag;
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
2013-04-04 02:05:11 +00:00
|
|
|
bool native_pixels;
|
|
|
|
} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, true};
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
/* ******** win open & close ************ */
|
|
|
|
|
2009-10-05 12:55:16 +00:00
|
|
|
/* XXX this one should correctly check for apple top header...
|
2012-03-09 18:28:30 +00:00
|
|
|
* done for Cocoa : returns window contents (and not frame) max size*/
|
2015-05-08 07:25:39 +10:00
|
|
|
void wm_get_screensize(int *r_width, int *r_height)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
|
|
|
unsigned int uiwidth;
|
|
|
|
unsigned int uiheight;
|
|
|
|
|
|
|
|
GHOST_GetMainDisplayDimensions(g_system, &uiwidth, &uiheight);
|
2015-05-08 07:25:39 +10:00
|
|
|
*r_width = uiwidth;
|
|
|
|
*r_height = uiheight;
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2013-09-10 06:32:32 +00:00
|
|
|
/* size of all screens (desktop), useful since the mouse is bound by this */
|
2015-05-08 07:25:39 +10:00
|
|
|
void wm_get_desktopsize(int *r_width, int *r_height)
|
2013-01-31 10:42:26 +00:00
|
|
|
{
|
|
|
|
unsigned int uiwidth;
|
|
|
|
unsigned int uiheight;
|
|
|
|
|
|
|
|
GHOST_GetAllDisplayDimensions(g_system, &uiwidth, &uiheight);
|
2015-05-08 07:25:39 +10:00
|
|
|
*r_width = uiwidth;
|
|
|
|
*r_height = uiheight;
|
2013-01-31 10:42:26 +00:00
|
|
|
}
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
/* keeps offset and size within monitor bounds */
|
|
|
|
/* XXX solve dual screen... */
|
|
|
|
static void wm_window_check_position(rcti *rect)
|
|
|
|
{
|
|
|
|
int width, height, d;
|
|
|
|
|
2013-10-06 14:32:53 +00:00
|
|
|
wm_get_screensize(&width, &height);
|
2009-07-24 12:43:59 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (rect->xmin < 0) {
|
2011-09-22 18:42:16 +00:00
|
|
|
rect->xmax -= rect->xmin;
|
|
|
|
rect->xmin = 0;
|
2009-07-24 13:17:40 +00:00
|
|
|
}
|
2012-03-24 06:24:53 +00:00
|
|
|
if (rect->ymin < 0) {
|
2011-09-22 18:42:16 +00:00
|
|
|
rect->ymax -= rect->ymin;
|
|
|
|
rect->ymin = 0;
|
2009-07-24 13:17:40 +00:00
|
|
|
}
|
2012-03-24 06:24:53 +00:00
|
|
|
if (rect->xmax > width) {
|
2012-03-27 01:24:16 +00:00
|
|
|
d = rect->xmax - width;
|
2009-07-24 12:43:59 +00:00
|
|
|
rect->xmax -= d;
|
|
|
|
rect->xmin -= d;
|
|
|
|
}
|
2012-03-24 06:24:53 +00:00
|
|
|
if (rect->ymax > height) {
|
2012-03-27 01:24:16 +00:00
|
|
|
d = rect->ymax - height;
|
2009-07-24 12:43:59 +00:00
|
|
|
rect->ymax -= d;
|
|
|
|
rect->ymin -= d;
|
|
|
|
}
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (rect->xmin < 0) rect->xmin = 0;
|
|
|
|
if (rect->ymin < 0) rect->ymin = 0;
|
2009-07-24 12:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
static void wm_ghostwindow_destroy(wmWindow *win)
|
|
|
|
{
|
2012-03-24 06:24:53 +00:00
|
|
|
if (win->ghostwin) {
|
2007-12-24 18:27:28 +00:00
|
|
|
GHOST_DisposeWindow(g_system, win->ghostwin);
|
2012-03-27 01:24:16 +00:00
|
|
|
win->ghostwin = NULL;
|
2016-02-04 22:26:46 +01:00
|
|
|
win->multisamples = 0;
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-10 13:56:54 +00:00
|
|
|
/* including window itself, C can be NULL.
|
2012-03-09 18:28:30 +00:00
|
|
|
* ED_screen_exit should have been called */
|
2009-10-20 13:58:53 +00:00
|
|
|
void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2009-07-24 12:43:59 +00:00
|
|
|
wmTimer *wt, *wtnext;
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* update context */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (C) {
|
2009-01-23 17:42:36 +00:00
|
|
|
WM_event_remove_handlers(C, &win->handlers);
|
2009-09-18 12:43:36 +00:00
|
|
|
WM_event_remove_handlers(C, &win->modalhandlers);
|
2009-07-24 12:43:59 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
if (CTX_wm_window(C) == win)
|
2009-10-20 13:58:53 +00:00
|
|
|
CTX_wm_window_set(C, NULL);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2009-10-20 13:58:53 +00:00
|
|
|
|
2012-02-19 06:00:20 +00:00
|
|
|
/* always set drawable and active to NULL,
|
|
|
|
* prevents non-drawable state of main windows (bugs #22967 and #25071, possibly #22477 too) */
|
2012-03-27 01:24:16 +00:00
|
|
|
wm->windrawable = NULL;
|
|
|
|
wm->winactive = NULL;
|
2009-10-20 13:58:53 +00:00
|
|
|
|
|
|
|
/* end running jobs, a job end also removes its timer */
|
2012-03-27 01:24:16 +00:00
|
|
|
for (wt = wm->timers.first; wt; wt = wtnext) {
|
|
|
|
wtnext = wt->next;
|
|
|
|
if (wt->win == win && wt->event_type == TIMERJOBS)
|
2009-10-20 13:58:53 +00:00
|
|
|
wm_jobs_timer_ended(wm, wt);
|
|
|
|
}
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
/* timer removing, need to call this api function */
|
2012-03-27 01:24:16 +00:00
|
|
|
for (wt = wm->timers.first; wt; wt = wtnext) {
|
|
|
|
wtnext = wt->next;
|
|
|
|
if (wt->win == win)
|
2009-10-20 13:58:53 +00:00
|
|
|
WM_event_remove_timer(wm, win, wt);
|
|
|
|
}
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (win->eventstate) MEM_freeN(win->eventstate);
|
2008-12-22 12:57:53 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
wm_event_free_all(win);
|
2008-01-01 15:53:38 +00:00
|
|
|
wm_subwindows_free(win);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
wm_draw_data_free(win);
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
wm_ghostwindow_destroy(win);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
MEM_freeN(win->stereo3d_format);
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
MEM_freeN(win);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int find_free_winid(wmWindowManager *wm)
|
|
|
|
{
|
|
|
|
wmWindow *win;
|
2012-03-27 01:24:16 +00:00
|
|
|
int id = 1;
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
for (win = wm->windows.first; win; win = win->next)
|
2012-03-24 06:24:53 +00:00
|
|
|
if (id <= win->winid)
|
2012-03-27 01:24:16 +00:00
|
|
|
id = win->winid + 1;
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2012-03-18 07:38:51 +00:00
|
|
|
/* don't change context itself */
|
2008-11-18 13:51:02 +00:00
|
|
|
wmWindow *wm_window_new(bContext *C)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2012-03-27 01:24:16 +00:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
wmWindow *win = MEM_callocN(sizeof(wmWindow), "window");
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
BLI_addtail(&wm->windows, win);
|
2012-03-27 01:24:16 +00:00
|
|
|
win->winid = find_free_winid(wm);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
win->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo 3D Format (window)");
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
return win;
|
|
|
|
}
|
|
|
|
|
2008-11-18 13:51:02 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* part of wm_window.c api */
|
2015-06-09 01:25:34 +10:00
|
|
|
wmWindow *wm_window_copy(bContext *C, wmWindow *win_src)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2015-06-09 01:25:34 +10:00
|
|
|
wmWindow *win_dst = wm_window_new(C);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2015-06-09 01:25:34 +10:00
|
|
|
win_dst->posx = win_src->posx + 10;
|
|
|
|
win_dst->posy = win_src->posy;
|
|
|
|
win_dst->sizex = win_src->sizex;
|
|
|
|
win_dst->sizey = win_src->sizey;
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2009-02-07 19:37:29 +00:00
|
|
|
/* duplicate assigns to window */
|
2015-06-09 01:25:34 +10:00
|
|
|
win_dst->screen = ED_screen_duplicate(win_dst, win_src->screen);
|
|
|
|
BLI_strncpy(win_dst->screenname, win_dst->screen->id.name + 2, sizeof(win_dst->screenname));
|
|
|
|
win_dst->screen->winid = win_dst->winid;
|
2009-08-15 16:43:03 +00:00
|
|
|
|
2015-06-09 01:25:34 +10:00
|
|
|
win_dst->screen->do_refresh = true;
|
|
|
|
win_dst->screen->do_draw = true;
|
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
|
|
|
|
2015-06-09 01:25:34 +10:00
|
|
|
win_dst->drawmethod = U.wmdrawmethod;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2015-06-09 01:25:34 +10:00
|
|
|
BLI_listbase_clear(&win_dst->drawdata);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2015-06-09 01:25:34 +10:00
|
|
|
*win_dst->stereo3d_format = *win_src->stereo3d_format;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2015-06-09 01:25:34 +10:00
|
|
|
return win_dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A higher level version of copy that tests the new window can be added.
|
|
|
|
* (called from the operator directly)
|
|
|
|
*/
|
|
|
|
wmWindow *wm_window_copy_test(bContext *C, wmWindow *win_src)
|
|
|
|
{
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
wmWindow *win_dst;
|
|
|
|
|
|
|
|
win_dst = wm_window_copy(C, win_src);
|
|
|
|
|
|
|
|
WM_check(C);
|
|
|
|
|
|
|
|
if (win_dst->ghostwin) {
|
|
|
|
WM_event_add_notifier(C, NC_WINDOW | NA_ADDED, NULL);
|
|
|
|
return win_dst;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
wm_window_close(C, wm, win_dst);
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-06-19 19:09:21 +00:00
|
|
|
}
|
2008-01-01 09:07:02 +00:00
|
|
|
|
2018-03-21 16:00:18 +01:00
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Quit Confirmation Dialog
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
/** Cancel quitting and close the dialog */
|
|
|
|
static void wm_block_confirm_quit_cancel(bContext *C, void *arg_block, void *UNUSED(arg))
|
|
|
|
{
|
|
|
|
wmWindow *win = CTX_wm_window(C);
|
|
|
|
UI_popup_block_close(C, win, arg_block);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Discard the file changes and quit */
|
|
|
|
static void wm_block_confirm_quit_discard(bContext *C, void *arg_block, void *UNUSED(arg))
|
|
|
|
{
|
|
|
|
wmWindow *win = CTX_wm_window(C);
|
|
|
|
UI_popup_block_close(C, win, arg_block);
|
|
|
|
WM_exit(C);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Save changes and quit */
|
|
|
|
static void wm_block_confirm_quit_save(bContext *C, void *arg_block, void *UNUSED(arg))
|
|
|
|
{
|
|
|
|
PointerRNA props_ptr;
|
|
|
|
wmWindow *win = CTX_wm_window(C);
|
|
|
|
|
|
|
|
UI_popup_block_close(C, win, arg_block);
|
|
|
|
|
|
|
|
wmOperatorType *ot = WM_operatortype_find("WM_OT_save_mainfile", false);
|
|
|
|
|
|
|
|
WM_operator_properties_create_ptr(&props_ptr, ot);
|
|
|
|
RNA_boolean_set(&props_ptr, "exit", true);
|
2018-03-22 16:23:29 +01:00
|
|
|
/* No need for second confirmation popup. */
|
|
|
|
RNA_boolean_set(&props_ptr, "check_existing", false);
|
2018-03-21 16:00:18 +01:00
|
|
|
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr);
|
|
|
|
WM_operator_properties_free(&props_ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Build the confirm dialog UI */
|
|
|
|
static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar, void *UNUSED(arg1))
|
|
|
|
{
|
|
|
|
|
|
|
|
uiStyle *style = UI_style_get();
|
|
|
|
uiBlock *block = UI_block_begin(C, ar, "confirm_quit_popup", UI_EMBOSS);
|
|
|
|
|
2018-04-05 19:12:28 +02:00
|
|
|
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT);
|
2018-03-21 16:00:18 +01:00
|
|
|
UI_block_emboss_set(block, UI_EMBOSS);
|
|
|
|
|
|
|
|
uiLayout *layout = UI_block_layout(
|
2018-03-27 16:46:10 +02:00
|
|
|
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.widget_unit * 24, U.widget_unit * 6, 0, style);
|
2018-03-21 16:00:18 +01:00
|
|
|
|
|
|
|
/* Text and some vertical space */
|
|
|
|
{
|
|
|
|
char *message;
|
|
|
|
if (G.main->name[0] == '\0') {
|
|
|
|
message = BLI_strdup(IFACE_("This file has not been saved yet. Save before closing?"));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
const char *basename = BLI_path_basename(G.main->name);
|
|
|
|
message = BLI_sprintfN(IFACE_("Save changes to \"%s\" before closing?"), basename);
|
|
|
|
}
|
|
|
|
uiItemL(layout, message, ICON_ERROR);
|
|
|
|
MEM_freeN(message);
|
|
|
|
}
|
|
|
|
|
|
|
|
uiItemS(layout);
|
|
|
|
uiItemS(layout);
|
|
|
|
|
|
|
|
|
|
|
|
/* Buttons */
|
|
|
|
uiBut *but;
|
|
|
|
|
|
|
|
uiLayout *split = uiLayoutSplit(layout, 0.0f, true);
|
|
|
|
|
|
|
|
uiLayout *col = uiLayoutColumn(split, false);
|
|
|
|
|
|
|
|
but = uiDefIconTextBut(
|
|
|
|
block, UI_BTYPE_BUT, 0, ICON_SCREEN_BACK, IFACE_("Cancel"), 0, 0, 0, UI_UNIT_Y,
|
|
|
|
NULL, 0, 0, 0, 0, TIP_("Do not quit"));
|
|
|
|
UI_but_func_set(but, wm_block_confirm_quit_cancel, block, NULL);
|
|
|
|
|
|
|
|
/* empty space between buttons */
|
|
|
|
col = uiLayoutColumn(split, false);
|
|
|
|
uiItemS(col);
|
|
|
|
|
|
|
|
col = uiLayoutColumn(split, 1);
|
|
|
|
but = uiDefIconTextBut(
|
|
|
|
block, UI_BTYPE_BUT, 0, ICON_CANCEL, IFACE_("Discard Changes"), 0, 0, 50, UI_UNIT_Y,
|
|
|
|
NULL, 0, 0, 0, 0, TIP_("Discard changes and quit"));
|
|
|
|
UI_but_func_set(but, wm_block_confirm_quit_discard, block, NULL);
|
|
|
|
|
|
|
|
col = uiLayoutColumn(split, 1);
|
|
|
|
but = uiDefIconTextBut(
|
|
|
|
block, UI_BTYPE_BUT, 0, ICON_FILE_TICK, IFACE_("Save & Quit"), 0, 0, 50, UI_UNIT_Y,
|
|
|
|
NULL, 0, 0, 0, 0, TIP_("Save and quit"));
|
|
|
|
UI_but_func_set(but, wm_block_confirm_quit_save, block, NULL);
|
|
|
|
|
|
|
|
UI_block_bounds_set_centered(block, 10);
|
|
|
|
|
|
|
|
return block;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-23 02:00:14 +01:00
|
|
|
/**
|
|
|
|
* Call the confirm dialog on quitting. It's displayed in the context window so
|
|
|
|
* caller should set it as desired.
|
|
|
|
*/
|
|
|
|
static void wm_confirm_quit(bContext *C)
|
|
|
|
{
|
|
|
|
wmWindow *win = CTX_wm_window(C);
|
|
|
|
|
|
|
|
if (GHOST_SupportsNativeDialogs() == 0) {
|
|
|
|
UI_popup_block_invoke(C, block_create_confirm_quit, NULL);
|
|
|
|
}
|
|
|
|
else if (GHOST_confirmQuit(win->ghostwin)) {
|
|
|
|
wm_exit_schedule_delayed(C);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call the quit confirmation prompt or exit directly if needed. The use can
|
|
|
|
* still cancel via the confirmation popup. Also, this may not quit Blender
|
|
|
|
* immediately, but rather schedule the closing.
|
|
|
|
*
|
|
|
|
* \param win The window to show the confirmation popup/window in.
|
|
|
|
*/
|
|
|
|
void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win)
|
2018-03-21 16:00:18 +01:00
|
|
|
{
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
2018-03-23 02:00:14 +01:00
|
|
|
wmWindow *win_ctx = CTX_wm_window(C);
|
|
|
|
|
|
|
|
/* The popup will be displayed in the context window which may not be set
|
|
|
|
* here (this function gets called outside of normal event handling loop). */
|
|
|
|
CTX_wm_window_set(C, win);
|
2018-03-21 16:00:18 +01:00
|
|
|
|
2018-03-23 02:00:14 +01:00
|
|
|
if ((U.uiflag & USER_QUIT_PROMPT) && !wm->file_saved && !G.background) {
|
|
|
|
wm_confirm_quit(C);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
wm_exit_schedule_delayed(C);
|
2018-03-21 16:00:18 +01:00
|
|
|
}
|
|
|
|
|
2018-03-23 02:00:14 +01:00
|
|
|
CTX_wm_window_set(C, win_ctx);
|
2018-03-21 16:00:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
2009-01-23 17:42:36 +00:00
|
|
|
/* this is event from ghost, or exit-blender op */
|
2009-10-20 13:58:53 +00:00
|
|
|
void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2012-03-16 17:37:45 +00:00
|
|
|
wmWindow *tmpwin;
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
/* first check if we have to quit (there are non-temp remaining windows) */
|
|
|
|
for (tmpwin = wm->windows.first; tmpwin; tmpwin = tmpwin->next) {
|
|
|
|
if (tmpwin == win)
|
|
|
|
continue;
|
|
|
|
if (tmpwin->screen->temp == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-03-23 02:00:14 +01:00
|
|
|
if (tmpwin == NULL) {
|
|
|
|
wm_quit_with_optional_confirmation_prompt(C, win);
|
2010-11-09 14:54:59 +00:00
|
|
|
}
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
else {
|
2018-03-21 16:00:18 +01:00
|
|
|
/* We're just closing a window */
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
bScreen *screen = win->screen;
|
|
|
|
|
|
|
|
BLI_remlink(&wm->windows, win);
|
|
|
|
|
|
|
|
wm_draw_window_clear(win);
|
|
|
|
|
|
|
|
CTX_wm_window_set(C, win); /* needed by handlers */
|
|
|
|
WM_event_remove_handlers(C, &win->handlers);
|
|
|
|
WM_event_remove_handlers(C, &win->modalhandlers);
|
2015-10-07 00:27:27 +11:00
|
|
|
|
|
|
|
/* for regular use this will _never_ be NULL,
|
|
|
|
* however we may be freeing an improperly initialized window. */
|
|
|
|
if (win->screen) {
|
|
|
|
ED_screen_exit(C, win, win->screen);
|
|
|
|
}
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
wm_window_free(C, wm, win);
|
2010-11-09 14:54:59 +00:00
|
|
|
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
/* if temp screen, delete it after window free (it stops jobs that can access it) */
|
2015-10-07 00:27:27 +11:00
|
|
|
if (screen && screen->temp) {
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
Main *bmain = CTX_data_main(C);
|
2014-01-15 16:37:03 +01:00
|
|
|
BKE_libblock_free(bmain, screen);
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
}
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
2008-01-15 18:54:38 +00:00
|
|
|
|
2009-02-18 13:29:54 +00:00
|
|
|
void wm_window_title(wmWindowManager *wm, wmWindow *win)
|
2009-02-13 13:33:01 +00:00
|
|
|
{
|
2012-03-24 06:24:53 +00:00
|
|
|
if (win->screen && win->screen->temp) {
|
2012-10-07 15:39:47 +00:00
|
|
|
/* nothing to do for 'temp' windows,
|
|
|
|
* because WM_window_open_temp always sets window title */
|
2009-07-24 12:43:59 +00:00
|
|
|
}
|
2014-10-07 15:46:19 -05:00
|
|
|
else if (win->ghostwin) {
|
2010-07-15 11:51:43 +00:00
|
|
|
/* this is set to 1 if you don't have startup.blend open */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (G.save_over && G.main->name[0]) {
|
2012-12-13 05:43:01 +00:00
|
|
|
char str[sizeof(G.main->name) + 24];
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", wm->file_saved ? "" : "*", G.main->name,
|
2012-12-13 01:00:21 +00:00
|
|
|
G.main->recovered ? " (Recovered)" : "");
|
2009-07-24 12:43:59 +00:00
|
|
|
GHOST_SetTitle(win->ghostwin, str);
|
|
|
|
}
|
2009-02-18 13:29:54 +00:00
|
|
|
else
|
2009-07-24 12:43:59 +00:00
|
|
|
GHOST_SetTitle(win->ghostwin, "Blender");
|
2009-02-18 13:29:54 +00:00
|
|
|
|
2009-10-05 12:55:16 +00:00
|
|
|
/* Informs GHOST of unsaved changes, to set window modified visual indicator (MAC OS X)
|
2012-03-09 18:28:30 +00:00
|
|
|
* and to give hint of unsaved changes for a user warning mechanism
|
|
|
|
* in case of OS application terminate request (e.g. OS Shortcut Alt+F4, Cmd+Q, (...), or session end) */
|
2012-03-27 01:24:16 +00:00
|
|
|
GHOST_SetWindowModifiedState(win->ghostwin, (GHOST_TUns8) !wm->file_saved);
|
2009-10-05 12:55:16 +00:00
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
}
|
2009-02-13 13:33:01 +00:00
|
|
|
}
|
|
|
|
|
2017-07-08 00:44:31 +02:00
|
|
|
void WM_window_set_dpi(wmWindow *win)
|
2015-10-27 12:53:58 +01:00
|
|
|
{
|
2017-08-07 22:42:47 +02:00
|
|
|
float auto_dpi = GHOST_GetDPIHint(win->ghostwin);
|
2015-10-27 12:53:58 +01:00
|
|
|
|
2017-07-17 14:10:57 +02:00
|
|
|
/* Clamp auto DPI to 96, since our font/interface drawing does not work well
|
|
|
|
* with lower sizes. The main case we are interested in supporting is higher
|
|
|
|
* DPI. If a smaller UI is desired it is still possible to adjust UI scale. */
|
2017-08-07 22:42:47 +02:00
|
|
|
auto_dpi = max_ff(auto_dpi, 96.0f);
|
2017-07-17 14:10:57 +02:00
|
|
|
|
2017-03-11 03:27:08 +01:00
|
|
|
/* Lazily init UI scale size, preserving backwards compatibility by
|
|
|
|
* computing UI scale from ratio of previous DPI and auto DPI */
|
|
|
|
if (U.ui_scale == 0) {
|
|
|
|
int virtual_pixel = (U.virtual_pixel == VIRTUAL_PIXEL_NATIVE) ? 1 : 2;
|
|
|
|
|
|
|
|
if (U.dpi == 0) {
|
|
|
|
U.ui_scale = virtual_pixel;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
U.ui_scale = (virtual_pixel * U.dpi * 96.0f) / (auto_dpi * 72.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
CLAMP(U.ui_scale, 0.25f, 4.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Blender's UI drawing assumes DPI 72 as a good default following macOS
|
|
|
|
* while Windows and Linux use DPI 96. GHOST assumes a default 96 so we
|
|
|
|
* remap the DPI to Blender's convention. */
|
2017-08-07 22:42:47 +02:00
|
|
|
auto_dpi *= GHOST_GetNativePixelSize(win->ghostwin);
|
2017-04-01 12:09:17 +11:00
|
|
|
int dpi = auto_dpi * U.ui_scale * (72.0 / 96.0f);
|
2017-03-11 03:27:08 +01:00
|
|
|
|
|
|
|
/* Automatically set larger pixel size for high DPI. */
|
2017-08-07 22:42:47 +02:00
|
|
|
int pixelsize = max_ii(1, (int)(dpi / 64));
|
|
|
|
/* User adjustment for pixel size. */
|
|
|
|
pixelsize = max_ii(1, pixelsize + U.ui_line_width);
|
2017-03-11 03:27:08 +01:00
|
|
|
|
|
|
|
/* Set user preferences globals for drawing, and for forward compatibility. */
|
2017-08-07 22:42:47 +02:00
|
|
|
U.pixelsize = pixelsize;
|
2017-03-11 03:27:08 +01:00
|
|
|
U.dpi = dpi / pixelsize;
|
|
|
|
U.virtual_pixel = (pixelsize == 1) ? VIRTUAL_PIXEL_NATIVE : VIRTUAL_PIXEL_DOUBLE;
|
2017-07-08 00:44:31 +02:00
|
|
|
U.widget_unit = (U.pixelsize * U.dpi * 20 + 36) / 72;
|
2017-03-11 03:27:08 +01:00
|
|
|
|
2017-07-08 00:44:31 +02:00
|
|
|
/* update font drawing */
|
|
|
|
BLF_default_dpi(U.pixelsize * U.dpi);
|
2014-09-30 18:29:32 +02:00
|
|
|
}
|
|
|
|
|
2008-11-18 13:51:02 +00:00
|
|
|
/* belongs to below */
|
2015-10-07 00:27:27 +11:00
|
|
|
static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wmWindow *win)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
|
|
|
GHOST_WindowHandle ghostwin;
|
2015-02-25 13:51:53 +01:00
|
|
|
GHOST_GLSettings glSettings = {0};
|
2012-11-11 12:02:39 +00:00
|
|
|
static int multisamples = -1;
|
2007-12-24 18:27:28 +00:00
|
|
|
int scr_w, scr_h, posy;
|
|
|
|
|
2012-11-11 12:02:39 +00:00
|
|
|
/* force setting multisamples only once, it requires restart - and you cannot
|
2012-11-18 01:22:31 +00:00
|
|
|
* mix it, either all windows have it, or none (tested in OSX opengl) */
|
2012-11-11 12:02:39 +00:00
|
|
|
if (multisamples == -1)
|
2015-03-06 13:07:02 +01:00
|
|
|
multisamples = U.ogl_multisamples;
|
2015-03-11 13:14:24 +11:00
|
|
|
|
|
|
|
glSettings.numOfAASamples = multisamples;
|
2015-02-25 13:51:53 +01:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* a new window is created when pageflip mode is required for a window */
|
|
|
|
if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP)
|
|
|
|
glSettings.flags |= GHOST_glStereoVisual;
|
|
|
|
|
2015-07-02 19:30:08 +02:00
|
|
|
if (G.debug & G_DEBUG_GPU) {
|
|
|
|
glSettings.flags |= GHOST_glDebugContext;
|
|
|
|
}
|
|
|
|
|
2013-10-06 14:32:53 +00:00
|
|
|
wm_get_screensize(&scr_w, &scr_h);
|
2012-03-27 01:24:16 +00:00
|
|
|
posy = (scr_h - win->posy - win->sizey);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
ghostwin = GHOST_CreateWindow(g_system, title,
|
|
|
|
win->posx, posy, win->sizex, win->sizey,
|
|
|
|
(GHOST_TWindowState)win->windowstate,
|
|
|
|
GHOST_kDrawingContextTypeOpenGL,
|
2015-02-25 13:51:53 +01:00
|
|
|
glSettings);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
if (ghostwin) {
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
GHOST_RectangleHandle bounds;
|
|
|
|
|
2014-10-07 15:46:19 -05:00
|
|
|
/* the new window has already been made drawable upon creation */
|
|
|
|
wm->windrawable = win;
|
|
|
|
|
2010-10-22 00:29:56 +00:00
|
|
|
/* needed so we can detect the graphics card below */
|
2014-10-07 15:46:19 -05:00
|
|
|
GPU_init();
|
2008-11-18 13:51:02 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
win->ghostwin = ghostwin;
|
|
|
|
GHOST_SetWindowUserData(ghostwin, win); /* pointer back */
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
if (win->eventstate == NULL)
|
|
|
|
win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
|
2016-02-04 22:26:46 +01:00
|
|
|
|
|
|
|
/* store multisamples window was created with, in case user prefs change */
|
|
|
|
win->multisamples = multisamples;
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2014-02-26 20:50:55 +01:00
|
|
|
/* store actual window size in blender window */
|
|
|
|
bounds = GHOST_GetClientBounds(win->ghostwin);
|
2017-10-04 11:44:22 -06:00
|
|
|
|
|
|
|
/* win32: gives undefined window size when minimized */
|
|
|
|
if (GHOST_GetWindowState(win->ghostwin) != GHOST_kWindowStateMinimized) {
|
|
|
|
win->sizex = GHOST_GetWidthRectangle(bounds);
|
|
|
|
win->sizey = GHOST_GetHeightRectangle(bounds);
|
|
|
|
}
|
2014-02-26 20:50:55 +01:00
|
|
|
GHOST_DisposeRectangle(bounds);
|
2014-03-13 18:02:50 +01:00
|
|
|
|
|
|
|
#ifndef __APPLE__
|
|
|
|
/* set the state here, so minimized state comes up correct on windows */
|
|
|
|
GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate);
|
|
|
|
#endif
|
2012-07-03 19:09:07 +00:00
|
|
|
/* until screens get drawn, make it nice gray */
|
2012-06-17 09:58:26 +00:00
|
|
|
glClearColor(0.55, 0.55, 0.55, 0.0);
|
2010-10-22 00:29:56 +00:00
|
|
|
/* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
|
2010-10-22 00:29:56 +00:00
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
}
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
/* needed here, because it's used before it reads userdef */
|
2017-07-08 00:44:31 +02:00
|
|
|
WM_window_set_dpi(win);
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
wm_window_swap_buffers(win);
|
2008-11-18 13:51:02 +00:00
|
|
|
|
2009-02-18 13:29:54 +00:00
|
|
|
//GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified);
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* standard state vars for window */
|
|
|
|
glEnable(GL_SCISSOR_TEST);
|
2008-12-19 17:26:15 +00:00
|
|
|
GPU_state_init();
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-07 00:27:27 +11:00
|
|
|
/**
|
2018-03-14 01:58:46 +11:00
|
|
|
* Initialize #wmWindow without ghostwin, open these and clear.
|
2015-10-07 00:27:27 +11:00
|
|
|
*
|
|
|
|
* window size is read from window, if 0 it uses prefsize
|
|
|
|
* called in #WM_check, also inits stuff after file read.
|
|
|
|
*
|
|
|
|
* \warning
|
|
|
|
* After running, 'win->ghostwin' can be NULL in rare cases
|
|
|
|
* (where OpenGL driver fails to create a context for eg).
|
|
|
|
* We could remove them with #wm_window_ghostwindows_remove_invalid
|
|
|
|
* but better not since caller may continue to use.
|
|
|
|
* Instead, caller needs to handle the error case and cleanup.
|
|
|
|
*/
|
|
|
|
void wm_window_ghostwindows_ensure(wmWindowManager *wm)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2007-12-24 18:27:28 +00:00
|
|
|
wmWindow *win;
|
|
|
|
|
2015-10-07 00:27:27 +11:00
|
|
|
BLI_assert(G.background == false);
|
|
|
|
|
2010-10-15 09:32:40 +00:00
|
|
|
/* no commandline prefsize? then we set this.
|
|
|
|
* Note that these values will be used only
|
|
|
|
* when there is no startup.blend yet.
|
|
|
|
*/
|
2012-03-13 15:44:48 +00:00
|
|
|
if (wm_init_state.size_x == 0) {
|
|
|
|
wm_get_screensize(&wm_init_state.size_x, &wm_init_state.size_y);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2015-06-09 00:20:34 +10:00
|
|
|
/* note!, this isnt quite correct, active screen maybe offset 1000s if PX,
|
|
|
|
* we'd need a wm_get_screensize like function that gives offset,
|
|
|
|
* in practice the window manager will likely move to the correct monitor */
|
|
|
|
wm_init_state.start_x = 0;
|
|
|
|
wm_init_state.start_y = 0;
|
2013-11-05 15:37:59 +00:00
|
|
|
|
2014-10-07 15:46:19 -05:00
|
|
|
#ifdef WITH_X11 /* X11 */
|
2013-03-12 14:55:52 +00:00
|
|
|
/* X11, start maximized but use default sane size */
|
2013-02-07 14:41:08 +00:00
|
|
|
wm_init_state.size_x = min_ii(wm_init_state.size_x, WM_WIN_INIT_SIZE_X);
|
|
|
|
wm_init_state.size_y = min_ii(wm_init_state.size_y, WM_WIN_INIT_SIZE_Y);
|
2013-03-12 14:55:52 +00:00
|
|
|
/* pad */
|
|
|
|
wm_init_state.start_x = WM_WIN_INIT_PAD;
|
|
|
|
wm_init_state.start_y = WM_WIN_INIT_PAD;
|
|
|
|
wm_init_state.size_x -= WM_WIN_INIT_PAD * 2;
|
|
|
|
wm_init_state.size_y -= WM_WIN_INIT_PAD * 2;
|
2013-02-07 14:41:08 +00:00
|
|
|
#endif
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
for (win = wm->windows.first; win; win = win->next) {
|
|
|
|
if (win->ghostwin == NULL) {
|
2012-03-13 15:44:48 +00:00
|
|
|
if ((win->sizex == 0) || (wm_init_state.override_flag & WIN_OVERRIDE_GEOM)) {
|
|
|
|
win->posx = wm_init_state.start_x;
|
|
|
|
win->posy = wm_init_state.start_y;
|
|
|
|
win->sizex = wm_init_state.size_x;
|
|
|
|
win->sizey = wm_init_state.size_y;
|
2012-10-24 16:15:36 +00:00
|
|
|
|
2013-01-31 09:53:34 +00:00
|
|
|
win->windowstate = GHOST_kWindowStateNormal;
|
2012-03-13 15:44:48 +00:00
|
|
|
wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM;
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
2012-03-13 15:44:48 +00:00
|
|
|
|
|
|
|
if (wm_init_state.override_flag & WIN_OVERRIDE_WINSTATE) {
|
|
|
|
win->windowstate = wm_init_state.windowstate;
|
2012-03-20 23:52:23 +00:00
|
|
|
wm_init_state.override_flag &= ~WIN_OVERRIDE_WINSTATE;
|
2012-03-13 15:44:48 +00:00
|
|
|
}
|
|
|
|
|
2015-07-16 17:28:20 +10:00
|
|
|
/* without this, cursor restore may fail, T45456 */
|
|
|
|
if (win->cursor == 0) {
|
|
|
|
win->cursor = CURSOR_STD;
|
|
|
|
}
|
|
|
|
|
2015-10-07 00:27:27 +11:00
|
|
|
wm_window_ghostwindow_add(wm, "Blender", win);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
2009-01-23 17:42:36 +00:00
|
|
|
/* happens after fileread */
|
2012-03-27 01:24:16 +00:00
|
|
|
if (win->eventstate == NULL)
|
|
|
|
win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
|
2009-01-23 17:42:36 +00:00
|
|
|
/* add keymap handlers (1 handler for all keys in map!) */
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Window", 0, 0);
|
2009-01-23 17:42:36 +00:00
|
|
|
WM_event_add_keymap_handler(&win->handlers, keymap);
|
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Screen", 0, 0);
|
2009-01-23 17:42:36 +00:00
|
|
|
WM_event_add_keymap_handler(&win->handlers, keymap);
|
2009-09-18 15:48:49 +00:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0);
|
2009-09-18 15:48:49 +00:00
|
|
|
WM_event_add_keymap_handler(&win->modalhandlers, keymap);
|
2009-02-18 13:29:54 +00:00
|
|
|
|
2010-12-17 19:05:34 +00:00
|
|
|
/* add drop boxes */
|
|
|
|
{
|
2012-03-27 01:24:16 +00:00
|
|
|
ListBase *lb = WM_dropboxmap_find("Window", 0, 0);
|
2010-12-17 19:05:34 +00:00
|
|
|
WM_event_add_dropbox_handler(&win->handlers, lb);
|
|
|
|
}
|
2009-02-18 13:29:54 +00:00
|
|
|
wm_window_title(wm, win);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-07 00:27:27 +11:00
|
|
|
/**
|
|
|
|
* Call after #wm_window_ghostwindows_ensure or #WM_check
|
|
|
|
* (after loading a new file) in the unlikely event a window couldn't be created.
|
|
|
|
*/
|
|
|
|
void wm_window_ghostwindows_remove_invalid(bContext *C, wmWindowManager *wm)
|
|
|
|
{
|
|
|
|
wmWindow *win, *win_next;
|
|
|
|
|
|
|
|
BLI_assert(G.background == false);
|
|
|
|
|
|
|
|
for (win = wm->windows.first; win; win = win_next) {
|
|
|
|
win_next = win->next;
|
|
|
|
if (win->ghostwin == NULL) {
|
|
|
|
wm_window_close(C, wm, win);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* new window, no screen yet, but we open ghostwindow for it,
|
|
|
|
* also gets the window level handlers
|
|
|
|
* \note area-rip calls this.
|
|
|
|
* \return the window or NULL.
|
|
|
|
*/
|
2014-01-19 23:14:24 +11:00
|
|
|
wmWindow *WM_window_open(bContext *C, const rcti *rect)
|
2008-11-18 13:51:02 +00:00
|
|
|
{
|
2015-10-07 00:27:27 +11:00
|
|
|
wmWindow *win_prev = CTX_wm_window(C);
|
2012-03-27 01:24:16 +00:00
|
|
|
wmWindow *win = wm_window_new(C);
|
2008-11-18 13:51:02 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
win->posx = rect->xmin;
|
|
|
|
win->posy = rect->ymin;
|
2012-09-15 11:48:20 +00:00
|
|
|
win->sizex = BLI_rcti_size_x(rect);
|
|
|
|
win->sizey = BLI_rcti_size_y(rect);
|
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
|
|
|
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
win->drawmethod = U.wmdrawmethod;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2009-11-11 04:08:09 +00:00
|
|
|
WM_check(C);
|
2008-11-18 13:51:02 +00:00
|
|
|
|
2015-10-07 00:27:27 +11:00
|
|
|
if (win->ghostwin) {
|
|
|
|
return win;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
wm_window_close(C, CTX_wm_manager(C), win);
|
|
|
|
CTX_wm_window_set(C, win_prev);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2009-07-24 12:43:59 +00:00
|
|
|
|
2015-10-07 00:27:27 +11:00
|
|
|
/**
|
|
|
|
* Uses `screen->temp` tag to define what to do, currently it limits
|
|
|
|
* to only one "temp" window for render out, preferences, filewindow, etc...
|
|
|
|
*
|
|
|
|
* \param type: WM_WINDOW_RENDER, WM_WINDOW_USERPREFS...
|
|
|
|
* \return the window or NULL.
|
|
|
|
*/
|
2017-04-20 00:17:42 +02:00
|
|
|
wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, int type)
|
2009-07-24 12:43:59 +00:00
|
|
|
{
|
2015-10-07 00:27:27 +11:00
|
|
|
wmWindow *win_prev = CTX_wm_window(C);
|
2009-07-24 12:43:59 +00:00
|
|
|
wmWindow *win;
|
|
|
|
ScrArea *sa;
|
2013-06-04 15:36:00 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2015-10-07 00:27:27 +11:00
|
|
|
const char *title;
|
2017-04-20 00:17:42 +02:00
|
|
|
|
|
|
|
/* convert to native OS window coordinates */
|
|
|
|
const float native_pixel_size = GHOST_GetNativePixelSize(win_prev->ghostwin);
|
|
|
|
x /= native_pixel_size;
|
|
|
|
y /= native_pixel_size;
|
|
|
|
sizex /= native_pixel_size;
|
|
|
|
sizey /= native_pixel_size;
|
|
|
|
|
|
|
|
/* calculate postition */
|
|
|
|
rcti rect;
|
|
|
|
rect.xmin = x + win_prev->posx - sizex / 2;
|
|
|
|
rect.ymin = y + win_prev->posy - sizey / 2;
|
|
|
|
rect.xmax = rect.xmin + sizex;
|
|
|
|
rect.ymax = rect.ymin + sizey;
|
2015-10-07 00:27:27 +11:00
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
/* changes rect to fit within desktop */
|
2015-10-07 00:27:27 +11:00
|
|
|
wm_window_check_position(&rect);
|
2009-07-24 12:43:59 +00:00
|
|
|
|
|
|
|
/* test if we have a temp screen already */
|
2012-03-27 01:24:16 +00:00
|
|
|
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next)
|
2012-03-24 06:24:53 +00:00
|
|
|
if (win->screen->temp)
|
2009-07-24 12:43:59 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* add new window? */
|
2012-03-27 01:24:16 +00:00
|
|
|
if (win == NULL) {
|
|
|
|
win = wm_window_new(C);
|
2009-07-24 12:43:59 +00:00
|
|
|
|
2015-10-07 00:27:27 +11:00
|
|
|
win->posx = rect.xmin;
|
|
|
|
win->posy = rect.ymin;
|
2009-07-24 12:43:59 +00:00
|
|
|
}
|
2015-10-27 12:53:58 +01:00
|
|
|
|
2017-03-11 03:27:08 +01:00
|
|
|
win->sizex = BLI_rcti_size_x(&rect);
|
|
|
|
win->sizey = BLI_rcti_size_y(&rect);
|
2015-10-27 12:53:58 +01:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (win->ghostwin) {
|
2012-02-27 10:35:39 +00:00
|
|
|
wm_window_set_size(win, win->sizex, win->sizey);
|
2009-07-24 12:43:59 +00:00
|
|
|
wm_window_raise(win);
|
|
|
|
}
|
|
|
|
|
2013-06-04 15:36:00 +00:00
|
|
|
if (win->screen == NULL) {
|
|
|
|
/* add new screen */
|
|
|
|
win->screen = ED_screen_add(win, scene, "temp");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* switch scene for rendering */
|
|
|
|
if (win->screen->scene != scene)
|
|
|
|
ED_screen_set_scene(C, win->screen, scene);
|
|
|
|
}
|
|
|
|
|
2010-11-09 14:54:59 +00:00
|
|
|
win->screen->temp = 1;
|
2009-07-24 12:43:59 +00:00
|
|
|
|
|
|
|
/* make window active, and validate/resize */
|
|
|
|
CTX_wm_window_set(C, win);
|
2009-11-11 04:08:09 +00:00
|
|
|
WM_check(C);
|
2015-10-07 00:27:27 +11:00
|
|
|
|
|
|
|
/* It's possible `win->ghostwin == NULL`.
|
|
|
|
* instead of attempting to cleanup here (in a half finished state),
|
|
|
|
* finish setting up the screen, then free it at the end of the function,
|
|
|
|
* to avoid having to take into account a partially-created window.
|
|
|
|
*/
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
/* ensure it shows the right spacetype editor */
|
2012-03-27 01:24:16 +00:00
|
|
|
sa = win->screen->areabase.first;
|
2009-07-24 12:43:59 +00:00
|
|
|
CTX_wm_area_set(C, sa);
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
if (type == WM_WINDOW_RENDER) {
|
Fix a bunch of temp full-screen glitches
Steps to reproduce fixed glitches were:
* Change any editor to be file browser from menu, Ctrl+O *from the file browser area*, Esc -> area reset to what it was before changing to file browser initially
* Ctrl+O from any area, F12, Esc -> returns to initial editor in full-screen (expected is file browser in full-screen)
Fixes T46229
Core of the fix is removing old area from spacedata list when going back to previous area (see ED_area_prevspace -> BKE_spacedata_remove). Also, when creating a new temp area we now don't exit old area anymore (needed so SpaceFile->op is kept, but it also makes sense in general)
Aaand finally removes some ugly hacks.
Tested quite a bit, so I think it's safe to apply (besides of remark below), just would like to get things double checked and confirmed. After all, this full-screen stuff finally starts to feel like it's working :P
Note, there's still a memory leak when quitting Blender with temp area open. Haven't found out how to solve yet, but it's not that important for review anyway.
Reviewers: campbellbarton, brecht
Reviewed By: brecht
Subscribers: plyczkowski, Blendify
Maniphest Tasks: T46229
Differential Revision: https://developer.blender.org/D1531
2016-02-29 16:18:42 +01:00
|
|
|
ED_area_newspace(C, sa, SPACE_IMAGE, false);
|
2009-07-24 12:43:59 +00:00
|
|
|
}
|
|
|
|
else {
|
Fix a bunch of temp full-screen glitches
Steps to reproduce fixed glitches were:
* Change any editor to be file browser from menu, Ctrl+O *from the file browser area*, Esc -> area reset to what it was before changing to file browser initially
* Ctrl+O from any area, F12, Esc -> returns to initial editor in full-screen (expected is file browser in full-screen)
Fixes T46229
Core of the fix is removing old area from spacedata list when going back to previous area (see ED_area_prevspace -> BKE_spacedata_remove). Also, when creating a new temp area we now don't exit old area anymore (needed so SpaceFile->op is kept, but it also makes sense in general)
Aaand finally removes some ugly hacks.
Tested quite a bit, so I think it's safe to apply (besides of remark below), just would like to get things double checked and confirmed. After all, this full-screen stuff finally starts to feel like it's working :P
Note, there's still a memory leak when quitting Blender with temp area open. Haven't found out how to solve yet, but it's not that important for review anyway.
Reviewers: campbellbarton, brecht
Reviewed By: brecht
Subscribers: plyczkowski, Blendify
Maniphest Tasks: T46229
Differential Revision: https://developer.blender.org/D1531
2016-02-29 16:18:42 +01:00
|
|
|
ED_area_newspace(C, sa, SPACE_USERPREF, false);
|
2009-07-24 12:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ED_screen_set(C, win->screen);
|
2012-12-26 13:05:39 +00:00
|
|
|
ED_screen_refresh(CTX_wm_manager(C), win); /* test scale */
|
2009-07-24 12:43:59 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
if (sa->spacetype == SPACE_IMAGE)
|
2015-10-07 00:27:27 +11:00
|
|
|
title = IFACE_("Blender Render");
|
2012-03-24 06:24:53 +00:00
|
|
|
else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
|
2015-10-07 00:27:27 +11:00
|
|
|
title = IFACE_("Blender User Preferences");
|
2012-03-27 01:24:16 +00:00
|
|
|
else if (sa->spacetype == SPACE_FILE)
|
2015-10-07 00:27:27 +11:00
|
|
|
title = IFACE_("Blender File View");
|
2009-07-24 12:43:59 +00:00
|
|
|
else
|
2015-10-07 00:27:27 +11:00
|
|
|
title = "Blender";
|
|
|
|
|
|
|
|
if (win->ghostwin) {
|
|
|
|
GHOST_SetTitle(win->ghostwin, title);
|
|
|
|
return win;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* very unlikely! but opening a new window can fail */
|
|
|
|
wm_window_close(C, CTX_wm_manager(C), win);
|
|
|
|
CTX_wm_window_set(C, win_prev);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2009-07-24 12:43:59 +00:00
|
|
|
}
|
|
|
|
|
2008-11-18 13:51:02 +00:00
|
|
|
|
|
|
|
/* ****************** Operators ****************** */
|
|
|
|
|
2015-10-20 15:41:13 +11:00
|
|
|
int wm_window_close_exec(bContext *C, wmOperator *UNUSED(op))
|
|
|
|
{
|
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
wmWindow *win = CTX_wm_window(C);
|
|
|
|
wm_window_close(C, wm, win);
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
2008-11-18 13:51:02 +00:00
|
|
|
/* operator callback */
|
2010-10-16 02:40:31 +00:00
|
|
|
int wm_window_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
|
2008-11-18 13:51:02 +00:00
|
|
|
{
|
2015-05-28 18:00:53 +10:00
|
|
|
wmWindow *win_src = CTX_wm_window(C);
|
2015-06-09 01:25:34 +10:00
|
|
|
bool ok;
|
2015-05-28 18:00:53 +10:00
|
|
|
|
2015-06-09 01:25:34 +10:00
|
|
|
ok = (wm_window_copy_test(C, win_src) != NULL);
|
2015-05-28 18:00:53 +10:00
|
|
|
|
2015-06-09 01:25:34 +10:00
|
|
|
return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
2008-11-18 13:51:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* fullscreen operator callback */
|
2010-10-16 02:40:31 +00:00
|
|
|
int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
2008-11-18 13:51:02 +00:00
|
|
|
{
|
2012-03-27 01:24:16 +00:00
|
|
|
wmWindow *window = CTX_wm_window(C);
|
2011-03-22 11:19:02 +00:00
|
|
|
GHOST_TWindowState state;
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (G.background)
|
2011-03-22 11:19:02 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
state = GHOST_GetWindowState(window->ghostwin);
|
|
|
|
if (state != GHOST_kWindowStateFullScreen)
|
2008-12-18 02:56:48 +00:00
|
|
|
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateFullScreen);
|
2008-11-18 13:51:02 +00:00
|
|
|
else
|
2008-12-18 02:56:48 +00:00
|
|
|
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateNormal);
|
2008-11-18 13:51:02 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* ************ events *************** */
|
|
|
|
|
2015-10-03 03:37:41 +02:00
|
|
|
void wm_cursor_position_from_ghost(wmWindow *win, int *x, int *y)
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
{
|
2013-01-12 17:07:49 +00:00
|
|
|
float fac = GHOST_GetNativePixelSize(win->ghostwin);
|
|
|
|
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
GHOST_ScreenToClient(win->ghostwin, *x, *y, x, y);
|
2013-01-12 17:07:49 +00:00
|
|
|
*x *= fac;
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
*y = (win->sizey - 1) - *y;
|
2013-01-12 17:07:49 +00:00
|
|
|
*y *= fac;
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
}
|
|
|
|
|
2015-10-03 03:37:41 +02:00
|
|
|
void wm_cursor_position_to_ghost(wmWindow *win, int *x, int *y)
|
|
|
|
{
|
|
|
|
float fac = GHOST_GetNativePixelSize(win->ghostwin);
|
|
|
|
|
|
|
|
*x /= fac;
|
|
|
|
*y /= fac;
|
|
|
|
*y = win->sizey - *y - 1;
|
|
|
|
|
|
|
|
GHOST_ClientToScreen(win->ghostwin, *x, *y, x, y);
|
|
|
|
}
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
void wm_get_cursor_position(wmWindow *win, int *x, int *y)
|
|
|
|
{
|
|
|
|
GHOST_GetCursorPosition(g_system, x, y);
|
2015-10-03 03:37:41 +02:00
|
|
|
wm_cursor_position_from_ghost(win, x, y);
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
}
|
|
|
|
|
2012-06-06 22:38:39 +00:00
|
|
|
typedef enum {
|
|
|
|
SHIFT = 's',
|
|
|
|
CONTROL = 'c',
|
|
|
|
ALT = 'a',
|
|
|
|
OS = 'C'
|
2010-10-15 13:03:10 +00:00
|
|
|
} modifierKeyType;
|
|
|
|
|
|
|
|
/* check if specified modifier key type is pressed */
|
|
|
|
static int query_qual(modifierKeyType qual)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
|
|
|
GHOST_TModifierKeyMask left, right;
|
2012-03-27 01:24:16 +00:00
|
|
|
int val = 0;
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
switch (qual) {
|
2010-10-15 13:03:10 +00:00
|
|
|
case SHIFT:
|
2012-03-27 01:24:16 +00:00
|
|
|
left = GHOST_kModifierKeyLeftShift;
|
|
|
|
right = GHOST_kModifierKeyRightShift;
|
2010-10-15 13:03:10 +00:00
|
|
|
break;
|
|
|
|
case CONTROL:
|
2012-03-27 01:24:16 +00:00
|
|
|
left = GHOST_kModifierKeyLeftControl;
|
|
|
|
right = GHOST_kModifierKeyRightControl;
|
2010-10-15 13:03:10 +00:00
|
|
|
break;
|
|
|
|
case OS:
|
2012-03-27 01:24:16 +00:00
|
|
|
left = right = GHOST_kModifierKeyOS;
|
2010-10-15 13:03:10 +00:00
|
|
|
break;
|
|
|
|
case ALT:
|
|
|
|
default:
|
2012-03-27 01:24:16 +00:00
|
|
|
left = GHOST_kModifierKeyLeftAlt;
|
|
|
|
right = GHOST_kModifierKeyRightAlt;
|
2010-10-15 13:03:10 +00:00
|
|
|
break;
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GHOST_GetModifierKeyState(g_system, left, &val);
|
|
|
|
if (!val)
|
|
|
|
GHOST_GetModifierKeyState(g_system, right, &val);
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2013-04-18 16:28:39 +00:00
|
|
|
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2008-12-18 02:56:48 +00:00
|
|
|
if (win != wm->windrawable && win->ghostwin) {
|
2012-05-27 19:40:36 +00:00
|
|
|
// win->lmbut = 0; /* keeps hanging when mousepressed while other window opened */
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
wm->windrawable = win;
|
2012-03-31 00:59:17 +00:00
|
|
|
if (G.debug & G_DEBUG_EVENTS) {
|
|
|
|
printf("%s: set drawable %d\n", __func__, win->winid);
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
GHOST_ActivateWindowDrawingContext(win->ghostwin);
|
2016-03-05 06:30:51 +11:00
|
|
|
|
|
|
|
/* this can change per window */
|
2017-07-08 00:44:31 +02:00
|
|
|
WM_window_set_dpi(win);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* called by ghost, here we handle events for windows themselves or send to event system */
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
/* mouse coordinate converversion happens here */
|
2012-06-17 11:36:28 +00:00
|
|
|
static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2012-06-17 11:36:28 +00:00
|
|
|
bContext *C = C_void_ptr;
|
2012-03-27 01:24:16 +00:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
|
|
|
GHOST_TEventType type = GHOST_GetEventType(evt);
|
|
|
|
int time = GHOST_GetEventTime(evt);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
if (type == GHOST_kEventQuit) {
|
|
|
|
WM_exit(C);
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-27 01:24:16 +00:00
|
|
|
GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt);
|
|
|
|
GHOST_TEventDataPtr data = GHOST_GetEventData(evt);
|
2007-12-24 18:27:28 +00:00
|
|
|
wmWindow *win;
|
|
|
|
|
2013-06-01 15:24:15 +00:00
|
|
|
/* Ghost now can call this function for life resizes, but it should return if WM didn't initialize yet.
|
2013-06-06 06:02:46 +00:00
|
|
|
* Can happen on file read (especially full size window) */
|
2013-06-01 15:24:15 +00:00
|
|
|
if ((wm->initialized & WM_INIT_WINDOW) == 0) {
|
|
|
|
return 1;
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
if (!ghostwin) {
|
2012-06-17 11:36:28 +00:00
|
|
|
/* XXX - should be checked, why are we getting an event here, and */
|
|
|
|
/* what is it? */
|
2011-06-11 00:25:48 +00:00
|
|
|
puts("<!> event has no window");
|
2007-12-24 18:27:28 +00:00
|
|
|
return 1;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
else if (!GHOST_ValidWindow(g_system, ghostwin)) {
|
2012-06-17 11:36:28 +00:00
|
|
|
/* XXX - should be checked, why are we getting an event here, and */
|
|
|
|
/* what is it? */
|
2012-10-21 05:46:41 +00:00
|
|
|
puts("<!> event has invalid window");
|
2007-12-24 18:27:28 +00:00
|
|
|
return 1;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-27 01:24:16 +00:00
|
|
|
win = GHOST_GetWindowUserData(ghostwin);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
switch (type) {
|
2007-12-24 18:27:28 +00:00
|
|
|
case GHOST_kEventWindowDeactivate:
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
wm_event_add_ghostevent(wm, win, type, time, data);
|
2012-03-27 01:24:16 +00:00
|
|
|
win->active = 0; /* XXX */
|
2013-01-08 14:40:15 +00:00
|
|
|
|
|
|
|
/* clear modifiers for inactive windows */
|
|
|
|
win->eventstate->alt = 0;
|
|
|
|
win->eventstate->ctrl = 0;
|
|
|
|
win->eventstate->shift = 0;
|
|
|
|
win->eventstate->oskey = 0;
|
|
|
|
win->eventstate->keymodifier = 0;
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
break;
|
|
|
|
case GHOST_kEventWindowActivate:
|
|
|
|
{
|
|
|
|
GHOST_TEventKeyData kdata;
|
2012-05-10 15:34:23 +00:00
|
|
|
wmEvent event;
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
int wx, wy;
|
2014-05-20 14:19:18 +10:00
|
|
|
const int keymodifier = ((query_qual(SHIFT) ? KM_SHIFT : 0) |
|
|
|
|
(query_qual(CONTROL) ? KM_CTRL : 0) |
|
|
|
|
(query_qual(ALT) ? KM_ALT : 0) |
|
|
|
|
(query_qual(OS) ? KM_OSKEY : 0));
|
2014-05-26 16:31:06 +10:00
|
|
|
|
|
|
|
/* Win23/GHOST modifier bug, see T40317 */
|
|
|
|
#ifndef WIN32
|
2014-06-02 22:31:32 +10:00
|
|
|
//# define USE_WIN_ACTIVATE
|
2014-05-26 16:31:06 +10:00
|
|
|
#endif
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
wm->winactive = win; /* no context change! c->wm->windrawable is drawable, or for area queues */
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
win->active = 1;
|
2007-12-24 18:27:28 +00:00
|
|
|
// window_handle(win, INPUTCHANGE, win->active);
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* bad ghost support for modifier keys... so on activate we set the modifiers again */
|
2013-02-15 13:30:30 +00:00
|
|
|
|
|
|
|
/* TODO: This is not correct since a modifier may be held when a window is activated...
|
2014-05-20 14:19:18 +10:00
|
|
|
* better solve this at ghost level. attempted fix r54450 but it caused bug [#34255]
|
|
|
|
*
|
|
|
|
* For now don't send GHOST_kEventKeyDown events, just set the 'eventstate'.
|
|
|
|
*/
|
2012-03-27 01:24:16 +00:00
|
|
|
kdata.ascii = '\0';
|
|
|
|
kdata.utf8_buf[0] = '\0';
|
2014-05-20 14:19:18 +10:00
|
|
|
|
|
|
|
if (win->eventstate->shift) {
|
|
|
|
if ((keymodifier & KM_SHIFT) == 0) {
|
|
|
|
kdata.key = GHOST_kKeyLeftShift;
|
|
|
|
wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
|
|
|
|
}
|
|
|
|
}
|
2014-05-26 16:31:06 +10:00
|
|
|
#ifdef USE_WIN_ACTIVATE
|
2014-05-20 14:19:18 +10:00
|
|
|
else {
|
|
|
|
if (keymodifier & KM_SHIFT) {
|
|
|
|
win->eventstate->shift = KM_MOD_FIRST;
|
|
|
|
}
|
|
|
|
}
|
2014-05-26 16:31:06 +10:00
|
|
|
#endif
|
2014-05-20 14:19:18 +10:00
|
|
|
if (win->eventstate->ctrl) {
|
|
|
|
if ((keymodifier & KM_CTRL) == 0) {
|
|
|
|
kdata.key = GHOST_kKeyLeftControl;
|
|
|
|
wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
2014-05-26 16:31:06 +10:00
|
|
|
#ifdef USE_WIN_ACTIVATE
|
2014-05-20 14:19:18 +10:00
|
|
|
else {
|
|
|
|
if (keymodifier & KM_CTRL) {
|
|
|
|
win->eventstate->ctrl = KM_MOD_FIRST;
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
2014-05-26 16:31:06 +10:00
|
|
|
#endif
|
2014-05-20 14:19:18 +10:00
|
|
|
if (win->eventstate->alt) {
|
|
|
|
if ((keymodifier & KM_ALT) == 0) {
|
|
|
|
kdata.key = GHOST_kKeyLeftAlt;
|
|
|
|
wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
2014-05-26 16:31:06 +10:00
|
|
|
#ifdef USE_WIN_ACTIVATE
|
2014-05-20 14:19:18 +10:00
|
|
|
else {
|
|
|
|
if (keymodifier & KM_ALT) {
|
|
|
|
win->eventstate->alt = KM_MOD_FIRST;
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
2014-05-26 16:31:06 +10:00
|
|
|
#endif
|
2014-05-20 14:19:18 +10:00
|
|
|
if (win->eventstate->oskey) {
|
|
|
|
if ((keymodifier & KM_OSKEY) == 0) {
|
|
|
|
kdata.key = GHOST_kKeyOS;
|
|
|
|
wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
|
|
|
|
}
|
|
|
|
}
|
2014-05-26 16:31:06 +10:00
|
|
|
#ifdef USE_WIN_ACTIVATE
|
2014-05-20 14:19:18 +10:00
|
|
|
else {
|
|
|
|
if (keymodifier & KM_OSKEY) {
|
|
|
|
win->eventstate->oskey = KM_MOD_FIRST;
|
|
|
|
}
|
|
|
|
}
|
2014-05-26 16:31:06 +10:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#undef USE_WIN_ACTIVATE
|
|
|
|
|
2014-05-20 14:19:18 +10:00
|
|
|
|
2009-08-16 17:42:09 +00:00
|
|
|
/* keymodifier zero, it hangs on hotkeys that open windows otherwise */
|
2012-03-27 01:24:16 +00:00
|
|
|
win->eventstate->keymodifier = 0;
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
/* entering window, update mouse pos. but no event */
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
wm_get_cursor_position(win, &wx, &wy);
|
|
|
|
|
|
|
|
win->eventstate->x = wx;
|
|
|
|
win->eventstate->y = wy;
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
win->addmousemove = 1; /* enables highlighted buttons */
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
2013-04-18 16:28:39 +00:00
|
|
|
wm_window_make_drawable(wm, win);
|
2012-05-10 15:34:23 +00:00
|
|
|
|
|
|
|
/* window might be focused by mouse click in configuration of window manager
|
|
|
|
* when focus is not following mouse
|
|
|
|
* click could have been done on a button and depending on window manager settings
|
|
|
|
* click would be passed to blender or not, but in any case button under cursor
|
|
|
|
* should be activated, so at max next click on button without moving mouse
|
|
|
|
* would trigger it's handle function
|
|
|
|
* currently it seems to be common practice to generate new event for, but probably
|
|
|
|
* we'll need utility function for this? (sergey)
|
|
|
|
*/
|
2013-07-29 08:29:04 +00:00
|
|
|
wm_event_init_from_window(win, &event);
|
2012-05-10 15:34:23 +00:00
|
|
|
event.type = MOUSEMOVE;
|
|
|
|
event.prevx = event.x;
|
|
|
|
event.prevy = event.y;
|
|
|
|
|
|
|
|
wm_event_add(win, &event);
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-09-08 08:59:47 +00:00
|
|
|
case GHOST_kEventWindowClose:
|
|
|
|
{
|
2009-10-20 13:58:53 +00:00
|
|
|
wm_window_close(C, wm, win);
|
2007-12-24 18:27:28 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-09-08 08:59:47 +00:00
|
|
|
case GHOST_kEventWindowUpdate:
|
|
|
|
{
|
2012-03-31 00:59:17 +00:00
|
|
|
if (G.debug & G_DEBUG_EVENTS) {
|
|
|
|
printf("%s: ghost redraw %d\n", __func__, win->winid);
|
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2013-04-18 16:28:39 +00:00
|
|
|
wm_window_make_drawable(wm, win);
|
2008-12-27 16:09:56 +00:00
|
|
|
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-12-30 13:30:31 +00:00
|
|
|
case GHOST_kEventWindowSize:
|
2012-09-08 08:59:47 +00:00
|
|
|
case GHOST_kEventWindowMove:
|
|
|
|
{
|
2008-12-28 15:28:09 +00:00
|
|
|
GHOST_TWindowState state;
|
|
|
|
state = GHOST_GetWindowState(win->ghostwin);
|
2012-03-10 17:49:26 +00:00
|
|
|
win->windowstate = state;
|
2008-12-28 15:28:09 +00:00
|
|
|
|
2012-11-11 18:33:35 +00:00
|
|
|
/* stop screencast if resize */
|
|
|
|
if (type == GHOST_kEventWindowSize) {
|
2014-04-30 07:48:54 +10:00
|
|
|
WM_jobs_stop(wm, win->screen, NULL);
|
2012-11-11 18:33:35 +00:00
|
|
|
}
|
2017-03-11 03:27:08 +01:00
|
|
|
|
2017-07-08 00:44:31 +02:00
|
|
|
WM_window_set_dpi(win);
|
2012-11-11 18:33:35 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
/* win32: gives undefined window size when minimized */
|
|
|
|
if (state != GHOST_kWindowStateMinimized) {
|
2008-12-28 15:28:09 +00:00
|
|
|
GHOST_RectangleHandle client_rect;
|
|
|
|
int l, t, r, b, scr_w, scr_h;
|
2009-09-20 17:24:56 +00:00
|
|
|
int sizex, sizey, posx, posy;
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
client_rect = GHOST_GetClientBounds(win->ghostwin);
|
2008-12-28 15:28:09 +00:00
|
|
|
GHOST_GetRectangle(client_rect, &l, &t, &r, &b);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2008-12-28 15:28:09 +00:00
|
|
|
GHOST_DisposeRectangle(client_rect);
|
|
|
|
|
2013-09-10 06:32:32 +00:00
|
|
|
wm_get_desktopsize(&scr_w, &scr_h);
|
2012-03-27 01:24:16 +00:00
|
|
|
sizex = r - l;
|
|
|
|
sizey = b - t;
|
|
|
|
posx = l;
|
|
|
|
posy = scr_h - t - win->sizey;
|
2009-09-20 17:24:56 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ghost sometimes send size or move events when the window hasn't changed.
|
|
|
|
* One case of this is using compiz on linux. To alleviate the problem
|
|
|
|
* we ignore all such event here.
|
|
|
|
*
|
|
|
|
* It might be good to eventually do that at Ghost level, but that is for
|
|
|
|
* another time.
|
|
|
|
*/
|
|
|
|
if (win->sizex != sizex ||
|
2012-03-27 01:24:16 +00:00
|
|
|
win->sizey != sizey ||
|
|
|
|
win->posx != posx ||
|
|
|
|
win->posy != posy)
|
2009-09-20 17:24:56 +00:00
|
|
|
{
|
2012-03-27 01:24:16 +00:00
|
|
|
win->sizex = sizex;
|
|
|
|
win->sizey = sizey;
|
|
|
|
win->posx = posx;
|
|
|
|
win->posy = posy;
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
2009-09-20 17:24:56 +00:00
|
|
|
/* debug prints */
|
2012-03-31 00:59:17 +00:00
|
|
|
if (G.debug & G_DEBUG_EVENTS) {
|
|
|
|
const char *state_str;
|
2009-09-20 17:24:56 +00:00
|
|
|
state = GHOST_GetWindowState(win->ghostwin);
|
2012-03-31 00:59:17 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
if (state == GHOST_kWindowStateNormal) {
|
2012-03-31 00:59:17 +00:00
|
|
|
state_str = "normal";
|
2009-09-20 17:24:56 +00:00
|
|
|
}
|
2012-03-27 01:24:16 +00:00
|
|
|
else if (state == GHOST_kWindowStateMinimized) {
|
2012-03-31 00:59:17 +00:00
|
|
|
state_str = "minimized";
|
2009-09-20 17:24:56 +00:00
|
|
|
}
|
2012-03-27 01:24:16 +00:00
|
|
|
else if (state == GHOST_kWindowStateMaximized) {
|
2012-03-31 00:59:17 +00:00
|
|
|
state_str = "maximized";
|
2009-09-20 17:24:56 +00:00
|
|
|
}
|
2012-03-27 01:24:16 +00:00
|
|
|
else if (state == GHOST_kWindowStateFullScreen) {
|
2012-03-31 00:59:17 +00:00
|
|
|
state_str = "fullscreen";
|
2009-09-20 17:24:56 +00:00
|
|
|
}
|
2012-03-31 00:59:17 +00:00
|
|
|
else {
|
|
|
|
state_str = "<unknown>";
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("%s: window %d state = %s\n", __func__, win->winid, state_str);
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
if (type != GHOST_kEventWindowSize) {
|
2012-03-31 00:59:17 +00:00
|
|
|
printf("win move event pos %d %d size %d %d\n",
|
|
|
|
win->posx, win->posy, win->sizex, win->sizey);
|
2009-09-20 17:24:56 +00:00
|
|
|
}
|
2008-12-28 15:28:09 +00:00
|
|
|
}
|
2009-09-20 17:24:56 +00:00
|
|
|
|
2013-04-18 16:28:39 +00:00
|
|
|
wm_window_make_drawable(wm, win);
|
2009-09-20 17:24:56 +00:00
|
|
|
wm_draw_window_clear(win);
|
2012-03-27 01:24:16 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
|
|
|
WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL);
|
2013-05-25 14:08:56 +00:00
|
|
|
|
2013-05-25 21:59:34 +00:00
|
|
|
#if defined(__APPLE__) || defined(WIN32)
|
|
|
|
/* OSX and Win32 don't return to the mainloop while resize */
|
2013-05-25 14:08:56 +00:00
|
|
|
wm_event_do_notifiers(C);
|
|
|
|
wm_draw_update(C);
|
2015-09-14 23:37:33 +10:00
|
|
|
|
|
|
|
/* Warning! code above nulls 'C->wm.window', causing BGE to quit, see: T45699.
|
|
|
|
* Further, its easier to match behavior across platforms, so restore the window. */
|
|
|
|
CTX_wm_window_set(C, win);
|
2013-05-25 14:08:56 +00:00
|
|
|
#endif
|
2008-12-28 15:28:09 +00:00
|
|
|
}
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-03-11 03:27:08 +01:00
|
|
|
|
|
|
|
case GHOST_kEventWindowDPIHintChanged:
|
|
|
|
{
|
2017-07-08 00:44:31 +02:00
|
|
|
WM_window_set_dpi(win);
|
2017-03-11 03:27:08 +01:00
|
|
|
/* font's are stored at each DPI level, without this we can easy load 100's of fonts */
|
|
|
|
BLF_cache_clear();
|
|
|
|
|
|
|
|
WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */
|
|
|
|
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-02-01 09:11:18 +00:00
|
|
|
case GHOST_kEventOpenMainFile:
|
|
|
|
{
|
|
|
|
PointerRNA props_ptr;
|
|
|
|
wmWindow *oldWindow;
|
2014-04-27 00:21:43 +10:00
|
|
|
const char *path = GHOST_GetEventData(evt);
|
2010-02-01 09:11:18 +00:00
|
|
|
|
|
|
|
if (path) {
|
2014-07-11 15:07:55 +10:00
|
|
|
wmOperatorType *ot = WM_operatortype_find("WM_OT_open_mainfile", false);
|
2010-02-01 09:11:18 +00:00
|
|
|
/* operator needs a valid window in context, ensures
|
2012-03-09 18:28:30 +00:00
|
|
|
* it is correctly set */
|
2010-02-01 09:11:18 +00:00
|
|
|
oldWindow = CTX_wm_window(C);
|
|
|
|
CTX_wm_window_set(C, win);
|
|
|
|
|
2014-07-11 15:07:55 +10:00
|
|
|
WM_operator_properties_create_ptr(&props_ptr, ot);
|
2010-06-14 03:52:10 +00:00
|
|
|
RNA_string_set(&props_ptr, "filepath", path);
|
2014-07-11 15:07:55 +10:00
|
|
|
WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &props_ptr);
|
2010-02-01 09:11:18 +00:00
|
|
|
WM_operator_properties_free(&props_ptr);
|
|
|
|
|
|
|
|
CTX_wm_window_set(C, oldWindow);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
case GHOST_kEventDraggingDropDone:
|
|
|
|
{
|
2010-05-06 17:45:02 +00:00
|
|
|
wmEvent event;
|
2012-03-27 01:24:16 +00:00
|
|
|
GHOST_TEventDragnDropData *ddd = GHOST_GetEventData(evt);
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
int wx, wy;
|
2010-05-06 17:45:02 +00:00
|
|
|
|
|
|
|
/* entering window, update mouse pos */
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
wm_get_cursor_position(win, &wx, &wy);
|
|
|
|
win->eventstate->x = wx;
|
|
|
|
win->eventstate->y = wy;
|
2010-05-06 17:45:02 +00:00
|
|
|
|
2013-07-29 08:29:04 +00:00
|
|
|
wm_event_init_from_window(win, &event); /* copy last state, like mouse coords */
|
2010-05-06 17:45:02 +00:00
|
|
|
|
2012-06-17 11:36:28 +00:00
|
|
|
/* activate region */
|
2012-03-27 01:24:16 +00:00
|
|
|
event.type = MOUSEMOVE;
|
|
|
|
event.prevx = event.x;
|
|
|
|
event.prevy = event.y;
|
2010-05-06 17:45:02 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
wm->winactive = win; /* no context change! c->wm->windrawable is drawable, or for area queues */
|
|
|
|
win->active = 1;
|
2010-05-06 17:45:02 +00:00
|
|
|
|
|
|
|
wm_event_add(win, &event);
|
|
|
|
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
|
|
|
/* make blender drop event with custom data pointing to wm drags */
|
2012-03-27 01:24:16 +00:00
|
|
|
event.type = EVT_DROP;
|
|
|
|
event.val = KM_RELEASE;
|
2014-07-21 12:02:05 +02:00
|
|
|
event.custom = EVT_DATA_DRAGDROP;
|
2012-03-27 01:24:16 +00:00
|
|
|
event.customdata = &wm->drags;
|
|
|
|
event.customdatafree = 1;
|
2010-05-06 17:45:02 +00:00
|
|
|
|
|
|
|
wm_event_add(win, &event);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
2010-05-06 17:45:02 +00:00
|
|
|
/* printf("Drop detected\n"); */
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
|
|
|
/* add drag data to wm for paths: */
|
2010-05-06 16:06:57 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (ddd->dataType == GHOST_kDragnDropTypeFilenames) {
|
2012-03-27 01:24:16 +00:00
|
|
|
GHOST_TStringArray *stra = ddd->data;
|
2010-12-17 19:05:34 +00:00
|
|
|
int a, icon;
|
2010-05-06 16:06:57 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
for (a = 0; a < stra->count; a++) {
|
2010-05-06 16:06:57 +00:00
|
|
|
printf("drop file %s\n", stra->strings[a]);
|
2010-12-17 19:05:34 +00:00
|
|
|
/* try to get icon type from extension */
|
2012-03-27 01:24:16 +00:00
|
|
|
icon = ED_file_extension_icon((char *)stra->strings[a]);
|
2010-12-17 19:05:34 +00:00
|
|
|
|
2014-07-21 12:02:05 +02:00
|
|
|
WM_event_start_drag(C, icon, WM_DRAG_PATH, stra->strings[a], 0.0, WM_DRAG_NOP);
|
2010-05-06 16:06:57 +00:00
|
|
|
/* void poin should point to string, it makes a copy */
|
2012-06-17 11:36:28 +00:00
|
|
|
break; /* only one drop element supported now */
|
2010-05-06 16:06:57 +00:00
|
|
|
}
|
|
|
|
}
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-01-12 17:07:49 +00:00
|
|
|
case GHOST_kEventNativeResolutionChange:
|
2016-08-04 01:05:27 +02:00
|
|
|
{
|
2016-08-12 01:19:22 +02:00
|
|
|
// only update if the actual pixel size changes
|
|
|
|
float prev_pixelsize = U.pixelsize;
|
2017-07-08 00:44:31 +02:00
|
|
|
WM_window_set_dpi(win);
|
2016-08-03 22:43:58 +02:00
|
|
|
|
2016-08-12 01:19:22 +02:00
|
|
|
if (U.pixelsize != prev_pixelsize) {
|
|
|
|
// close all popups since they are positioned with the pixel
|
|
|
|
// size baked in and it's difficult to correct them
|
|
|
|
wmWindow *oldWindow = CTX_wm_window(C);
|
|
|
|
CTX_wm_window_set(C, win);
|
|
|
|
UI_popup_handlers_remove_all(C, &win->modalhandlers);
|
|
|
|
CTX_wm_window_set(C, oldWindow);
|
|
|
|
|
|
|
|
wm_window_make_drawable(wm, win);
|
|
|
|
wm_draw_window_clear(win);
|
2016-08-03 22:43:58 +02:00
|
|
|
|
2016-08-12 01:19:22 +02:00
|
|
|
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
|
|
|
WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL);
|
|
|
|
}
|
2013-01-12 17:07:49 +00:00
|
|
|
|
|
|
|
break;
|
2016-08-04 01:05:27 +02:00
|
|
|
}
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
case GHOST_kEventTrackpad:
|
|
|
|
{
|
|
|
|
GHOST_TEventTrackpadData *pd = data;
|
2010-05-06 17:45:02 +00:00
|
|
|
|
2015-10-03 03:37:41 +02:00
|
|
|
wm_cursor_position_from_ghost(win, &pd->x, &pd->y);
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
wm_event_add_ghostevent(wm, win, type, time, data);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GHOST_kEventCursorMove:
|
|
|
|
{
|
|
|
|
GHOST_TEventCursorData *cd = data;
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
2015-10-03 03:37:41 +02:00
|
|
|
wm_cursor_position_from_ghost(win, &cd->x, &cd->y);
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
wm_event_add_ghostevent(wm, win, type, time, data);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
default:
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
wm_event_add_ghostevent(wm, win, type, time, data);
|
2007-12-24 18:27:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-12-22 12:57:53 +00:00
|
|
|
|
2015-06-01 14:56:07 +10:00
|
|
|
/**
|
|
|
|
* This timer system only gives maximum 1 timer event per redraw cycle,
|
2012-03-09 18:28:30 +00:00
|
|
|
* to prevent queues to get overloaded.
|
2015-06-01 14:56:07 +10:00
|
|
|
* Timer handlers should check for delta to decide if they just update, or follow real time.
|
2012-03-09 18:28:30 +00:00
|
|
|
* Timer handlers can also set duration to match frames passed
|
|
|
|
*/
|
2008-12-22 12:57:53 +00:00
|
|
|
static int wm_window_timer(const bContext *C)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2012-03-27 01:24:16 +00:00
|
|
|
wmWindowManager *wm = CTX_wm_manager(C);
|
2009-10-20 13:58:53 +00:00
|
|
|
wmTimer *wt, *wtnext;
|
2008-12-22 12:57:53 +00:00
|
|
|
wmWindow *win;
|
2012-03-27 01:24:16 +00:00
|
|
|
double time = PIL_check_seconds_timer();
|
|
|
|
int retval = 0;
|
2008-12-21 19:58:25 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
for (wt = wm->timers.first; wt; wt = wtnext) {
|
|
|
|
wtnext = wt->next; /* in case timer gets removed */
|
|
|
|
win = wt->win;
|
2009-10-20 13:58:53 +00:00
|
|
|
|
2012-05-15 18:45:20 +00:00
|
|
|
if (wt->sleep == 0) {
|
2012-03-24 06:24:53 +00:00
|
|
|
if (time > wt->ntime) {
|
2012-03-27 01:24:16 +00:00
|
|
|
wt->delta = time - wt->ltime;
|
2009-10-20 13:58:53 +00:00
|
|
|
wt->duration += wt->delta;
|
2012-03-27 01:24:16 +00:00
|
|
|
wt->ltime = time;
|
2012-09-30 06:12:47 +00:00
|
|
|
wt->ntime = wt->stime + wt->timestep * ceil(wt->duration / wt->timestep);
|
2009-10-20 13:58:53 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (wt->event_type == TIMERJOBS)
|
2009-10-20 13:58:53 +00:00
|
|
|
wm_jobs_timer(C, wm, wt);
|
2012-03-24 06:24:53 +00:00
|
|
|
else if (wt->event_type == TIMERAUTOSAVE)
|
2009-10-20 13:58:53 +00:00
|
|
|
wm_autosave_timer(C, wm, wt);
|
2015-08-11 12:11:48 +02:00
|
|
|
else if (wt->event_type == TIMERNOTIFIER)
|
|
|
|
WM_main_add_notifier(GET_UINT_FROM_POINTER(wt->customdata), NULL);
|
2012-03-24 06:24:53 +00:00
|
|
|
else if (win) {
|
2013-07-29 08:29:04 +00:00
|
|
|
wmEvent event;
|
|
|
|
wm_event_init_from_window(win, &event);
|
2008-12-26 13:29:47 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
event.type = wt->event_type;
|
2015-04-05 06:22:49 +10:00
|
|
|
event.val = KM_NOTHING;
|
2012-11-01 15:51:24 +00:00
|
|
|
event.keymodifier = 0;
|
2012-03-27 01:24:16 +00:00
|
|
|
event.custom = EVT_DATA_TIMER;
|
|
|
|
event.customdata = wt;
|
2008-12-26 13:29:47 +00:00
|
|
|
wm_event_add(win, &event);
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
retval = 1;
|
2008-12-22 12:57:53 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-21 19:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-22 12:57:53 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
void wm_window_process_events(const bContext *C)
|
|
|
|
{
|
2013-01-22 02:21:21 +00:00
|
|
|
int hasevent;
|
|
|
|
|
|
|
|
BLI_assert(BLI_thread_is_main());
|
|
|
|
|
|
|
|
hasevent = GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (hasevent)
|
2008-12-21 19:58:25 +00:00
|
|
|
GHOST_DispatchEvents(g_system);
|
2015-04-07 14:08:30 +02:00
|
|
|
|
2008-12-22 12:57:53 +00:00
|
|
|
hasevent |= wm_window_timer(C);
|
|
|
|
|
|
|
|
/* no event, we sleep 5 milliseconds */
|
2012-03-27 01:24:16 +00:00
|
|
|
if (hasevent == 0)
|
2008-12-22 12:57:53 +00:00
|
|
|
PIL_sleep_ms(5);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
void wm_window_process_events_nosleep(void)
|
2009-06-13 20:58:43 +00:00
|
|
|
{
|
2012-03-24 06:24:53 +00:00
|
|
|
if (GHOST_ProcessEvents(g_system, 0))
|
2009-06-13 20:58:43 +00:00
|
|
|
GHOST_DispatchEvents(g_system);
|
|
|
|
}
|
|
|
|
|
2008-12-30 13:16:14 +00:00
|
|
|
/* exported as handle callback to bke blender.c */
|
|
|
|
void wm_window_testbreak(void)
|
|
|
|
{
|
2012-03-27 01:24:16 +00:00
|
|
|
static double ltime = 0;
|
|
|
|
double curtime = PIL_check_seconds_timer();
|
2013-01-22 02:21:21 +00:00
|
|
|
|
|
|
|
BLI_assert(BLI_thread_is_main());
|
|
|
|
|
2008-12-30 13:16:14 +00:00
|
|
|
/* only check for breaks every 50 milliseconds
|
2012-03-09 18:28:30 +00:00
|
|
|
* if we get called more often.
|
|
|
|
*/
|
2012-06-17 09:58:26 +00:00
|
|
|
if ((curtime - ltime) > 0.05) {
|
2012-03-27 01:24:16 +00:00
|
|
|
int hasevent = GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
|
2008-12-30 13:16:14 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (hasevent)
|
2008-12-30 13:16:14 +00:00
|
|
|
GHOST_DispatchEvents(g_system);
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
ltime = curtime;
|
2008-12-30 13:16:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* **************** init ********************** */
|
|
|
|
|
|
|
|
void wm_ghost_init(bContext *C)
|
|
|
|
{
|
|
|
|
if (!g_system) {
|
2012-03-27 01:24:16 +00:00
|
|
|
GHOST_EventConsumerHandle consumer = GHOST_CreateEventConsumer(ghost_event_proc, C);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
g_system = GHOST_CreateSystem();
|
2007-12-24 18:27:28 +00:00
|
|
|
GHOST_AddEventConsumer(g_system, consumer);
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
if (wm_init_state.native_pixels) {
|
|
|
|
GHOST_UseNativePixels();
|
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2009-08-05 02:40:51 +00:00
|
|
|
void wm_ghost_exit(void)
|
|
|
|
{
|
2012-03-24 06:24:53 +00:00
|
|
|
if (g_system)
|
2009-08-05 02:40:51 +00:00
|
|
|
GHOST_DisposeSystem(g_system);
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
g_system = NULL;
|
2009-08-05 02:40:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* **************** timer ********************** */
|
|
|
|
|
2008-12-22 12:57:53 +00:00
|
|
|
/* to (de)activate running timers temporary */
|
2013-12-05 17:26:03 +11:00
|
|
|
void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer, bool do_sleep)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2008-12-22 12:57:53 +00:00
|
|
|
wmTimer *wt;
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
for (wt = wm->timers.first; wt; wt = wt->next)
|
|
|
|
if (wt == timer)
|
2008-12-22 12:57:53 +00:00
|
|
|
break;
|
2009-10-20 13:58:53 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (wt)
|
2013-12-05 17:26:03 +11:00
|
|
|
wt->sleep = do_sleep;
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2009-10-20 13:58:53 +00:00
|
|
|
wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2012-03-27 01:24:16 +00:00
|
|
|
wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer");
|
2015-09-22 16:45:23 +10:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
wt->event_type = event_type;
|
|
|
|
wt->ltime = PIL_check_seconds_timer();
|
|
|
|
wt->ntime = wt->ltime + timestep;
|
|
|
|
wt->stime = wt->ltime;
|
|
|
|
wt->timestep = timestep;
|
|
|
|
wt->win = win;
|
2008-12-22 12:57:53 +00:00
|
|
|
|
2009-10-20 13:58:53 +00:00
|
|
|
BLI_addtail(&wm->timers, wt);
|
2008-12-22 12:57:53 +00:00
|
|
|
|
|
|
|
return wt;
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
}
|
|
|
|
|
2015-08-11 12:11:48 +02:00
|
|
|
wmTimer *WM_event_add_timer_notifier(wmWindowManager *wm, wmWindow *win, unsigned int type, double timestep)
|
|
|
|
{
|
|
|
|
wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer");
|
|
|
|
|
|
|
|
wt->event_type = TIMERNOTIFIER;
|
|
|
|
wt->ltime = PIL_check_seconds_timer();
|
|
|
|
wt->ntime = wt->ltime + timestep;
|
|
|
|
wt->stime = wt->ltime;
|
|
|
|
wt->timestep = timestep;
|
|
|
|
wt->win = win;
|
|
|
|
wt->customdata = SET_UINT_IN_POINTER(type);
|
2018-02-09 17:19:11 +01:00
|
|
|
wt->flags |= WM_TIMER_NO_FREE_CUSTOM_DATA;
|
2015-08-11 12:11:48 +02:00
|
|
|
|
|
|
|
BLI_addtail(&wm->timers, wt);
|
|
|
|
|
|
|
|
return wt;
|
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
{
|
2008-12-22 12:57:53 +00:00
|
|
|
wmTimer *wt;
|
|
|
|
|
2009-07-24 12:43:59 +00:00
|
|
|
/* extra security check */
|
2012-03-27 01:24:16 +00:00
|
|
|
for (wt = wm->timers.first; wt; wt = wt->next)
|
|
|
|
if (wt == timer)
|
2008-12-22 12:57:53 +00:00
|
|
|
break;
|
2012-03-24 06:24:53 +00:00
|
|
|
if (wt) {
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
wmWindow *win;
|
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (wm->reports.reporttimer == wt)
|
2012-03-27 01:24:16 +00:00
|
|
|
wm->reports.reporttimer = NULL;
|
2009-07-24 12:43:59 +00:00
|
|
|
|
2009-10-20 13:58:53 +00:00
|
|
|
BLI_remlink(&wm->timers, wt);
|
2018-02-09 17:19:11 +01:00
|
|
|
if (wt->customdata != NULL && (wt->flags & WM_TIMER_NO_FREE_CUSTOM_DATA) == 0) {
|
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
2009-05-21 13:33:04 +00:00
|
|
|
MEM_freeN(wt->customdata);
|
2018-02-09 17:19:11 +01:00
|
|
|
}
|
2008-12-22 12:57:53 +00:00
|
|
|
MEM_freeN(wt);
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
/* there might be events in queue with this timer as customdata */
|
|
|
|
for (win = wm->windows.first; win; win = win->next) {
|
|
|
|
wmEvent *event;
|
|
|
|
for (event = win->queue.first; event; event = event->next) {
|
|
|
|
if (event->customdata == wt) {
|
2012-12-13 16:21:08 +00:00
|
|
|
event->customdata = NULL;
|
|
|
|
event->type = EVENT_NONE; /* timer users customdata, dont want NULL == NULL */
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-12-22 12:57:53 +00:00
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2015-08-11 12:11:48 +02:00
|
|
|
void WM_event_remove_timer_notifier(wmWindowManager *wm, wmWindow *win, wmTimer *timer)
|
|
|
|
{
|
|
|
|
timer->customdata = NULL;
|
|
|
|
WM_event_remove_timer(wm, win, timer);
|
|
|
|
}
|
|
|
|
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
/* ******************* clipboard **************** */
|
|
|
|
|
2014-01-08 17:39:12 +11:00
|
|
|
static char *wm_clipboard_text_get_ex(bool selection, int *r_len,
|
|
|
|
bool firstline)
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
{
|
|
|
|
char *p, *p2, *buf, *newbuf;
|
|
|
|
|
2014-01-08 17:39:12 +11:00
|
|
|
if (G.background) {
|
|
|
|
*r_len = 0;
|
2010-12-12 14:28:23 +00:00
|
|
|
return NULL;
|
2014-01-08 17:39:12 +11:00
|
|
|
}
|
2010-12-12 14:28:23 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
buf = (char *)GHOST_getClipboard(selection);
|
2014-01-08 17:39:12 +11:00
|
|
|
if (!buf) {
|
|
|
|
*r_len = 0;
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
return NULL;
|
2014-01-08 17:39:12 +11:00
|
|
|
}
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
|
|
|
|
/* always convert from \r\n to \n */
|
2014-01-08 17:39:12 +11:00
|
|
|
p2 = newbuf = MEM_mallocN(strlen(buf) + 1, __func__);
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
|
2014-01-08 17:39:12 +11:00
|
|
|
if (firstline) {
|
|
|
|
/* will return an over-alloc'ed value in the case there are newlines */
|
|
|
|
for (p = buf; *p; p++) {
|
|
|
|
if ((*p != '\n') && (*p != '\r')) {
|
|
|
|
*(p2++) = *p;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
}
|
2014-01-08 17:39:12 +11:00
|
|
|
else {
|
|
|
|
for (p = buf; *p; p++) {
|
|
|
|
if (*p != '\r') {
|
|
|
|
*(p2++) = *p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
*p2 = '\0';
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
|
|
|
|
free(buf); /* ghost uses regular malloc */
|
|
|
|
|
2014-01-08 17:39:12 +11:00
|
|
|
*r_len = (p2 - newbuf);
|
|
|
|
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
return newbuf;
|
|
|
|
}
|
|
|
|
|
2014-01-08 17:39:12 +11:00
|
|
|
/**
|
|
|
|
* Return text from the clipboard.
|
|
|
|
*
|
|
|
|
* \note Caller needs to check for valid utf8 if this is a requirement.
|
|
|
|
*/
|
|
|
|
char *WM_clipboard_text_get(bool selection, int *r_len)
|
|
|
|
{
|
|
|
|
return wm_clipboard_text_get_ex(selection, r_len, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convenience function for pasting to areas of Blender which don't support newlines.
|
|
|
|
*/
|
|
|
|
char *WM_clipboard_text_get_firstline(bool selection, int *r_len)
|
|
|
|
{
|
|
|
|
return wm_clipboard_text_get_ex(selection, r_len, true);
|
|
|
|
}
|
|
|
|
|
2013-12-05 17:26:03 +11:00
|
|
|
void WM_clipboard_text_set(const char *buf, bool selection)
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
{
|
2012-03-24 06:24:53 +00:00
|
|
|
if (!G.background) {
|
2009-04-08 18:48:17 +00:00
|
|
|
#ifdef _WIN32
|
2010-12-12 21:28:07 +00:00
|
|
|
/* do conversion from \n to \r\n on Windows */
|
2014-01-13 04:28:51 +02:00
|
|
|
const char *p;
|
|
|
|
char *p2, *newbuf;
|
2012-03-27 01:24:16 +00:00
|
|
|
int newlen = 0;
|
2010-12-12 21:28:07 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
for (p = buf; *p; p++) {
|
2012-03-24 06:24:53 +00:00
|
|
|
if (*p == '\n')
|
2010-12-12 21:28:07 +00:00
|
|
|
newlen += 2;
|
|
|
|
else
|
|
|
|
newlen++;
|
|
|
|
}
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
newbuf = MEM_callocN(newlen + 1, "WM_clipboard_text_set");
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
for (p = buf, p2 = newbuf; *p; p++, p2++) {
|
2012-03-24 06:24:53 +00:00
|
|
|
if (*p == '\n') {
|
2012-03-27 01:24:16 +00:00
|
|
|
*(p2++) = '\r'; *p2 = '\n';
|
2010-12-12 21:28:07 +00:00
|
|
|
}
|
2013-03-09 03:46:30 +00:00
|
|
|
else {
|
|
|
|
*p2 = *p;
|
|
|
|
}
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
}
|
2012-03-27 01:24:16 +00:00
|
|
|
*p2 = '\0';
|
2010-12-12 21:28:07 +00:00
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
GHOST_putClipboard((GHOST_TInt8 *)newbuf, selection);
|
2010-12-12 21:28:07 +00:00
|
|
|
MEM_freeN(newbuf);
|
2009-04-08 18:48:17 +00:00
|
|
|
#else
|
2012-03-27 01:24:16 +00:00
|
|
|
GHOST_putClipboard((GHOST_TInt8 *)buf, selection);
|
2009-04-08 18:48:17 +00:00
|
|
|
#endif
|
2010-12-12 21:28:07 +00:00
|
|
|
}
|
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
|
|
|
}
|
|
|
|
|
2010-06-01 20:21:40 +00:00
|
|
|
/* ******************* progress bar **************** */
|
|
|
|
|
|
|
|
void WM_progress_set(wmWindow *win, float progress)
|
|
|
|
{
|
|
|
|
GHOST_SetProgressBar(win->ghostwin, progress);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WM_progress_clear(wmWindow *win)
|
|
|
|
{
|
|
|
|
GHOST_EndProgressBar(win->ghostwin);
|
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* ************************************ */
|
|
|
|
|
2015-05-08 07:25:39 +10:00
|
|
|
void wm_window_get_position(wmWindow *win, int *r_pos_x, int *r_pos_y)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2015-05-08 07:25:39 +10:00
|
|
|
*r_pos_x = win->posx;
|
|
|
|
*r_pos_y = win->posy;
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void wm_window_set_size(wmWindow *win, int width, int height)
|
|
|
|
{
|
|
|
|
GHOST_SetClientSize(win->ghostwin, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wm_window_lower(wmWindow *win)
|
|
|
|
{
|
|
|
|
GHOST_SetWindowOrder(win->ghostwin, GHOST_kWindowOrderBottom);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wm_window_raise(wmWindow *win)
|
|
|
|
{
|
|
|
|
GHOST_SetWindowOrder(win->ghostwin, GHOST_kWindowOrderTop);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wm_window_swap_buffers(wmWindow *win)
|
|
|
|
{
|
2008-12-21 09:58:32 +00:00
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
glDisable(GL_SCISSOR_TEST);
|
2007-12-24 18:27:28 +00:00
|
|
|
GHOST_SwapWindowBuffers(win->ghostwin);
|
2008-12-21 09:58:32 +00:00
|
|
|
glEnable(GL_SCISSOR_TEST);
|
|
|
|
#else
|
|
|
|
GHOST_SwapWindowBuffers(win->ghostwin);
|
|
|
|
#endif
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2013-07-29 22:31:32 +00:00
|
|
|
void wm_window_set_swap_interval (wmWindow *win, int interval)
|
|
|
|
{
|
|
|
|
GHOST_SetSwapInterval(win->ghostwin, interval);
|
|
|
|
}
|
|
|
|
|
2014-10-07 15:46:19 -05:00
|
|
|
bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut)
|
2013-07-29 22:31:32 +00:00
|
|
|
{
|
2014-10-07 15:46:19 -05:00
|
|
|
return GHOST_GetSwapInterval(win->ghostwin, intervalOut);
|
2013-07-29 22:31:32 +00:00
|
|
|
}
|
|
|
|
|
2009-12-07 18:06:37 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* ******************* exported api ***************** */
|
|
|
|
|
|
|
|
|
|
|
|
/* called whem no ghost system was initialized */
|
2012-08-11 21:35:24 +00:00
|
|
|
void WM_init_state_size_set(int stax, int stay, int sizx, int sizy)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
2012-03-13 15:44:48 +00:00
|
|
|
wm_init_state.start_x = stax; /* left hand pos */
|
|
|
|
wm_init_state.start_y = stay; /* bottom pos */
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
wm_init_state.size_x = sizx < 640 ? 640 : sizx;
|
|
|
|
wm_init_state.size_y = sizy < 480 ? 480 : sizy;
|
2012-03-13 15:44:48 +00:00
|
|
|
wm_init_state.override_flag |= WIN_OVERRIDE_GEOM;
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
|
2010-09-15 11:48:59 +00:00
|
|
|
/* for borderless and border windows set from command-line */
|
2012-08-11 21:35:24 +00:00
|
|
|
void WM_init_state_fullscreen_set(void)
|
2010-09-15 11:48:59 +00:00
|
|
|
{
|
2012-03-13 15:44:48 +00:00
|
|
|
wm_init_state.windowstate = GHOST_kWindowStateFullScreen;
|
|
|
|
wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
|
2010-09-15 11:48:59 +00:00
|
|
|
}
|
|
|
|
|
2012-08-11 21:35:24 +00:00
|
|
|
void WM_init_state_normal_set(void)
|
2010-09-15 11:48:59 +00:00
|
|
|
{
|
2012-03-13 15:44:48 +00:00
|
|
|
wm_init_state.windowstate = GHOST_kWindowStateNormal;
|
|
|
|
wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
|
2010-09-15 11:48:59 +00:00
|
|
|
}
|
|
|
|
|
2013-04-04 02:05:11 +00:00
|
|
|
void WM_init_native_pixels(bool do_it)
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
{
|
|
|
|
wm_init_state.native_pixels = do_it;
|
|
|
|
}
|
|
|
|
|
2009-11-11 08:32:29 +00:00
|
|
|
/* This function requires access to the GHOST_SystemHandle (g_system) */
|
|
|
|
void WM_cursor_warp(wmWindow *win, int x, int y)
|
|
|
|
{
|
|
|
|
if (win && win->ghostwin) {
|
2012-03-27 01:24:16 +00:00
|
|
|
int oldx = x, oldy = y;
|
2009-11-11 08:32:29 +00:00
|
|
|
|
2015-10-03 03:37:41 +02:00
|
|
|
wm_cursor_position_to_ghost(win, &x, &y);
|
2009-11-11 08:32:29 +00:00
|
|
|
GHOST_SetCursorPosition(g_system, x, y);
|
|
|
|
|
2012-03-27 01:24:16 +00:00
|
|
|
win->eventstate->prevx = oldx;
|
|
|
|
win->eventstate->prevy = oldy;
|
2014-06-17 14:10:18 +10:00
|
|
|
|
|
|
|
win->eventstate->x = oldx;
|
|
|
|
win->eventstate->y = oldy;
|
2009-11-11 08:32:29 +00:00
|
|
|
}
|
2009-11-11 10:51:40 +00:00
|
|
|
}
|
|
|
|
|
2015-09-08 23:35:49 +10:00
|
|
|
/**
|
|
|
|
* Set x, y to values we can actually position the cursor to.
|
|
|
|
*/
|
2015-09-08 23:46:56 +10:00
|
|
|
void WM_cursor_compatible_xy(wmWindow *win, int *x, int *y)
|
2015-09-08 23:35:49 +10:00
|
|
|
{
|
|
|
|
float f = GHOST_GetNativePixelSize(win->ghostwin);
|
|
|
|
if (f != 1.0f) {
|
|
|
|
*x = (int)(*x / f) * f;
|
|
|
|
*y = (int)(*y / f) * f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-16 19:22:15 +00:00
|
|
|
/**
|
|
|
|
* Get the cursor pressure, in most cases you'll want to use wmTabletData from the event
|
|
|
|
*/
|
|
|
|
float WM_cursor_pressure(const struct wmWindow *win)
|
|
|
|
{
|
|
|
|
const GHOST_TabletData *td = GHOST_GetTabletData(win->ghostwin);
|
|
|
|
/* if there's tablet data from an active tablet device then add it */
|
|
|
|
if ((td != NULL) && td->Active != GHOST_kTabletModeNone) {
|
|
|
|
return td->Pressure;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return -1.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
/* support for native pixel size */
|
|
|
|
/* mac retina opens window in size X, but it has up to 2 x more pixels */
|
|
|
|
int WM_window_pixels_x(wmWindow *win)
|
|
|
|
{
|
2013-01-12 17:07:49 +00:00
|
|
|
float f = GHOST_GetNativePixelSize(win->ghostwin);
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
return (int)(f * (float)win->sizex);
|
|
|
|
}
|
|
|
|
|
|
|
|
int WM_window_pixels_y(wmWindow *win)
|
|
|
|
{
|
2013-01-12 17:07:49 +00:00
|
|
|
float f = GHOST_GetNativePixelSize(win->ghostwin);
|
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)
2012-12-12 18:58:11 +00:00
|
|
|
|
|
|
|
return (int)(f * (float)win->sizey);
|
|
|
|
|
|
|
|
}
|
2014-02-27 23:39:40 +01:00
|
|
|
|
|
|
|
bool WM_window_is_fullscreen(wmWindow *win)
|
|
|
|
{
|
|
|
|
return win->windowstate == GHOST_kWindowStateFullScreen;
|
|
|
|
}
|
|
|
|
|
2014-12-07 00:58:17 +01:00
|
|
|
|
|
|
|
#ifdef WITH_INPUT_IME
|
2014-12-14 18:46:51 +01:00
|
|
|
/* note: keep in mind wm_window_IME_begin is also used to reposition the IME window */
|
2014-12-07 00:58:17 +01:00
|
|
|
void wm_window_IME_begin(wmWindow *win, int x, int y, int w, int h, bool complete)
|
|
|
|
{
|
2014-12-14 18:46:51 +01:00
|
|
|
BLI_assert(win);
|
2014-12-07 00:58:17 +01:00
|
|
|
|
|
|
|
GHOST_BeginIME(win->ghostwin, x, win->sizey - y, w, h, complete);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wm_window_IME_end(wmWindow *win)
|
|
|
|
{
|
|
|
|
BLI_assert(win && win->ime_data);
|
|
|
|
|
|
|
|
GHOST_EndIME(win->ghostwin);
|
|
|
|
win->ime_data = NULL;
|
|
|
|
}
|
|
|
|
#endif /* WITH_INPUT_IME */
|