From 8401d4c6c6c10d7b9b793f57e36ef1d4d612582d Mon Sep 17 00:00:00 2001 From: rpolzer Date: Thu, 18 Sep 2008 17:25:03 +0000 Subject: [PATCH] make Ctrl-Tab center the views in the XYZ view git-svn-id: svn://svn.icculus.org/netradiant/trunk@90 61c419a2-8eb2-4b30-bcec-8cead039b335 --- radiant/mainframe.cpp | 9 +-------- radiant/xywindow.cpp | 46 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 78799f4..d979640 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2127,14 +2127,7 @@ GtkMenuItem* create_view_menu(MainFrame::EViewStyle style) create_menu_item_with_mnemonic(menu_in_menu, "Set Se_lected Brushes", "RegionSetSelection"); } - if(style == MainFrame::eSplit || style == MainFrame::eFloating) - { - command_connect_accelerator("CenterXYViews"); - } - else - { - command_connect_accelerator("CenterXYView"); - } + command_connect_accelerator("CenterXYView"); return view_menu_item; } diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index dfc0c25..0a6e9ae 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -2577,12 +2577,28 @@ void XY_Split_Focus() void XY_Focus() { + if (g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating) + { + // cannot do this in a split window + // do something else that the user may want here + XY_Split_Focus(); + return; + } + XYWnd* xywnd = g_pParentWnd->GetXYWnd(); XYWnd_Focus(xywnd); } void XY_Top() { + if (g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating) + { + // cannot do this in a split window + // do something else that the user may want here + XY_Split_Focus(); + return; + } + XYWnd* xywnd = g_pParentWnd->GetXYWnd(); xywnd->SetViewType(XY); XYWnd_Focus(xywnd); @@ -2590,6 +2606,14 @@ void XY_Top() void XY_Side() { + if (g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating) + { + // cannot do this in a split window + // do something else that the user may want here + XY_Split_Focus(); + return; + } + XYWnd* xywnd = g_pParentWnd->GetXYWnd(); xywnd->SetViewType(XZ); XYWnd_Focus(xywnd); @@ -2597,12 +2621,29 @@ void XY_Side() void XY_Front() { - g_pParentWnd->GetXYWnd()->SetViewType(YZ); - XYWnd_Focus(g_pParentWnd->GetXYWnd()); + if (g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating) + { + // cannot do this in a split window + // do something else that the user may want here + XY_Split_Focus(); + return; + } + + XYWnd* xywnd = g_pParentWnd->GetXYWnd(); + xywnd->SetViewType(XY); + XYWnd_Focus(xywnd); } void XY_Next() { + if (g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating) + { + // cannot do this in a split window + // do something else that the user may want here + XY_Split_Focus(); + return; + } + XYWnd* xywnd = g_pParentWnd->GetXYWnd(); if (xywnd->GetViewType() == XY) xywnd->SetViewType(XZ); @@ -2906,7 +2947,6 @@ void XYWindow_Construct() GlobalCommands_insert("ViewSide", FreeCaller()); GlobalCommands_insert("ViewFront", FreeCaller()); GlobalCommands_insert("Zoom100", FreeCaller()); - GlobalCommands_insert("CenterXYViews", FreeCaller(), Accelerator(GDK_Tab, (GdkModifierType)(GDK_SHIFT_MASK|GDK_CONTROL_MASK))); GlobalCommands_insert("CenterXYView", FreeCaller(), Accelerator(GDK_Tab, (GdkModifierType)(GDK_SHIFT_MASK|GDK_CONTROL_MASK))); GlobalPreferenceSystem().registerPreference("ClipCaulk", BoolImportStringCaller(g_clip_useCaulk), BoolExportStringCaller(g_clip_useCaulk)); -- 2.39.2