Merge pull request #7608 from pchote/widgetcommon

Move common widgets from Game to Mods.Common.
This commit is contained in:
Oliver Brakmann
2015-03-21 13:57:56 +01:00
31 changed files with 94 additions and 59 deletions

View File

@@ -260,5 +260,10 @@ namespace OpenRA.Graphics
if (fontSheetBuilder != null) if (fontSheetBuilder != null)
fontSheetBuilder.Dispose(); fontSheetBuilder.Dispose();
} }
public string GetClipboardText()
{
return Device.GetClipboardText();
}
} }
} }

View File

@@ -172,38 +172,11 @@
<Compile Include="Traits\World\ResourceType.cs" /> <Compile Include="Traits\World\ResourceType.cs" />
<Compile Include="Traits\World\ScreenShaker.cs" /> <Compile Include="Traits\World\ScreenShaker.cs" />
<Compile Include="Traits\World\Shroud.cs" /> <Compile Include="Traits\World\Shroud.cs" />
<Compile Include="Widgets\BackgroundWidget.cs" />
<Compile Include="Widgets\ButtonWidget.cs" />
<Compile Include="Widgets\ChatDisplayWidget.cs" />
<Compile Include="Widgets\CheckboxWidget.cs" />
<Compile Include="Widgets\ChromeMetrics.cs" />
<Compile Include="Widgets\ColorBlockWidget.cs" />
<Compile Include="Widgets\DropDownButtonWidget.cs" />
<Compile Include="Widgets\GridLayout.cs" />
<Compile Include="Widgets\ImageWidget.cs" />
<Compile Include="Widgets\LabelWidget.cs" />
<Compile Include="Widgets\LineGraphWidget.cs" />
<Compile Include="Widgets\ListLayout.cs" />
<Compile Include="Widgets\MapPreviewWidget.cs" />
<Compile Include="Widgets\PasswordFieldWidget.cs" />
<Compile Include="Widgets\PerfGraphWidget.cs" />
<Compile Include="Widgets\ProgressBarWidget.cs" />
<Compile Include="Widgets\ScrollItemWidget.cs" />
<Compile Include="Widgets\ScrollPanelWidget.cs" />
<Compile Include="Widgets\SliderWidget.cs" />
<Compile Include="Widgets\TextFieldWidget.cs" />
<Compile Include="Widgets\VqaPlayerWidget.cs" />
<Compile Include="Widgets\Widget.cs" />
<Compile Include="Widgets\WidgetLoader.cs" />
<Compile Include="Widgets\WidgetUtils.cs" />
<Compile Include="Widgets\WorldInteractionControllerWidget.cs" />
<Compile Include="World.cs" /> <Compile Include="World.cs" />
<Compile Include="WorldUtils.cs" /> <Compile Include="WorldUtils.cs" />
<Compile Include="Network\ReplayRecorderConnection.cs" /> <Compile Include="Network\ReplayRecorderConnection.cs" />
<Compile Include="Widgets\TooltipContainerWidget.cs" />
<Compile Include="Traits\DebugPauseState.cs" /> <Compile Include="Traits\DebugPauseState.cs" />
<Compile Include="Network\UPnP.cs" /> <Compile Include="Network\UPnP.cs" />
<Compile Include="Widgets\ClientTooltipRegionWidget.cs" />
<Compile Include="Graphics\Renderable.cs" /> <Compile Include="Graphics\Renderable.cs" />
<Compile Include="Graphics\Voxel.cs" /> <Compile Include="Graphics\Voxel.cs" />
<Compile Include="Graphics\VoxelRenderer.cs" /> <Compile Include="Graphics\VoxelRenderer.cs" />
@@ -211,16 +184,12 @@
<Compile Include="Graphics\VoxelProvider.cs" /> <Compile Include="Graphics\VoxelProvider.cs" />
<Compile Include="Traits\BodyOrientation.cs" /> <Compile Include="Traits\BodyOrientation.cs" />
<Compile Include="Graphics\VoxelAnimation.cs" /> <Compile Include="Graphics\VoxelAnimation.cs" />
<Compile Include="Widgets\ViewportControllerWidget.cs" />
<Compile Include="Traits\Player\FrozenActorLayer.cs" /> <Compile Include="Traits\Player\FrozenActorLayer.cs" />
<Compile Include="Graphics\Theater.cs" /> <Compile Include="Graphics\Theater.cs" />
<Compile Include="Traits\Player\PlayerColorPalette.cs" /> <Compile Include="Traits\Player\PlayerColorPalette.cs" />
<Compile Include="Traits\Player\PlayerHighlightPalette.cs" /> <Compile Include="Traits\Player\PlayerHighlightPalette.cs" />
<Compile Include="Traits\World\ScreenMap.cs" /> <Compile Include="Traits\World\ScreenMap.cs" />
<Compile Include="Traits\World\ActorMap.cs" /> <Compile Include="Traits\World\ActorMap.cs" />
<Compile Include="Widgets\HotkeyEntryWidget.cs" />
<Compile Include="Widgets\SpriteWidget.cs" />
<Compile Include="Widgets\RGBASpriteWidget.cs" />
<Compile Include="Scripting\ScriptContext.cs" /> <Compile Include="Scripting\ScriptContext.cs" />
<Compile Include="Scripting\ScriptActorInterface.cs" /> <Compile Include="Scripting\ScriptActorInterface.cs" />
<Compile Include="Scripting\ScriptObjectWrapper.cs" /> <Compile Include="Scripting\ScriptObjectWrapper.cs" />
@@ -236,7 +205,6 @@
<Compile Include="GameRules\RulesetCache.cs" /> <Compile Include="GameRules\RulesetCache.cs" />
<Compile Include="Support\MersenneTwister.cs" /> <Compile Include="Support\MersenneTwister.cs" />
<Compile Include="GameInformation.cs" /> <Compile Include="GameInformation.cs" />
<Compile Include="Widgets\RootWidget.cs" />
<Compile Include="Map\CellLayer.cs" /> <Compile Include="Map\CellLayer.cs" />
<Compile Include="Map\CellRegion.cs" /> <Compile Include="Map\CellRegion.cs" />
<Compile Include="Input\IInputHandler.cs" /> <Compile Include="Input\IInputHandler.cs" />
@@ -259,6 +227,12 @@
<Compile Include="Support\PerfItem.cs" /> <Compile Include="Support\PerfItem.cs" />
<Compile Include="Support\PerfSample.cs" /> <Compile Include="Support\PerfSample.cs" />
<Compile Include="Graphics\SpriteRenderable.cs" /> <Compile Include="Graphics\SpriteRenderable.cs" />
<Compile Include="Widgets\Widget.cs" />
<Compile Include="Widgets\RootWidget.cs" />
<Compile Include="Widgets\WidgetLoader.cs" />
<Compile Include="Widgets\ChromeMetrics.cs" />
<Compile Include="Widgets\WidgetUtils.cs" />
<Compile Include="Widgets\WorldInteractionControllerWidget.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="FileSystem\D2kSoundResources.cs" /> <Compile Include="FileSystem\D2kSoundResources.cs" />

View File

@@ -8,6 +8,7 @@
*/ */
#endregion #endregion
using OpenRA.Mods.Common.Widgets;
using OpenRA.Mods.Common.Widgets.Logic; using OpenRA.Mods.Common.Widgets.Logic;
using OpenRA.Widgets; using OpenRA.Widgets;

View File

@@ -590,6 +590,32 @@
<Compile Include="Widgets\Logic\ReplayUtils.cs" /> <Compile Include="Widgets\Logic\ReplayUtils.cs" />
<Compile Include="InstallUtils.cs" /> <Compile Include="InstallUtils.cs" />
<Compile Include="Graphics\DefaultSpriteSequence.cs" /> <Compile Include="Graphics\DefaultSpriteSequence.cs" />
<Compile Include="Widgets\BackgroundWidget.cs" />
<Compile Include="Widgets\ButtonWidget.cs" />
<Compile Include="Widgets\ChatDisplayWidget.cs" />
<Compile Include="Widgets\CheckboxWidget.cs" />
<Compile Include="Widgets\ClientTooltipRegionWidget.cs" />
<Compile Include="Widgets\ColorBlockWidget.cs" />
<Compile Include="Widgets\DropDownButtonWidget.cs" />
<Compile Include="Widgets\GridLayout.cs" />
<Compile Include="Widgets\HotkeyEntryWidget.cs" />
<Compile Include="Widgets\ImageWidget.cs" />
<Compile Include="Widgets\LabelWidget.cs" />
<Compile Include="Widgets\LineGraphWidget.cs" />
<Compile Include="Widgets\ListLayout.cs" />
<Compile Include="Widgets\MapPreviewWidget.cs" />
<Compile Include="Widgets\PasswordFieldWidget.cs" />
<Compile Include="Widgets\PerfGraphWidget.cs" />
<Compile Include="Widgets\ProgressBarWidget.cs" />
<Compile Include="Widgets\RGBASpriteWidget.cs" />
<Compile Include="Widgets\ScrollItemWidget.cs" />
<Compile Include="Widgets\ScrollPanelWidget.cs" />
<Compile Include="Widgets\SliderWidget.cs" />
<Compile Include="Widgets\SpriteWidget.cs" />
<Compile Include="Widgets\TextFieldWidget.cs" />
<Compile Include="Widgets\TooltipContainerWidget.cs" />
<Compile Include="Widgets\ViewportControllerWidget.cs" />
<Compile Include="Widgets\VqaPlayerWidget.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>

View File

@@ -11,6 +11,7 @@
using System; using System;
using System.IO; using System.IO;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Mods.Common.Widgets;
using OpenRA.Widgets; using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Scripting namespace OpenRA.Mods.Common.Scripting

View File

@@ -9,8 +9,9 @@
#endregion #endregion
using System.Drawing; using System.Drawing;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class BackgroundWidget : Widget public class BackgroundWidget : Widget
{ {

View File

@@ -10,8 +10,9 @@
using System; using System;
using System.Drawing; using System.Drawing;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class ButtonWidget : Widget public class ButtonWidget : Widget
{ {

View File

@@ -12,8 +12,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class ChatDisplayWidget : Widget public class ChatDisplayWidget : Widget
{ {

View File

@@ -11,8 +11,9 @@
using System; using System;
using System.Drawing; using System.Drawing;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class CheckboxWidget : ButtonWidget public class CheckboxWidget : ButtonWidget
{ {

View File

@@ -10,8 +10,9 @@
using System; using System;
using OpenRA.Network; using OpenRA.Network;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class ClientTooltipRegionWidget : Widget public class ClientTooltipRegionWidget : Widget
{ {

View File

@@ -10,8 +10,9 @@
using System; using System;
using System.Drawing; using System.Drawing;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class ColorBlockWidget : Widget public class ColorBlockWidget : Widget
{ {

View File

@@ -12,8 +12,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class DropDownButtonWidget : ButtonWidget public class DropDownButtonWidget : ButtonWidget
{ {

View File

@@ -9,8 +9,9 @@
#endregion #endregion
using System; using System;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class GridLayout : ILayout public class GridLayout : ILayout
{ {

View File

@@ -11,8 +11,9 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class HotkeyEntryWidget : Widget public class HotkeyEntryWidget : Widget
{ {

View File

@@ -10,8 +10,9 @@
using System; using System;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class ImageWidget : Widget public class ImageWidget : Widget
{ {

View File

@@ -11,8 +11,9 @@
using System; using System;
using System.Drawing; using System.Drawing;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public enum TextAlign { Left, Center, Right } public enum TextAlign { Left, Center, Right }
public enum TextVAlign { Top, Middle, Bottom } public enum TextVAlign { Top, Middle, Bottom }

View File

@@ -12,8 +12,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class LineGraphWidget : Widget public class LineGraphWidget : Widget
{ {

View File

@@ -8,7 +8,9 @@
*/ */
#endregion #endregion
namespace OpenRA.Widgets using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets
{ {
public class ListLayout : ILayout public class ListLayout : ILayout
{ {

View File

@@ -14,8 +14,9 @@ using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Network; using OpenRA.Network;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class SpawnOccupant public class SpawnOccupant
{ {

View File

@@ -8,7 +8,9 @@
*/ */
#endregion #endregion
namespace OpenRA.Widgets using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets
{ {
public class PasswordFieldWidget : TextFieldWidget public class PasswordFieldWidget : TextFieldWidget
{ {

View File

@@ -11,8 +11,9 @@
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Support; using OpenRA.Support;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class PerfGraphWidget : Widget public class PerfGraphWidget : Widget
{ {

View File

@@ -10,8 +10,9 @@
using System; using System;
using System.Drawing; using System.Drawing;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class ProgressBarWidget : Widget public class ProgressBarWidget : Widget
{ {

View File

@@ -10,8 +10,9 @@
using System; using System;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class RGBASpriteWidget : Widget public class RGBASpriteWidget : Widget
{ {

View File

@@ -9,8 +9,9 @@
#endregion #endregion
using System; using System;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class ScrollItemWidget : ButtonWidget public class ScrollItemWidget : ButtonWidget
{ {

View File

@@ -13,8 +13,9 @@ using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Primitives; using OpenRA.Primitives;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public interface ILayout public interface ILayout
{ {

View File

@@ -11,8 +11,9 @@
using System; using System;
using System.Drawing; using System.Drawing;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class SliderWidget : Widget public class SliderWidget : Widget
{ {

View File

@@ -10,8 +10,9 @@
using System; using System;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class SpriteWidget : Widget public class SpriteWidget : Widget
{ {

View File

@@ -10,8 +10,9 @@
using System; using System;
using System.Drawing; using System.Drawing;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class TextFieldWidget : Widget public class TextFieldWidget : Widget
{ {
@@ -177,7 +178,7 @@ namespace OpenRA.Widgets
((Platform.CurrentPlatform != PlatformType.OSX && e.Modifiers.HasModifier(Modifiers.Ctrl)) || ((Platform.CurrentPlatform != PlatformType.OSX && e.Modifiers.HasModifier(Modifiers.Ctrl)) ||
(Platform.CurrentPlatform == PlatformType.OSX && e.Modifiers.HasModifier(Modifiers.Meta)))) (Platform.CurrentPlatform == PlatformType.OSX && e.Modifiers.HasModifier(Modifiers.Meta))))
{ {
var clipboardText = Game.Renderer.Device.GetClipboardText(); var clipboardText = Game.Renderer.GetClipboardText();
// Take only the first line of the clipboard contents // Take only the first line of the clipboard contents
var nl = clipboardText.IndexOf('\n'); var nl = clipboardText.IndexOf('\n');

View File

@@ -11,8 +11,9 @@
using System; using System;
using System.Drawing; using System.Drawing;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class TooltipContainerWidget : Widget public class TooltipContainerWidget : Widget
{ {

View File

@@ -14,8 +14,9 @@ using System.Linq;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Orders; using OpenRA.Orders;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public enum WorldTooltipType { None, Unexplored, Actor, FrozenActor } public enum WorldTooltipType { None, Unexplored, Actor, FrozenActor }

View File

@@ -13,8 +13,9 @@ using System.Drawing;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.FileSystem; using OpenRA.FileSystem;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Widgets namespace OpenRA.Mods.Common.Widgets
{ {
public class VqaPlayerWidget : Widget public class VqaPlayerWidget : Widget
{ {