void TopWindow::SetupRect(Ctrl *owner) { Rect r = GetRect(); if(r.IsEmpty()) SetRect(GetDefaultWindowRect()); else if(r.left == 0 && r.top == 0 && center == 1) { Rect area = owner ? owner->GetWorkArea() : Ctrl::GetWorkArea(); SetRect(area.CenterRect(min(area.Size(), r.Size()))); } }
void HelpWin::OpenHelp(const String& topic) { if(!IsTreeEnabled()) ClearTree(); if(!IsOpen()) { Rect r = Ctrl::GetWorkArea(); Size s = r.Size(); r = r.CenterRect(s/2); SetRect(r); OpenMain(); } else SetForeground(); GoTo("topic://" + GetExeTitle() + "/" + topic); EnableTree(false); return; }
void RichEdit::Find() { CancelSelection(); FindReplaceAddHistory(); if(notfoundfw) Move(0, false); found = notfoundfw = false; int pos = FindPos(); if(pos >= 0) { anchor = pos; cursor = pos + findreplace.find.GetText().GetLength(); Finish(); found = true; Size sz = findreplace.GetSize(); Rect sw = GetScreenView(); Rect r = sw.CenterRect(sz); Rect cr = GetCaretRect(); if(cr.top < sz.cy + 2 * cr.Height()) { r.bottom = sw.bottom - 8; r.top = r.bottom - sz.cy; } else { r.top = sw.top + 24; r.bottom = r.top + sz.cy; } findreplace.SetRect(r); if(!findreplace.IsOpen()) { findreplace.Open(); } SetFocus(); } else { CancelSelection(); CloseFindReplace(); notfoundfw = true; } }