Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if IsValid(menubar.Control) then
- menubar.Control:SetSkin("DarkRP")
- menubar.Control.Paint = function(s,w,h)
- end
- end
- function menubar.ParentTo( pnl )
- if not IsValid(menubar.Control) then
- return
- end
- menubar.Control:SetParent( pnl )
- menubar.Control:MoveToBack()
- menubar.Control:SetHeight( 24 )
- menubar.Control:SetVisible( true )
- end
- for k, v in pairs(g_ContextMenu:GetChildren()) do
- if v.ClassName == "DIconLayout" then
- v:Remove()
- end
- end
- g_ContextMenu:SetWorldClicker(false)
- -- shameless copy
- function g_ContextMenu:Open()
- self:SetHangOpen( false )
- -- If the spawn menu is open, try to close it..
- if ( g_SpawnMenu:IsVisible() ) then
- g_SpawnMenu:Close( true )
- end
- if ( self:IsVisible() ) then return end
- CloseDermaMenus()
- self:MakePopup()
- self:SetVisible( true )
- self:SetKeyboardInputEnabled( false )
- self:SetMouseInputEnabled( true )
- RestoreCursorPosition()
- hook.Run("MidContextMenuOpening")
- local wep = LocalPlayer():GetActiveWeapon()
- local bShouldShow = wep:IsValid() and wep:GetClass() == "gmod_tool"
- -- TODO: Any situation in which we shouldn't show the tool menu on the context menu?
- -- Set up the active panel..
- if ( bShouldShow && IsValid( spawnmenu.ActiveControlPanel() ) ) then
- self.OldParent = spawnmenu.ActiveControlPanel():GetParent()
- self.OldPosX, self.OldPosY = spawnmenu.ActiveControlPanel():GetPos()
- spawnmenu.ActiveControlPanel():SetParent( self )
- self.Canvas:Clear()
- self.Canvas:AddItem( spawnmenu.ActiveControlPanel() )
- self.Canvas:Rebuild()
- self.Canvas:SetVisible( true )
- else
- self.Canvas:SetVisible( false )
- end
- self:InvalidateLayout( true )
- end
- function g_ContextMenu:PerformLayout()
- if ( IsValid( spawnmenu.ActiveControlPanel() ) ) then
- spawnmenu.ActiveControlPanel():InvalidateLayout( true )
- local Tall = math.min( spawnmenu.ActiveControlPanel():GetTall() + 10, ScrH() * 0.8 )
- if ( self.Canvas:GetTall() != Tall ) then self.Canvas:SetTall( Tall ) end
- if ( self.Canvas:GetWide() != 320 ) then self.Canvas:SetWide( 320 ) end
- self.Canvas:SetPos( ScrW() - self.Canvas:GetWide() - 50, ScrH() - 50 - Tall - yscale(150) )
- self.Canvas:InvalidateLayout( true )
- end
- end
- concommand.Add( "+menu_context", function()
- if IsValid(_G.cmenuspawnedframe) and _G.cmenuspawnedframe:IsVisible() then
- return
- end
- if g_ContextMenu:IsVisible() then
- if ( input.IsKeyTrapping() ) then return end
- hook.Call( "OnContextMenuClose", GAMEMODE )
- else
- hook.Call( "OnContextMenuOpen", GAMEMODE ) end
- end
- , nil, "Toggles the context menu", { FCVAR_DONTRECORD } )
- concommand.Add( "-menu_context", function() end, nil, "Absolutely nothing", { FCVAR_DONTRECORD } )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement