mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
ide: Fixed creating new codereferenced topic
This commit is contained in:
parent
3d1385dfba
commit
d4592db146
7 changed files with 37 additions and 37 deletions
|
|
@ -1,31 +1,31 @@
|
|||
LAYOUT(AddressBookLayout, 512, 456)
|
||||
ITEM(MenuBar, menu, LeftPosZ(0, 216).TopPosZ(0, 20))
|
||||
ITEM(TabCtrl, tab, LeftPosZ(8, 496).TopPosZ(32, 84))
|
||||
ITEM(ArrayCtrl, array, LeftPosZ(8, 496).TopPosZ(124, 324))
|
||||
ITEM(Upp::TabCtrl, tab, LeftPosZ(8, 496).TopPosZ(32, 84))
|
||||
ITEM(Upp::ArrayCtrl, array, LeftPosZ(8, 496).TopPosZ(124, 324))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(ModifyLayout, 480, 52)
|
||||
ITEM(Label, dv___0, SetLabel(t_("&Name")).LeftPosZ(8, 48).TopPosZ(8, 15))
|
||||
ITEM(EditField, name, LeftPosZ(8, 96).TopPosZ(28, 19))
|
||||
ITEM(Label, dv___2, SetLabel(t_("&Surname")).LeftPosZ(108, 48).TopPosZ(8, 15))
|
||||
ITEM(EditField, surname, LeftPosZ(108, 96).TopPosZ(28, 19))
|
||||
ITEM(Label, dv___4, SetLabel(t_("&Address")).LeftPosZ(208, 48).TopPosZ(8, 15))
|
||||
ITEM(EditField, address, LeftPosZ(208, 96).TopPosZ(28, 19))
|
||||
ITEM(Label, dv___6, SetLabel(t_("&Email")).LeftPosZ(308, 48).TopPosZ(8, 15))
|
||||
ITEM(EditField, email, LeftPosZ(308, 96).TopPosZ(28, 19))
|
||||
ITEM(Button, add, SetLabel(t_("Ad&d")).LeftPosZ(416, 56).TopPosZ(4, 20))
|
||||
ITEM(Button, change, SetLabel(t_("&Change")).LeftPosZ(416, 56).TopPosZ(28, 20))
|
||||
ITEM(Upp::Label, dv___0, SetLabel(t_("&Name")).LeftPosZ(8, 48).TopPosZ(8, 15))
|
||||
ITEM(Upp::EditField, name, LeftPosZ(8, 96).TopPosZ(28, 19))
|
||||
ITEM(Upp::Label, dv___2, SetLabel(t_("&Surname")).LeftPosZ(108, 48).TopPosZ(8, 15))
|
||||
ITEM(Upp::EditField, surname, LeftPosZ(108, 96).TopPosZ(28, 19))
|
||||
ITEM(Upp::Label, dv___4, SetLabel(t_("&Address")).LeftPosZ(208, 48).TopPosZ(8, 15))
|
||||
ITEM(Upp::EditField, address, LeftPosZ(208, 96).TopPosZ(28, 19))
|
||||
ITEM(Upp::Label, dv___6, SetLabel(t_("&Email")).LeftPosZ(308, 48).TopPosZ(8, 15))
|
||||
ITEM(Upp::EditField, email, LeftPosZ(308, 96).TopPosZ(28, 19))
|
||||
ITEM(Upp::Button, add, SetLabel(t_("Ad&d")).LeftPosZ(416, 56).TopPosZ(4, 20))
|
||||
ITEM(Upp::Button, change, SetLabel(t_("&Change")).LeftPosZ(416, 56).TopPosZ(28, 20))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(SearchLayout, 480, 56)
|
||||
ITEM(Option, oname, SetLabel(t_("&Name")).LeftPosZ(8, 56).TopPosZ(8, 18))
|
||||
ITEM(EditField, name, LeftPosZ(8, 96).TopPosZ(28, 19))
|
||||
ITEM(Option, osurname, SetLabel(t_("&Surname")).LeftPosZ(108, 64).TopPosZ(8, 18))
|
||||
ITEM(EditField, surname, LeftPosZ(108, 96).TopPosZ(28, 19))
|
||||
ITEM(Option, oaddress, SetLabel(t_("&Address")).LeftPosZ(208, 64).TopPosZ(8, 18))
|
||||
ITEM(EditField, address, LeftPosZ(208, 96).TopPosZ(28, 19))
|
||||
ITEM(Option, oemail, SetLabel(t_("&Email")).LeftPosZ(308, 52).TopPosZ(8, 18))
|
||||
ITEM(EditField, email, LeftPosZ(308, 96).TopPosZ(28, 19))
|
||||
ITEM(Button, search, SetLabel(t_("&Search")).LeftPosZ(416, 56).TopPosZ(28, 20))
|
||||
ITEM(Upp::Option, oname, SetLabel(t_("&Name")).LeftPosZ(8, 56).TopPosZ(8, 18))
|
||||
ITEM(Upp::EditField, name, LeftPosZ(8, 96).TopPosZ(28, 19))
|
||||
ITEM(Upp::Option, osurname, SetLabel(t_("&Surname")).LeftPosZ(108, 64).TopPosZ(8, 18))
|
||||
ITEM(Upp::EditField, surname, LeftPosZ(108, 96).TopPosZ(28, 19))
|
||||
ITEM(Upp::Option, oaddress, SetLabel(t_("&Address")).LeftPosZ(208, 64).TopPosZ(8, 18))
|
||||
ITEM(Upp::EditField, address, LeftPosZ(208, 96).TopPosZ(28, 19))
|
||||
ITEM(Upp::Option, oemail, SetLabel(t_("&Email")).LeftPosZ(308, 52).TopPosZ(8, 18))
|
||||
ITEM(Upp::EditField, email, LeftPosZ(308, 96).TopPosZ(28, 19))
|
||||
ITEM(Upp::Button, search, SetLabel(t_("&Search")).LeftPosZ(416, 56).TopPosZ(28, 20))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
|
|||
|
|
@ -141,12 +141,12 @@ void AssistEditor::OpenTopic(String topic, String create, bool before)
|
|||
theide->OpenTopic(topic, create, before);
|
||||
}
|
||||
|
||||
const AnnotationItem *AssistEditor::GetAnnotationPtr(const String& id)
|
||||
AnnotationItem AssistEditor::GetCodeAnnotation(const String& id)
|
||||
{
|
||||
for(const AnnotationItem& h : annotations)
|
||||
if(h.id == id)
|
||||
return &h;
|
||||
return nullptr;
|
||||
return h;
|
||||
return AnnotationItem();
|
||||
}
|
||||
|
||||
void SplitCodeRef(const String& s, String& scope, String& item)
|
||||
|
|
@ -177,7 +177,7 @@ void AssistEditor::NewTopic(String group, String coderef)
|
|||
return;
|
||||
String scope, item;
|
||||
SplitCodeRef(coderef, scope, item);
|
||||
if(!te->NewTopicEx(IsNull(scope) ? n : Join(Split(scope, ':'), "_"), GetAnnotationPtr(coderef)))
|
||||
if(!te->NewTopicEx(IsNull(scope) ? n : Join(Split(scope, ':'), "_"), GetCodeAnnotation(coderef)))
|
||||
theide->EditFile(ef);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ struct AssistEditor : CodeEditor, Navigator {
|
|||
|
||||
bool WaitCurrentFile();
|
||||
|
||||
const AnnotationItem *GetAnnotationPtr(const String& id);
|
||||
AnnotationItem GetCodeAnnotation(const String& id);
|
||||
|
||||
bool GetAnnotationRefs(Vector<String>& tl, String& coderef, int q = -1);
|
||||
bool GetAnnotationRef(String& t, String& coderef, int q = -1);
|
||||
|
|
|
|||
|
|
@ -207,10 +207,10 @@ public:
|
|||
typedef TopicEditor CLASSNAME;
|
||||
|
||||
void ShowEditor(bool b) { editor.Show(b); }
|
||||
bool NewTopicEx(const String& name, const AnnotationItem *create);
|
||||
bool NewTopicEx(const String& iname, const AnnotationItem& create);
|
||||
void Open(const String& grouppath);
|
||||
void OpenFile(const String& path);
|
||||
void GoTo(const String& _topic, const String& link, const AnnotationItem *create, bool before);
|
||||
void GoTo(const String& _topic, const String& link, const AnnotationItem& create, bool before);
|
||||
void GoToPart(int ii);
|
||||
void PersistentFindReplace(bool b) { editor.PersistentFindReplace(b); }
|
||||
|
||||
|
|
|
|||
|
|
@ -314,14 +314,14 @@ void TopicEditor::GoTo(const String& _topic, const String& link, const String& c
|
|||
|
||||
|
||||
|
||||
void TopicEditor::GoTo(const String& _topic, const String& link, const AnnotationItem *create, bool before)
|
||||
void TopicEditor::GoTo(const String& _topic, const String& link, const AnnotationItem& create, bool before)
|
||||
{
|
||||
if(topics_list.FindSetCursor(_topic) && !IsNull(link)) {
|
||||
editor.Select(editor.GetLength(), 0);
|
||||
for(String cr : AnnotationCandidates(link))
|
||||
if(editor.GotoLabel([&](const WString& id) { return cr == CleanupTppId(id.ToString()); }))
|
||||
break;
|
||||
if(create) {
|
||||
if(create.id.GetCount()) {
|
||||
if(!before)
|
||||
for(int pass = 0; pass < 2; pass++)
|
||||
for(;;) {
|
||||
|
|
@ -333,7 +333,7 @@ void TopicEditor::GoTo(const String& _topic, const String& link, const Annotatio
|
|||
if(editor.GetCursor() == c)
|
||||
break;
|
||||
}
|
||||
InsertNew(*create);
|
||||
InsertNew(create);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ void CreateTopic(const char *fn, int lang, const String& ss)
|
|||
SaveFile(fn, WriteTopic("", ParseQTF(ss + "[{_}%" + LNGAsText(lang) + " ")));
|
||||
}
|
||||
|
||||
bool TopicEditor::NewTopicEx(const String& iname, const AnnotationItem *create)
|
||||
bool TopicEditor::NewTopicEx(const String& iname, const AnnotationItem& create)
|
||||
{
|
||||
TopicDlg<WithNewTopicLayout<TopWindow> > d("New topic");
|
||||
d.lang <<= lastlang;
|
||||
|
|
@ -326,14 +326,14 @@ bool TopicEditor::NewTopicEx(const String& iname, const AnnotationItem *create)
|
|||
topics_list.FindSetCursor(GetFileTitle(fn));
|
||||
editor.SetFocus();
|
||||
serial++;
|
||||
if(create)
|
||||
InsertNew(*create);
|
||||
if(create.id.GetCount())
|
||||
InsertNew(create);
|
||||
return true;
|
||||
}
|
||||
|
||||
void TopicEditor::NewTopic()
|
||||
{
|
||||
NewTopicEx(Null, nullptr);
|
||||
NewTopicEx(Null, AnnotationItem());
|
||||
}
|
||||
|
||||
void TopicEditor::RemoveTopic()
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ void Ide::OpenTopic(const String& topic, const String& create_id, bool before)
|
|||
if(designer) {
|
||||
TopicEditor *te = dynamic_cast<TopicEditor *>(&designer->DesignerCtrl());
|
||||
if(te)
|
||||
te->GoTo(tl.topic, tl.label, editor.GetAnnotationPtr(create_id), before);
|
||||
te->GoTo(tl.topic, tl.label, editor.GetCodeAnnotation(create_id), before);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ void Ide::IdeOpenTopicFile(const String& file)
|
|||
if(designer) {
|
||||
TopicEditor *te = dynamic_cast<TopicEditor *>(&designer->DesignerCtrl());
|
||||
if(te)
|
||||
te->GoTo(GetFileTitle(file), "", nullptr, false);
|
||||
te->GoTo(GetFileTitle(file), "", AnnotationItem(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue