]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Merge commit 'e984b9f54a0c733aab34a8ec19724dc4114ade28' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 02:43:16 +0000 (04:43 +0200)
committerThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 02:43:16 +0000 (04:43 +0200)
1  2 
libs/gtkutil/paned.cpp
libs/gtkutil/paned.h
radiant/brushmanip.cpp
radiant/gtkdlgs.cpp
radiant/mainframe.cpp
radiant/mainframe.h

Simple merge
index 951a72d7bc08237d008b2030f61229c0f28989ac,7bb5dc1bee62ed4d1b211730684dab9f4611ae4d..1a19d9c541874ac2cc8d52035da6734d4c41d446
  #if !defined( INCLUDED_GTKUTIL_PANED_H )
  #define INCLUDED_GTKUTIL_PANED_H
  
 -ui::Widget create_split_views( ui::Widget topleft, ui::Widget botleft, ui::Widget topright, ui::Widget botright, ui::Widget& vsplit1, ui::Widget& vsplit2 );
++#include <gtk/gtk.h>
+ #include <uilib/uilib.h>
 +class PanedState
 +{
 +public:
 +float position;
 +int size;
 +};
 +
 +gboolean hpaned_allocate( ui::Widget widget, GtkAllocation* allocation, PanedState* paned );
 +gboolean vpaned_allocate( ui::Widget widget, GtkAllocation* allocation, PanedState* paned );
 +gboolean paned_position( ui::Widget widget, gpointer dummy, PanedState* paned );
  
- ui::HPaned create_split_views( ui::Widget topleft, ui::Widget topright, ui::Widget botleft, ui::Widget botright );
++ui::Widget create_split_views( ui::Widget topleft, ui::Widget botleft, ui::Widget topright, ui::Widget botright, ui::Widget& vsplit1, ui::Widget& vsplit2 );
  #endif
Simple merge
Simple merge
index dd18db7101188bd41e12623e6e07687f7fadfda4,86bddbe7db554d77dd6507d466c29e762f6d06bb..46960e22f8bf80bc060864a8d960566e7a6e272d
@@@ -3252,13 -3172,20 +3253,17 @@@ void MainFrame::Create()
                {
                        auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
                        g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
 -#ifndef GARUX_GTK_WORKAROUND
 -                      /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
 -                      g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
 -#endif
 +                      WORKAROUND_GOBJECT_SET_GLWIDGET( GroupDialog_getWindow(), TextureBrowser_getGLWidget() );
                }
  
+               // FIXME: find a way to do it with newer syntax
+               // m_vSplit = 0;
+               // m_hSplit = 0;
+               // m_vSplit2 = 0;
                GroupDialog_show();
        }
 -      else // 4 way
 +      else if ( CurrentStyle() == eSplit )
        {
                m_pCamWnd = NewCamWnd();
                GlobalCamera_setCamWnd( *m_pCamWnd );
                {
              auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
                        g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
 -#ifndef GARUX_GTK_WORKAROUND
 -                      /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
 -                      g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
 -#endif
 +
 +                      WORKAROUND_GOBJECT_SET_GLWIDGET( window, TextureBrowser_getGLWidget() );
                }
        }
-               ui::Widget split = create_split_views( camera, yz, xy, xz );
 +      else // single window
 +      {
 +              m_pCamWnd = NewCamWnd();
 +              GlobalCamera_setCamWnd( *m_pCamWnd );
 +              CamWnd_setParent( *m_pCamWnd, window );
 +
 +              ui::Widget camera = CamWnd_getWidget( *m_pCamWnd );
 +
 +              m_pYZWnd = new XYWnd();
 +              m_pYZWnd->SetViewType( YZ );
 +
 +              ui::Widget yz = m_pYZWnd->GetWidget();
 +
 +              m_pXYWnd = new XYWnd();
 +              m_pXYWnd->SetViewType( XY );
 +
 +              ui::Widget xy = m_pXYWnd->GetWidget();
 +
 +              m_pXZWnd = new XYWnd();
 +              m_pXZWnd->SetViewType( XZ );
 +
 +              ui::Widget xz = m_pXZWnd->GetWidget();
 +
 +              ui::Widget hsplit = ui::HPaned(ui::New);
 +              vbox.pack_start( hsplit, TRUE, TRUE, 0 );
 +              hsplit.show();
 +
-               gtk_paned_add1( GTK_PANED( hsplit ), split );
++              /* Before merging NetRadiantCustom:
++              ui::Widget split = create_split_views( camera, yz, xy, xz ); */
++              m_hSplit = create_split_views( camera, yz, xy, xz, m_vSplit, m_vSplit2 );
 +
 +              ui::Widget vsplit = ui::VPaned(ui::New);
 +              vsplit.show();
 +
 +              // textures
 +              ui::Widget texture_window = create_framed_widget( TextureBrowser_constructWindow( window ) );
 +
 +              // console
 +              ui::Widget console_window = create_framed_widget( Console_constructWindow( window ) );
 +
++              /* Before merging NetRadiantCustom:
++              gtk_paned_add1( GTK_PANED( hsplit ), m_hSplit );
 +              gtk_paned_add2( GTK_PANED( hsplit ), vsplit );
 +
 +              gtk_paned_add1( GTK_PANED( vsplit ), texture_window  );
 +              gtk_paned_add2( GTK_PANED( vsplit ), console_window  );
++              */
++
++              gtk_paned_pack1( GTK_PANED( hsplit ), m_hSplit, TRUE, TRUE );
++              gtk_paned_pack2( GTK_PANED( hsplit ), vsplit, TRUE, TRUE);
++
++              gtk_paned_pack1( GTK_PANED( vsplit ), texture_window, TRUE, TRUE );
++              gtk_paned_pack2( GTK_PANED( vsplit ), console_window, TRUE, TRUE );
 +
 +              hsplit.connect( "size_allocate", G_CALLBACK( hpaned_allocate ), &g_single_hpaned );
 +              hsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_single_hpaned );
 +
 +              vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_single_vpaned );
 +              vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_single_vpaned );
 +      }
  
        EntityList_constructWindow( window );
        PreferencesDialog_constructWindow( window );
@@@ -3582,9 -3461,76 +3597,76 @@@ void MainFrame_toggleFullscreen()
        }
  }
  
 -
+ class MaximizeView
+ {
+ public:
+       MaximizeView(): m_maximized( false ){
+       }
+       void toggle(){
+               return m_maximized ? restore() : maximize();
+       }
+ private:
+       bool m_maximized;
+       int m_vSplitPos;
+       int m_vSplit2Pos;
+       int m_hSplitPos;
+       void restore(){
+               m_maximized = false;
+               gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit ), m_vSplitPos );
+               gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit2 ), m_vSplit2Pos );
+               gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_hSplit ), m_hSplitPos );
+       }
+       void maximize(){
+               m_maximized = true;
+               m_vSplitPos = gtk_paned_get_position( GTK_PANED( g_pParentWnd->m_vSplit ) );
+               m_vSplit2Pos = gtk_paned_get_position( GTK_PANED( g_pParentWnd->m_vSplit2 ) );
+               m_hSplitPos = gtk_paned_get_position( GTK_PANED( g_pParentWnd->m_hSplit ) );
+               int vSplitX, vSplitY, vSplit2X, vSplit2Y, hSplitX, hSplitY;
+               gdk_window_get_origin( GTK_WIDGET( g_pParentWnd->m_vSplit )->window, &vSplitX, &vSplitY );
+               gdk_window_get_origin( GTK_WIDGET( g_pParentWnd->m_vSplit2 )->window, &vSplit2X, &vSplit2Y );
+               gdk_window_get_origin( GTK_WIDGET( g_pParentWnd->m_hSplit )->window, &hSplitX, &hSplitY );
+               vSplitY += m_vSplitPos;
+               vSplit2Y += m_vSplit2Pos;
+               hSplitX += m_hSplitPos;
+               int cur_x, cur_y;
+               Sys_GetCursorPos( MainFrame_getWindow(), &cur_x, &cur_y );
+               if( cur_x > hSplitX ){
+                       gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_hSplit ), 0 );
+               }
+               else{
+                       gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_hSplit ), 9999 );
+               }
+               if( cur_y > vSplitY ){
+                       gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit ), 0 );
+               }
+               else{
+                       gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit ), 9999 );
+               }
+               if( cur_y > vSplit2Y ){
+                       gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit2 ), 0 );
+               }
+               else{
+                       gtk_paned_set_position( GTK_PANED( g_pParentWnd->m_vSplit2 ), 9999 );
+               }
+       }
+ };
+ MaximizeView g_maximizeview;
+ void Maximize_View(){
+       if( g_pParentWnd != 0 && g_pParentWnd->m_vSplit != 0 && g_pParentWnd->m_vSplit2 != 0 && g_pParentWnd->m_hSplit != 0 )
+               g_maximizeview.toggle();
+ }
  #include "preferencesystem.h"
  #include "stringio.h"
 +#include "transformpath/transformpath.h"
  
  void MainFrame_Construct(){
        GlobalCommands_insert( "OpenManual", makeCallbackF(OpenHelpURL), Accelerator( GDK_KEY_F1 ) );
        GlobalCommands_insert( "ColorSchemeQER", makeCallbackF(ColorScheme_QER) );
        GlobalCommands_insert( "ColorSchemeBlackAndGreen", makeCallbackF(ColorScheme_Black) );
        GlobalCommands_insert( "ColorSchemeYdnar", makeCallbackF(ColorScheme_Ydnar) );
-       GlobalCommands_insert("ColorSchemeAdwaitaDark", makeCallbackF(ColorScheme_AdwaitaDark));
++      GlobalCommands_insert( "ColorSchemeAdwaitaDark", makeCallbackF(ColorScheme_AdwaitaDark));
        GlobalCommands_insert( "ChooseTextureBackgroundColor", makeCallback( g_ColoursMenu.m_textureback ) );
        GlobalCommands_insert( "ChooseGridBackgroundColor", makeCallback( g_ColoursMenu.m_xyback ) );
        GlobalCommands_insert( "ChooseGridMajorColor", makeCallback( g_ColoursMenu.m_gridmajor ) );
Simple merge