]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
make Ctrl-Tab center the views in the XYZ view
authorrpolzer <rpolzer@61c419a2-8eb2-4b30-bcec-8cead039b335>
Thu, 18 Sep 2008 17:25:03 +0000 (17:25 +0000)
committerrpolzer <rpolzer@61c419a2-8eb2-4b30-bcec-8cead039b335>
Thu, 18 Sep 2008 17:25:03 +0000 (17:25 +0000)
git-svn-id: svn://svn.icculus.org/netradiant/trunk@90 61c419a2-8eb2-4b30-bcec-8cead039b335

radiant/mainframe.cpp
radiant/xywindow.cpp

index 78799f431a362a6014567572ea6a4db5a8850eee..d97964085ee75c0f40c5a4fe13aa178119f443e7 100644 (file)
@@ -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;
 }
index dfc0c25bf28d021a9e6f4aa1dfc6dda84ef95e0e..0a6e9aebaef84c8eb1883a687203d7670a5dca49 100644 (file)
@@ -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<XY_Side>());
   GlobalCommands_insert("ViewFront", FreeCaller<XY_Front>());
   GlobalCommands_insert("Zoom100", FreeCaller<XY_Zoom100>());
-  GlobalCommands_insert("CenterXYViews", FreeCaller<XY_Split_Focus>(), Accelerator(GDK_Tab, (GdkModifierType)(GDK_SHIFT_MASK|GDK_CONTROL_MASK)));
   GlobalCommands_insert("CenterXYView", FreeCaller<XY_Focus>(), Accelerator(GDK_Tab, (GdkModifierType)(GDK_SHIFT_MASK|GDK_CONTROL_MASK)));
 
   GlobalPreferenceSystem().registerPreference("ClipCaulk", BoolImportStringCaller(g_clip_useCaulk), BoolExportStringCaller(g_clip_useCaulk));