]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Merge commit '86023af46cb7b0057fd3c9dae743660b2968e255' into garux-merge
authorThomas Debesse <dev@illwieckz.net>
Sun, 24 Feb 2019 02:54:35 +0000 (03:54 +0100)
committerThomas Debesse <dev@illwieckz.net>
Sun, 24 Feb 2019 02:54:35 +0000 (03:54 +0100)
1  2 
Makefile
libs/gtkutil/xorrectangle.cpp
radiant/CMakeLists.txt
radiant/main.cpp
radiant/mainframe.cpp
radiant/texwindow.cpp
radiant/xywindow.cpp

diff --cc Makefile
Simple merge
index c638e0e21fcaa61ffd01d77da3f7ef32c5942d98,e4f46c6b8b171a838841c651b4ce216b125e89b9..e7012328d104a9df2c68916465cfbed088f85496
@@@ -1,50 -1,22 +1,99 @@@
 -/*
 -   Copyright (C) 2001-2006, William Joseph.
 -   All Rights Reserved.
 +#include "xorrectangle.h"
  
 -   This file is part of GtkRadiant.
 +#include <gtk/gtk.h>
  
 -   GtkRadiant 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.
++#include "gtkutil/glwidget.h"
++#include "igl.h"
 -   GtkRadiant 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.
++#include <gtk/gtkglwidget.h>
 -   You should have received a copy of the GNU General Public License
 -   along with GtkRadiant; if not, write to the Free Software
 -   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 - */
++//#include "stream/stringstream.h"
 -#include "xorrectangle.h"
 +bool XORRectangle::initialised() const
 +{
 +    return !!cr;
 +}
 +
 +void XORRectangle::lazy_init()
 +{
 +    if (!initialised()) {
 +        cr = gdk_cairo_create(gtk_widget_get_window(m_widget));
 +    }
 +}
 +
 +void XORRectangle::draw() const
 +{
 +    const int x = float_to_integer(m_rectangle.x);
 +    const int y = float_to_integer(m_rectangle.y);
 +    const int w = float_to_integer(m_rectangle.w);
 +    const int h = float_to_integer(m_rectangle.h);
 +    GtkAllocation allocation;
 +    gtk_widget_get_allocation(m_widget, &allocation);
 +    cairo_rectangle(cr, x, -(h) - (y - allocation.height), w, h);
 +    cairo_set_source_rgb(cr, 1, 1, 1);
 +    cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
 +    cairo_stroke(cr);
 +}
 +
 +XORRectangle::XORRectangle(ui::GLArea widget) : m_widget(widget), cr(0)
 +{
 +}
 +
 +XORRectangle::~XORRectangle()
 +{
 +    if (initialised()) {
 +        cairo_destroy(cr);
 +    }
 +}
 +
 +void XORRectangle::set(rectangle_t rectangle)
 +{
 +    if (gtk_widget_get_realized(m_widget)) {
-         lazy_init();
-         draw();
-         m_rectangle = rectangle;
-         draw();
++              if( m_rectangle.w != rectangle.w || m_rectangle.h != rectangle.h ){
++              //if( !(m_rectangle.w == 0 && m_rectangle.h == 0 && rectangle.w == 0 && rectangle.h == 0) ){
++              //globalOutputStream() << "m_x" << m_rectangle.x << " m_y" << m_rectangle.y << " m_w" << m_rectangle.w << " m_h" << m_rectangle.h << "\n";
++              //globalOutputStream() << "__x" << rectangle.x << " __y" << rectangle.y << " __w" << rectangle.w << " __h" << rectangle.h << "\n";
++                      if ( glwidget_make_current( m_widget ) != FALSE ) {
++                              GlobalOpenGL_debugAssertNoErrors();
++
++                              gint width, height;
++                              gdk_gl_drawable_get_size( gtk_widget_get_gl_drawable( m_widget ), &width, &height );
++
++                              glViewport( 0, 0, width, height );
++                              glMatrixMode( GL_PROJECTION );
++                              glLoadIdentity();
++                              glOrtho( 0, width, 0, height, -100, 100 );
++                              glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
++                              glDisable( GL_DEPTH_TEST );
++
++                              glDrawBuffer( GL_FRONT );
++
++                              glEnable( GL_BLEND );
++                              glBlendFunc( GL_ONE_MINUS_DST_COLOR, GL_ZERO );
++
++                              glLineWidth( 2 );
++                              glColor3f( 1, 1, 1 );
++                              glDisable( GL_TEXTURE_2D );
++                              glBegin( GL_LINE_LOOP );
++                              glVertex2f( m_rectangle.x, m_rectangle.y + m_rectangle.h );
++                              glVertex2f( m_rectangle.x + m_rectangle.w, m_rectangle.y + m_rectangle.h );
++                              glVertex2f( m_rectangle.x + m_rectangle.w, m_rectangle.y );
++                              glVertex2f( m_rectangle.x, m_rectangle.y );
++                              glEnd();
++
++                              glBegin( GL_LINE_LOOP );
++                              glVertex2f( rectangle.x, rectangle.y + rectangle.h );
++                              glVertex2f( rectangle.x + rectangle.w, rectangle.y + rectangle.h );
++                              glVertex2f( rectangle.x + rectangle.w, rectangle.y );
++                              glVertex2f( rectangle.x, rectangle.y );
++                              glEnd();
++
++                              glDrawBuffer( GL_BACK );
++                              GlobalOpenGL_debugAssertNoErrors();
++                              //glwidget_swap_buffers( m_widget );
++                              glwidget_make_current( m_widget );
++                      }
++              }
++              m_rectangle = rectangle;
 +    }
 +}
index 1edced736eade534b52a073ac430bd96d805b16d,0000000000000000000000000000000000000000..6f0a250a175a58da2f8b87fc3eb73b8dfff1c17f
mode 100644,000000..100644
--- /dev/null
@@@ -1,134 -1,0 +1,135 @@@
 +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
 +
 +find_package(OpenGL REQUIRED)
 +
 +string(SUBSTRING ${CMAKE_SHARED_MODULE_SUFFIX} 1 -1 _clibext)
 +add_definitions(-DCMAKE_SHARED_MODULE_SUFFIX="${_clibext}")
 +unset(_clibext)
 +
 +set(RADIANTLIST
 +    autosave.cpp autosave.h
 +    brush.cpp brush.h
 +    brush_primit.cpp brush_primit.h
 +    brushmanip.cpp brushmanip.h
 +    brushmodule.cpp brushmodule.h
 +    brushnode.cpp brushnode.h
 +    brushtokens.cpp brushtokens.h
 +    brushxml.cpp brushxml.h
 +    build.cpp build.h
 +    camwindow.cpp camwindow.h
 +    clippertool.cpp clippertool.h
 +    commands.cpp commands.h
 +    console.cpp console.h
 +    csg.cpp csg.h
 +    dialog.cpp dialog.h
 +    eclass.cpp eclass.h
 +    eclass_def.cpp eclass_def.h
 +    eclass_doom3.cpp eclass_doom3.h
 +    eclass_fgd.cpp eclass_fgd.h
 +    eclass_xml.cpp eclass_xml.h
 +    entity.cpp entity.h
 +    entityinspector.cpp entityinspector.h
 +    entitylist.cpp entitylist.h
 +    environment.cpp environment.h
 +    error.cpp error.h
 +    feedback.cpp feedback.h
 +    filetypes.cpp filetypes.h
 +    filterbar.cpp filterbar.h
 +    filters.cpp filters.h
 +    findtexturedialog.cpp findtexturedialog.h
 +    glwidget.cpp glwidget.h
 +    grid.cpp grid.h
 +    groupdialog.cpp groupdialog.h
 +    gtkdlgs.cpp gtkdlgs.h
 +    gtkmisc.cpp gtkmisc.h
++      gtktheme.cpp gtktheme.h
 +    help.cpp help.h
 +    image.cpp image.h
 +    main.cpp main.h
 +    mainframe.cpp mainframe.h
 +    map.cpp map.h
 +    mru.cpp mru.h
 +    nullmodel.cpp nullmodel.h
 +    parse.cpp parse.h
 +    patch.cpp patch.h
 +    patchdialog.cpp patchdialog.h
 +    patchmanip.cpp patchmanip.h
 +    patchmodule.cpp patchmodule.h
 +    plugin.cpp plugin.h
 +    pluginapi.cpp pluginapi.h
 +    pluginmanager.cpp pluginmanager.h
 +    pluginmenu.cpp pluginmenu.h
 +    plugintoolbar.cpp plugintoolbar.h
 +    points.cpp points.h
 +    preferencedictionary.cpp preferencedictionary.h
 +    preferences.cpp preferences.h
 +    qe3.cpp qe3.h
 +    qgl.cpp qgl.h
 +    referencecache.cpp referencecache.h
 +    renderer.cpp renderer.h
 +    renderstate.cpp renderstate.h
 +    resource.h
 +    scenegraph.cpp scenegraph.h
 +    select.cpp select.h
 +    selection.cpp selection.h
 +    server.cpp server.h
 +    shaders.cpp shaders.h
 +    sockets.cpp sockets.h
 +    stacktrace.cpp stacktrace.h
 +    surfacedialog.cpp surfacedialog.h
 +    texmanip.cpp texmanip.h
 +    textureentry.cpp textureentry.h
 +    textures.cpp textures.h
 +    texwindow.cpp texwindow.h
 +    timer.cpp timer.h
 +    treemodel.cpp treemodel.h
 +    undo.cpp undo.h
 +    url.cpp url.h
 +    view.cpp view.h
 +    watchbsp.cpp watchbsp.h
 +    winding.cpp winding.h
 +    windowobservers.cpp windowobservers.h
 +    xmlstuff.cpp xmlstuff.h
 +    xywindow.cpp xywindow.h
 +)
 +if (WIN32)
 +    list(APPEND RADIANTLIST multimon.cpp multimon.h)
 +endif()
 +
 +radiant_tool(radiant WIN32 radiant.rc ${RADIANTLIST})
 +add_dependencies(radiant modules)
 +target_link_libraries(radiant
 +    ${CMAKE_DL_LIBS}
 +    ${LIBXML2_LIBRARIES}
 +    ${OPENGL_gl_LIBRARY}
 +    ${GTK${GTK_TARGET}_LIBRARIES}
 +    ${GTKGL_LIBRARIES}
 +    includes
 +    cmdlib
 +    container
 +    ddslib
 +    debugging
 +    etclib
 +    filematch
 +    generic
 +    l_net
 +    math
 +    mathlib
 +    memory
 +    modulesystem
 +    os
 +    picomodel
 +    profile
 +    script
 +    signal
 +    splines
 +    stream
 +    string
 +    uilib
 +    xmllib
 +)
 +if (X11_LIBRARIES)
 +    target_link_libraries(radiant ${X11_LIBRARIES})
 +endif ()
 +
 +copy_dlls(radiant)
index d27d8c6b11a0ae78f93a8955e2ffe1710aa99154,f7f6cf6b27265fc6b198e0fbec13f8f2469568c0..d0962c2da74a77902dc09d4d62a168d720236313
@@@ -534,6 -543,21 +534,29 @@@ void user_shortcuts_save()
        SaveCommandMap( path.c_str() );
  }
  
++/* FIXME: HACK: not GTK3 compatible
++ https://developer.gnome.org/gtk2/stable/gtk2-Resource-Files.html#gtk-rc-add-default-file
++ https://developer.gnome.org/gtk3/stable/gtk3-Resource-Files.html#gtk-rc-add-default-file
++ > gtk_rc_add_default_file has been deprecated since version 3.0 and should not be used in newly-written code.
++ > Use GtkStyleContext with a custom GtkStyleProvider instead
++*/
++void gtk_rc_add_default_file (const gchar *filename);
++
+ void add_local_rc_files(){
+       {
+               StringOutputStream path( 512 );
+               path << AppPath_get() << ".gtkrc-2.0.radiant";
+               gtk_rc_add_default_file( path.c_str() );
+       }
+ #ifdef WIN32
+       {
+               StringOutputStream path( 512 );
+               path << AppPath_get() << ".gtkrc-2.0.win";
+               gtk_rc_add_default_file( path.c_str() );
+       }
+ #endif
+ }
  int main( int argc, char* argv[] ){
        crt_init();
  
index 8581cc4caf8519e771dbcb735e9b1df2bb7e34d8,60f3a5eb372dd73bb353bbce7db1e04f544f073e..c9fcc01ee2d4ed5112dbddd45b33eb2e65045fd5
  #include "renderstate.h"
  #include "feedback.h"
  #include "referencecache.h"
 -
 +#include "texwindow.h"
  #include "filterbar.h"
+ #include "gtktheme.h"
  
  
  struct layout_globals_t
@@@ -3395,79 -3239,81 +3398,80 @@@ void Layout_registerPreferencesPage()
  #include "stringio.h"
  
  void MainFrame_Construct(){
 -      GlobalCommands_insert( "OpenManual", FreeCaller<OpenHelpURL>(), Accelerator( GDK_F1 ) );
 -
 -      GlobalCommands_insert( "Sleep", FreeCaller<thunk_OnSleep>(), Accelerator( 'P', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
 -      GlobalCommands_insert( "NewMap", FreeCaller<NewMap>() );
 -      GlobalCommands_insert( "OpenMap", FreeCaller<OpenMap>(), Accelerator( 'O', (GdkModifierType)GDK_CONTROL_MASK ) );
 -      GlobalCommands_insert( "ImportMap", FreeCaller<ImportMap>() );
 -      GlobalCommands_insert( "SaveMap", FreeCaller<SaveMap>(), Accelerator( 'S', (GdkModifierType)GDK_CONTROL_MASK ) );
 -      GlobalCommands_insert( "SaveMapAs", FreeCaller<SaveMapAs>() );
 -      GlobalCommands_insert( "SaveSelected", FreeCaller<ExportMap>() );
 -      GlobalCommands_insert( "SaveRegion", FreeCaller<SaveRegion>() );
 -      GlobalCommands_insert( "RefreshReferences", FreeCaller<RefreshReferences>() );
 -      GlobalCommands_insert( "ProjectSettings", FreeCaller<DoProjectSettings>() );
 -      GlobalCommands_insert( "CheckForUpdate", FreeCaller<OpenUpdateURL>() );
 -      GlobalCommands_insert( "Exit", FreeCaller<Exit>() );
 -
 -      GlobalCommands_insert( "Undo", FreeCaller<Undo>(), Accelerator( 'Z', (GdkModifierType)GDK_CONTROL_MASK ) );
 -      GlobalCommands_insert( "Redo", FreeCaller<Redo>(), Accelerator( 'Y', (GdkModifierType)GDK_CONTROL_MASK ) );
 -      GlobalCommands_insert( "Copy", FreeCaller<Copy>(), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) );
 -      GlobalCommands_insert( "Paste", FreeCaller<Paste>(), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) );
 -      GlobalCommands_insert( "PasteToCamera", FreeCaller<PasteToCamera>(), Accelerator( 'V', (GdkModifierType)GDK_SHIFT_MASK ) );
 -      GlobalCommands_insert( "CloneSelection", FreeCaller<Selection_Clone>(), Accelerator( GDK_space ) );
 -      GlobalCommands_insert( "CloneSelectionAndMakeUnique", FreeCaller<Selection_Clone_MakeUnique>(), Accelerator( GDK_space, (GdkModifierType)GDK_SHIFT_MASK ) );
 -//    GlobalCommands_insert( "DeleteSelection", FreeCaller<deleteSelection>(), Accelerator( GDK_BackSpace ) );
 -      GlobalCommands_insert( "DeleteSelection2", FreeCaller<deleteSelection>(), Accelerator( GDK_BackSpace ) );
 -      GlobalCommands_insert( "DeleteSelection", FreeCaller<deleteSelection>(), Accelerator( 'Z' ) );
 -      GlobalCommands_insert( "ParentSelection", FreeCaller<Scene_parentSelected>() );
 -//    GlobalCommands_insert( "UnSelectSelection", FreeCaller<Selection_Deselect>(), Accelerator( GDK_Escape ) );
 -      GlobalCommands_insert( "UnSelectSelection2", FreeCaller<Selection_Deselect>(), Accelerator( GDK_Escape ) );
 -      GlobalCommands_insert( "UnSelectSelection", FreeCaller<Selection_Deselect>(), Accelerator( 'C' ) );
 -      GlobalCommands_insert( "InvertSelection", FreeCaller<Select_Invert>(), Accelerator( 'I' ) );
 -      GlobalCommands_insert( "SelectInside", FreeCaller<Select_Inside>() );
 -      GlobalCommands_insert( "SelectTouching", FreeCaller<Select_Touching>() );
 -      GlobalCommands_insert( "ExpandSelectionToEntities", FreeCaller<Scene_ExpandSelectionToEntities>(), Accelerator( 'E', (GdkModifierType)GDK_SHIFT_MASK ) );
 -      GlobalCommands_insert( "Preferences", FreeCaller<PreferencesDialog_showDialog>(), Accelerator( 'P' ) );
 -
 -      GlobalCommands_insert( "ToggleConsole", FreeCaller<Console_ToggleShow>(), Accelerator( 'O' ) );
 -      GlobalCommands_insert( "ToggleEntityInspector", FreeCaller<EntityInspector_ToggleShow>(), Accelerator( 'N' ) );
 -      GlobalCommands_insert( "EntityList", FreeCaller<EntityList_toggleShown>(), Accelerator( 'L' ) );
 -
 -      GlobalCommands_insert( "ShowHidden", FreeCaller<Select_ShowAllHidden>(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
 -      GlobalCommands_insert( "HideSelected", FreeCaller<HideSelected>(), Accelerator( 'H' ) );
 -
 -      GlobalToggles_insert( "DragVertices", FreeCaller<SelectVertexMode>(), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) );
 -      GlobalToggles_insert( "DragEdges", FreeCaller<SelectEdgeMode>(), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) );
 -      GlobalToggles_insert( "DragFaces", FreeCaller<SelectFaceMode>(), ToggleItem::AddCallbackCaller( g_faceMode_button ), Accelerator( 'F' ) );
 -
 -      GlobalCommands_insert( "MirrorSelectionX", FreeCaller<Selection_Flipx>() );
 -      GlobalCommands_insert( "RotateSelectionX", FreeCaller<Selection_Rotatex>() );
 -      GlobalCommands_insert( "MirrorSelectionY", FreeCaller<Selection_Flipy>() );
 -      GlobalCommands_insert( "RotateSelectionY", FreeCaller<Selection_Rotatey>() );
 -      GlobalCommands_insert( "MirrorSelectionZ", FreeCaller<Selection_Flipz>() );
 -      GlobalCommands_insert( "RotateSelectionZ", FreeCaller<Selection_Rotatez>() );
 -
 -      GlobalCommands_insert( "ArbitraryRotation", FreeCaller<DoRotateDlg>(), Accelerator( 'R', (GdkModifierType)GDK_SHIFT_MASK ) );
 -      GlobalCommands_insert( "ArbitraryScale", FreeCaller<DoScaleDlg>(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
 -
 -      GlobalCommands_insert( "BuildMenuCustomize", FreeCaller<DoBuildMenu>() );
 -
 -      GlobalCommands_insert( "FindBrush", FreeCaller<DoFind>() );
 -
 -      GlobalCommands_insert( "MapInfo", FreeCaller<DoMapInfo>(), Accelerator( 'M' ) );
 -
 -
 -      GlobalToggles_insert( "ToggleClipper", FreeCaller<ClipperMode>(), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) );
 -
 -      GlobalToggles_insert( "MouseTranslate", FreeCaller<TranslateMode>(), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) );
 -      GlobalToggles_insert( "MouseRotate", FreeCaller<RotateMode>(), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) );
 -      GlobalToggles_insert( "MouseScale", FreeCaller<ScaleMode>(), ToggleItem::AddCallbackCaller( g_scalemode_button ) );
 -      GlobalToggles_insert( "MouseDrag", FreeCaller<DragMode>(), ToggleItem::AddCallbackCaller( g_dragmode_button ), Accelerator( 'Q' ) );
 -
 -      GlobalCommands_insert( "gtkThemeDlg", FreeCaller<gtkThemeDlg>() );
 -      GlobalCommands_insert( "ColorSchemeOriginal", FreeCaller<ColorScheme_Original>() );
 -      GlobalCommands_insert( "ColorSchemeQER", FreeCaller<ColorScheme_QER>() );
 -      GlobalCommands_insert( "ColorSchemeBlackAndGreen", FreeCaller<ColorScheme_Black>() );
 -      GlobalCommands_insert( "ColorSchemeYdnar", FreeCaller<ColorScheme_Ydnar>() );
 +      GlobalCommands_insert( "OpenManual", makeCallbackF(OpenHelpURL), Accelerator( GDK_KEY_F1 ) );
 +
 +      GlobalCommands_insert( "Sleep", makeCallbackF(thunk_OnSleep), Accelerator( 'P', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
 +      GlobalCommands_insert( "NewMap", makeCallbackF(NewMap) );
 +      GlobalCommands_insert( "OpenMap", makeCallbackF(OpenMap), Accelerator( 'O', (GdkModifierType)GDK_CONTROL_MASK ) );
 +      GlobalCommands_insert( "ImportMap", makeCallbackF(ImportMap) );
 +      GlobalCommands_insert( "SaveMap", makeCallbackF(SaveMap), Accelerator( 'S', (GdkModifierType)GDK_CONTROL_MASK ) );
 +      GlobalCommands_insert( "SaveMapAs", makeCallbackF(SaveMapAs) );
 +      GlobalCommands_insert( "ExportSelected", makeCallbackF(ExportMap) );
 +      GlobalCommands_insert( "SaveRegion", makeCallbackF(SaveRegion) );
 +      GlobalCommands_insert( "RefreshReferences", makeCallbackF(VFS_Refresh) );
 +      GlobalCommands_insert( "ProjectSettings", makeCallbackF(DoProjectSettings) );
 +      GlobalCommands_insert( "Exit", makeCallbackF(Exit) );
 +
 +      GlobalCommands_insert( "Undo", makeCallbackF(Undo), Accelerator( 'Z', (GdkModifierType)GDK_CONTROL_MASK ) );
 +      GlobalCommands_insert( "Redo", makeCallbackF(Redo), Accelerator( 'Y', (GdkModifierType)GDK_CONTROL_MASK ) );
 +      GlobalCommands_insert( "Copy", makeCallbackF(Copy), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) );
 +      GlobalCommands_insert( "Paste", makeCallbackF(Paste), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) );
 +      GlobalCommands_insert( "PasteToCamera", makeCallbackF(PasteToCamera), Accelerator( 'V', (GdkModifierType)GDK_MOD1_MASK ) );
 +      GlobalCommands_insert( "CloneSelection", makeCallbackF(Selection_Clone), Accelerator( GDK_KEY_space ) );
 +      GlobalCommands_insert( "CloneSelectionAndMakeUnique", makeCallbackF(Selection_Clone_MakeUnique), Accelerator( GDK_KEY_space, (GdkModifierType)GDK_SHIFT_MASK ) );
 +//    GlobalCommands_insert( "DeleteSelection", makeCallbackF(deleteSelection), Accelerator( GDK_KEY_BackSpace ) );
 +      GlobalCommands_insert( "DeleteSelection2", makeCallbackF(deleteSelection), Accelerator( GDK_KEY_BackSpace ) );
 +      GlobalCommands_insert( "DeleteSelection", makeCallbackF(deleteSelection), Accelerator( 'Z' ) );
 +      GlobalCommands_insert( "ParentSelection", makeCallbackF(Scene_parentSelected) );
 +//    GlobalCommands_insert( "UnSelectSelection", makeCallbackF(Selection_Deselect), Accelerator( GDK_KEY_Escape ) );
 +      GlobalCommands_insert( "UnSelectSelection2", makeCallbackF(Selection_Deselect), Accelerator( GDK_KEY_Escape ) );
 +      GlobalCommands_insert( "UnSelectSelection", makeCallbackF(Selection_Deselect), Accelerator( 'C' ) );
 +      GlobalCommands_insert( "InvertSelection", makeCallbackF(Select_Invert), Accelerator( 'I' ) );
 +      GlobalCommands_insert( "SelectInside", makeCallbackF(Select_Inside) );
 +      GlobalCommands_insert( "SelectTouching", makeCallbackF(Select_Touching) );
 +      GlobalCommands_insert( "ExpandSelectionToEntities", makeCallbackF(Scene_ExpandSelectionToEntities), Accelerator( 'E', (GdkModifierType)( GDK_MOD1_MASK | GDK_CONTROL_MASK ) ) );
 +      GlobalCommands_insert( "Preferences", makeCallbackF(PreferencesDialog_showDialog), Accelerator( 'P' ) );
 +
 +      GlobalCommands_insert( "ToggleConsole", makeCallbackF(Console_ToggleShow), Accelerator( 'O' ) );
 +      GlobalCommands_insert( "ToggleEntityInspector", makeCallbackF(EntityInspector_ToggleShow), Accelerator( 'N' ) );
 +      GlobalCommands_insert( "EntityList", makeCallbackF(EntityList_toggleShown), Accelerator( 'L' ) );
 +
 +      GlobalCommands_insert( "ShowHidden", makeCallbackF(Select_ShowAllHidden), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) );
 +      GlobalCommands_insert( "HideSelected", makeCallbackF(HideSelected), Accelerator( 'H' ) );
 +
 +      GlobalToggles_insert( "DragVertices", makeCallbackF(SelectVertexMode), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) );
 +      GlobalToggles_insert( "DragEdges", makeCallbackF(SelectEdgeMode), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) );
 +      GlobalToggles_insert( "DragFaces", makeCallbackF(SelectFaceMode), ToggleItem::AddCallbackCaller( g_faceMode_button ), Accelerator( 'F' ) );
 +
 +      GlobalCommands_insert( "MirrorSelectionX", makeCallbackF(Selection_Flipx) );
 +      GlobalCommands_insert( "RotateSelectionX", makeCallbackF(Selection_Rotatex) );
 +      GlobalCommands_insert( "MirrorSelectionY", makeCallbackF(Selection_Flipy) );
 +      GlobalCommands_insert( "RotateSelectionY", makeCallbackF(Selection_Rotatey) );
 +      GlobalCommands_insert( "MirrorSelectionZ", makeCallbackF(Selection_Flipz) );
 +      GlobalCommands_insert( "RotateSelectionZ", makeCallbackF(Selection_Rotatez) );
 +
 +      GlobalCommands_insert( "ArbitraryRotation", makeCallbackF(DoRotateDlg) );
 +      GlobalCommands_insert( "ArbitraryScale", makeCallbackF(DoScaleDlg) );
 +
 +      GlobalCommands_insert( "BuildMenuCustomize", makeCallbackF(DoBuildMenu) );
 +
 +      GlobalCommands_insert( "FindBrush", makeCallbackF(DoFind) );
 +
 +      GlobalCommands_insert( "MapInfo", makeCallbackF(DoMapInfo), Accelerator( 'M' ) );
 +
 +
 +      GlobalToggles_insert( "ToggleClipper", makeCallbackF(ClipperMode), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) );
 +
 +      GlobalToggles_insert( "MouseTranslate", makeCallbackF(TranslateMode), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) );
 +      GlobalToggles_insert( "MouseRotate", makeCallbackF(RotateMode), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) );
 +      GlobalToggles_insert( "MouseScale", makeCallbackF(ScaleMode), ToggleItem::AddCallbackCaller( g_scalemode_button ) );
 +      GlobalToggles_insert( "MouseDrag", makeCallbackF(DragMode), ToggleItem::AddCallbackCaller( g_dragmode_button ), Accelerator( 'Q' ) );
 +
++      GlobalCommands_insert( "gtkThemeDlg", makeCallbackF(gtkThemeDlg) );
 +      GlobalCommands_insert( "ColorSchemeOriginal", makeCallbackF(ColorScheme_Original) );
 +      GlobalCommands_insert( "ColorSchemeQER", makeCallbackF(ColorScheme_QER) );
 +      GlobalCommands_insert( "ColorSchemeBlackAndGreen", makeCallbackF(ColorScheme_Black) );
 +      GlobalCommands_insert( "ColorSchemeYdnar", makeCallbackF(ColorScheme_Ydnar) );
        GlobalCommands_insert( "ChooseTextureBackgroundColor", makeCallback( g_ColoursMenu.m_textureback ) );
        GlobalCommands_insert( "ChooseGridBackgroundColor", makeCallback( g_ColoursMenu.m_xyback ) );
        GlobalCommands_insert( "ChooseGridMajorColor", makeCallback( g_ColoursMenu.m_gridmajor ) );
index 7a24d67fd18592acbbc7d7ea0a1c97ffe33dbebb,0dbb6a0b736e1f1eeb7d059fbf5edaca4dfe3785..6c17ba96639f58ad4ff8ebdd84b6cdd859ef9cb3
@@@ -2173,52 -2072,62 +2173,56 @@@ ui::Widget TextureBrowser_constructWind
  
        g_TextureBrowser.m_parent = toplevel;
  
 -      GtkWidget* table = gtk_table_new( 3, 3, FALSE );
 -      GtkWidget* frame_table = NULL;
 -      GtkWidget* vbox = gtk_vbox_new( FALSE, 0 );
 -      gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0 );
 -      gtk_widget_show( vbox );
 +      auto table = ui::Table(3, 3, FALSE);
 +      auto vbox = ui::VBox(FALSE, 0);
 +      table.attach(vbox, {0, 1, 1, 3}, {GTK_FILL, GTK_FILL});
 +      vbox.show();
  
 -      //GtkWidget* menu_bar;
 -      GtkToolbar* toolbar;
 +      // ui::Widget menu_bar{ui::null};
 +      auto toolbar = ui::Toolbar::from( gtk_toolbar_new() );
  
        { // menu bar
 -              //menu_bar = gtk_menu_bar_new();
 -              GtkWidget* menu_view = gtk_menu_new();
 -              //GtkWidget* view_item = (GtkWidget*)
 -              TextureBrowser_constructViewMenu( GTK_MENU( menu_view ) );
 -              gtk_menu_set_title( GTK_MENU( menu_view ), "View" );
 -              //gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view );
 -              //gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), view_item );
 -
 +              // menu_bar = ui::Widget::from(gtk_menu_bar_new());
 +              auto menu_view = ui::Menu(ui::New);
 +              // auto view_item = TextureBrowser_constructViewMenu( menu_view );
 +              TextureBrowser_constructViewMenu( menu_view );
++              gtk_menu_set_title( menu_view, "View" );
 +              // gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view );
 +              // gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), view_item );
  
 -              toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
                //gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( toolbar ), 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0 );
                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( toolbar ), FALSE, FALSE, 0 );
  
                //view menu button
 -              GtkButton* button = GTK_BUTTON( gtk_button_new() );
 -              button_set_icon( button, "texbro_view.png" );
 -              gtk_widget_show( GTK_WIDGET( button ) );
 -              gtk_button_set_relief( button, GTK_RELIEF_NONE );
 -              gtk_widget_set_size_request( GTK_WIDGET( button ), 24, 24 );
 -              GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS );
 -              GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_DEFAULT );
 -              gtk_toolbar_append_element( toolbar, GTK_TOOLBAR_CHILD_WIDGET, GTK_WIDGET( button ), "", "View", "", 0, 0, 0 );
 -              g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( Popup_View_Menu ), menu_view );
 -
 -              //to show detached menu over floating tex bro
 -              gtk_menu_attach_to_widget( GTK_MENU( menu_view ), GTK_WIDGET( button ), NULL );
 -
 -              button = toolbar_append_button( toolbar, "Find / Replace...", "texbro_gtk-find-and-replace.png", "FindReplaceTextures" );
 -              gtk_widget_set_size_request( GTK_WIDGET( button ), 22, 22 );
 -
 +              {
 +                      auto button = toolbar_append_button( toolbar, "View", "texbro_view.png" );
 +                      button.dimensions( 22, 22 );
 +                      button.connect( "clicked", G_CALLBACK( Popup_View_Menu ), menu_view );
 -              button = toolbar_append_button( toolbar, "Flush & Reload Shaders", "texbro_refresh.png", "RefreshShaders" );
 -              gtk_widget_set_size_request( GTK_WIDGET( button ), 22, 22 );
 -              gtk_widget_show( GTK_WIDGET( toolbar ) );
++                      //to show detached menu over floating tex bro
++                      gtk_menu_attach_to_widget( GTK_MENU( menu_view ), GTK_WIDGET( button ), NULL );
 +              }
 +              {
 +                      auto button = toolbar_append_button( toolbar, "Find / Replace...", "texbro_gtk-find-and-replace.png", "FindReplaceTextures" );
 +                      button.dimensions( 22, 22 );
 +              }
 +              {
 +                      auto button = toolbar_append_button( toolbar, "Flush & Reload Shaders", "texbro_refresh.png", "RefreshShaders" );
 +                      button.dimensions( 22, 22 );
 +              }
 +              toolbar.show();
  
  /*
 -              GtkWidget* menu_tools = gtk_menu_new();
 -              GtkWidget* tools_item = (GtkWidget*)TextureBrowser_constructToolsMenu( GTK_MENU( menu_tools ) );
 +              auto menu_tools = ui::Menu(ui::New);
 +              auto tools_item = TextureBrowser_constructToolsMenu( menu_tools );
                gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools_item ), menu_tools );
 -              gtk_menu_bar_append( GTK_MENU_BAR( menu_bar ), tools_item );
 +              gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tools_item );
  */
 -              //gtk_table_attach( GTK_TABLE( table ), menu_bar, 0, 3, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0 );
 -              //gtk_widget_show( menu_bar );
 +              // table.attach(menu_bar, {0, 3, 0, 1}, {GTK_FILL, GTK_SHRINK});
 +              // menu_bar.show();
        }
        { // Texture TreeView
 -              g_TextureBrowser.m_scr_win_tree = gtk_scrolled_window_new( NULL, NULL );
 +              g_TextureBrowser.m_scr_win_tree = ui::ScrolledWindow(ui::New);
                gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tree ), 0 );
  
                // vertical only scrolling for treeview
index e5a4ec8f47de87d8525171a884c424c3e233c282,393a957ad7a05b446c4a70b3726ebd69b59a61d6..9177f9fefd81b2b0405293fd987656412ad9266e
@@@ -724,8 -719,17 +724,17 @@@ bool XYWnd::chaseMouseMotion( int point
  Shader* XYWnd::m_state_selected = 0;
  
  void xy_update_xor_rectangle( XYWnd& self, rect_t area ){
 -      if ( GTK_WIDGET_VISIBLE( self.GetWidget() ) ) {
 +      if ( self.GetWidget().visible() ) {
-               self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.Width(), self.Height() ) );
+               rectangle_t rect = rectangle_from_area( area.min, area.max, self.Width(), self.Height() );
+               int nDim1 = ( self.GetViewType() == YZ ) ? 1 : 0;
+               int nDim2 = ( self.GetViewType() == XY ) ? 1 : 2;
+               rect.x /= self.Scale();
+               rect.y /= self.Scale();
+               rect.w /= self.Scale();
+               rect.h /= self.Scale();
+               rect.x += self.GetOrigin()[nDim1];
+               rect.y += self.GetOrigin()[nDim2];
+               self.m_XORRectangle.set( rect );
        }
  }