mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Ctrl+C on project files
This commit is contained in:
parent
b12ceeb625
commit
047ae9acc3
2 changed files with 74 additions and 2 deletions
|
@ -636,6 +636,38 @@ namespace IDE
|
|||
label.Append('\x02');
|
||||
}
|
||||
}
|
||||
|
||||
static String sHexUpperChars = "0123456789ABCDEF";
|
||||
public static void URLEncode(StringView inStr, String outStr)
|
||||
{
|
||||
for (var c in inStr)
|
||||
{
|
||||
if ((c.IsLetterOrDigit) || (c == '-') || (c == '_') || (c == '.') || (c == '~') || (c == '/'))
|
||||
{
|
||||
outStr.Append(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
outStr.Append('%');
|
||||
outStr.Append(sHexUpperChars[(.)c>>4]);
|
||||
outStr.Append(sHexUpperChars[(.)c&0xF]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void URLDecode(StringView inStr, String outStr)
|
||||
{
|
||||
for (int i < inStr.Length)
|
||||
{
|
||||
char8 c = inStr[i];
|
||||
if ((c == '%') && (i < inStr.Length-2))
|
||||
{
|
||||
c = (.)int32.Parse(inStr.Substring(i+1, 2), .HexNumber).GetValueOrDefault();
|
||||
i += 2;
|
||||
}
|
||||
outStr.Append(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2061,8 +2061,42 @@ namespace IDE.ui
|
|||
}
|
||||
|
||||
base.KeyDown(keyCode, isRepeat);
|
||||
if (keyCode == KeyCode.Delete)
|
||||
RemoveSelectedItems();
|
||||
|
||||
if (mWidgetWindow.GetKeyFlags() == .Ctrl)
|
||||
{
|
||||
switch (keyCode)
|
||||
{
|
||||
case (.)'C':
|
||||
|
||||
String clipData = scope .();
|
||||
mListView.GetRoot().WithSelectedItems(scope (selectedItem) =>
|
||||
{
|
||||
if (mListViewToProjectMap.GetValue(selectedItem) case .Ok(var sourceProjectItem))
|
||||
{
|
||||
if (var projectSource = sourceProjectItem as ProjectSource)
|
||||
{
|
||||
var path = scope String();
|
||||
sourceProjectItem.mProject.GetProjectFullPath(projectSource.mPath, path);
|
||||
path.Replace('\\', '/');
|
||||
|
||||
if (!clipData.IsEmpty)
|
||||
clipData.Append("\n");
|
||||
clipData.Append("file:///");
|
||||
IDEUtils.URLEncode(path, clipData);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!clipData.IsEmpty)
|
||||
gApp.SetClipboardData("code/file-list", clipData.Ptr, (.)clipData.Length, true);
|
||||
case (.)'V':
|
||||
default:
|
||||
}
|
||||
}
|
||||
else if (mWidgetWindow.GetKeyFlags() == .None)
|
||||
{
|
||||
if (keyCode == KeyCode.Delete)
|
||||
RemoveSelectedItems();
|
||||
}
|
||||
}
|
||||
|
||||
void ItemClicked(MouseEvent theEvent)
|
||||
|
@ -2909,6 +2943,12 @@ namespace IDE.ui
|
|||
{
|
||||
Regenerate(false);
|
||||
});
|
||||
|
||||
item = gApp.AddMenuItem(menu, "Duplicate", "Duplicate Item");
|
||||
item.mOnMenuItemSelected.Add(new (item) =>
|
||||
{
|
||||
|
||||
});
|
||||
}
|
||||
else if (let projectFolder = projectItem as ProjectFolder)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue