Skip to content

Commit 7519cce

Browse files
Issues 1, 8
1 parent 5a6c3c1 commit 7519cce

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

ConTeXt-IDE.Shared/App.xaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,6 @@
474474
<local:FileTypeToVisibility x:Key="FileTypeToVisibility" />
475475
<local:VisibilityToCornerRadius x:Key="VisibilityToCornerRadius" />
476476

477-
<Style TargetType="AppBarButton">
478-
<Setter Property="CornerRadius" Value="{StaticResource CornerRadius}"/>
479-
<Setter Property="LabelPosition" Value="Default"/>
480-
</Style>
481-
482477
<ResourceDictionary.ThemeDictionaries>
483478

484479
<ResourceDictionary x:Key="Default">
@@ -496,13 +491,11 @@
496491
<Color x:Key="GripperColor">#555555</Color>
497492
<Color x:Key="ForegroundLightColor">#DDEEEEEE</Color>
498493
<Color x:Key="AcrylicColor">#444444</Color>
499-
<!--<Color x:Key="SystemAltHighColor">Red</Color>-->
500494
<SolidColorBrush x:Key="AccentColorBrushHigh" Color="{ThemeResource SystemAccentColorLight2}"></SolidColorBrush>
501495
<SolidColorBrush x:Key="AccentColorBrushLow" Color="{ThemeResource SystemAccentColorDark2}"></SolidColorBrush>
502496
<SolidColorBrush x:Key="SystemControlBackgroundAltHighHighBrush" Color="{Binding AccentColorLowLowLow, Source={StaticResource AccentColorSetting}}"></SolidColorBrush>
503497
<SolidColorBrush x:Key="SystemControlBackgroundAltHighBrush" Color="{Binding AccentColorLowLow, Source={StaticResource AccentColorSetting}}"></SolidColorBrush>
504498
<StaticResource x:Key="SystemBaseHighColor" ResourceKey="ForegroundColor"></StaticResource>
505-
<!--<StaticResource x:Key="SystemAccentColor" ResourceKey="SystemAccentColorDark2"></StaticResource>-->
506499
</ResourceDictionary>
507500

508501
<ResourceDictionary x:Key="HighContrast">
@@ -529,8 +522,6 @@
529522
<SolidColorBrush x:Key="AccentColorBrushHigh" Color="{ThemeResource SystemAccentColorDark2}"></SolidColorBrush>
530523
<SolidColorBrush x:Key="AccentColorBrushLow" Color="{ThemeResource SystemAccentColorLight2}"></SolidColorBrush>
531524
<StaticResource x:Key="SystemBaseHighColor" ResourceKey="ForegroundColor"></StaticResource>
532-
533-
<!--<StaticResource x:Key="SystemAccentColor" ResourceKey="SystemAccentColorLight2"></StaticResource>-->
534525
</ResourceDictionary>
535526
</ResourceDictionary.ThemeDictionaries>
536527
</ResourceDictionary>

ConTeXt-IDE.Shared/Views/MainPage.xaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,7 @@
281281
</ToggleButton>
282282

283283
<TextBlock Style="{StaticResource RibbonTextBlock}" Text="Font Size: "></TextBlock>
284-
<NumberBox Value="{Binding Default.FontSize, Mode=TwoWay}" Minimum="6" Maximum="100" SmallChange="1" LargeChange="4" SpinButtonPlacementMode="Inline" CornerRadius="0,2,2,0">
285-
286-
</NumberBox>
284+
<NumberBox Value="{Binding Default.FontSize, Mode=TwoWay}" Minimum="6" Maximum="100" SmallChange="1" LargeChange="4" Height="100" SpinButtonPlacementMode="Inline" CornerRadius="0,2,2,0"> </NumberBox>
287285

288286
<Border Style="{StaticResource Separator}" ></Border>
289287

ConTeXt-IDE.Shared/Views/MainPage.xaml.cs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using System.Net.NetworkInformation;
2424
using System.Runtime.CompilerServices;
2525
using System.Runtime.InteropServices.WindowsRuntime;
26+
using System.Text.RegularExpressions;
2627
using System.Threading.Tasks;
2728
using Windows.ApplicationModel;
2829
using Windows.ApplicationModel.Activation;
@@ -559,8 +560,8 @@ private async void FileDrop(DragEventArgs e)
559560

560561
private async void FileItemTapped(object sender, TappedRoutedEventArgs e)
561562
{
562-
var treeviewitem = (sender as MyTreeViewItem);
563-
var fileitem = treeviewitem.DataContext as FileItem;
563+
MyTreeViewItem treeviewitem = sender as MyTreeViewItem;
564+
FileItem fileitem = treeviewitem.DataContext as FileItem;
564565

565566
if (fileitem.Type == FileItem.ExplorerItemType.File)
566567
{
@@ -577,6 +578,7 @@ private async void FileItemTapped(object sender, TappedRoutedEventArgs e)
577578
tip.HeroContent = content;
578579
tip.HeroContentPlacement = TeachingTipHeroContentPlacementMode.Bottom;
579580
RootGrid.Children.Add(tip);
581+
580582
tip.IsOpen = true;
581583
}
582584
else if (type == ".pdf")
@@ -691,8 +693,15 @@ public async void CompileTex(bool compileRoot = false, FileItem fileToCompile =
691693
App.VM.IsError = true;
692694
StorageFile errorfile = error as StorageFile;
693695
string text = await FileIO.ReadTextAsync(errorfile);
694-
string newtext = text.Replace(" ", "").Replace("return", "").Replace("[\"", "\"").Replace("\"]", "\"").Replace(@"\n", "").Replace("=", ":");
696+
697+
// BAD code, quick hack to convert the lua table to a json format. Depending on special characters in the error message, the JsonConvert.DeserializeObject function can through errors.
698+
string newtext = text.Replace(" ", "").Replace("return", "").Replace("[\"", "\"").Replace("\"]", "\"").Replace("=", ":");
699+
string pattern = @"([^\\])(\\n)"; // Matches every \n except \\n
700+
string replacement = "$1"; // Match gets replaced with first capturing group, e.g. ]\n --> ]
701+
newtext = Regex.Replace(newtext, pattern, replacement);
702+
695703
var errormessage = JsonConvert.DeserializeObject<ConTeXtErrorMessage>(newtext);
704+
696705
App.VM.Log("Compiler error: " + errormessage.lasttexerror);
697706
App.VM.ConTeXtErrorMessage = errormessage;
698707
}
@@ -884,13 +893,22 @@ private async void Tabs_TabCloseRequested(TabView sender, TabViewTabCloseRequest
884893
VM.CurrentProject.LastOpenedFiles = VM.FileItems.Select(x => x.FileName).ToList();
885894
}
886895

887-
private void Pin_Click(object sender, RoutedEventArgs e)
896+
private async void Pin_Click(object sender, RoutedEventArgs e)
888897
{
889898
var fi = (FileItem)(sender as FrameworkElement).DataContext;
899+
900+
if (!fi.IsPinned) {
901+
bool reselect = fi == VM.CurrentFileItem;
902+
VM.FileItems.Remove(fi);
903+
VM.FileItems.Insert(0, fi);
904+
if (reselect)
905+
{
906+
await Task.Delay(500);
907+
VM.CurrentFileItem = fi;
908+
}
909+
}
910+
890911
fi.IsPinned = !fi.IsPinned;
891-
int currind = VM.FileItems.IndexOf(fi);
892-
if (currind > 0)
893-
VM.FileItems.Move(currind, 0);
894912
}
895913

896914
#endregion

0 commit comments

Comments
 (0)