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
This commit is contained in:
rpolzer 2008-09-18 17:25:03 +00:00
parent 04397d579b
commit 8401d4c6c6
2 changed files with 44 additions and 11 deletions

View 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"); 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; return view_menu_item;
} }

View File

@ -2577,12 +2577,28 @@ void XY_Split_Focus()
void XY_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* xywnd = g_pParentWnd->GetXYWnd();
XYWnd_Focus(xywnd); XYWnd_Focus(xywnd);
} }
void XY_Top() 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* xywnd = g_pParentWnd->GetXYWnd();
xywnd->SetViewType(XY); xywnd->SetViewType(XY);
XYWnd_Focus(xywnd); XYWnd_Focus(xywnd);
@ -2590,6 +2606,14 @@ void XY_Top()
void XY_Side() 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* xywnd = g_pParentWnd->GetXYWnd();
xywnd->SetViewType(XZ); xywnd->SetViewType(XZ);
XYWnd_Focus(xywnd); XYWnd_Focus(xywnd);
@ -2597,12 +2621,29 @@ void XY_Side()
void XY_Front() void XY_Front()
{ {
g_pParentWnd->GetXYWnd()->SetViewType(YZ); if (g_pParentWnd->CurrentStyle() == MainFrame::eSplit || g_pParentWnd->CurrentStyle() == MainFrame::eFloating)
XYWnd_Focus(g_pParentWnd->GetXYWnd()); {
// 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() 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(); XYWnd* xywnd = g_pParentWnd->GetXYWnd();
if (xywnd->GetViewType() == XY) if (xywnd->GetViewType() == XY)
xywnd->SetViewType(XZ); xywnd->SetViewType(XZ);
@ -2906,7 +2947,6 @@ void XYWindow_Construct()
GlobalCommands_insert("ViewSide", FreeCaller<XY_Side>()); GlobalCommands_insert("ViewSide", FreeCaller<XY_Side>());
GlobalCommands_insert("ViewFront", FreeCaller<XY_Front>()); GlobalCommands_insert("ViewFront", FreeCaller<XY_Front>());
GlobalCommands_insert("Zoom100", FreeCaller<XY_Zoom100>()); 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))); 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)); GlobalPreferenceSystem().registerPreference("ClipCaulk", BoolImportStringCaller(g_clip_useCaulk), BoolExportStringCaller(g_clip_useCaulk));