alt+j -> .lay, .iml

This commit is contained in:
Mirek Fidler 2022-08-13 11:41:01 +02:00
parent 3332e4ea9a
commit 795b842adf
5 changed files with 50 additions and 6 deletions

View file

@ -168,6 +168,8 @@ void Ide::ContextGoto0(int pos)
String found_path;
Point found_pos(INT_MAX, INT_MAX);
bool found_definition = false;
String found_name;
String found_nest;
for(const auto& f : ~CodeIndex())
for(const AnnotationItem& m : f.value.items) {
@ -178,10 +180,38 @@ void Ide::ContextGoto0(int pos)
found_path = f.key;
found_pos = m.pos;
found_definition = m.definition;
found_name = m.name;
found_nest = m.nest;
}
}
if(found_path.GetCount())
GotoPos(found_path, found_pos);
if(found_path.GetCount()) {
AddHistory();
EditFile(found_path);
LayDesigner *l = dynamic_cast<LayDesigner *>(~designer);
if(l) {
String cls = found_nest;
int q = cls.ReverseFind(':');
if(q >= 0)
cls = cls.Mid(q + 1);
if(cls.TrimStart("With")) {
l->FindLayout(cls, found_name);
return;
}
else
if(found_name.TrimStart("SetLayout_")) {
l->FindLayout(found_name, Null);
return;
}
DoEditAsText(found_path);
}
IdeIconDes *k = dynamic_cast<IdeIconDes *>(~designer);
if(k) {
k->FindId(found_name);
return;
}
GotoPos(found_pos);
AddHistory();
}
}
}

View file

@ -83,11 +83,13 @@ void LayDes::RestoreEditPos()
void LayDes::FindLayout(const String& name, const String& item_name)
{
DDUMP(item_name);
for(int i = 0; i < layout.GetCount(); i++)
if(layout[i].name == name) {
GoTo(i);
if(!IsNull(item_name)) {
int q = item.Find(item_name, 1);
DDUMP(q);
if(q >= 0)
SelectOne(q, 0);
}

View file

@ -156,6 +156,12 @@ ISUES:
- Alt-J on layout
- Alt-J relaxed rules if not found (in templates, different parameters)
- Remove IdeGotoFileAndId (after fixing laydes Alt+K)
- remove bool Ide::GotoDesignerFile(const String& path, const String& scope, const String& name, int line)
GREAT CODEBASE PURGE:
- ReferenceDlg

View file

@ -808,6 +808,7 @@ public:
void SelectMode();
void SerializeOutputMode(Stream& s);
void GotoPos(Point pos);
void GotoPos(String path, int line);
void GotoPos(String path, Point pos);

View file

@ -2,6 +2,14 @@
#define LLOG(x) // DLOG(x)
void Ide::GotoPos(Point pos)
{
editor.SetCursor(editor.GetPos64(pos.y, pos.x));
editor.TopCursor(4);
editor.SetFocus();
AddHistory();
}
void Ide::GotoPos(String path, int line)
{
GotoPos(path, Point(0, line));
@ -16,10 +24,7 @@ void Ide::GotoPos(String path, Point pos)
DoEditAsText(path);
EditFile(path);
}
editor.SetCursor(editor.GetPos64(pos.y, pos.x));
editor.TopCursor(4);
editor.SetFocus();
AddHistory();
GotoPos(pos);
}
String PosFn(const String& pkg, const String& n)