Merge pull request #3489 from jlewin/design_tools

Inline localization strings
This commit is contained in:
Lars Brubaker 2018-06-29 11:41:09 -07:00 committed by GitHub
commit 4e2778a2c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 15 additions and 155 deletions

View file

@ -213,8 +213,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage
ApplicationController.Instance.Library.NotifyContainerChanged();
}
},
rebuildThumbnailsMessage,
rebuildThumbnailsTitle,
"You are switching to a different thumbnail rendering mode. If you want, your current thumbnails can be removed and recreated in the new style. You can switch back and forth at any time. There will be some processing overhead while the new thumbnails are created.\n\nDo you want to rebuild your existing thumbnails now?".Localize(),
"Rebuild Thumbnails Now".Localize(),
StyledMessageBox.MessageType.YES_NO,
"Rebuild".Localize());
});
@ -418,9 +418,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage
return container;
}
private string rebuildThumbnailsMessage = "You are switching to a different thumbnail rendering mode. If you want, your current thumbnails can be removed and recreated in the new style. You can switch back and forth at any time. There will be some processing overhead while the new thumbnails are created.\n\nDo you want to rebuild your existing thumbnails now?".Localize();
private string rebuildThumbnailsTitle = "Rebuild Thumbnails Now".Localize();
[Conditional("DEBUG")]
private void GenerateLocalizationValidationFile()
{

View file

@ -1,71 +0,0 @@
/*
Copyright (c) 2014, Kevin Pope
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg.UI;
namespace MatterHackers.MatterControl
{
public class FatFlatClickWidget : ClickWidget
{
private GuiWidget overlay;
public FatFlatClickWidget(TextWidget textWidget)
{
overlay = new GuiWidget();
overlay.AnchorAll();
overlay.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
overlay.Visible = false;
this.GetChildClicks = true;
this.AddChild(textWidget);
this.AddChild(overlay);
}
public override void OnMouseDown(MouseEventArgs mouseEvent)
{
if (PositionWithinLocalBounds(mouseEvent.X, mouseEvent.Y))
{
overlay.Visible = true;
}
base.OnMouseDown(mouseEvent);
}
public override void OnMouseLeave(MouseEventArgs mouseEvent)
{
base.OnMouseLeave(mouseEvent);
}
public override void OnMouseUp(MouseEventArgs mouseEvent)
{
base.OnMouseUp(mouseEvent);
overlay.Visible = false;
}
}
}

View file

@ -102,7 +102,6 @@ namespace MatterHackers.MatterControl.PrintHistory
private static int rightOverlayWidth = 200;
#endif
private int actionButtonSize = rightOverlayWidth/2;
private SlideWidget rightButtonOverlay;
public PrintHistoryListItem(ListViewItem listViewItem, int thumbWidth, int thumbHeight, PrintTask printTask, bool showTimestamp, ThemeConfig theme)
: base(listViewItem, thumbWidth, thumbHeight, theme)
@ -215,50 +214,6 @@ namespace MatterHackers.MatterControl.PrintHistory
primaryContainer.AddChild(primaryFlow);
rightButtonOverlay = new SlideWidget();
rightButtonOverlay.VAnchor = VAnchor.Stretch;
rightButtonOverlay.HAnchor = Agg.UI.HAnchor.Right;
rightButtonOverlay.Width = rightOverlayWidth;
rightButtonOverlay.Visible = false;
FlowLayoutWidget rightMiddleColumnContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
rightMiddleColumnContainer.VAnchor = VAnchor.Stretch;
{
TextWidget viewLabel = new TextWidget("View".Localize());
viewLabel.TextColor = Color.White;
viewLabel.VAnchor = VAnchor.Center;
viewLabel.HAnchor = HAnchor.Center;
TextWidget printLabel = new TextWidget("Print".Localize());
printLabel.TextColor = Color.White;
printLabel.VAnchor = VAnchor.Center;
printLabel.HAnchor = HAnchor.Center;
FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel);
printButton.VAnchor = VAnchor.Stretch;
printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
printButton.Width = actionButtonSize;
printButton.Click += (sender, e) =>
{
UiThread.RunOnIdle(() =>
{
if (!ApplicationController.Instance.ActivePrinter.Connection.PrintIsActive)
{
// TODO: More work needed here. We need to stash the bedplate, switch to a new context, then invoke print as normal
//ApplicationController.Instance.PrintActivePartIfPossible(new PrintItemWrapper(printTask.PrintItemId));
}
else
{
// TODO: Queue is somewhat deprecated. Consider disabling this feature/button while printing
QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId));
}
rightButtonOverlay.SlideOut();
});
};
rightMiddleColumnContainer.AddChild(printButton);
}
rightButtonOverlay.AddChild(rightMiddleColumnContainer);
if (showTimestamp)
{
FlowLayoutWidget timestampColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
@ -321,7 +276,6 @@ namespace MatterHackers.MatterControl.PrintHistory
}
mainContainer.AddChild(primaryContainer);
mainContainer.AddChild(rightButtonOverlay);
this.AddChild(mainContainer);
}

View file

@ -270,6 +270,7 @@
<Compile Include="Utilities\MarkdigAgg\AggCodeBlockRenderer.cs" />
<Compile Include="Utilities\MarkdigAgg\AggHeadingRenderer.cs" />
<Compile Include="Utilities\MarkdigAgg\AggListRenderer.cs" />
<Compile Include="Utilities\MarkdigAgg\AggMarkdownDocument.cs" />
<Compile Include="Utilities\MarkdigAgg\AggObjectRenderer.cs" />
<Compile Include="Utilities\MarkdigAgg\AggQuoteBlockRenderer.cs" />
<Compile Include="Utilities\MarkdigAgg\AggRenderer.cs" />
@ -300,7 +301,6 @@
<Compile Include="ConfigurationPage\PrintLeveling\PrintLevelingData.cs" />
<Compile Include="ControlElements\AttentionGetter.cs" />
<Compile Include="CustomWidgets\DoubleSolidSlider.cs" />
<Compile Include="CustomWidgets\FatFlatClickWidget.cs" />
<Compile Include="CustomWidgets\FlowSpacers.cs" />
<Compile Include="CustomWidgets\LibrarySelector\FolderBreadCrumbWidget.cs" />
<Compile Include="CustomWidgets\SlideWidget.cs" />
@ -447,7 +447,6 @@
<Compile Include="Utilities\AuthenticationData.cs" />
<Compile Include="Utilities\JsonPath.cs" />
<Compile Include="Utilities\LimitCallFrequency.cs" />
<Compile Include="Utilities\MarkdigAgg\MarkdownDocument.cs" />
<Compile Include="Utilities\MarkdigAgg\MarkdownExtensions.cs" />
<Compile Include="Utilities\MarkdigAgg\MarkdownPage.cs" />
<Compile Include="Utilities\MarkdigAgg\MarkdownWidget.cs" />

View file

@ -85,21 +85,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
};
// Force the ActionArea to be as high as ButtonHeight
tabControl.TabBar.ActionArea.MinimumSize = new Vector2(0, theme.ButtonHeight);
tabControl.TabBar.BackgroundColor = theme.TabBarBackground;
tabControl.TabBar.BorderColor = theme.ActiveTabColor;
// Force common padding into top region
var padding = theme.TabbarPadding;
tabControl.TabBar.Padding = padding.Clone(top: padding.Top * 2, bottom: 0);
//tabControl.TabBar.Padding = 0;
//tabControl.TabBar.ActionArea.Padding = padding.Clone(top: padding.Top * 2, bottom: 0);
Color selectedTabColor = ActiveTheme.Instance.TabLabelSelected;
tabControl.TabBar.Padding = theme.TabbarPadding.Clone(top: theme.TabbarPadding.Top * 2, bottom: 0);
// add in a what's new button
Button seeWhatsNewButton = theme.LinkButtonFactory.Generate("What's New...".Localize());

@ -1 +1 @@
Subproject commit 6f687c8959a60be2722fb20a19e43a6a2b2cafab
Subproject commit 7373165635f93ce5e178b8de201d8133f52765cc

View file

@ -43,17 +43,17 @@ namespace Markdig.Agg
public string PageID { get; internal set; }
}
public class MarkdownDocument
public class AggMarkdownDocument
{
private string _markDownText = null;
private MarkdownPipeline _pipeLine = null;
private static readonly MarkdownPipeline DefaultPipeline = new MarkdownPipelineBuilder().UseSupportedExtensions().Build();
public MarkdownDocument()
public AggMarkdownDocument()
{
}
public MarkdownDocument(Uri baseUri)
public AggMarkdownDocument(Uri baseUri)
{
this.BaseUri = baseUri;
}
@ -62,13 +62,13 @@ namespace Markdig.Agg
public List<MarkdownDocumentLink> Children { get; private set; } = new List<MarkdownDocumentLink>();
public static MarkdownDocument Load(Uri uri)
public static AggMarkdownDocument Load(Uri uri)
{
var webClient = new WebClient();
string rawText = webClient.DownloadString(uri);
return new MarkdownDocument(uri)
return new AggMarkdownDocument(uri)
{
Markdown = rawText,
};

View file

@ -42,7 +42,7 @@ namespace Markdig.Renderers
}
/// <summary>
/// Agg renderer for a Markdown <see cref="MarkdownDocument"/> object.
/// Agg renderer for a Markdown <see cref="AggMarkdownDocument"/> object.
/// </summary>
/// <seealso cref="RendererBase" />
public class AggRenderer : RendererBase

View file

@ -29,7 +29,6 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Net;
using Markdig.Renderers;
using MatterHackers.Agg.UI;
using MatterHackers.VectorMath;
@ -37,12 +36,10 @@ namespace Markdig.Agg
{
public class MarkdownWidget : ScrollableWidget
{
private static readonly MarkdownPipeline DefaultPipeline = new MarkdownPipelineBuilder().UseSupportedExtensions().Build();
private string _markDownText = null;
private FlowLayoutWidget contentPanel;
private MarkdownDocument markdownDocument;
private AggMarkdownDocument markdownDocument;
public MarkdownWidget(Uri contentUri, bool scrollContent = true)
: this(scrollContent)
@ -55,21 +52,13 @@ namespace Markdig.Agg
public MarkdownWidget(bool scrollContent = true)
: base(scrollContent)
{
markdownDocument = new MarkdownDocument();
markdownDocument = new AggMarkdownDocument();
this.HAnchor = HAnchor.Stretch;
this.ScrollArea.HAnchor = HAnchor.Stretch;
if (scrollContent)
{
this.VAnchor = VAnchor.Stretch;
this.ScrollArea.VAnchor = VAnchor.Fit;
}
else
{
this.VAnchor = VAnchor.Fit;
this.ScrollArea.VAnchor = VAnchor.Fit;
}
this.VAnchor = (scrollContent) ? VAnchor.Stretch : VAnchor.Fit;
this.ScrollArea.VAnchor = (scrollContent) ? VAnchor.Fit : VAnchor.Fit;
var lastScroll = this.TopLeftOffset;
this.ScrollPositionChanged += (s, e) =>