From: Thomas Debesse Date: Tue, 21 Jun 2022 04:32:59 +0000 (+0200) Subject: Merge commit 'a8192282200b4691a016c4f7757638cbb132f2dc' into master-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=27c45113f1053186ab5f7b5c0a80f052c4896a6d;p=xonotic%2Fnetradiant.git Merge commit 'a8192282200b4691a016c4f7757638cbb132f2dc' into master-merge --- 27c45113f1053186ab5f7b5c0a80f052c4896a6d diff --cc radiant/mainframe.cpp index 9148ab0a,3f39db58..44888d86 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@@ -3707,9 -3579,13 +3715,13 @@@ void Maximize_View() g_maximizeview.toggle(); } + void FocusAllViews(){ + XY_Centralize(); //using centralizing here, not focusing function + GlobalCamera_FocusOnSelected(); + } - #include "preferencesystem.h" #include "stringio.h" +#include "transformpath/transformpath.h" void MainFrame_Construct(){ GlobalCommands_insert( "OpenManual", makeCallbackF(OpenHelpURL), Accelerator( GDK_KEY_F1 ) ); diff --cc radiant/texwindow.cpp index 11ea9cb8,3ad553d6..07abbde5 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@@ -1179,13 -1123,11 +1178,13 @@@ void TextureBrowser_Tracking_MouseDown TextureBrowser_Tracking_MouseUp( textureBrowser ); } textureBrowser.m_move_started = true; - textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_parent, textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser ); + /* NetRadiantCustom did this instead: + textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_parent, textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser ); */ + textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser ); } - void TextureBrowser_Selection_MouseDown( TextureBrowser& textureBrowser, guint32 flags, int pointx, int pointy ){ - SelectTexture( textureBrowser, pointx, textureBrowser.height - 1 - pointy, flags ); + void TextureBrowser_Selection_MouseDown( TextureBrowser& textureBrowser, guint32 flags, int pointx, int pointy, bool texturizeSelection ){ + SelectTexture( textureBrowser, pointx, textureBrowser.height - 1 - pointy, flags, texturizeSelection ); } void TextureBrowser_Selection_MouseUp( TextureBrowser& textureBrowser, guint32 flags, int pointx, int pointy ){ @@@ -1538,9 -1479,9 +1537,9 @@@ gboolean TextureBrowser_button_press( u if ( event->type == GDK_BUTTON_PRESS ) { gtk_widget_grab_focus( widget ); if ( event->button == 3 ) { - if ( GlobalTextureBrowser().m_tags ) { + if ( textureBrowser->m_tags ) { textureBrowser->m_rmbSelected = true; - TextureBrowser_Selection_MouseDown( *textureBrowser, event->state, static_cast( event->x ), static_cast( event->y ) ); + TextureBrowser_Selection_MouseDown( *textureBrowser, event->state, static_cast( event->x ), static_cast( event->y ), false ); BuildStoreAssignedTags( textureBrowser->m_assigned_store, textureBrowser->shader.c_str(), textureBrowser ); BuildStoreAvailableTags( textureBrowser->m_available_store, textureBrowser->m_assigned_store, textureBrowser->m_all_tags, textureBrowser ); @@@ -1556,10 -1497,10 +1555,10 @@@ TextureBrowser_Tracking_MouseDown( *textureBrowser ); } } - else if ( event->button == 1 ) { - TextureBrowser_Selection_MouseDown( *textureBrowser, event->state, static_cast( event->x ), static_cast( event->y ) ); + else if ( event->button == 1 || event->button == 2 ) { + TextureBrowser_Selection_MouseDown( *textureBrowser, event->state, static_cast( event->x ), static_cast( event->y ), event->button == 2 ); - if ( GlobalTextureBrowser().m_tags ) { + if ( textureBrowser->m_tags ) { textureBrowser->m_rmbSelected = false; textureBrowser->m_tag_frame.hide(); } @@@ -2151,12 -2065,13 +2149,13 @@@ void TextureBrowser_searchTags() TextureDirectory_loadTexture( path.c_str(), name.c_str() ); } } - TextureBrowser_SetHideUnused( g_TextureBrowser, false ); - g_TextureBrowser.m_searchedTags = true; ++ TextureBrowser_SetHideUnused( textureBrowser, false ); + textureBrowser.m_searchedTags = true; g_TextureBrowser_currentDirectory = tags_searched; - g_TextureBrowser.m_nTotalHeight = 0; - TextureBrowser_setOriginY( g_TextureBrowser, 0 ); - TextureBrowser_heightChanged( g_TextureBrowser ); + textureBrowser.m_nTotalHeight = 0; + TextureBrowser_setOriginY( textureBrowser, 0 ); + TextureBrowser_heightChanged( textureBrowser ); TextureBrowser_updateTitle(); } g_slist_free( selected ); diff --cc radiant/xywindow.cpp index c7d1d6cb,c597b2e9..742e3326 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@@ -558,19 -557,20 +558,33 @@@ void XYWnd::ZoomInWithMouse( int pointx } } +void XYWnd::Redraw() { + if ( glwidget_make_current( m_gl_widget ) != FALSE ) { + if ( Map_Valid( g_map ) && ScreenUpdates_Enabled() ) { + GlobalOpenGL_debugAssertNoErrors(); + XY_Draw(); + GlobalOpenGL_debugAssertNoErrors(); + + m_XORRectangle.set( rectangle_t() ); + } + glwidget_swap_buffers( m_gl_widget ); + } +} + + void XYWnd::FocusOnBounds( AABB& bounds ){ + SetOrigin( bounds.origin ); + int nDim1 = ( m_viewType == YZ ) ? 1 : 0; + int nDim2 = ( m_viewType == XY ) ? 1 : 2; + if( bounds.extents[ nDim1 ] < 128.f ) + bounds.extents[ nDim1 ] = 128.f; + if( bounds.extents[ nDim2 ] < 128.f ) + bounds.extents[ nDim2 ] = 128.f; + float scale1 = Width() / ( 3.f * bounds.extents[ nDim1 ] ); + float scale2 = Height() / ( 3.f * bounds.extents[ nDim2 ] ); + SetScale( MIN( scale1, scale2 ) ); + + } + VIEWTYPE GlobalXYWnd_getCurrentViewType(){ ASSERT_NOTNULL( g_pParentWnd ); ASSERT_NOTNULL( g_pParentWnd->ActiveXY() ); diff --cc radiant/xywindow.h index 07db53ec,4eb6cf55..e23b4bd7 --- a/radiant/xywindow.h +++ b/radiant/xywindow.h @@@ -127,11 -127,9 +127,12 @@@ guint m_zoom_focusOut void ZoomIn(); void ZoomOut(); void ZoomInWithMouse( int pointx, int pointy ); + void FocusOnBounds( AABB& bounds ); +void Redraw(); + void RenderActive(); + void SetActive( bool b ){ m_bActive = b; RenderActive();