ide: Insert file extended to 2MB

This commit is contained in:
Mirek Fidler 2025-11-07 14:54:21 +01:00
parent d938ee2d9a
commit 2a492d1730
2 changed files with 7 additions and 7 deletions

View file

@ -180,8 +180,8 @@ void Ide::InsertAs(const String& data)
{
WithInsertAsLayout<TopWindow> dlg;
CtrlLayoutOKCancel(dlg, "Insert data");
if(data.GetCount() > 20*1024)
Exclamation("Data size is too big!&(Limit is 20KB.)");
if(data.GetCount() > 2*1024*1024)
Exclamation("Data size is too big!&(Limit is 2MB.)");
String f[6];
f[0] = data;
f[1] = Encode64(data);
@ -200,7 +200,7 @@ void Ide::InsertAs(const String& data)
String d = f[i];
WriteClipboardText(AsString(d.GetCount()));
if(i == 0 || i == 1)
editor.Paste(AsCString(d).ToWString());
editor.Paste(AsCString(d, 256).ToWString());
else {
for(int i = 0; i < d.GetCount(); i += 256) {
int e = min(i + 256, d.GetCount());
@ -229,8 +229,8 @@ void Ide::InsertFileContent()
String path = SelectInsertFile();
path.Replace("\\", "/");
if(path.GetCount()) {
if(GetFileLength(path) >= 20*1024) {
Exclamation("File is too big!&(Limit is 20KB.)");
if(GetFileLength(path) >= 2*1024*1024) {
Exclamation("File is too big!&(Limit is 2MB.)");
return;
}
InsertAs(LoadFile(path));

View file

@ -912,10 +912,10 @@ LAYOUT(SlideShowSettingsLayout, 184, 188)
END_LAYOUT
LAYOUT(InsertAsLayout, 276, 168)
ITEM(Upp::Switch, format, SetLabel(t_("C string\nBase64 encoded text\nByte values\nLZ4 compressed byte values\nZ compressed byte values\n7z compressed byte values")).LeftPosZ(8, 260).TopPosZ(8, 96))
ITEM(Upp::Switch, format, SetLabel(t_("C string\nBase64 encoded text\nByte values\nLZ4 compressed byte values\nZ compressed byte values\n7z compressed byte values")).LeftPosZ(8, 260).TopPosZ(8, 108))
ITEM(Upp::Button, ok, SetLabel(t_("OK")).RightPosZ(76, 64).BottomPosZ(8, 24))
ITEM(Upp::Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(8, 24))
ITEM(Upp::Label, dv___3, SetLabel(t_("Data length will be put into the clipboard")).LeftPosZ(8, 260).TopPosZ(108, 19))
ITEM(Upp::Label, dv___3, SetLabel(t_("Data length will be put into the clipboard")).LeftPosZ(8, 260).TopPosZ(112, 19))
END_LAYOUT
LAYOUT(UppHubLayout, 1000, 656)