void TopicEditor::InsertItem() { if(IsNull(topicpath)) return; Save(); ref.Title("Insert"); if(ref.item.IsCursor()) ref.item.SetFocus(); ref.item.MultiSelect(); ref.classlist.Show(); int c = ref.Execute(); if(c == IDCANCEL) return; if(c == IDYES) { String qtf = "&{{1 "; bool next = false; for(int i = 0; i < ref.scope.GetCount(); i++) { String s = ref.scope.Get(i, 1); if(*s != '<') { if(next) qtf << ":: "; qtf << DeQtf(s); next = true; } } qtf << "}}&"; editor.PasteText(ParseQTF(qtf)); return; } String qtf; if(ref.item.IsSelection()) { for(int i = 0; i < ref.item.GetCount(); i++) if(ref.item.IsSelected(i)) { const CppItemInfo& m = ref.GetItemInfo(i); qtf << CreateQtf(ref.GetCodeRef(i), m.name, m, GetLang()); } } else if(ref.item.IsCursor()) { const CppItemInfo& m = ref.GetItemInfo(); qtf << CreateQtf(ref.GetCodeRef(), m.name, m, GetLang()); } else return; editor.BeginOp(); editor.PasteText(ParseQTF(styles + qtf)); editor.PrevPara(); editor.PrevPara(); }
nsLangTextAttr::nsLangTextAttr(nsHyperTextAccessible *aRootAcc, nsIContent *aRootContent, nsIContent *aContent) : nsTextAttr<nsAutoString>(aContent == nsnull), mRootContent(aRootContent) { aRootAcc->Language(mRootNativeValue); mIsRootDefined = !mRootNativeValue.IsEmpty(); if (aContent) mIsDefined = GetLang(aContent, mNativeValue); }
void TopicEditor::InsertNew(const String& coderef) { const CppItem *m = GetCodeRefItem(coderef); if(!m) return; editor.BeginOp(); editor.PasteText(ParseQTF(styles + CreateQtf(coderef, m->name, *m, GetLang()))); editor.PrevPara(); editor.PrevPara(); }
bool BecherBuilding::StartBuilding(int gold, int wood, int stone) { if (!GetLevel()->GetCash()->Add(-gold)) { GetLevel()->GetPanel()->GetInfo()->Add(GetLang()->GetString(104)); return false; } // build SetMode(EBM_Build); return true; }
int BecherBuilding::BuildPlace(float *pos) { int ret = StatusPlace(pos); #ifndef BECHER_EDITOR switch (ret) { case 0: // postavit GetCtrl()->SetOverColor(0xffffffff); break; case 1: // nevhodny teren SendGameMsgId(0, BMSG_Info, 0,(void*)GetLang()->GetString(101), 1); break; case 2: // blizko objektu SendGameMsgId(0, BMSG_Info, 0,(void*)GetLang()->GetString(102), 1); break; case 3: SendGameMsgId(0, BMSG_Info, 0,(void*)GetLang()->GetString(103), 1); break; }; #endif return ret; }
nsLangTextAttr::nsLangTextAttr(nsHyperTextAccessible *aRootAcc, nsIDOMNode *aRootNode, nsIDOMNode *aNode) : nsTextAttr<nsAutoString>(aNode == nsnull) { mRootContent = do_QueryInterface(aRootNode); nsresult rv = aRootAcc->GetLanguage(mRootNativeValue); mIsRootDefined = NS_SUCCEEDED(rv) && !mRootNativeValue.IsEmpty(); if (aNode) { nsCOMPtr<nsIContent> content(do_QueryInterface(aNode)); mIsDefined = GetLang(content, mNativeValue); } }
void CLangMngr::MergeDefinitions(const char *lang, ke::Vector<sKeyDef> &tmpVec) { CLang * language = GetLang(lang); if (language) language->MergeDefinitions(tmpVec); }
bool nsLangTextAttr::GetValueFor(nsIContent *aElm, nsAutoString *aValue) { return GetLang(aElm, *aValue); }
void TopicEditor::FixTopic() { String nest; if(!EditText(nest, "Fix topic", "Nest")) return; CppBase& base = CodeBase(); int q = base.Find(nest); if(q < 0) { Exclamation("Nest not found"); return; } Array<CppItem>& n = base[q]; Index<String> natural; Vector<String> link; for(int i = 0; i < n.GetCount(); i++) { const CppItem& m = n[i]; String nat; if(m.virt) nat << "virtual "; if(m.kind == CLASSFUNCTION || m.kind == CLASSFUNCTIONTEMPLATE) nat << "static "; nat << m.natural; natural.Add(nat); link.Add(MakeCodeRef(nest, n[i].qitem)); } RichText result; const RichText& txt = editor.Get(); bool started = false; int l, h; if(editor.GetSelection(l, h)) { l = txt.FindPart(l); h = txt.FindPart(h); } else { l = 0; h = txt.GetPartCount(); } for(int i = 0; i < txt.GetPartCount(); i++) if(txt.IsPara(i)) { RichPara p = txt.Get(i); if(i >= l && i < h) { WString h = p.GetText(); String nat; const wchar *s = h; while(*s) if(*s == 160 || *s == ' ') { nat.Cat(' '); while(*s == 160 || *s == ' ') s++; } else nat.Cat(*s++); int q = nat.GetCount() ? natural.Find(nat) : -1; if(q >= 0) { started = true; const CppItem& m = n[q]; RichText h = ParseQTF(styles + ("[s7; &]" + CreateQtf(link[q], n[q].name, m, GetLang(), true))); if(h.GetPartCount()) h.RemovePart(h.GetPartCount() - 1); result.CatPick(pick(h)); } else if(!started || p.GetLength()) result.Cat(p); } else result.Cat(p); } else { RichTable b; b <<= txt.GetTable(i); result.CatPick(pick(b)); } RichPara empty; result.Cat(empty); editor.BeginOp(); editor.SetSelection(0, txt.GetLength()); editor.PasteText(result); }
PRBool nsLangTextAttr::GetValueFor(nsIDOMElement *aElm, nsAutoString *aValue) { nsCOMPtr<nsIContent> content = do_QueryInterface(aElm); return GetLang(content, *aValue); }