1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-27 20:18:01 +02:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Brian Fiete 2020-04-26 06:25:13 -07:00
commit 169e351a63
12 changed files with 172 additions and 73 deletions

View file

@ -4368,6 +4368,9 @@ namespace IDE
void ShowPanel(Panel panel, String label, bool setFocus = true)
{
if (!mInitialized)
return;
mLastActivePanel = panel;
RecordHistoryLocation();
ShowTab(panel, label, false, setFocus);
@ -6843,6 +6846,11 @@ namespace IDE
var window = (WidgetWindow)evt.mSender;
if (window.mFocusWidget is KeysEditWidget)
{
return;
}
IDECommand.ContextFlags useFlags = .None;
var activeWindow = GetActiveWindow();
bool isMainWindow = activeWindow.mRootWidget is MainFrame;
@ -10646,19 +10654,22 @@ namespace IDE
float fontSize = DarkTheme.sScale * mSettings.mEditorSettings.mFontSize;
float tinyFontSize = fontSize * 8.0f/9.0f;
bool failed = false;
String err = scope String();
void FontFail(StringView name)
{
String err = scope String()..AppendF("Failed to load font '{}'", name);
OutputErrorLine(err);
if (!failed)
Fail(err);
failed = true;
if (!err.IsEmpty)
err.Append("\n");
err.AppendF("Failed to load font '{}'", name);
}
bool isFirstFont = true;
for (let fontName in mSettings.mEditorSettings.mFonts)
for (var fontName in mSettings.mEditorSettings.mFonts)
FontLoop:
{
bool isOptional;
if (isOptional = fontName.StartsWith("?"))
fontName = scope:FontLoop String(fontName, "?".Length);
if (isFirstFont)
{
mTinyCodeFont.Dispose(true);
@ -10670,7 +10681,7 @@ namespace IDE
else
{
mTinyCodeFont.AddAlternate(fontName, tinyFontSize).IgnoreError();
if (mCodeFont.AddAlternate(fontName, fontSize) case .Err)
if ((mCodeFont.AddAlternate(fontName, fontSize) case .Err) && (!isOptional))
FontFail(fontName);
}
}
@ -10685,12 +10696,12 @@ namespace IDE
if (mCodeFont.GetWidth('😊') == 0)
{
mCodeFont.AddAlternate("Segoe UI", fontSize);
mCodeFont.AddAlternate("Segoe UI Symbol", fontSize);
mCodeFont.AddAlternate("Segoe UI Symbol", fontSize).IgnoreError();
mCodeFont.AddAlternate("Segoe UI Historic", fontSize).IgnoreError();
mCodeFont.AddAlternate("Segoe UI Emoji", fontSize).IgnoreError();
mTinyCodeFont.AddAlternate("Segoe UI", tinyFontSize);
mTinyCodeFont.AddAlternate("Segoe UI Symbol", tinyFontSize);
mTinyCodeFont.AddAlternate("Segoe UI Symbol", tinyFontSize).IgnoreError();
mTinyCodeFont.AddAlternate("Segoe UI Historic", tinyFontSize).IgnoreError();
mTinyCodeFont.AddAlternate("Segoe UI Emoji", tinyFontSize).IgnoreError();
@ -10703,6 +10714,12 @@ namespace IDE
mTinyCodeFont.AddAlternate(new String("fonts/seguihis.ttf"), tinyFontSize);*/
}
if (!err.IsEmpty)
{
OutputErrorLine(err);
Fail(err);
}
//mTinyCodeFont.Load(scope String(BFApp.sApp.mInstallDir, "fonts/SourceCodePro-Regular.ttf"), fontSize);
float squiggleScale = DarkTheme.sScale;

View file

@ -39,20 +39,36 @@ namespace IDE
{
sd.GetString("Bin32Path", mBin32Path);
sd.GetString("Bin64Path", mBin64Path);
ClearAndDeleteItems(mLib32Paths);
for (sd.Enumerate("Lib32Paths"))
void ReadPaths(String pathName, List<String> paths)
{
var str = new String();
sd.GetCurString(str);
mLib32Paths.Add(str);
}
ClearAndDeleteItems(mLib64Paths);
for (sd.Enumerate("Lib64Paths"))
{
var str = new String();
sd.GetCurString(str);
mLib64Paths.Add(str);
HashSet<String> newPaths = scope .();
List<String> prevPaths = scope .();
for (var str in paths)
prevPaths.Add(str);
paths.Clear();
for (sd.Enumerate(pathName))
{
var str = new String();
sd.GetCurString(str);
if (newPaths.Add(str))
paths.Add(str);
else
delete str;
}
for (var path in prevPaths)
{
if (!newPaths.Contains(path))
paths.Add(path);
else
delete path;
}
}
ReadPaths("Lib32Paths", mLib32Paths);
ReadPaths("Lib64Paths", mLib64Paths);
}
[CLink, StdCall]
@ -68,6 +84,9 @@ namespace IDE
#if BF_PLATFORM_WINDOWS
StringView vsInfo = .(VSSupport_Find());
ClearAndDeleteItems(mLib32Paths);
ClearAndDeleteItems(mLib64Paths);
for (var infoStr in vsInfo.Split('\n'))
{
if (infoStr.IsEmpty)
@ -354,9 +373,9 @@ namespace IDE
{
mFonts.Add(new String("fonts/SourceCodePro-Regular.ttf"));
mFonts.Add(new String("Segoe UI"));
mFonts.Add(new String("Segoe UI Symbol"));
mFonts.Add(new String("Segoe UI Historic"));
mFonts.Add(new String("Segoe UI Emoji"));
mFonts.Add(new String("?Segoe UI Symbol"));
mFonts.Add(new String("?Segoe UI Historic"));
mFonts.Add(new String("?Segoe UI Emoji"));
}
public void Apply()

View file

@ -397,15 +397,6 @@ namespace IDE.ui
int32 startIdx = (int32)(scrollPos / mAutoCompleteListWidget.mItemSpacing);
int32 endIdx = Math.Min((int32)((scrollPos + mAutoCompleteListWidget.mHeight)/ mAutoCompleteListWidget.mItemSpacing) + 1, (int32)mAutoCompleteListWidget.mEntryList.Count);
for (int32 itemIdx = startIdx; itemIdx < endIdx; itemIdx++)
{
var entry = (EntryWidget)mAutoCompleteListWidget.mEntryList[itemIdx];
float curY = entry.Y;
using (g.PushTranslate(4, curY))
entry.Draw(g);
}
if (mAutoCompleteListWidget.mSelectIdx != -1)
{
var selectedEntry = mAutoCompleteListWidget.mEntryList[mAutoCompleteListWidget.mSelectIdx];
@ -421,6 +412,15 @@ namespace IDE.ui
g.DrawButton(DarkTheme.sDarkTheme.GetImage(DarkTheme.ImageIdx.MenuSelect), GS!(4), selectedEntry.Y - GS!(2), width);
}
}
for (int32 itemIdx = startIdx; itemIdx < endIdx; itemIdx++)
{
var entry = (EntryWidget)mAutoCompleteListWidget.mEntryList[itemIdx];
float curY = entry.Y;
using (g.PushTranslate(4, curY))
entry.Draw(g);
}
}
public override void MouseDown(float x, float y, int32 btn, int32 btnCount)

View file

@ -1923,12 +1923,51 @@ namespace IDE.ui
Menu menu = new Menu();
bool handled = false;
void AddOpenContainingFolder()
{
var item = menu.AddItem("Open Containing Folder");
item.mOnMenuItemSelected.Add(new (item) =>
{
let projectItem = GetSelectedProjectItem();
String path = scope String();
if (projectItem == null)
{
path.Set(gApp.mWorkspace.mDir);
}
else if (let projectFolder = projectItem as ProjectFolder)
{
if (projectFolder.mParentFolder == null)
{
path.Set(projectFolder.mProject.mProjectDir);
}
else
projectFolder.GetFullImportPath(path);
}
else
projectItem.mParentFolder.GetFullImportPath(path);
if (!path.IsWhiteSpace)
{
ProcessStartInfo psi = scope ProcessStartInfo();
psi.SetFileName(path);
psi.UseShellExecute = true;
psi.SetVerb("Open");
var process = scope SpawnedProcess();
process.Start(psi).IgnoreError();
}
});
}
if (projectItem == null)
{
Menu anItem;
if (gApp.mWorkspace.IsInitialized)
{
AddOpenContainingFolder();
menu.AddItem();
anItem = menu.AddItem("Add New Project...");
anItem.mOnMenuItemSelected.Add(new (item) => { AddNewProject(); });
@ -1938,6 +1977,7 @@ namespace IDE.ui
anItem = menu.AddItem("Add From Installed...");
anItem.mOnMenuItemSelected.Add(new (item) => { mImportInstalledDeferred = true; });
menu.AddItem();
anItem = menu.AddItem("Properties...");
anItem.mOnMenuItemSelected.Add(new (item) => { ShowWorkspaceProperties(); });
@ -2027,6 +2067,8 @@ namespace IDE.ui
}
});
AddOpenContainingFolder();
menu.AddItem();
}
@ -2168,24 +2210,7 @@ namespace IDE.ui
});
item = menu.AddItem("Open Containing Folder");
item.mOnMenuItemSelected.Add(new (item) =>
{
let projectItem = GetSelectedProjectItem();
String path = scope String();
if (let projectFolder = projectItem as ProjectFolder)
projectFolder.GetFullImportPath(path);
else
projectItem.mParentFolder.GetFullImportPath(path);
ProcessStartInfo psi = scope ProcessStartInfo();
psi.SetFileName(path);
psi.UseShellExecute = true;
psi.SetVerb("Open");
var process = scope SpawnedProcess();
process.Start(psi).IgnoreError();
});
AddOpenContainingFolder();
menu.AddItem();
}

View file

@ -80,7 +80,7 @@ namespace IDE.ui
{
if ((evt.mKeyFlags == 0) &&
((evt.mKeyCode == .Delete) || (evt.mKeyCode == .Backspace)) &&
(Content.HasSelection()))
((Content.HasSelection()) || (!HasKeys)))
{
if ((evt.mKeyCode == .Delete) || (evt.mKeyCode == .Backspace))
{
@ -949,10 +949,11 @@ namespace IDE.ui
if (curVariantType == typeof(List<KeyState>))
{
if (!newValue.IsEmpty && !newValue.StartsWith("<"))
if (!newValue.StartsWith("<"))
{
let entries = new List<KeyState>();
KeyState.Parse(newValue, entries);
if (!newValue.IsEmpty)
KeyState.Parse(newValue, entries);
editingProp.mCurValue = Variant.Create(entries, true);
}
else
@ -1386,6 +1387,13 @@ namespace IDE.ui
var str = scope String();
KeyState.ToString(keyList, str);
if (str.IsEmpty)
{
let origEntry = propEntry.mOrigValue.Get<List<KeyState>>();
if (!origEntry.IsEmpty)
str.Append("< Removed >");
}
valueItem.Label = str;
}
else if (curVariantType.IsGenericType)

View file

@ -632,7 +632,7 @@ namespace IDE.ui
}
else if (elementFlags.HasFlag(SourceElementFlags.SpellingError))
{
underlineColor = 0xE0FF3000;
underlineColor = 0x80FFD200;
}
if (underlineColor != 0)