mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
ide: Improved Assist in layout files in text mode
This commit is contained in:
parent
20e5b5fafd
commit
838b25429b
5 changed files with 38 additions and 11 deletions
|
|
@ -92,6 +92,10 @@ void Ide::ContextGoto0(int pos)
|
||||||
String l = editor.GetUtf8Line(li);
|
String l = editor.GetUtf8Line(li);
|
||||||
if(OpenLink(l, lp))
|
if(OpenLink(l, lp))
|
||||||
return;
|
return;
|
||||||
|
if(editfile.EndsWith(".lay")) {
|
||||||
|
EditUsingDesigner();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(IsPif(l) || IsPelse(l)) {
|
if(IsPif(l) || IsPelse(l)) {
|
||||||
int lvl = 0;
|
int lvl = 0;
|
||||||
while(li + 1 < editor.GetLineCount()) {
|
while(li + 1 < editor.GetLineCount()) {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ void Ide::SwapS()
|
||||||
return;
|
return;
|
||||||
if(!editor.WaitCurrentFile())
|
if(!editor.WaitCurrentFile())
|
||||||
return;
|
return;
|
||||||
|
if(editfile.EndsWith(".lay")) {
|
||||||
|
EditUsingDesigner();
|
||||||
|
return;
|
||||||
|
}
|
||||||
AnnotationItem cm = editor.FindCurrentAnnotation();
|
AnnotationItem cm = editor.FindCurrentAnnotation();
|
||||||
PutAssist("Swap: " + cm.id);
|
PutAssist("Swap: " + cm.id);
|
||||||
Cycle(cm, cm.pos.y, false);
|
Cycle(cm, cm.pos.y, false);
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,18 @@ void Ide::Usage()
|
||||||
|
|
||||||
void Ide::IdUsage()
|
void Ide::IdUsage()
|
||||||
{
|
{
|
||||||
|
if(designer)
|
||||||
|
return;
|
||||||
|
if(editfile.EndsWith(".lay")) {
|
||||||
|
String layout, item;
|
||||||
|
if(GetLayoutItem(layout, item)) {
|
||||||
|
if(item.GetCount())
|
||||||
|
FindDesignerItemReferences("With" + layout + "::" + item, item);
|
||||||
|
else
|
||||||
|
FindDesignerItemReferences("With" + layout, layout);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
String name;
|
String name;
|
||||||
Point ref_pos;
|
Point ref_pos;
|
||||||
String ref_id;
|
String ref_id;
|
||||||
|
|
|
||||||
|
|
@ -796,6 +796,8 @@ public:
|
||||||
void GotoPos(String path, int line);
|
void GotoPos(String path, int line);
|
||||||
void GotoPos(String path, Point pos);
|
void GotoPos(String path, Point pos);
|
||||||
|
|
||||||
|
bool GetLayoutItem(String& layout, String& item);
|
||||||
|
|
||||||
void LoadAbbr();
|
void LoadAbbr();
|
||||||
void SaveAbbr();
|
void SaveAbbr();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -757,16 +757,8 @@ void Ide::EditAsText()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ide::EditUsingDesigner()
|
bool Ide::GetLayoutItem(String& layout, String& item)
|
||||||
{
|
{
|
||||||
String path = editfile;
|
|
||||||
if(editastext.Find(editfile) < 0 && editashex.Find(editfile) < 0)
|
|
||||||
return;
|
|
||||||
editashex.RemoveKey(editfile);
|
|
||||||
editastext.RemoveKey(editfile);
|
|
||||||
byte cs = editor.GetCharset();
|
|
||||||
int sc = editor.GetSpellcheckComments();
|
|
||||||
String layout, item;
|
|
||||||
if(ToLower(GetFileExt(editfile)) == ".lay") {
|
if(ToLower(GetFileExt(editfile)) == ".lay") {
|
||||||
int i = editor.GetLine(editor.GetCursor());
|
int i = editor.GetLine(editor.GetCursor());
|
||||||
item = GetLayItemId(editor.GetUtf8Line(i));
|
item = GetLayItemId(editor.GetUtf8Line(i));
|
||||||
|
|
@ -777,13 +769,26 @@ void Ide::EditUsingDesigner()
|
||||||
if(p.Id("LAYOUT")) {
|
if(p.Id("LAYOUT")) {
|
||||||
p.Char('(');
|
p.Char('(');
|
||||||
layout = p.ReadId();
|
layout = p.ReadId();
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(CParser::Error) {}
|
catch(CParser::Error) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ide::EditUsingDesigner()
|
||||||
|
{
|
||||||
|
String path = editfile;
|
||||||
|
if(editastext.Find(editfile) < 0 && editashex.Find(editfile) < 0)
|
||||||
|
return;
|
||||||
|
editashex.RemoveKey(editfile);
|
||||||
|
editastext.RemoveKey(editfile);
|
||||||
|
byte cs = editor.GetCharset();
|
||||||
|
int sc = editor.GetSpellcheckComments();
|
||||||
|
String layout, item;
|
||||||
|
GetLayoutItem(layout, item);
|
||||||
FlushFile();
|
FlushFile();
|
||||||
EditFile0(path, cs, sc);
|
EditFile0(path, cs, sc);
|
||||||
if(layout.GetCount()) {
|
if(layout.GetCount()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue