From: Thomas Debesse Date: Mon, 25 May 2020 19:21:11 +0000 (+0200) Subject: Merge commit '0d5ebb17b29d4263ec4f1634af24a27620ab47a4' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=020d0244e4239b21dc804d630edff926386ea34f;p=xonotic%2Fnetradiant.git Merge commit '0d5ebb17b29d4263ec4f1634af24a27620ab47a4' into garux-merge --- 020d0244e4239b21dc804d630edff926386ea34f diff --cc libs/gtkutil/cursor.cpp index 58d68c95,ae19afe0..8f387220 --- a/libs/gtkutil/cursor.cpp +++ b/libs/gtkutil/cursor.cpp @@@ -53,91 -65,3 +53,100 @@@ void Sys_SetCursorPos( ui::Window windo gdk_display_get_pointer( gdk_display_get_default(), &screen, 0, 0, 0 ); gdk_display_warp_pointer( gdk_display_get_default(), screen, x, y ); } + +gboolean DeferredMotion::gtk_motion(ui::Widget widget, GdkEventMotion *event, DeferredMotion *self) +{ + self->motion( event->x, event->y, event->state ); + return FALSE; +} + +gboolean FreezePointer::motion_delta(ui::Window widget, GdkEventMotion *event, FreezePointer *self) +{ + int current_x, current_y; + Sys_GetCursorPos( widget, ¤t_x, ¤t_y ); + int dx = current_x - self->last_x; + int dy = current_y - self->last_y; + int ddx = current_x - self->center_x; + int ddy = current_y - self->center_y; + self->last_x = current_x; + self->last_y = current_y; + if ( dx != 0 || dy != 0 ) { + //globalOutputStream() << "motion x: " << dx << ", y: " << dy << "\n"; + if (ddx < -32 || ddx > 32 || ddy < -32 || ddy > 32) { + Sys_SetCursorPos( widget, self->center_x, self->center_y ); + self->last_x = self->center_x; + self->last_y = self->center_y; + } + self->m_function( dx, dy, event->state, self->m_data ); + } + return FALSE; +} + +void FreezePointer::freeze_pointer(ui::Window window, ui::Widget widget, FreezePointer::MotionDeltaFunction function, void *data) +{ + ASSERT_MESSAGE( m_function == 0, "can't freeze pointer" ); + + const GdkEventMask mask = static_cast( GDK_POINTER_MOTION_MASK + | GDK_POINTER_MOTION_HINT_MASK + | GDK_BUTTON_MOTION_MASK + | GDK_BUTTON1_MOTION_MASK + | GDK_BUTTON2_MOTION_MASK + | GDK_BUTTON3_MOTION_MASK + | GDK_BUTTON_PRESS_MASK + | GDK_BUTTON_RELEASE_MASK + | GDK_VISIBILITY_NOTIFY_MASK ); + + //GdkCursor* cursor = create_blank_cursor(); + GdkCursor* cursor = gdk_cursor_new( GDK_BLANK_CURSOR ); + //GdkGrabStatus status = + /* fixes cursor runaways during srsly quick drags in camera + drags with pressed buttons have no problem at all w/o this */ + gdk_pointer_grab( gtk_widget_get_window(window), TRUE, mask, 0, cursor, GDK_CURRENT_TIME ); + //gdk_window_set_cursor ( GTK_WIDGET( window )->window, cursor ); + /* is needed to fix activating neighbour widgets, that happens, if using upper one */ + gtk_grab_add( widget ); - weedjet = widget; ++ m_weedjet = widget; + + gdk_cursor_unref( cursor ); + + Sys_GetCursorPos( window, &recorded_x, &recorded_y ); + + /* using center for tracking for max safety */ + gdk_window_get_origin( GTK_WIDGET( widget )->window, ¢er_x, ¢er_y ); + auto allocation = widget.dimensions(); + center_y += allocation.height / 2; + center_x += allocation.width / 2; + + Sys_SetCursorPos( window, center_x, center_y ); + + last_x = center_x; + last_y = center_y; + + m_function = function; + m_data = data; + + handle_motion = window.connect( "motion_notify_event", G_CALLBACK( motion_delta ), this ); +} + - void FreezePointer::unfreeze_pointer(ui::Window window) ++void FreezePointer::unfreeze_pointer(ui::Window window, bool centerize ) +{ + g_signal_handler_disconnect( G_OBJECT( window ), handle_motion ); + + m_function = 0; + m_data = 0; + - Sys_SetCursorPos( window, recorded_x, recorded_y ); ++ if ( centerize ){ ++ Sys_SetCursorPos( window, center_x, center_y ); ++ } ++ else{ ++ Sys_SetCursorPos( window, recorded_x, recorded_y ); ++ } + +// gdk_window_set_cursor( GTK_WIDGET( window )->window, 0 ); + gdk_pointer_ungrab( GDK_CURRENT_TIME ); - gtk_grab_remove( weedjet ); ++ ++ if ( m_weedjet ) ++ { ++ gtk_grab_remove( m_weedjet ); ++ } +} diff --cc libs/gtkutil/cursor.h index 81767d2e,b08c7428..89c6f72b --- a/libs/gtkutil/cursor.h +++ b/libs/gtkutil/cursor.h @@@ -110,18 -118,95 +110,18 @@@ class FreezePointe { unsigned int handle_motion; int recorded_x, recorded_y, last_x, last_y, center_x, center_y; - ui::Widget weedjet{ui::null}; -GtkWidget* m_weedjet; ++ui::Widget m_weedjet{ui::null}; typedef void ( *MotionDeltaFunction )( int x, int y, unsigned int state, void* data ); MotionDeltaFunction m_function; void* m_data; public: FreezePointer() : handle_motion( 0 ), m_function( 0 ), m_data( 0 ){ } -static gboolean motion_delta( GtkWidget *widget, GdkEventMotion *event, FreezePointer* self ){ - int current_x, current_y; - Sys_GetCursorPos( GTK_WINDOW( widget ), ¤t_x, ¤t_y ); - int dx = current_x - self->last_x; - int dy = current_y - self->last_y; - int ddx = current_x - self->center_x; - int ddy = current_y - self->center_y; - self->last_x = current_x; - self->last_y = current_y; - if ( dx != 0 || dy != 0 ) { - //globalOutputStream() << "motion x: " << dx << ", y: " << dy << "\n"; - if (ddx < -32 || ddx > 32 || ddy < -32 || ddy > 32) { - Sys_SetCursorPos( GTK_WINDOW( widget ), self->center_x, self->center_y ); - self->last_x = self->center_x; - self->last_y = self->center_y; - } - self->m_function( dx, dy, event->state, self->m_data ); - } - return FALSE; -} - -void freeze_pointer( GtkWindow* window, GtkWidget* widget, MotionDeltaFunction function, void* data ){ - ASSERT_MESSAGE( m_function == 0, "can't freeze pointer" ); - - const GdkEventMask mask = static_cast( GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK - | GDK_BUTTON_MOTION_MASK - | GDK_BUTTON1_MOTION_MASK - | GDK_BUTTON2_MOTION_MASK - | GDK_BUTTON3_MOTION_MASK - | GDK_BUTTON_PRESS_MASK - | GDK_BUTTON_RELEASE_MASK - | GDK_VISIBILITY_NOTIFY_MASK ); - - GdkCursor* cursor = gdk_cursor_new( GDK_BLANK_CURSOR ); - //GdkCursor* cursor = create_blank_cursor(); - //GdkGrabStatus status = - /* fixes cursor runaways during srsly quick drags in camera - drags with pressed buttons have no problem at all w/o this */ - gdk_pointer_grab( GTK_WIDGET( window )->window, TRUE, mask, 0, cursor, GDK_CURRENT_TIME ); - //gdk_window_set_cursor ( GTK_WIDGET( window )->window, cursor ); - /* is needed to fix activating neighbour widgets, that happens, if using upper one */ - gtk_grab_add( widget ); - m_weedjet = widget; - - gdk_cursor_unref( cursor ); - - Sys_GetCursorPos( window, &recorded_x, &recorded_y ); - - /* using center for tracking for max safety */ - gdk_window_get_origin( widget->window, ¢er_x, ¢er_y ); - center_y += widget->allocation.height / 2; - center_x += widget->allocation.width / 2; - - Sys_SetCursorPos( window, center_x, center_y ); - - last_x = center_x; - last_y = center_y; - - m_function = function; - m_data = data; - - handle_motion = g_signal_connect( G_OBJECT( window ), "motion_notify_event", G_CALLBACK( motion_delta ), this ); -} - -void unfreeze_pointer( GtkWindow* window, bool centerize ){ - g_signal_handler_disconnect( G_OBJECT( window ), handle_motion ); +static gboolean motion_delta( ui::Window widget, GdkEventMotion *event, FreezePointer* self ); - m_function = 0; - m_data = 0; +void freeze_pointer( ui::Window window, ui::Widget widget, MotionDeltaFunction function, void* data ); - void unfreeze_pointer( ui::Window window ); - if( centerize ){ - Sys_SetCursorPos( window, center_x, center_y ); - } - else{ - Sys_SetCursorPos( window, recorded_x, recorded_y ); - } -// gdk_window_set_cursor( GTK_WIDGET( window )->window, 0 ); - gdk_pointer_ungrab( GDK_CURRENT_TIME ); - if( m_weedjet ) - gtk_grab_remove( m_weedjet ); -} ++void unfreeze_pointer( ui::Window window, bool centerize ); }; #endif diff --cc libs/stringio.h index 9003bca8,658e0ace..22792729 --- a/libs/stringio.h +++ b/libs/stringio.h @@@ -235,10 -234,7 +235,10 @@@ inline bool Tokeniser_getFloat( Tokenis //fallback for 1.#IND 1.#INF 1.#QNAN cases, happening sometimes after rotating & often scaling with tex lock in BP mode else if ( token != 0 && strstr( token, ".#" ) ) { globalErrorStream() << "Warning: " << Unsigned( tokeniser.getLine() ) << ":" << Unsigned( tokeniser.getColumn() ) << ": expected parse problem at '" << token << "': wanted '#number'\nProcessing anyway\n"; + #define GARUX_DISABLE_QNAN_FALLBACK + #ifndef GARUX_DISABLE_QNAN_FALLBACK - *strstr( token, ".#" ) = '\0'; + // *strstr( token, ".#" ) = '\0'; + #endif return true; } Tokeniser_unexpectedError( tokeniser, token, "#number" ); diff --cc radiant/mainframe.cpp index eb656102,9054117a..16c23709 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@@ -2450,9 -2327,10 +2476,10 @@@ void register_shortcuts() // SnapToGrid_registerShortcuts(); // SelectByType_registerShortcuts(); TexBro_registerShortcuts(); + Misc_registerShortcuts(); } -void File_constructToolbar( GtkToolbar* toolbar ){ +void File_constructToolbar( ui::Toolbar toolbar ){ toolbar_append_button( toolbar, "Open an existing map (CTRL + O)", "file_open.png", "OpenMap" ); toolbar_append_button( toolbar, "Save the active map (CTRL + S)", "file_save.png", "SaveMap" ); } @@@ -2498,10 -2376,10 +2525,10 @@@ void XYWnd_constructToolbar( ui::Toolba toolbar_append_button( toolbar, "Change views (CTRL + TAB)", "view_change.png", "NextView" ); } -void Manipulators_constructToolbar( GtkToolbar* toolbar ){ +void Manipulators_constructToolbar( ui::Toolbar toolbar ){ toolbar_append_toggle_button( toolbar, "Translate (W)", "select_mousetranslate.png", "MouseTranslate" ); toolbar_append_toggle_button( toolbar, "Rotate (R)", "select_mouserotate.png", "MouseRotate" ); - toolbar_append_toggle_button( toolbar, "Scale", "select_mousescale.png", "MouseScale" ); + toolbar_append_toggle_button( toolbar, "Scale (Q)", "select_mousescale.png", "MouseScale" ); toolbar_append_toggle_button( toolbar, "Resize (Q)", "select_mouseresize.png", "MouseDrag" ); Clipper_constructToolbar( toolbar ); @@@ -3413,82 -3277,83 +3440,84 @@@ void Layout_registerPreferencesPage() #include "stringio.h" void MainFrame_Construct(){ - GlobalCommands_insert( "OpenManual", FreeCaller(), Accelerator( GDK_F1 ) ); - - GlobalCommands_insert( "Sleep", FreeCaller(), Accelerator( 'P', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - GlobalCommands_insert( "NewMap", FreeCaller() ); - GlobalCommands_insert( "OpenMap", FreeCaller(), Accelerator( 'O', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "ImportMap", FreeCaller() ); - GlobalCommands_insert( "SaveMap", FreeCaller(), Accelerator( 'S', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "SaveMapAs", FreeCaller() ); - GlobalCommands_insert( "SaveSelected", FreeCaller() ); - GlobalCommands_insert( "SaveRegion", FreeCaller() ); - GlobalCommands_insert( "RefreshReferences", FreeCaller() ); - GlobalCommands_insert( "ProjectSettings", FreeCaller() ); - GlobalCommands_insert( "CheckForUpdate", FreeCaller() ); - GlobalCommands_insert( "Exit", FreeCaller() ); - - GlobalCommands_insert( "Undo", FreeCaller(), Accelerator( 'Z', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "Redo", FreeCaller(), Accelerator( 'Y', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "Copy", FreeCaller(), Accelerator( 'C', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "Paste", FreeCaller(), Accelerator( 'V', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "PasteToCamera", FreeCaller(), Accelerator( 'V', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "CloneSelection", FreeCaller(), Accelerator( GDK_space ) ); - GlobalCommands_insert( "CloneSelectionAndMakeUnique", FreeCaller(), Accelerator( GDK_space, (GdkModifierType)GDK_SHIFT_MASK ) ); -// GlobalCommands_insert( "DeleteSelection", FreeCaller(), Accelerator( GDK_BackSpace ) ); - GlobalCommands_insert( "DeleteSelection2", FreeCaller(), Accelerator( GDK_BackSpace ) ); - GlobalCommands_insert( "DeleteSelection", FreeCaller(), Accelerator( 'Z' ) ); - GlobalCommands_insert( "ParentSelection", FreeCaller() ); -// GlobalCommands_insert( "UnSelectSelection", FreeCaller(), Accelerator( GDK_Escape ) ); - GlobalCommands_insert( "UnSelectSelection2", FreeCaller(), Accelerator( GDK_Escape ) ); - GlobalCommands_insert( "UnSelectSelection", FreeCaller(), Accelerator( 'C' ) ); - GlobalCommands_insert( "InvertSelection", FreeCaller(), Accelerator( 'I' ) ); - GlobalCommands_insert( "SelectInside", FreeCaller() ); - GlobalCommands_insert( "SelectTouching", FreeCaller() ); - GlobalCommands_insert( "ExpandSelectionToEntities", FreeCaller(), Accelerator( 'E', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "Preferences", FreeCaller(), Accelerator( 'P' ) ); - - GlobalCommands_insert( "ToggleConsole", FreeCaller(), Accelerator( 'O' ) ); - GlobalCommands_insert( "ToggleEntityInspector", FreeCaller(), Accelerator( 'N' ) ); - GlobalCommands_insert( "EntityList", FreeCaller(), Accelerator( 'L' ) ); - - GlobalCommands_insert( "ShowHidden", FreeCaller(), Accelerator( 'H', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "HideSelected", FreeCaller(), Accelerator( 'H' ) ); - - GlobalToggles_insert( "DragVertices", FreeCaller(), ToggleItem::AddCallbackCaller( g_vertexMode_button ), Accelerator( 'V' ) ); - GlobalToggles_insert( "DragEdges", FreeCaller(), ToggleItem::AddCallbackCaller( g_edgeMode_button ), Accelerator( 'E' ) ); - GlobalToggles_insert( "DragFaces", FreeCaller(), ToggleItem::AddCallbackCaller( g_faceMode_button ), Accelerator( 'F' ) ); - - GlobalCommands_insert( "MirrorSelectionX", FreeCaller() ); - GlobalCommands_insert( "RotateSelectionX", FreeCaller() ); - GlobalCommands_insert( "MirrorSelectionY", FreeCaller() ); - GlobalCommands_insert( "RotateSelectionY", FreeCaller() ); - GlobalCommands_insert( "MirrorSelectionZ", FreeCaller() ); - GlobalCommands_insert( "RotateSelectionZ", FreeCaller() ); - - GlobalCommands_insert( "ArbitraryRotation", FreeCaller(), Accelerator( 'R', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "ArbitraryScale", FreeCaller(), Accelerator( 'S', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); - - GlobalCommands_insert( "BuildMenuCustomize", FreeCaller() ); - - GlobalCommands_insert( "FindBrush", FreeCaller() ); - - GlobalCommands_insert( "MapInfo", FreeCaller(), Accelerator( 'M' ) ); - - - GlobalToggles_insert( "ToggleClipper", FreeCaller(), ToggleItem::AddCallbackCaller( g_clipper_button ), Accelerator( 'X' ) ); - - GlobalToggles_insert( "MouseTranslate", FreeCaller(), ToggleItem::AddCallbackCaller( g_translatemode_button ), Accelerator( 'W' ) ); - GlobalToggles_insert( "MouseRotate", FreeCaller(), ToggleItem::AddCallbackCaller( g_rotatemode_button ), Accelerator( 'R' ) ); - GlobalToggles_insert( "MouseScale", FreeCaller(), ToggleItem::AddCallbackCaller( g_scalemode_button ) ); - GlobalToggles_insert( "MouseDrag", FreeCaller(), ToggleItem::AddCallbackCaller( g_dragmode_button ) ); - GlobalCommands_insert( "MouseRotateOrScale", FreeCaller() ); - GlobalCommands_insert( "MouseDragOrScale", FreeCaller(), Accelerator( 'Q' ) ); - - GlobalCommands_insert( "gtkThemeDlg", FreeCaller() ); - GlobalCommands_insert( "ColorSchemeOriginal", FreeCaller() ); - GlobalCommands_insert( "ColorSchemeQER", FreeCaller() ); - GlobalCommands_insert( "ColorSchemeBlackAndGreen", FreeCaller() ); - GlobalCommands_insert( "ColorSchemeYdnar", FreeCaller() ); + 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' ) ); ++ GlobalToggles_insert( "MouseDrag", makeCallbackF(DragMode), ToggleItem::AddCallbackCaller( g_dragmode_button ) ); ++ GlobalCommands_insert( "MouseRotateOrScale", makeCallbackF(ToggleRotateScaleModes) ); ++ GlobalCommands_insert( "MouseDragOrScale", makeCallbackF(ToggleDragScaleModes), Accelerator( 'Q' ) ); + +#ifndef GARUX_DISABLE_GTKTHEME + GlobalCommands_insert( "gtkThemeDlg", makeCallbackF(gtkThemeDlg) ); +#endif + 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 ) ); diff --cc radiant/texwindow.cpp index 416d3178,ba6c59e4..24090155 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@@ -1500,10 -1399,9 +1500,11 @@@ gboolean TextureBrowser_button_press( u } } else if ( event->type == GDK_2BUTTON_PRESS && event->button == 1 ) { + #define GARUX_DISABLE_2BUTTON + #ifndef GARUX_DISABLE_2BUTTON CopiedString texName = textureBrowser->shader; - const char* sh = textureBrowser->shader.c_str(); + //const char* sh = texName.c_str(); + char* sh = const_cast( texName.c_str() ); char* dir = strrchr( sh, '/' ); if( dir != NULL ){ *(dir + 1) = '\0'; diff --cc radiant/xywindow.cpp index f1cb57fd,af6467e3..1a176bfd --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@@ -1229,7 -1240,7 +1245,7 @@@ void XYWnd::Move_Begin() void XYWnd::Move_End(){ m_move_started = false; - g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow() ); - g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), false ); ++ g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), false ); g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_move_focusOut ); } @@@ -1274,7 -1285,7 +1290,7 @@@ void XYWnd::Zoom_Begin() void XYWnd::Zoom_End(){ m_zoom_started = false; - g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow() ); - g_xywnd_freezePointer.unfreeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), false ); ++ g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), false ); g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_zoom_focusOut ); } diff --cc tools/quake3/common/vfs.c index 48a1f86f,2b1b61bc..e8648e81 --- a/tools/quake3/common/vfs.c +++ b/tools/quake3/common/vfs.c @@@ -581,7 -565,42 +581,49 @@@ qboolean vfsPackFile( const char *filen } return qfalse; +#else + Error( "Disabled because of miniz issue" ); +#endif } + + qboolean vfsPackFile_Absolute_Path( const char *filepath, const char *filename, const char *packname, const int compLevel ){ ++#ifndef GARUX_DISABLE_BAD_MINIZ + char tmp[NAME_MAX]; + strcpy( tmp, filepath ); + if ( access( tmp, R_OK ) == 0 ) { + if ( access( packname, R_OK ) == 0 ) { + mz_zip_archive zip; + memset( &zip, 0, sizeof(zip) ); + mz_zip_reader_init_file( &zip, packname, 0 ); + mz_zip_writer_init_from_reader( &zip, packname ); + + mz_bool success = MZ_TRUE; + success &= mz_zip_writer_add_file( &zip, filename, tmp, 0, 0, compLevel ); + if ( !success || !mz_zip_writer_finalize_archive( &zip ) ){ + Error( "Failed creating zip archive \"%s\"!\n", packname ); + } + mz_zip_reader_end( &zip); + mz_zip_writer_end( &zip ); + } + else{ + mz_zip_archive zip; + memset( &zip, 0, sizeof(zip) ); + if( !mz_zip_writer_init_file( &zip, packname, 0 ) ){ + Error( "Failed creating zip archive \"%s\"!\n", packname ); + } + mz_bool success = MZ_TRUE; + success &= mz_zip_writer_add_file( &zip, filename, tmp, 0, 0, compLevel ); + if ( !success || !mz_zip_writer_finalize_archive( &zip ) ){ + Error( "Failed creating zip archive \"%s\"!\n", packname ); + } + mz_zip_writer_end( &zip ); + } + + return qtrue; + } + + return qfalse; ++#else ++ Error( "Disabled because of miniz issue" ); ++#endif + }