diff --git a/uppsrc/Draw/Copying b/olddraw/CtrlCore/Copying similarity index 100% rename from uppsrc/Draw/Copying rename to olddraw/CtrlCore/Copying diff --git a/olddraw/CtrlCore/Ctrl.cpp b/olddraw/CtrlCore/Ctrl.cpp new file mode 100644 index 000000000..9cf21269a --- /dev/null +++ b/olddraw/CtrlCore/Ctrl.cpp @@ -0,0 +1,953 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) // DLOG(x) + +#define IMAGECLASS CtrlCoreImg +#define IMAGEFILE +#include + +static bool StdDisplayErrorFn(const Value& e) +{ + GuiLock __; + if(!e.IsError()) + return false; + String s = GetErrorText(e); +#ifdef PLATFORM_WIN32 +#ifdef PLATFORM_WINCE + MessageBox(NULL, ToSystemCharset(s), ToSystemCharset(GetExeTitle()), MB_OK | MB_ICONQUESTION); +#else + MessageBox(NULL, s, GetExeTitle(), MB_OK | MB_ICONQUESTION); +#endif +#else + fputs(String().Cat() << GetExeTitle() << ": " << s << '\n', stderr); +#endif + return true; +} + +bool (*&DisplayErrorFn())(const Value& v) +{ + static bool (*errfn)(const Value& v) = &StdDisplayErrorFn; + return errfn; +} + +Ctrl *Ctrl::LoopCtrl; +int Ctrl::LoopLevel; + +bool Ctrl::MemoryCheck; + +void Ctrl::SetData(const Value&) {} +Value Ctrl::GetData() const { return Value(); } + +void Ctrl::Paint(Draw& draw) {} +int Ctrl::OverPaint() const { return 0; } + +void Ctrl::Activate() {} +void Ctrl::Deactivate() {} +void Ctrl::CancelMode() {} +void Ctrl::MouseEnter(Point p, dword keyflags) {} +void Ctrl::LeftDown(Point p, dword keyflags) {} +void Ctrl::RightDown(Point p, dword keyflags) {} +void Ctrl::LeftRepeat(Point p, dword keyflags) {} +void Ctrl::RightRepeat(Point p, dword keyflags) {} +void Ctrl::MouseMove(Point p, dword keyflags) {} +void Ctrl::LeftUp(Point, dword keyflags) {} +void Ctrl::RightUp(Point p, dword keyflags) {} +void Ctrl::MouseLeave() {} +void Ctrl::MouseWheel(Point p, int zd, dword kf) {} +void Ctrl::LeftDrag(Point p, dword keyflags) {} +void Ctrl::LeftHold(Point p, dword keyflags) {} +void Ctrl::RightDrag(Point p, dword keyflags) {} +void Ctrl::RightHold(Point p, dword keyflags) {} +void Ctrl::MiddleDown(Point p, dword keyflags) {} +void Ctrl::MiddleDouble(Point p, dword keyflags) {} +void Ctrl::MiddleTriple(Point p, dword keyflags) {} +void Ctrl::MiddleRepeat(Point p, dword keyflags) {} +void Ctrl::MiddleDrag(Point p, dword keyflags) {} +void Ctrl::MiddleHold(Point p, dword keyflags) {} +void Ctrl::MiddleUp(Point p, dword keyflags) {} + +void Ctrl::Layout() {} + +void Ctrl::PostInput() +{ + GuiLock __; + if(parent) parent->PostInput(); +} + +void Ctrl::LeftDouble(Point p, dword keyflags) +{ + LeftDown(p, keyflags); +} + +void Ctrl::LeftTriple(Point p, dword keyflags) +{ + LeftDown(p, keyflags); +} + +void Ctrl::RightDouble(Point p, dword keyflags) +{ + RightDown(p, keyflags); +} + +void Ctrl::RightTriple(Point p, dword keyflags) +{ + RightDown(p, keyflags); +} + +void Ctrl::ChildGotFocus() +{ + GuiLock __; + if(parent) parent->ChildGotFocus(); +} + +void Ctrl::ChildLostFocus() +{ + GuiLock __; + if(parent) parent->ChildLostFocus(); +} + +void Ctrl::ChildAdded(Ctrl *q) +{ + GuiLock __; + if(parent) parent->ChildAdded(q); +} + +void Ctrl::ChildRemoved(Ctrl *q) +{ + GuiLock __; + if(parent) parent->ChildRemoved(q); +} + +void Ctrl::ParentChange() {} + +bool Ctrl::Key(dword key, int count) +{ + return false; +} + +void Ctrl::GotFocus() {} +void Ctrl::LostFocus() {} + +dword Ctrl::AccessKeyBit(int accesskey) +{ + accesskey &= 255; + if(accesskey >= 'A' && accesskey <= 'Z') + return (uint64)2 << (accesskey - 'A'); + return !!accesskey; +} + +dword Ctrl::GetAccessKeysDeep() const +{ + GuiLock __; + dword used = GetAccessKeys(); + for(Ctrl *ctrl = GetFirstChild(); ctrl; ctrl = ctrl->GetNext()) + used |= ctrl->GetAccessKeysDeep(); + return used; +} + +void Ctrl::AssignAccessKeys(dword used) +{ + GuiLock __; + for(Ctrl *ctrl = GetFirstChild(); ctrl; ctrl = ctrl->GetNext()) { + ctrl->AssignAccessKeys(used); + used |= ctrl->GetAccessKeys(); + } +} + +dword Ctrl::GetAccessKeys() const +{ + return 0; +} + +void Ctrl::DistributeAccessKeys() +{ + AssignAccessKeys(GetAccessKeysDeep()); +} + +bool Ctrl::VisibleAccessKeys() +{ + GuiLock __; + if(GUI_AltAccessKeys()) + return GetAlt() && GetTopCtrl() == GetActiveCtrl(); + return true; +} + +void Ctrl::State(int) {} + +void Ctrl::StateDeep(int reason) +{ + GuiLock __; + if(destroying) + return; + State(reason); + for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) + q->StateDeep(reason); +} + +void Ctrl::StateH(int reason) +{ + GuiLock __; + for(int i = 0; i < statehook().GetCount(); i++) + if((*statehook()[i])(this, reason)) + return; + if(reason == POSITION) + State(reason); + else + StateDeep(reason); +} + +bool Ctrl::Accept() +{ + GuiLock __; + if(!IsEnabled() || !IsShown()) + return true; + if(DisplayError(GetData())) { + SetWantFocus(); + return false; + } + for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) + if(!q->Accept()) return false; + return true; +} + +void Ctrl::Reject() +{ + GuiLock __; + for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) + q->Reject(); +} + +void Ctrl::Serialize(Stream& s) +{ + GuiLock __; + Value x; + if(s.IsStoring()) + x = GetData(); + s % x; + if(s.IsLoading()) + SetData(x); + for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) + q->Serialize(s); +} + +void Ctrl::Updated() {} + +bool Ctrl::IsForeground() const +{ + GuiLock __; + return GetTopCtrl()->IsWndForeground(); +} + +void Ctrl::SetForeground() +{ + GuiLock __; + GetTopCtrl()->SetWndForeground(); +} + +bool Ctrl::IsOpen() const +{ + GuiLock __; + const Ctrl *q = GetTopCtrl(); + return q->IsWndOpen() && q->isopen; +} + +void Ctrl::Show(bool ashow) { + GuiLock __; + if(visible != ashow) { + visible = true; + fullrefresh = false; + RefreshFrame(); + visible = ashow; + fullrefresh = false; + RefreshFrame(); + if(parent) + StateH(SHOW); + if(top) + WndShow(visible); + if(InFrame() && parent) + RefreshParentLayout(); + } +} + +bool Ctrl::IsVisible() const { + GuiLock __; + const Ctrl *q = this; + for(;;) { + if(!q->visible) return false; + if(!q->parent) break; + q = q->parent; + } + return q->visible; +} + +void Ctrl::Enable(bool aenable) { + GuiLock __; + if(enabled != aenable) { + enabled = aenable; +// 01/12/2007 - mdelfede +// added support for windowed controls +// if(!parent) WndEnable(enabled); + if(top) WndEnable(enabled); +// 01/12/2007 - END + if(!enabled && parent && HasFocusDeep()) + IterateFocusForward(this, GetTopCtrl()); + RefreshFrame(); + StateH(ENABLE); + SyncCaret(); + } +} + +bool Ctrl::IsShowEnabled() const { + GuiLock __; + return IsEnabled() && (!parent || parent->IsShowEnabled()); +} + +Ctrl& Ctrl::SetEditable(bool aeditable) { + GuiLock __; + if(editable != aeditable) { + editable = aeditable; + RefreshFrame(); + StateH(EDITABLE); + } + return *this; +} + +void Ctrl::SetModify() +{ + modify = true; +} + +void Ctrl::ClearModify() +{ + GuiLock __; + modify = false; + for(Ctrl *q = firstchild; q; q = q->next) + q->ClearModify(); +} + +bool Ctrl::IsModified() const +{ + GuiLock __; + if(IsModifySet()) return true; + for(Ctrl *q = firstchild; q; q = q->next) + if(q->IsModified()) return true; + return false; +} + +void Ctrl::SetCaret(int x, int y, int cx, int cy) +{ + GuiLock __; +#ifdef PLATFORM_X11 + if(this == caretCtrl) + RefreshCaret(); +#endif + caretx = x; + carety = y; + caretcx = cx; + caretcy = cy; +#ifdef PLATFORM_X11 + WndCaretTime = GetTickCount(); + if(this == caretCtrl) + RefreshCaret(); +#endif +} + +void Ctrl::SetCaret(const Rect& r) +{ + SetCaret(r.left, r.top, r.GetWidth(), r.GetHeight()); +} + +Rect Ctrl::GetCaret() const +{ + return RectC(caretx, carety, caretcx, caretcy); +} + +void Ctrl::KillCaret() +{ + SetCaret(0, 0, 0, 0); +} + +void Ctrl::SetInfoPart(int i, const char *txt) +{ + Vector f = Split(info, '\x7f', false); + f.At(i) = txt; + info = Join(f, "\x7f"); +} + +Ctrl& Ctrl::Tip(const char *txt) +{ + SetInfoPart(0, txt); + return *this; +} + +Ctrl& Ctrl::HelpLine(const char *txt) +{ + SetInfoPart(1, txt); + return *this; +} + +Ctrl& Ctrl::Description(const char *txt) +{ + SetInfoPart(2, txt); + return *this; +} + +Ctrl& Ctrl::HelpTopic(const char *txt) +{ + SetInfoPart(3, txt); + return *this; +} + +Ctrl& Ctrl::LayoutId(const char *txt) +{ + SetInfoPart(4, txt); + return *this; +} + +String Ctrl::GetInfoPart(int i) const +{ + Vector f = Split(info, '\x7f', false); + return i < f.GetCount() ? f[i] : String(); +} + +String Ctrl::GetTip() const +{ + return GetInfoPart(0);; +} + +String Ctrl::GetHelpLine() const +{ + return GetInfoPart(1); +} + +String Ctrl::GetDescription() const +{ + return GetInfoPart(2); +} + +String Ctrl::GetHelpTopic() const +{ + return GetInfoPart(3); +} + +String Ctrl::GetLayoutId() const +{ + return GetInfoPart(4); +} + +bool Ctrl::SetWantFocus() { + GuiLock __; + if(IsWantFocus() && IsEnabled() && IsVisible() && IsOpen()) + return SetFocus(); + return false; +} + +void Ctrl::UpdateRefresh() { + Update(); + Refresh(); +} + +void Ctrl::Update() { + SetModify(); + Updated(); +} + +void Ctrl::Action() { + WhenAction(); +} + +void Ctrl::UpdateAction() { + Update(); + Action(); +} + +void Ctrl::UpdateActionRefresh() { + Update(); + Action(); + Refresh(); +}; + +void Ctrl::CancelModeDeep() { + GuiLock __; + CancelMode(); + for(Ctrl *q = firstchild; q; q = q->next) + q->CancelModeDeep(); +} + +String Ctrl::Name() const { + GuiLock __; +#ifdef CPU_64 + String s = String(typeid(*this).name()) + " : 0x" + FormatIntHex(this); +#else + String s = String(typeid(*this).name()) + " : " + Format("0x%x", (int) this); +#endif + if(IsChild()) + s << "(parent " << String(typeid(*parent).name()) << ")"; + else +#ifdef PLATFORM_WIN32 + s << Format("(hwnd 0x%x)", (int)(intptr_t) GetHWND()); +#endif +#ifdef PLATFORM_X11 + s << Format("(window 0x%x)", (int)(intptr_t) GetWindow()); +#endif + return s; +} + +String Ctrl::GetDesc() const +{ + return ""; +} + + +String Name(const Ctrl *ctrl) +{ + return ctrl ? ctrl->Name() : "NULL"; +} + +String Desc(const Ctrl *ctrl) +{ + if(!ctrl) + return "NULL"; + String s; + s << typeid(*ctrl).name(); + String q = ctrl->GetDesc(); + if(IsNull(q)) { + if(ctrl->GetPrev()) { + q = ctrl->GetPrev()->GetDesc(); + if(!IsNull(q)) + s << " <<\"" << q << "\">>"; + } + } + else + s << " \"" << q << '\"'; + const Ctrl *top = ctrl->GetTopWindow(); + if(top && top != ctrl) { + String q = top->GetDesc(); + if(IsNull(q)) + s << " (" << typeid(*top).name() << ")"; + else + s << " (\"" << q << "\")"; + } + return s; +} + +#ifdef _DEBUG + +#define sFLAG(x) (x ? #x" " : "") +#define LG(x) s << x << '\n' + +void Ctrl::Dump(Stream& s) const { + GuiLock __; + LG(Name()); + LG(sFLAG(backpaint) << sFLAG(inframe) << sFLAG(visible) << sFLAG(enabled) << + sFLAG(wantfocus) << sFLAG(editable) << sFLAG(IsModified()) << sFLAG(transparent)); + LG("Rect: " << GetRect()); + LG("View: " << GetView()); + for(int i = 0; i < frame.GetCount(); i++) + LG("Frame " << i << ": " << typeid(*frame[i].frame).name() << " - " << frame[i].view); + LG("Data: " << GetData().ToString()); + if(firstchild) { + LG("Children"); + s << LOG_BEGIN; + for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) { + q->Dump(s); + LG("------"); + } + s << LOG_END; + } + else + LG("No child"); +} + +void Ctrl::Dump() const { + Dump(VppLog()); +} + +void Dump(const Ctrl *ctrl) +{ + if(ctrl) + ctrl->Dump(); + else + LOG("NULL"); +} + +#endif + +bool Ctrl::IsOcxChild() +{ + return false; +} + +Ctrl::Ctrl() { + GuiLock __; + LLOG("Ctrl::Ctrl"); + destroying = false; + parent = prev = next = firstchild = lastchild = NULL; + top = NULL; + exitcode = 0; + frame.Add().frame = &NullFrame(); + enabled = visible = wantfocus = initfocus = true; + editable = true; +// GLX = false; +#ifdef PLATFORM_WIN32 + activex = false; + isdhctrl = false; +#endif + backpaint = IsCompositedGui() ? FULLBACKPAINT : TRANSPARENTBACKPAINT; + inframe = false; + ignoremouse = transparent = false; + caretcx = caretcy = caretx = carety = 0; + SetRect(Rect(0, 0, 0, 0)); + inloop = popup = isopen = false; + modify = false; + unicode = false; + popupgrab = false; + fullrefresh = false; + akv = false; + hasdhctrl = false; +} + +void KillTimeCallbacks(void *id, void *idlim); + +void Ctrl::DoRemove() { + GuiLock __; + if(!IsOpen()) return; + ReleaseCapture(); + CancelModeDeep(); + if(HasChildDeep(mouseCtrl) || mouseCtrl == this) + mouseCtrl = NULL; + LLOG("DoRemove " << Name() << " focusCtrl: " << UPP::Name(focusCtrl)); +#ifdef PLATFORM_X11 + if(popupgrab) { + EndPopupGrab(); + popupgrab = false; + } +#endif + if(HasFocusDeep()) { + LLOG("DoRemove - HasFocusDeep"); + if(destroying) { + if(parent) { + LLOG("parent - deferred SetFocus / ChildLostFocus; parent = " << UPP::Name(parent)); + defferedSetFocus = parent; + defferedChildLostFocus.Add(parent); + } + else + if(IsPopUp()) { + LLOG("Remove Popup"); + Ctrl *owner = GetOwner(); + if(owner && owner->IsEnabled()) + owner->ActivateWnd(); + } + NoWantFocus(); + } + else { + Ptr fc = focusCtrl; + focusCtrl = NULL; + DoKillFocus(fc, NULL); + if(parent) { + LLOG("DoRemove -> SetFocus(" << UPP::Name(parent) << "), focusCtrl = " << UPP::Name(focusCtrl) << ", fc = " << UPP::Name(fc)); + bool b = IsWantFocus(); + NoWantFocus(); + parent->SetFocus0(false); + WantFocus(b); + } + else + if(IsPopUp()) { + LLOG("Remove Popup"); + Ctrl *owner = GetOwner(); + if(owner && owner->IsEnabled()) { + LLOG("Remove popup -> owner->ActivateWnd"); + owner->ActivateWnd(); + } + } + } + SyncCaret(); + } + LLOG("//DoRemove " << Name() << " focusCtrl: " << UPP::Name(focusCtrl)); +} + +void Ctrl::Close() +{ + GuiLock __; + Ctrl *q = GetTopCtrl(); + if(!q->top) return; + DoRemove(); + if(parent) return; + StateH(CLOSE); + bool vis = visible; + UsrLogT(3, "CLOSE " + Desc(this)); + WndDestroy(); + visible = vis; + popup = false; +} + +Ctrl::~Ctrl() { + GuiLock __; + LLOG("Ctrl::~Ctrl"); + destroying = true; + while(GetFirstChild()) + RemoveChild(GetFirstChild()); + if(parent) + parent->RemoveChild(this); + Close(); + KillTimeCallbacks(this, (byte *) this + sizeof(Ctrl)); +} + +GLOBAL_VAR(Vector, Ctrl::mousehook); +GLOBAL_VAR(Vector, Ctrl::keyhook); +GLOBAL_VAR(Vector, Ctrl::statehook); + +void Ctrl::InstallMouseHook(MouseHook hook) +{ + GuiLock __; + mousehook().Add(hook); +} + +void Ctrl::DeinstallMouseHook(MouseHook hook) +{ + GuiLock __; + int q = FindIndex(mousehook(), hook); + if(q >= 0) mousehook().Remove(q); +} + +void Ctrl::InstallKeyHook(KeyHook hook) +{ + GuiLock __; + keyhook().Add(hook); +} + +void Ctrl::DeinstallKeyHook(KeyHook hook) +{ + GuiLock __; + int q = FindIndex(keyhook(), hook); + if(q >= 0) keyhook().Remove(q); +} + +void Ctrl::InstallStateHook(StateHook hook) +{ + GuiLock __; + statehook().Add(hook); +} + +void Ctrl::DeinstallStateHook(StateHook hook) +{ + GuiLock __; + int q = FindIndex(statehook(), hook); + if(q >= 0) statehook().Remove(q); +} + +static char sZoomText[] = "OK Cancel Exit Retry"; + +const char *Ctrl::GetZoomText() +{ + GuiLock __; + return sZoomText; +} + +Size Ctrl::Dsize; +Size Ctrl::Csize; + +inline void Ctrl::Csizeinit() +{ + GuiLock __; + if(Csize.cx == 0) + Csize = GetTextSize(sZoomText, StdFont()); + if(Dsize.cx == 0) + Dsize = Size(99, 13); + Csize.cx = max(Csize.cx, Dsize.cx); + Csize.cy = max(Csize.cy, Dsize.cy); +} + +void Ctrl::SetZoomSize(Size sz, Size bsz) +{ + GuiLock __; + Csize = sz; + Dsize = bsz; +} + +void Ctrl::NoLayoutZoom() +{ + GuiLock __; + Csize = Dsize = Size(1, 1); +} + +void Ctrl::GetZoomRatio(Size& m, Size& d) +{ + GuiLock __; + m = Csize; + d = Dsize; +} + +int Ctrl::HorzLayoutZoom(int cx) +{ + Csizeinit(); + return Csize.cx * cx / Dsize.cx; +} + +int Ctrl::VertLayoutZoom(int cy) +{ + Csizeinit(); + return Csize.cy * cy / Dsize.cy; +} + +Size Ctrl::LayoutZoom(int cx, int cy) +{ + Csizeinit(); + return Size(Csize.cx * cx / Dsize.cx, Csize.cy * cy / Dsize.cy); +} + +Size Ctrl::LayoutZoom(Size sz) +{ + Csizeinit(); + return LayoutZoom(sz.cx, sz.cy); +} + +Font FontZ(int face, int height) +{ + return Font(face, Ctrl::VertLayoutZoom(height)); +} + +Font StdFontZ(int height) { return FontZ(Font::STDFONT, height); } +Font ScreenSansZ(int height) { return FontZ(Font::SCREEN_SANS, height); } +Font ScreenSerifZ(int height) { return FontZ(Font::SCREEN_SERIF, height); } +Font ScreenFixedZ(int height) { return FontZ(Font::SCREEN_FIXED, height); } +Font RomanZ(int height) { return FontZ(Font::ROMAN, height); } +Font ArialZ(int height) { return FontZ(Font::ARIAL, height); } +Font CourierZ(int height) { return FontZ(Font::COURIER, height); } + +String Ctrl::appname; + +void Ctrl::SetAppName(const String& nm) +{ + GuiLock __; + appname = nm; +} + +String Ctrl::GetAppName() +{ + GuiLock __; + if(appname.IsEmpty()) + appname = GetExeTitle(); + return appname; +} + +static bool _ClickFocus; +bool Ctrl::ClickFocus() { return _ClickFocus; } +void Ctrl::ClickFocus(bool cf) { _ClickFocus = cf; } + + +Vector Ctrl::GetTopWindows() +{ + GuiLock __; + Vector c = GetTopCtrls(); + Vector r; + for(int i = 0; i < c.GetCount(); i++) + if(!c[i]->IsPopUp()) + r.Add(c[i]); + return r; +} + +void Ctrl::CloseTopCtrls() +{ + GuiLock __; + Vector tc = Ctrl::GetTopCtrls(); + for(int i = 0; i < tc.GetCount(); i++) + tc[i]->Close(); +} + +bool xpstyle; + +bool IsOrOwnedBy(Ctrl *q, Ctrl *window) +{ + while(q) { + if(q == window) + return true; + q = q->GetOwner(); + } + return false; +} + +Vector< Ptr > DisableCtrls(const Vector& ctrl, Ctrl *exclude) +{ + Vector< Ptr > disabled; + for(int i = 0; i < ctrl.GetCount(); i++) { + Ctrl *q = ctrl[i]; + if(q && q->IsEnabled() && !IsOrOwnedBy(q, exclude)) { + q->Disable(); + disabled.Add(q); + } + } + return disabled; +} + +void EnableCtrls(const Vector< Ptr >& ctrl) +{ + for(int i = ctrl.GetCount(); --i >= 0;) { + Ctrl *q = ctrl[i]; + if(q) q->Enable(); + } +} + +void Modality::Begin(Ctrl *modal, bool fo) +{ + active = Ctrl::GetFocusCtrl(); + fore_only = fo; + LLOG("Active " << Name(active)); + enable = DisableCtrls(Ctrl::GetTopWindows(), modal); +} + +void Modality::End() +{ + EnableCtrls(enable); + if(active && (!fore_only || active->IsForeground())) + active->SetFocus(); + enable.Clear(); + active = NULL; +} + +void (*s_chdefault)(); + +void (*Ctrl::skin)(); + +void CtrlSetDefaultSkin(void (*fn1)(), void (*fn2)()) +{ + GuiLock __; + s_chdefault = fn1; + Ctrl::skin = fn2; +} + +void Ctrl::SetSkin(void (*_skin)()) +{ + GuiLock __; + skin = _skin; + ChSync(); + Vector ctrl = GetTopCtrls(); + for(int i = 0; i < ctrl.GetCount(); i++) { + ctrl[i]->RefreshLayoutDeep(); + ctrl[i]->RefreshFrame(); + } +} + +void Ctrl::ChSync() +{ + GuiLock __; + if(s_chdefault) + (*s_chdefault)(); + if(skin) + (*skin)(); + Csize.cx = Dsize.cx = 0; + ChFinish(); +} + +CH_INT(GUI_GlobalStyle, GUISTYLE_CLASSIC); +CH_INT(GUI_DragFullWindow, 1); +CH_INT(GUI_PopUpEffect, GUIEFFECT_SLIDE); +CH_INT(GUI_DropShadows, 1); +CH_INT(GUI_AltAccessKeys, 1); +CH_INT(GUI_AKD_Conservative, 0); +CH_INT(GUI_DragDistance, 4); +CH_INT(GUI_DblClickTime, 500); + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/Ctrl.iml b/olddraw/CtrlCore/Ctrl.iml new file mode 100644 index 000000000..85cf0553e --- /dev/null +++ b/olddraw/CtrlCore/Ctrl.iml @@ -0,0 +1,79 @@ +PREMULTIPLIED +IMAGE_ID(DndMoveX11) +IMAGE_ID(DndMove) +IMAGE_ID(DndMove98) +IMAGE_ID(DndNone) +IMAGE_ID(DndNone98) +IMAGE_ID(DndCopy) +IMAGE_ID(DndCopy98) +IMAGE_ID(DndData) + +IMAGE_BEGIN_DATA +IMAGE_DATA(120,156,237,154,91,136,13,113,28,199,191,110,43,81,238,47,10,39,181,158,36,145,7,235,206,150,187,8,41,183,245,66) +IMAGE_DATA(173,7,228,65,33,183,114,217,92,138,16,121,217,164,220,10,81,10,229,65,81,188,88,121,17,187,229,36,90,75,109,203) +IMAGE_DATA(38,235,210,142,239,239,156,153,115,206,206,252,231,204,204,158,253,255,231,60,204,175,190,205,153,255,206,153,207,247,247,251) +IMAGE_DATA(95,102,246,244,71,10,41,20,132,133,120,195,178,85,109,107,172,105,190,132,237,225,42,181,213,176,7,203,9,219,195,3) +IMAGE_DATA(195,30,172,194,136,193,131,229,14,195,30,60,124,195,30,148,124,131,30,124,249,134,60,20,229,27,240,16,200,215,236,33) +IMAGE_DATA(136,233,168,153,122,69,213,81,227,117,241,225,93,143,132,219,68,189,132,158,245,209,147,175,130,47,236,11,208,243,124,112) +IMAGE_DATA(179,154,21,30,132,127,72,3,27,200,247,239,99,100,235,252,64,193,151,118,169,125,181,38,126,13,117,3,249,241,61,67) +IMAGE_DATA(225,161,176,6,238,177,169,210,34,42,21,210,131,228,181,19,93,199,86,177,26,88,116,226,175,236,245,75,109,15,97,66) +IMAGE_DATA(152,227,225,237,95,191,26,100,218,234,158,213,89,53,119,107,50,127,147,163,156,23,92,43,227,181,54,36,223,47,252,106) +IMAGE_DATA(144,105,123,154,126,154,171,119,125,67,125,230,188,135,249,64,190,63,155,220,124,40,250,93,3,95,250,100,171,205,117,214) +IMAGE_DATA(159,12,167,245,87,107,142,251,241,251,199,204,185,6,190,227,161,240,253,52,195,233,248,215,97,181,255,110,207,240,228,40) +IMAGE_DATA(231,154,248,238,240,121,98,88,198,248,33,164,147,47,243,122,169,205,240,83,148,249,31,53,82,246,189,107,139,40,202,250) +IMAGE_DATA(151,68,18,241,68,153,254,24,80,105,107,136,105,126,193,2,42,15,154,42,195,30,220,139,248,110,195,30,84,15,18,147) +IMAGE_DATA(30,252,30,102,166,60,20,123,160,154,240,16,244,80,215,237,33,204,139,133,78,15,69,249,6,60,4,242,53,123,8,98) +IMAGE_DATA(58,186,79,157,161,86,82,35,116,241,225,93,143,132,123,133,58,9,61,235,163,39,95,5,95,216,235,161,231,249,224,102) +IMAGE_DATA(221,87,120,16,254,18,13,108,32,223,191,251,144,173,243,110,5,95,218,165,246,149,154,248,83,169,109,200,143,239,148,194) +IMAGE_DATA(131,206,26,72,94,115,208,117,108,153,172,129,48,71,192,155,155,201,26,168,194,100,13,124,61,20,176,227,224,75,173,171) +IMAGE_DATA(108,110,28,239,103,142,135,184,222,79,147,72,34,137,36,244,68,153,254,24,16,27,191,224,97,27,27,63,70,15,170,127) +IMAGE_DATA(64,98,227,199,224,193,195,55,236,65,201,55,232,193,151,111,200,67,81,190,1,15,129,124,205,30,130,152,70,243,135,249) +IMAGE_DATA(245,200,147,111,28,124,23,203,164,7,21,195,52,95,217,110,184,31,202,133,239,59,22,157,99,58,157,238,114,30,116,140) +IMAGE_DATA(10,119,223,195,237,167,27,199,238,228,159,59,143,154,131,59,23,221,223,9,184,93,169,249,151,4,71,146,127,146,191,230) +IMAGE_DATA(239,4,220,174,187,249,247,216,49,42,92,131,135,36,252,162,76,127,12,72,118,6,32,217,25,16,131,7,15,223,176,7) +IMAGE_DATA(37,223,160,7,95,190,33,15,69,249,6,60,4,242,53,123,8,98,58,74,118,6,148,215,206,128,138,94,192,186,185,64) +IMAGE_DATA(227,49,160,243,60,175,59,8,252,155,0,60,71,180,237,252,14,35,202,206,128,138,65,192,233,35,64,219,101,224,215,98) +IMAGE_DATA(224,211,84,224,221,38,224,243,109,122,217,1,52,247,7,118,241,186,222,33,249,145,118,6,244,97,222,231,200,222,15,180) +IMAGE_DATA(242,243,9,182,45,160,102,245,3,78,209,79,103,43,175,63,76,95,108,155,73,245,13,225,33,210,206,0,154,104,124,2) +IMAGE_DATA(252,29,8,92,228,57,187,0,19,153,239,97,26,249,209,64,62,39,72,243,27,126,103,52,112,151,127,27,69,245,10,224) +IMAGE_DATA(71,218,25,112,154,12,230,254,141,159,215,80,147,168,45,103,129,142,183,108,103,255,191,98,194,71,175,3,127,86,3,239) +IMAGE_DATA(249,183,249,84,69,136,26,168,66,89,3,25,107,181,192,23,126,158,199,188,143,10,251,53,217,149,217,177,39,235,67,237) +IMAGE_DATA(37,224,231,6,32,205,207,171,168,193,221,228,3,249,241,153,219,25,112,138,227,156,181,110,99,82,215,88,144,246,183,121) +IMAGE_DATA(54,145,152,206,252,55,222,97,255,172,202,230,47,126,134,149,192,247,236,12,224,96,125,254,130,76,154,233,108,176,107,110) +IMAGE_DATA(115,166,83,163,232,229,158,244,255,80,224,182,221,54,180,4,190,227,33,247,126,202,193,84,189,135,99,172,133,12,118,238) +IMAGE_DATA(103,182,29,160,214,82,203,70,2,245,55,129,223,155,129,175,114,78,77,161,6,148,200,247,4,107,191,107,59,231,216,67) +IMAGE_DATA(230,207,73,219,198,197,177,241,56,208,242,136,158,104,228,43,231,226,94,94,54,155,26,131,112,235,64,212,144,123,206,28) +IMAGE_DATA(206,57,182,156,253,76,254,135,133,92,131,56,39,111,177,157,75,18,102,81,227,168,254,26,216,78,200,218,34,243,91,230) +IMAGE_DATA(152,140,243,21,212,52,106,50,178,121,235,100,59,33,107,139,204,111,153,99,50,206,101,172,73,127,235,168,121,18,73,244) +IMAGE_DATA(104,252,7,44,92,244,185,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) +IMAGE_END_DATA(1184, 4) + +IMAGE_BEGIN_DATA +IMAGE_DATA(120,156,237,152,191,107,21,65,16,199,7,44,108,45,2,182,175,201,159,96,147,66,108,37,41,180,16,65,5,65,65,124) +IMAGE_DATA(41,69,210,4,130,54,70,144,136,198,31,77,8,18,181,139,4,12,54,41,132,88,90,8,81,17,212,66,196,128,18,33) +IMAGE_DATA(70,48,106,252,1,227,204,187,61,223,102,111,247,126,228,237,206,70,220,47,76,178,55,119,236,231,59,187,123,123,239,14) +IMAGE_DATA(90,208,2,77,8,113,133,145,61,32,43,162,7,204,21,201,3,234,138,224,1,77,9,123,40,240,133,61,88,249,130,30) +IMAGE_DATA(156,124,33,15,165,124,1,15,149,252,192,30,170,152,162,245,131,252,126,84,168,55,6,223,96,213,241,176,155,255,180,233) +IMAGE_DATA(252,56,197,117,138,243,20,39,155,123,182,49,170,248,29,246,4,157,187,69,209,214,98,142,98,180,153,7,215,181,165,30) +IMAGE_DATA(166,41,119,193,146,159,162,220,39,199,185,134,114,242,185,206,69,75,255,147,148,91,162,56,66,241,108,107,115,81,203,195) +IMAGE_DATA(101,106,95,52,250,190,73,199,47,21,155,143,103,3,242,121,173,157,213,142,153,253,84,99,179,242,117,209,35,31,192,178) +IMAGE_DATA(62,185,254,107,42,55,105,212,157,235,62,29,159,240,195,223,107,38,184,174,199,20,183,181,249,54,175,241,52,255,78,241) +IMAGE_DATA(250,94,161,24,180,48,230,252,141,125,169,206,16,99,129,98,140,98,88,237,65,124,124,188,200,222,25,202,3,143,241,49) +IMAGE_DATA(85,239,161,192,99,190,77,181,3,212,126,108,40,216,152,39,37,121,211,54,253,24,208,175,98,151,52,95,123,216,158,162) +IMAGE_DATA(24,16,246,96,62,240,71,132,61,216,94,64,36,61,184,94,130,164,60,20,248,194,30,172,124,65,15,78,190,144,135,82) +IMAGE_DATA(190,128,135,74,126,96,15,85,204,60,230,41,174,80,28,164,232,11,197,135,226,126,196,220,25,138,75,16,102,127,44,212) +IMAGE_DATA(107,225,51,251,40,132,121,62,152,172,121,139,7,230,15,6,96,3,116,231,151,222,225,59,227,60,98,225,115,158,199,190) +IMAGE_DATA(63,16,127,15,197,48,116,215,119,203,226,65,31,3,115,109,218,98,191,234,167,142,184,174,125,176,121,109,149,141,1,94) +IMAGE_DATA(189,135,120,122,2,241,240,57,196,3,163,89,112,155,115,234,250,33,229,161,142,152,217,7,197,249,117,141,1,62,90,66) +IMAGE_DATA(156,122,128,56,126,55,59,55,54,157,181,57,167,174,189,1,157,247,214,158,228,26,3,124,245,14,241,225,19,196,217,197) +IMAGE_DATA(236,220,157,133,172,205,57,143,124,128,238,124,206,232,252,15,171,133,253,169,19,207,223,120,231,243,156,12,40,110,190,255) +IMAGE_DATA(224,231,117,196,229,143,136,175,151,51,222,139,183,89,155,115,158,249,185,7,253,247,41,126,251,129,184,246,5,113,101,45) +IMAGE_DATA(227,189,95,205,218,156,11,192,55,133,191,126,35,110,252,68,252,186,129,184,254,61,11,110,115,78,130,95,35,66,242,249) +IMAGE_DATA(190,30,82,12,87,52,185,255,155,170,165,250,110,151,68,147,253,47,41,41,142,182,233,199,128,104,124,237,97,27,141,31) +IMAGE_DATA(209,131,237,5,36,26,63,130,135,2,95,216,131,149,47,232,193,201,23,242,80,202,23,240,80,201,15,236,161,138,41,90) +IMAGE_DATA(63,200,239,71,133,122,99,240,13,150,164,7,27,67,154,111,205,151,120,168,243,50,208,179,175,50,126,192,123,213,185,22) +IMAGE_DATA(109,121,243,158,49,175,105,234,197,100,185,250,172,226,27,255,183,82,255,223,99,75,13,155,60,233,161,215,220,75,253,117) +IMAGE_DATA(60,86,140,191,173,150,186,22,188,240,165,234,55,5,2,245,215,136,144,245,55,233,46,68,253,181,59,130,127,183,126,111) +IMAGE_DATA(255,155,194,3,120,72,114,169,149,62,88,37,37,37,37,37,37,37,37,233,250,223,127,12,123,251,1,221,75,253,62,248) +IMAGE_DATA(144,234,79,245,167,250,211,199,128,36,167,254,0,206,90,25,174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) +IMAGE_END_DATA(864, 4) diff --git a/olddraw/CtrlCore/CtrlChild.cpp b/olddraw/CtrlCore/CtrlChild.cpp new file mode 100644 index 000000000..62fb44d7c --- /dev/null +++ b/olddraw/CtrlCore/CtrlChild.cpp @@ -0,0 +1,264 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) // DLOG(x) + +bool Ctrl::HasDHCtrl() const +{ + GuiLock __; + if(dynamic_cast(this)) + return true; + for(Ctrl *q = GetFirstChild(); q; q = q->next) + if(q->HasDHCtrl()) + return true; + return false; +} + +void Ctrl::SyncDHCtrl() +{ + GuiLock __; + Ctrl *p = GetTopCtrl(); + p->hasdhctrl = p->HasDHCtrl(); +} + +void Ctrl::AddChild(Ctrl *q, Ctrl *p) +{ + GuiLock __; + ASSERT(q); + LLOG("Add " << UPP::Name(q) << " to: " << Name()); + if(p == q) return; + bool updaterect = true; + if(q->parent) { + ASSERT(!q->inframe); + if(q->parent == this) { + RemoveChild0(q); + updaterect = false; + } + else + q->parent->RemoveChild(q); + } + q->parent = this; + if(p) { + ASSERT(p->parent == this); + q->prev = p; + q->next = p->next; + if(p == lastchild) + lastchild = q; + else + p->next->prev = q; + p->next = q; + } + else + if(firstchild) { + q->prev = NULL; + q->next = firstchild; + firstchild->prev = q; + firstchild = q; + } + else { + ASSERT(lastchild == NULL); + firstchild = lastchild = q; + q->prev = q->next = NULL; + } + q->CancelModeDeep(); + if(updaterect) + q->UpdateRect(); + ChildAdded(q); + q->ParentChange(); + if(GetTopCtrl()->IsOpen()) + q->StateH(OPEN); + if(dynamic_cast(q)) + SyncDHCtrl(); +} + +void Ctrl::AddChild(Ctrl *child) +{ + AddChild(child, lastchild); +} + +void Ctrl::AddChildBefore(Ctrl *child, Ctrl *insbefore) +{ + if(insbefore) + AddChild(child, insbefore->prev); + else + AddChild(child); +} + +void Ctrl::RemoveChild0(Ctrl *q) +{ + GuiLock __; + ChildRemoved(q); + q->DoRemove(); + q->parent = NULL; + if(q == firstchild) + firstchild = firstchild->next; + if(q == lastchild) + lastchild = lastchild->prev; + if(q->prev) + q->prev->next = q->next; + if(q->next) + q->next->prev = q->prev; + q->next = q->prev = NULL; + if(dynamic_cast(q)) + SyncDHCtrl(); +} + +void Ctrl::RemoveChild(Ctrl *q) +{ + GuiLock __; + if(q->parent != this) return; + q->RefreshFrame(); + RemoveChild0(q); + q->ParentChange(); + if(GetTopCtrl()->IsOpen()) + q->StateH(CLOSE); +} + +void Ctrl::Remove() +{ + GuiLock __; + if(parent) + parent->RemoveChild(this); +} + +bool Ctrl::HasChild(Ctrl *q) const +{ + GuiLock __; + return q && q->IsChild() && q->parent == this; +} + +bool Ctrl::HasChildDeep(Ctrl *q) const +{ + GuiLock __; + while(q && q->IsChild()) { + if(q->parent == this) return true; + q = q->parent; + } + return false; +} + +static bool IterateFocusFw(Ctrl *ctrl, bool noframe, bool init, bool all) +{ + LLOG("IterateFocusFw(" << UPP::Name(ctrl) << ")"); + while(ctrl) { + if(ctrl->IsOpen() && ctrl->IsVisible() && ctrl->IsEnabled()) { + if(!(noframe && ctrl->InFrame())) { + if(all) { + ctrl->SetFocus(); + return true; + } + if((!init || ctrl->IsInitFocus()) && ctrl->SetWantFocus()) + return true; + } + if(IterateFocusFw(ctrl->GetFirstChild(), noframe, init, all)) + return true; + } + ctrl = ctrl->GetNext(); + } + return false; +} + +bool Ctrl::IterateFocusForward(Ctrl *ctrl, Ctrl *top, bool noframe, bool init, bool all) +{ + GuiLock __; + LLOG("IterateFocusForward(" << UPP::Name(ctrl) << ", top " << UPP::Name(top) << ", noframe " << noframe << ", init " << init << ")"); + if(!ctrl) return false; + if(IterateFocusFw(ctrl->GetFirstChild(), noframe, init, all)) + return true; + if(ctrl->GetNext() && IterateFocusFw(ctrl->GetNext(), noframe, init, all)) + return true; + while(ctrl->GetParent() != top && (ctrl = ctrl->GetParent()) != NULL) + if(IterateFocusFw(ctrl->GetNext(), noframe, init, all)) + return true; + return false; +} + +static bool IterateFocusBw(Ctrl *ctrl, bool noframe, bool all) +{ + while(ctrl) { + if(ctrl->IsOpen() && ctrl->IsVisible() && ctrl->IsEnabled()) { + if(IterateFocusBw(ctrl->GetLastChild(), noframe, all)) + return true; + if(!(noframe && ctrl->InFrame())) { + if(all) { + ctrl->SetFocus(); + return true; + } + if(ctrl->SetWantFocus()) + return true; + } + } + ctrl = ctrl->GetPrev(); + } + return false; +} + +bool Ctrl::IterateFocusBackward(Ctrl *ctrl, Ctrl *top, bool noframe, bool all) +{ + GuiLock __; + if(!ctrl || ctrl == top) return false; + if(IterateFocusBw(ctrl->GetPrev(), noframe, all)) + return true; + while(ctrl->GetParent() != top) { + ctrl = ctrl->GetParent(); + if(ctrl->SetWantFocus()) + return true; + if(IterateFocusBw(ctrl->GetPrev(), noframe, all)) + return true; + } + return false; +} + +Ctrl *Ctrl::GetTopCtrl() +{ + GuiLock __; + Ctrl *q = this; + while(q->parent) + q = q->parent; + return q; +} + +const Ctrl *Ctrl::GetTopCtrl() const { return const_cast(this)->GetTopCtrl(); } +const Ctrl *Ctrl::GetOwner() const { return const_cast(this)->GetOwner(); } +Ctrl *Ctrl::GetTopCtrlOwner() { return GetTopCtrl()->GetOwner(); } +const Ctrl *Ctrl::GetTopCtrlOwner() const { return GetTopCtrl()->GetOwner(); } + +Ctrl *Ctrl::GetOwnerCtrl() { GuiLock __; return !IsChild() && top ? top->owner : NULL; } +const Ctrl *Ctrl::GetOwnerCtrl() const { return const_cast(this)->GetOwnerCtrl(); } + +TopWindow *Ctrl::GetTopWindow() +{ + GuiLock __; + Ctrl *q = GetTopCtrl(); + while(q) { + TopWindow *w = dynamic_cast(q); + if(w) return w; + q = q->GetOwner(); + } + return NULL; +} + +const TopWindow *Ctrl::GetTopWindow() const +{ + return const_cast(this)->GetTopWindow(); +} + +TopWindow *Ctrl::GetMainWindow() +{ + GuiLock __; + Ctrl *q = GetTopCtrl(); + for(;;) { + Ctrl *w = q->GetOwner(); + if(!w) + return dynamic_cast(q); + q = w; + } +} + +const TopWindow *Ctrl::GetMainWindow() const +{ + return const_cast(this)->GetMainWindow(); +} + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/CtrlClip.cpp b/olddraw/CtrlCore/CtrlClip.cpp new file mode 100644 index 000000000..d4416b0d8 --- /dev/null +++ b/olddraw/CtrlCore/CtrlClip.cpp @@ -0,0 +1,311 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +ClipData::ClipData(const Value& data, String (*render)(const Value& data)) +: data(data), render(render) +{} + +String sRawClipData(const Value& data) +{ + return data; +} + +ClipData::ClipData(const String& data) +: data(data), render(sRawClipData) +{} + +ClipData::ClipData() +: render(sRawClipData) +{} + +void Ctrl::DragAndDrop(Point p, PasteClip& d) {} +void Ctrl::FrameDragAndDrop(Point p, PasteClip& d) {} +void Ctrl::DragEnter() {} +void Ctrl::DragRepeat(Point p) {} +void Ctrl::DragLeave() {} + +PasteClip& Ctrl::Clipboard() +{ + GuiLock __; + static PasteClip d; + d.fmt.Clear(); + return d; +} + +PasteClip& Ctrl::Selection() +{ + GuiLock __; + static PasteClip d; +#ifdef PLATFORM_X11 + d.fmt.Clear(); + d.type = 2; +#endif + return d; +} + +String Ctrl::GetDropData(const String& fmt) const +{ + return GetSelectionData(fmt); +} + +String Ctrl::GetSelectionData(const String& fmt) const +{ + return Null; +} + +#ifdef PLATFORM_WIN32 +bool Has(UDropTarget *dt, const char *fmt); +String Get(UDropTarget *dt, const char *fmt); + +bool PasteClip::IsAvailable(const char *fmt) const +{ + if(this == &Ctrl::Selection()) + return false; + return dt ? UPP::Has(dt, fmt) : IsClipboardAvailable(fmt); +} + +String PasteClip::Get(const char *fmt) const +{ + if(this == &Ctrl::Selection()) + return Null; + return dt ? UPP::Get(dt, fmt) : ReadClipboard(fmt); +} +#endif + +#ifdef PLATFORM_X11 +bool PasteClip::IsAvailable(const char *fmt) const +{ + return Ctrl::ClipHas(type, fmt); +} + +String PasteClip::Get(const char *fmt) const +{ + return Ctrl::ClipGet(type, fmt); +} +#endif + +bool PasteClip::Accept() +{ + accepted = true; + return paste; +} + +bool PasteClip::Accept(const char *_fmt) +{ + Vector f = Split(_fmt, ';'); + for(int i = 0; i < f.GetCount(); i++) { + if(IsAccepted() && fmt == _fmt) + return paste; + if(IsAvailable(f[i])) { + accepted = true; + if(paste) { + fmt = f[i]; + data = Get(f[i]); + return true; + } + break; + } + } + return false; +} + +PasteClip::PasteClip() +{ + paste = true; + accepted = false; +#ifdef PLATFORM_WIN32 + dt = NULL; +#else + type = 0; +#endif +} + +int Ctrl::DoDragAndDrop(const char *fmts, const Image& sample, dword actions) +{ + VectorMap dummy; + return DoDragAndDrop(fmts, sample, actions, dummy); +} + +int Ctrl::DoDragAndDrop(const VectorMap& data, const Image& sample, dword actions) +{ + return DoDragAndDrop("", sample, actions, data); +} + +Uuid sDndUuid; +const void *sInternalPtr; + +String GetInternalDropId__(const char *type, const char *id) +{ + return "U++ Internal clip:" + AsString(sDndUuid) + '-' + type + '-' + id; +} + +void NewInternalDrop__(const void *ptr) +{ + sDndUuid = Uuid::Create(); + sInternalPtr = ptr; +} + +const void *GetInternalDropPtr__() +{ + return sInternalPtr; +} + +String Unicode__(const WString& w) +{ + return String((const char *)~w, 2 * w.GetLength()); +} + +WString Unicode__(const String& s) +{ + return WString((const wchar *)~s, s.GetLength() / 2); +} + +Image MakeDragImage(const Image& arrow, Image sample) +{ + ImageBuffer b; + if(IsNull(sample)) { + sample = CtrlCoreImg::DndData(); + b = sample; + Over(b, Point(0, 0), arrow, arrow.GetSize()); + } + else { + b.Create(128, 128); + memset(~b, 0, sizeof(RGBA) * b.GetLength()); + Size ssz = sample.GetSize(); + Over(b, Point(2, 22), sample, sample.GetSize()); + for(int y = 20; y < 96; y++) { + RGBA *s = b[y]; + RGBA *e = s + 96; + while(s < e) + (s++)->a >>= 1; + e += 32; + int q = 128; + while(s < e) { + s->a = (s->a * q) >> 8; + q -= 4; + s++; + } + } + int qq = 128; + for(int y = 96; y < 128; y++) { + RGBA *s = b[y]; + RGBA *e = s + 96; + while(s < e) { + s->a = (s->a * qq) >> 8; + s++; + } + e += 32; + int q = 255; + while(s < e) { + s->a = (s->a * q * qq) >> 16; + q -= 8; + s++; + } + qq -= 4; + } + RGBA *s = b[21] + 1; + RGBA c1 = Blue(); + RGBA c2 = White(); + for(int a = 255; a > 0; a -= 3) { + c1.a = c2.a = a; + *s++ = c1; + Swap(c1, c2); + } + s = b[21] + 1; + c1 = Black(); + c2 = White(); + for(int a = 255; a > 0; a -= 8) { + c1.a = c2.a = a; + *s = c1; + s += b.GetWidth(); + Swap(c1, c2); + } +#ifdef PLATFORM_X11 + if(Ctrl::IsCompositedGui()) { + Image h = Rescale(b, 64, 64); + b = h; + } +#endif + Over(b, Point(0, 0), arrow, arrow.GetSize()); + } + + return b; +} + +Ptr Ctrl::dndctrl; +Point Ctrl::dndpos; +bool Ctrl::dndframe; +PasteClip Ctrl::dndclip; + +void Ctrl::DnDRepeat() +{ + GuiLock __; + if(dndctrl) { + dndctrl->DragRepeat(dndpos); + if(dndctrl) { + PasteClip d = dndclip; + if(dndframe) + dndctrl->FrameDragAndDrop(dndpos, d); + else + dndctrl->DragAndDrop(dndpos, d); + } + } + else + UPP::KillTimeCallback(&dndpos); +} + +void Ctrl::DnD(Point p, PasteClip& clip) +{ + GuiLock __; + UPP::KillTimeCallback(&dndpos); + dndclip = clip; + Point hp = p - GetScreenRect().TopLeft(); + Ptr ctrl = this; + while(ctrl && ctrl->IsEnabled()) { + Rect view = ctrl->GetScreenView(); + if(ctrl->IsMouseActive()) + if(view.Contains(p)) { + dndpos = p - view.TopLeft(); + dndframe = false; + ctrl->DragAndDrop(dndpos, clip); + if(clip.IsAccepted()) + break; + } + else { + dndpos = p - ctrl->GetScreenRect().TopLeft(); + dndframe = true; + ctrl->FrameDragAndDrop(dndpos, clip); + if(clip.IsAccepted()) + break; + } + ctrl = ctrl->ChildFromPoint(hp); + } + if(ctrl != dndctrl) { + if(dndctrl) + dndctrl->DragLeave(); + dndctrl = ctrl; + if(dndctrl) + dndctrl->DragEnter(); + } + if(dndctrl) + UPP::SetTimeCallback(-40, callback(DnDRepeat), &dndpos); +} + +void Ctrl::DnDLeave() +{ + GuiLock __; + if(dndctrl) { + dndctrl->DragLeave(); + UPP::KillTimeCallback(&dndpos); + dndctrl = NULL; + } +} + +Ctrl *Ctrl::GetDragAndDropTarget() +{ + GuiLock __; + return dndctrl; +} + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/CtrlCore.h b/olddraw/CtrlCore/CtrlCore.h new file mode 100644 index 000000000..71b9570f6 --- /dev/null +++ b/olddraw/CtrlCore/CtrlCore.h @@ -0,0 +1,1851 @@ +#ifndef CTRLCORE_H +#define CTRLCORE_H + +#include + +NAMESPACE_UPP + +enum { + K_DELTA = 0x010000, + + K_ALT = 0x080000, + K_SHIFT = 0x040000, + K_CTRL = 0x020000, + + K_KEYUP = 0x100000, + + K_MOUSEMIDDLE = 0x200000, + K_MOUSERIGHT = 0x400000, + K_MOUSELEFT = 0x800000, + K_MOUSEDOUBLE = 0x1000000, + K_MOUSETRIPLE = 0x2000000, + + K_SHIFT_CTRL = K_SHIFT|K_CTRL, +}; + +#include "MKeys.h" + +enum { + DELAY_MINIMAL = 0 +}; + +void SetTimeCallback(int delay_ms, Callback cb, void *id = NULL); // delay_ms < 0 -> periodic +void KillTimeCallback(void *id); +bool ExistsTimeCallback(void *id); +dword GetTimeClick(); + +inline +void PostCallback(Callback cb, void *id = NULL) { SetTimeCallback(1, cb, id); } + +class TimeCallback +{ +public: + ~TimeCallback() { Kill(); } + + void Set(int delay, Callback cb) { UPP::SetTimeCallback(delay, cb, this); } + void Post(Callback cb) { UPP::PostCallback(cb, this); } + void Kill() { UPP::KillTimeCallback(this); } + void KillSet(int delay, Callback cb) { Kill(); Set(delay, cb); } + void KillPost(Callback cb) { Kill(); Post(cb); } + +private: + byte dummy; +}; + +class Ctrl; + +class CtrlFrame { +public: + virtual void FrameLayout(Rect& r) = 0; + virtual void FrameAddSize(Size& sz) = 0; + virtual void FramePaint(Draw& w, const Rect& r); + virtual void FrameAdd(Ctrl& parent); + virtual void FrameRemove(); + virtual int OverPaint() const; + +#ifdef flagSO + CtrlFrame(); + virtual ~CtrlFrame(); +#else + CtrlFrame() {} + virtual ~CtrlFrame() {} +#endif + +private: + CtrlFrame(const CtrlFrame&); + void operator=(const CtrlFrame&); +}; + +struct NullFrameClass : public CtrlFrame { + virtual void FrameLayout(Rect& r); + virtual void FramePaint(Draw& w, const Rect& r); + virtual void FrameAddSize(Size& sz); +}; + +CtrlFrame& NullFrame(); + +class BorderFrame : public CtrlFrame { +public: + virtual void FrameLayout(Rect& r); + virtual void FramePaint(Draw& w, const Rect& r); + virtual void FrameAddSize(Size& sz); + +protected: + const ColorF *border; + +public: +#ifdef flagSO + BorderFrame(const ColorF *border); + virtual ~BorderFrame(); +#else + BorderFrame(const ColorF *border) : border(border) {} +#endif +}; + +CtrlFrame& InsetFrame(); +CtrlFrame& OutsetFrame(); +CtrlFrame& ButtonFrame(); +CtrlFrame& ThinInsetFrame(); +CtrlFrame& ThinOutsetFrame(); +CtrlFrame& BlackFrame(); + +CtrlFrame& XPFieldFrame(); + +CtrlFrame& FieldFrame(); +// CtrlFrame& EditFieldFrame(); //TODO remove + +CtrlFrame& TopSeparatorFrame(); +CtrlFrame& BottomSeparatorFrame(); +CtrlFrame& LeftSeparatorFrame(); +CtrlFrame& RightSeparatorFrame(); + +void LayoutFrameLeft(Rect& r, Ctrl *ctrl, int cx); +void LayoutFrameRight(Rect& r, Ctrl *ctrl, int cx); +void LayoutFrameTop(Rect& r, Ctrl *ctrl, int cy); +void LayoutFrameBottom(Rect& r, Ctrl *ctrl, int cy); + +dword GetMouseFlags(); + +Point GetMousePos(); +dword GetMouseFlags(); + +#ifdef PLATFORM_WIN32 +#ifdef PLATFORM_WINCE +bool GetShift(); +bool GetCtrl(); +bool GetAlt(); +bool GetCapsLock(); +bool GetMouseLeft(); +bool GetMouseRight(); +bool GetMouseMiddle(); +#else +inline bool GetShift() { return !!(GetKeyState(VK_SHIFT) & 0x8000); } +inline bool GetCtrl() { return !!(GetKeyState(VK_CONTROL) & 0x8000); } +inline bool GetAlt() { return !!(GetKeyState(VK_MENU) & 0x8000); } +inline bool GetCapsLock() { return !!(GetKeyState(VK_CAPITAL) & 1); } +inline bool GetMouseLeft() { return !!(GetKeyState(VK_LBUTTON) & 0x8000); } +inline bool GetMouseRight() { return !!(GetKeyState(VK_RBUTTON) & 0x8000); } +inline bool GetMouseMiddle() { return !!(GetKeyState(VK_MBUTTON) & 0x8000); } +#endif +#endif + +#ifdef PLATFORM_X11 +bool GetShift(); +bool GetCtrl(); +bool GetAlt(); +bool GetCapsLock(); +bool GetMouseLeft(); +bool GetMouseRight(); +bool GetMouseMiddle(); + +String XAtomName(Atom atom); +Atom XAtom(const char *name); + +String GetProperty(Window w, Atom property, Atom rtype = AnyPropertyType); +Vector GetPropertyInts(Window w, Atom property, Atom rtype = AnyPropertyType); +String ReadPropertyData(Window w, Atom property, Atom rtype = AnyPropertyType); + +Index& _NET_Supported(); +#endif + +#define IMAGECLASS CtrlCoreImg +#define IMAGEFILE +#include + +class TopWindow; +class TrayIcon; +class GLCtrl; + +enum { + DND_NONE = 0, + DND_COPY = 1, + DND_MOVE = 2, + + DND_ALL = 3, + + DND_EXACTIMAGE = 0x80000000, +}; + +struct UDropTarget; + +struct ClipData : Moveable { + Value data; + String (*render)(const Value& data); + + String Render() const { return (*render)(data); } + + ClipData(const Value& data, String (*render)(const Value& data)); + ClipData(const String& data); + ClipData(); +}; + +class PasteClip { + friend struct UDropTarget; + friend class Ctrl; + friend PasteClip sMakeDropClip(bool paste); + + +#ifdef PLATFORM_WIN32 + UDropTarget *dt; +#endif +#ifdef PLATFORM_X11 + int type; +#endif + byte action; + byte allowed; + bool paste; + bool accepted; + String fmt; + String data; + +public: + bool IsAvailable(const char *fmt) const; + String Get(const char *fmt) const; + + bool Accept(); + bool Accept(const char *fmt); + String Get() const { return data; } + operator String() const { return data; } + String operator ~() const { return data; } + + void Reject() { accepted = false; data.Clear(); } + + int GetAction() const { return action; } + int GetAllowedActions() const { return allowed; } + void SetAction(int x) { action = x; } + + bool IsAccepted() const { return accepted; } + + bool IsQuery() const { return !paste; } + bool IsPaste() const { return paste; } + + PasteClip(); +}; + +String Unicode__(const WString& w); +WString Unicode__(const String& s); + +const char *ClipFmtsText(); +bool AcceptText(PasteClip& clip); +String GetString(PasteClip& clip); +WString GetWString(PasteClip& clip); +String GetTextClip(const String& text, const String& fmt); +String GetTextClip(const WString& text, const String& fmt); +void Append(VectorMap& data, const String& text); +void Append(VectorMap& data, const WString& text); + +const char *ClipFmtsImage(); +bool AcceptImage(PasteClip& clip); +Image GetImage(PasteClip& clip); +String GetImageClip(const Image& m, const String& fmt); +void Append(VectorMap& data, const Image& img); + +bool AcceptFiles(PasteClip& clip); +Vector GetFiles(PasteClip& clip); + +template +String ClipFmt() +{ + return String("U++ type: ") + typeid(T).name(); +} + +template +bool Accept(PasteClip& clip) +{ + return clip.Accept(ClipFmt()); +} + + +String GetInternalDropId__(const char *type, const char *id); +void NewInternalDrop__(const void *ptr); +const void *GetInternalDropPtr__(); + +template +VectorMap InternalClip(const T& x, const char *id = "") +{ + NewInternalDrop__(&x); + VectorMap d; + d.Add(GetInternalDropId__(typeid(T).name(), id)); + return d; +} + +template +bool IsAvailableInternal(PasteClip& d, const char *id = "") +{ + return d.IsAvailable(GetInternalDropId__(typeid(T).name(), id)); +} + +template +bool AcceptInternal(PasteClip& d, const char *id = "") +{ + return d.Accept(GetInternalDropId__(typeid(T).name(), id)); +} + +template +const T& GetInternal(PasteClip& d) +{ + return *(T *)GetInternalDropPtr__(); +} + +class Ctrl : public Pte { +public: + enum PlacementConstants { + CENTER = 0, + MIDDLE = 0, + LEFT = 1, + RIGHT = 2, + TOP = 1, + BOTTOM = 2, + SIZE = 3, + + MINSIZE = -16380, + MAXSIZE = -16381, + STDSIZE = -16382, + }; + + class Logc { + dword data; + + static int LSGN(dword d) { return int16(d & 0x7fff | ((d & 0x4000) << 1)); } + + public: + bool operator==(Logc q) const { return data == q.data; } + bool operator!=(Logc q) const { return data != q.data; } + int GetAlign() const { return (data >> 30) & 3; } + int GetA() const { return LSGN(data >> 15); } + int GetB() const { return LSGN(data); } + void SetAlign(int align) { data = (data & ~(3 << 30)) | (align << 30); } + void SetA(int a) { data = (data & ~(0x7fff << 15)) | ((a & 0x7fff) << 15); } + void SetB(int b) { data = (data & ~0x7fff) | (b & 0x7fff); } + bool IsEmpty() const; + + Logc(int al, int a, int b) { data = (al << 30) | ((a & 0x7fff) << 15) | (b & 0x7fff); } + Logc() { data = 0xffffffff; } + }; + + struct LogPos { + Logc x, y; + + bool operator==(LogPos b) const { return x == b.x && y == b.y; } + bool operator!=(LogPos b) const { return !(*this == b); } + + LogPos(Logc x, Logc y) : x(x), y(y) {} + LogPos() {} + }; + + static Logc PosLeft(int pos, int size) { return Logc(LEFT, pos, size); } + static Logc PosRight(int pos, int size) { return Logc(RIGHT, pos, size); } + static Logc PosTop(int pos, int size) { return Logc(TOP, pos, size); } + static Logc PosBottom(int pos, int size) { return Logc(BOTTOM, pos, size); } + static Logc PosSize(int lpos, int rpos) { return Logc(SIZE, lpos, rpos); } + static Logc PosCenter(int size, int offset) { return Logc(CENTER, offset, size); } + static Logc PosCenter(int size) { return Logc(CENTER, 0, size); } + + typedef bool (*MouseHook)(Ctrl *ctrl, bool inframe, int event, Point p, + int zdelta, dword keyflags); + typedef bool (*KeyHook)(Ctrl *ctrl, dword key, int count); + typedef bool (*StateHook)(Ctrl *ctrl, int reason); + + static dword KEYtoK(dword); + +private: + Ctrl(Ctrl&); + void operator=(Ctrl&); + +private: + struct Frame : Moveable { + CtrlFrame *frame; + Rect16 view; + + Frame() { view.Clear(); } + }; + Ctrl *parent; + + struct Scroll : Moveable { + Rect rect; + int dx; + int dy; + }; + + struct MoveCtrl : Moveable { + Ptr ctrl; + Rect from; + Rect to; + }; + + friend struct UDropTarget; + + struct Top { +#ifdef PLATFORM_WIN32 + HWND hwnd; + UDropTarget *dndtgt; +#endif +#ifdef PLATFORM_X11 + Window window; +#endif + Vector scroll; + VectorMap move; + VectorMap scroll_move; + Ptr owner; + }; + + Top *top; + int exitcode; + + Ctrl *prev, *next; + Ctrl *firstchild, *lastchild;//16 + LogPos pos;//8 + Rect16 rect; + Mitor frame;//16 + String info;//16 + int16 caretx, carety, caretcx, caretcy;//8 + + byte overpaint; + + bool unicode:1; + +#ifdef PLATFORM_WIN32 + bool activex:1; +#endif + bool fullrefresh:1; + + bool transparent:1; + bool visible:1; + bool enabled:1; + bool wantfocus:1; + bool initfocus:1; + bool activepopup:1; + bool editable:1; + bool modify:1; + bool ignoremouse:1; + bool inframe:1; + bool inloop:1; + bool isopen:1; + bool popup:1; + bool popupgrab:1; + byte backpaint:2;//2 + bool hasdhctrl:1; +#ifdef PLATFORM_WIN32 + bool isdhctrl:1; +#endif + + bool akv:1; + bool destroying:1; +#ifdef PLATFORM_X11 + bool ignoretakefocus:1; +#endif + + static Ptr eventCtrl; + static Ptr mouseCtrl; + static Point mousepos; + static Point leftmousepos, rightmousepos, middlemousepos; + static Ptr focusCtrl; + static Ptr focusCtrlWnd; + static Ptr lastActiveWnd; + static Ptr caretCtrl; + static Rect caretRect; + static Ptr captureCtrl; + static bool ignoreclick; + static bool ignorekeyup; + static bool mouseinview; + static bool mouseinframe; + static bool globalbackpaint; + static int LoopLevel; + static Ctrl *LoopCtrl; + + static Ptr defferedSetFocus; + static Vector< Ptr > defferedChildLostFocus; + + static Ptr repeatTopCtrl; + static Point repeatMousePos; + + static Vector& mousehook(); + static Vector& keyhook(); + static Vector& statehook(); + +#ifdef flagSO + static Ptr FocusCtrl(); + static void FocusCtrl(Ptr fc); +#else + static Ptr FocusCtrl() { return focusCtrl; } + static void FocusCtrl(Ptr fc) { focusCtrl = fc; } +#endif + + void StateDeep(int state); + + void RemoveChild0(Ctrl *q); + + static void ChSync(); + + static int FindMoveCtrl(const VectorMap& m, Ctrl *x); + static MoveCtrl *FindMoveCtrlPtr(VectorMap& m, Ctrl *x); + + Size PosVal(int v) const; + void Lay1(int& pos, int& r, int align, int a, int b, int sz) const; + Rect CalcRect(LogPos pos, const Rect& prect, const Rect& pview) const; + Rect CalcRect(const Rect& prect, const Rect& pview) const; + void UpdateRect0(); + void UpdateRect(); + void SetPos0(LogPos p, bool inframe); + void SetWndRect(const Rect& r); + void SyncMoves(); + + static void EndIgnore(); + static void LRep(); + static void LHold(); + static void LRepeat(); + static void RRep(); + static void RHold(); + static void RRepeat(); + static void MRep(); + static void MHold(); + static void MRepeat(); + static void KillRepeat(); + static void CheckMouseCtrl(); + static void DoCursorShape(); + static Image& CursorOverride(); + bool IsMouseActive() const; + Image MouseEventH(int event, Point p, int zdelta, dword keyflags); + Image FrameMouseEventH(int event, Point p, int zdelta, dword keyflags); + Image MEvent0(int e, Point p, int zd); + Image DispatchMouse(int e, Point p, int zd = 0); + Image DispatchMouseEvent(int e, Point p, int zd = 0); + void LogMouseEvent(const char *f, const Ctrl *ctrl, int event, Point p, int zdelta, dword keyflags); + + struct CallBox; + static void PerformCall(CallBox *cbox); + + void StateH(int reason); + + void RefreshAccessKeys(); + void RefreshAccessKeysDo(bool vis); + static void DefferedFocusSync(); + static void SyncCaret(); + static void RefreshCaret(); + static bool DispatchKey(dword keycode, int count); + void SetFocusWnd(); + void KillFocusWnd(); + + static Ptr dndctrl; + static Point dndpos; + static bool dndframe; + static PasteClip dndclip; + + void DnD(Point p, PasteClip& clip); + static void DnDRepeat(); + static void DnDLeave(); + + void SyncLayout(int force = 0); + bool AddScroll(const Rect& sr, int dx, int dy); + Rect GetClippedView(); + void ScrollRefresh(const Rect& r, int dx, int dy); + void SyncScroll(); + void PaintCaret(SystemDraw& w); + void CtrlPaint(SystemDraw& w, const Rect& clip); + void RemoveFullRefresh(); + bool PaintOpaqueAreas(SystemDraw& w, const Rect& r, const Rect& clip, bool nochild = false); + void GatherTransparentAreas(Vector& area, SystemDraw& w, Rect r, const Rect& clip); + Ctrl *FindBestOpaque(const Rect& clip); + void UpdateArea0(SystemDraw& draw, const Rect& clip, int backpaint); + void UpdateArea(SystemDraw& draw, const Rect& clip); + Ctrl *GetTopRect(Rect& r, bool inframe); + void DoSync(Ctrl *q, Rect r, bool inframe); + bool HasDHCtrl() const; + void SyncDHCtrl(); + void SetInfoPart(int i, const char *txt); + String GetInfoPart(int i) const; + +// System window interface... + void WndShow(bool b); + + void WndSetPos(const Rect& rect); + + bool IsWndOpen() const; + + bool SetWndCapture(); + bool HasWndCapture() const; + bool ReleaseWndCapture(); + + static void SetMouseCursor(const Image& m); + + static void DoDeactivate(Ptr pfocusCtrl, Ptr nfocusCtrl); + static void DoKillFocus(Ptr pfocusCtrl, Ptr nfocusCtrl); + static void DoSetFocus(Ptr pfocusCtrl, Ptr nfocusCtrl, bool activate); + + void ActivateWnd(); + void ClickActivateWnd(); + bool SetFocus0(bool activate); + bool SetWndFocus(); + bool HasWndFocus() const; + + static void WndDestroyCaret(); + void WndCreateCaret(const Rect& cr); + + void WndInvalidateRect(const Rect& r); + + void SetWndForeground(); + bool IsWndForeground() const; + + bool WndEnable(bool b); + + Rect GetWndUpdateRect() const; + Rect GetWndScreenRect() const; + void WndScrollView(const Rect& r, int dx, int dy); + void WndUpdate(); + void WndUpdate(const Rect& r); + + void WndFree(); + void WndDestroy0(); + void WndDestroy(); + + static void GuiSleep0(int ms); + + static void InitTimer(); + + static String appname; + + static Size Dsize; + static Size Csize; + static void Csizeinit(); + static void (*skin)(); + + friend void CtrlSetDefaultSkin(void (*fn1)(), void (*fn2)()); + friend class DHCtrl; + friend class ViewDraw; + friend class TopWindow; + friend class TrayIcon; + friend class GLCtrl; + friend class WaitCursor; + friend struct UDropSource; + friend class DnDAction; + friend class PasteClip; + +#ifdef PLATFORM_WIN32 + static LRESULT CALLBACK UtilityProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + static void RenderFormat(int format); + static void RenderAllFormats(); + static void DestroyClipboard(); + +public: + static Event& ExitLoopEvent(); + static bool& EndSession(); + static bool IsEndSession() { return EndSession(); } + static HINSTANCE hInstance; + +protected: + static HCURSOR hCursor; + + static VectorMap< HWND, Ptr >& Windows(); + static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + + static Event OverwatchEndSession; + static HWND OverwatchHWND; + static HANDLE OverwatchThread; + + static LRESULT CALLBACK OverwatchWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + static DWORD WINAPI Win32OverwatchThread(LPVOID); + + static Rect GetScreenClient(HWND hwnd); + struct CreateBox; + void Create0(CreateBox *cr); + void Create(HWND parent, DWORD style, DWORD exstyle, bool savebits, int show, bool dropshadow); + Image DoMouse(int e, Point p, int zd = 0); + + friend void sSetCursor(Ctrl *ctrl, const Image& m); + +public: + virtual void NcCreate(HWND hwnd); + virtual void NcDestroy(); + virtual void PreDestroy(); + virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); + + HWND GetHWND() const { return parent ? NULL : top ? top->hwnd : NULL; } + HWND GetOwnerHWND() const; + + static Ctrl *CtrlFromHWND(HWND hwnd); +#endif + +#ifdef PLATFORM_X11 +protected: + struct XWindow { + Ptr ctrl; + bool exposed; + Vector invalid; + Ptr owner; + Ptr last_active; + XIC xic; + }; + +private: + static ArrayMap& Xwindow(); + static int WndCaretTime; + static bool WndCaretVisible; + static int Xbuttons; + static int Xbuttontime; + static Window grabWindow, focusWindow; + static Point mousePos; + static int PopupGrab; + static Ptr popupWnd; + static Index sel_formats; + static Ptr sel_ctrl; + static void ProcessEvent(XEvent *event); + static void TimerAndPaint(); + static void ProcessEvent(XEvent& event); + void Invalidate(XWindow& xw, const Rect& r); + static void AnimateCaret(); + void DoPaint(const Vector& invalid); + void SetLastActive(XWindow *w, Ctrl *la); + XWindow *GetXWindow(); + static void SyncMousePos(); + static void ReleaseGrab(); + + void StartPopupGrab(); + static void EndPopupGrab(); + static void SyncIMPosition(); + + friend bool GetMouseRight(); + friend bool GetMouseLeft(); + friend bool GetMouseMiddle(); + friend Point GetMousePos(); + +protected: + void Create(Ctrl *owner, bool redirect, bool savebits); + void Create0(Ctrl *owner, bool redirect, bool savebits); + void SyncExpose(); + void TakeFocus(); + static Window GetXServerFocusWindow(); + void AddGlobalRepaint(); + static void KillFocus(Window w); + static void FocusSync(); + + void DropEvent(XWindow& w, XEvent *event); + static void DropStatusEvent(XEvent *event); + static Index drop_formats; + static String Unicode(const WString& w); + static WString Unicode(const String& s); + static bool ClipHas(int type, const char *fmt); + static String ClipGet(int type, const char *fmt); + + XWindow *AddXWindow(Window &w); + void RemoveXWindow(Window &w); + XWindow *XWindowFromWindow(Window &w); + +public: + struct Xclipboard { + Window win; + + VectorMap data; + + String Read(int fmt, int selection, int property); + void Write(int fmt, const ClipData& data); + bool IsAvailable(int fmt, const char *type); + + void Clear() { data.Clear(); } + void Request(XSelectionRequestEvent *se); + + Xclipboard(); + ~Xclipboard(); + }; + + static Xclipboard& xclipboard(); + + static int Xeventtime; + + static XIM xim; + + void DnD(Window src, bool paste); + + virtual void EventProc(XWindow& w, XEvent *event); + virtual bool HookProc(XEvent *event); + Window GetWindow() const { return top ? top->window : None; } + static Ctrl *CtrlFromWindow(Window w); + bool TrapX11Errors(); + void UntrapX11Errors(bool b); + + Window GetParentWindow(void) const; + Ctrl *GetParentWindowCtrl(void) const; + Rect GetRectInParentWindow(void) const; + + static void SyncNativeWindows(void); +#endif + +private: + void DoRemove(); + +protected: + static void TimerProc(dword time); + + Ctrl& Unicode() { unicode = true; return *this; } + +public: + enum StateReason { + FOCUS = 10, + ACTIVATE = 11, + DEACTIVATE = 12, + SHOW = 13, + ENABLE = 14, + EDITABLE = 15, + OPEN = 16, + CLOSE = 17, + POSITION = 100, + LAYOUTPOS = 101, + }; + + enum MouseEvents { + BUTTON = 0x0F, + ACTION = 0xF0, + + MOUSEENTER = 0x10, + MOUSEMOVE = 0x20, + MOUSELEAVE = 0x30, + CURSORIMAGE = 0x40, + MOUSEWHEEL = 0x50, + + DOWN = 0x80, + UP = 0x90, + DOUBLE = 0xa0, + REPEAT = 0xb0, + DRAG = 0xc0, + HOLD = 0xd0, + TRIPLE = 0xe0, + + LEFTDOWN = LEFT|DOWN, + LEFTDOUBLE = LEFT|DOUBLE, + LEFTREPEAT = LEFT|REPEAT, + LEFTUP = LEFT|UP, + LEFTDRAG = LEFT|DRAG, + LEFTHOLD = LEFT|HOLD, + LEFTTRIPLE = LEFT|TRIPLE, + + RIGHTDOWN = RIGHT|DOWN, + RIGHTDOUBLE = RIGHT|DOUBLE, + RIGHTREPEAT = RIGHT|REPEAT, + RIGHTUP = RIGHT|UP, + RIGHTDRAG = RIGHT|DRAG, + RIGHTHOLD = RIGHT|HOLD, + RIGHTTRIPLE = RIGHT|TRIPLE, + + MIDDLEDOWN = MIDDLE|DOWN, + MIDDLEDOUBLE = MIDDLE|DOUBLE, + MIDDLEREPEAT = MIDDLE|REPEAT, + MIDDLEUP = MIDDLE|UP, + MIDDLEDRAG = MIDDLE|DRAG, + MIDDLEHOLD = MIDDLE|HOLD, + MIDDLETRIPLE = MIDDLE|TRIPLE + }; + + enum { + NOBACKPAINT, + FULLBACKPAINT, + TRANSPARENTBACKPAINT, + EXCLUDEPAINT, + }; + + static Vector GetTopCtrls(); + static Vector GetTopWindows(); + static void CloseTopCtrls(); + + static void InstallMouseHook(MouseHook hook); + static void DeinstallMouseHook(MouseHook hook); + + static void InstallKeyHook(KeyHook hook); + static void DeinstallKeyHook(KeyHook hook); + + static void InstallStateHook(StateHook hook); + static void DeinstallStateHook(StateHook hook); + + virtual bool Accept(); + virtual void Reject(); + virtual void SetData(const Value& data); + virtual Value GetData() const; + virtual void Serialize(Stream& s); + virtual void SetModify(); + virtual void ClearModify(); + virtual bool IsModified() const; + + virtual void Paint(Draw& w); + virtual int OverPaint() const; + + virtual void CancelMode(); + + virtual void Activate(); + virtual void Deactivate(); + + virtual Image FrameMouseEvent(int event, Point p, int zdelta, dword keyflags); + virtual Image MouseEvent(int event, Point p, int zdelta, dword keyflags); + virtual void MouseEnter(Point p, dword keyflags); + virtual void MouseMove(Point p, dword keyflags); + virtual void LeftDown(Point p, dword keyflags); + virtual void LeftDouble(Point p, dword keyflags); + virtual void LeftTriple(Point p, dword keyflags); + virtual void LeftRepeat(Point p, dword keyflags); + virtual void LeftDrag(Point p, dword keyflags); + virtual void LeftHold(Point p, dword keyflags); + virtual void LeftUp(Point p, dword keyflags); + virtual void RightDown(Point p, dword keyflags); + virtual void RightDouble(Point p, dword keyflags); + virtual void RightTriple(Point p, dword keyflags); + virtual void RightRepeat(Point p, dword keyflags); + virtual void RightDrag(Point p, dword keyflags); + virtual void RightHold(Point p, dword keyflags); + virtual void RightUp(Point p, dword keyflags); + virtual void MiddleDown(Point p, dword keyflags); + virtual void MiddleDouble(Point p, dword keyflags); + virtual void MiddleTriple(Point p, dword keyflags); + virtual void MiddleRepeat(Point p, dword keyflags); + virtual void MiddleDrag(Point p, dword keyflags); + virtual void MiddleHold(Point p, dword keyflags); + virtual void MiddleUp(Point p, dword keyflags); + virtual void MouseWheel(Point p, int zdelta, dword keyflags); + virtual void MouseLeave(); + + virtual void DragAndDrop(Point p, PasteClip& d); + virtual void FrameDragAndDrop(Point p, PasteClip& d); + virtual void DragRepeat(Point p); + virtual void DragEnter(); + virtual void DragLeave(); + virtual String GetDropData(const String& fmt) const; + virtual String GetSelectionData(const String& fmt) const; + + virtual Image CursorImage(Point p, dword keyflags); + + virtual bool Key(dword key, int count); + virtual void GotFocus(); + virtual void LostFocus(); + virtual bool HotKey(dword key); + + virtual dword GetAccessKeys() const; + virtual void AssignAccessKeys(dword used); + + virtual void PostInput(); + + virtual void ChildFrameMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags); + virtual void ChildMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags); + virtual void ChildGotFocus(); + virtual void ChildLostFocus(); + virtual void ChildAdded(Ctrl *child); + virtual void ChildRemoved(Ctrl *child); + virtual void ParentChange(); + + virtual void State(int reason); + + virtual void Layout(); + + virtual Size GetMinSize() const; + virtual Size GetStdSize() const; + virtual Size GetMaxSize() const; + + virtual bool IsShowEnabled() const; + + virtual Rect GetOpaqueRect(); + virtual Rect GetVoidRect(); + + virtual void Updated(); + + virtual void Close(); + + virtual bool IsOcxChild(); + + virtual String GetDesc() const; + + Callback WhenAction; + + void AddChild(Ctrl *child); + void AddChild(Ctrl *child, Ctrl *insafter); + void AddChildBefore(Ctrl *child, Ctrl *insbefore); + void RemoveChild(Ctrl *child); + Ctrl *GetParent() const { return parent; } + Ctrl *GetLastChild() const { return lastchild; } + Ctrl *GetFirstChild() const { return firstchild; } + Ctrl *GetPrev() const { return parent ? prev : NULL; } + Ctrl *GetNext() const { return parent ? next : NULL; } + + bool IsChild() const { return parent; } + + Ctrl *ChildFromPoint(Point& pt) const; + + bool IsForeground() const; + void SetForeground(); + + const Ctrl *GetTopCtrl() const; + Ctrl *GetTopCtrl(); + const Ctrl *GetOwner() const; + Ctrl *GetOwner(); + const Ctrl *GetTopCtrlOwner() const; + Ctrl *GetTopCtrlOwner(); + + Ctrl *GetOwnerCtrl(); + const Ctrl *GetOwnerCtrl() const; + + const TopWindow *GetTopWindow() const; + TopWindow *GetTopWindow(); + + const TopWindow *GetMainWindow() const; + TopWindow *GetMainWindow(); + + Ctrl& SetFrame(int i, CtrlFrame& frm); + Ctrl& SetFrame(CtrlFrame& frm) { return SetFrame(0, frm); } + Ctrl& AddFrame(CtrlFrame& frm); + const CtrlFrame& GetFrame(int i = 0) const { return *frame[i].frame; } + CtrlFrame& GetFrame(int i = 0) { return *frame[i].frame; } + void RemoveFrame(int i); + void RemoveFrame(CtrlFrame& frm); + void InsertFrame(int i, CtrlFrame& frm); + int FindFrame(CtrlFrame& frm); + int GetFrameCount() const { return frame.GetCount(); } + void ClearFrames(); + + bool IsOpen() const; + + void Shutdown() { destroying = true; } + bool IsShutdown() const { return destroying; } + + Ctrl& SetPos(LogPos p, bool inframe); + + Ctrl& SetPos(LogPos p); + Ctrl& SetPos(Logc x, Logc y) { return SetPos(LogPos(x, y)); } + Ctrl& SetPosX(Logc x); + Ctrl& SetPosY(Logc y); + + void SetRect(const Rect& r); + void SetRect(int x, int y, int cx, int cy); + void SetRectX(int x, int cx); + void SetRectY(int y, int cy); + + Ctrl& SetFramePos(LogPos p); + Ctrl& SetFramePos(Logc x, Logc y) { return SetFramePos(LogPos(x, y)); } + Ctrl& SetFramePosX(Logc x); + Ctrl& SetFramePosY(Logc y); + + void SetFrameRect(const Rect& r); + void SetFrameRect(int x, int y, int cx, int cy); + void SetFrameRectX(int x, int cx); + void SetFrameRectY(int y, int cy); + + bool InFrame() const { return inframe; } + bool InView() const { return !inframe; } + LogPos GetPos() const { return pos; } + + void RefreshLayout() { SyncLayout(1); } + void RefreshLayoutDeep() { SyncLayout(2); } + void RefreshParentLayout() { if(parent) parent->RefreshLayout(); } + + void UpdateLayout() { SyncLayout(); } + void UpdateParentLayout() { if(parent) parent->UpdateLayout(); } + + Ctrl& LeftPos(int a, int size = STDSIZE); + Ctrl& RightPos(int a, int size = STDSIZE); + Ctrl& TopPos(int a, int size = STDSIZE); + Ctrl& BottomPos(int a, int size = STDSIZE); + Ctrl& HSizePos(int a = 0, int b = 0); + Ctrl& VSizePos(int a = 0, int b = 0); + Ctrl& SizePos(); + Ctrl& HCenterPos(int size = STDSIZE, int delta = 0); + Ctrl& VCenterPos(int size = STDSIZE, int delta = 0); + + Ctrl& LeftPosZ(int a, int size = STDSIZE); + Ctrl& RightPosZ(int a, int size = STDSIZE); + Ctrl& TopPosZ(int a, int size = STDSIZE); + Ctrl& BottomPosZ(int a, int size = STDSIZE); + Ctrl& HSizePosZ(int a = 0, int b = 0); + Ctrl& VSizePosZ(int a = 0, int b = 0); + Ctrl& HCenterPosZ(int size = STDSIZE, int delta = 0); + Ctrl& VCenterPosZ(int size = STDSIZE, int delta = 0); + + Rect GetRect() const; + Rect GetScreenRect() const; + + Rect GetView() const; + Rect GetScreenView() const; + Size GetSize() const; + + Rect GetVisibleScreenRect() const; + Rect GetVisibleScreenView() const; + + Rect GetWorkArea() const; + + Size AddFrameSize(int cx, int cy) const; + Size AddFrameSize(Size sz) const { return AddFrameSize(sz.cx, sz.cy); } + + void Refresh(const Rect& r); + void Refresh(int x, int y, int cx, int cy); + void Refresh(); + bool IsFullRefresh() const { return fullrefresh; } + + void RefreshFrame(const Rect& r); + void RefreshFrame(int x, int y, int cx, int cy); + void RefreshFrame(); + + void ScrollView(const Rect& r, int dx, int dy); + void ScrollView(int x, int y, int cx, int cy, int dx, int dy); + void ScrollView(int dx, int dy); + void ScrollView(const Rect& r, Size delta) { ScrollView(r, delta.cx, delta.cy); } + void ScrollView(Size delta) { ScrollView(delta.cx, delta.cy); } + + void Sync(); + void Sync(const Rect& r); + + static Image OverrideCursor(const Image& m); + + void DrawCtrl(Draw& w, int x = 0, int y = 0); + void DrawCtrlWithParent(Draw& w, int x = 0, int y = 0); + + bool HasChild(Ctrl *ctrl) const; + bool HasChildDeep(Ctrl *ctrl) const; + + Ctrl& IgnoreMouse(bool b = true) { ignoremouse = b; return *this; } + Ctrl& NoIgnoreMouse() { return IgnoreMouse(false); } + bool HasMouse() const; + bool HasMouseDeep() const; + bool HasMouseInFrame(const Rect& r); + bool HasMouseIn(const Rect& r) const; + Point GetMouseViewPos() const; + static Ctrl *GetMouseCtrl(); + + static void IgnoreMouseClick(); + static void IgnoreMouseUp(); + + bool SetCapture(); + bool ReleaseCapture(); + bool HasCapture() const; + static bool ReleaseCtrlCapture(); + + bool SetFocus(); + bool HasFocus() const { return FocusCtrl() == this; } + bool HasFocusDeep() const; + Ctrl& WantFocus(bool ft = true) { wantfocus = ft; return *this; } + Ctrl& NoWantFocus() { return WantFocus(false); } + bool IsWantFocus() const { return wantfocus; } + bool SetWantFocus(); + Ctrl& InitFocus(bool ft = true) { initfocus = ft; return *this; } + Ctrl& NoInitFocus() { return InitFocus(false); } + bool IsInitFocus() { return initfocus; } + Ctrl *GetFocusChild() const { return HasChild(FocusCtrl()) ? ~FocusCtrl() : NULL; } + Ctrl *GetFocusChildDeep() const { return HasChildDeep(FocusCtrl()) ? ~FocusCtrl() : NULL; } + + void CancelModeDeep(); + + void SetCaret(int x, int y, int cx, int cy); + void SetCaret(const Rect& r); + Rect GetCaret() const; + void KillCaret(); + + static Ctrl *GetFocusCtrl() { return FocusCtrl(); } + + static Ctrl *GetEventTopCtrl() { return eventCtrl; } + + static bool IterateFocusForward(Ctrl *ctrl, Ctrl *top, bool noframe = false, bool init = false, bool all = false); + static bool IterateFocusBackward(Ctrl *ctrl, Ctrl *top, bool noframe = false, bool all = false); + + static dword AccessKeyBit(int accesskey); + dword GetAccessKeysDeep() const; + void DistributeAccessKeys(); + bool VisibleAccessKeys(); + + void Show(bool show = true); + void Hide() { Show(false); } + bool IsShown() const { return visible; } + bool IsVisible() const; + + void Enable(bool enable = true); + void Disable() { Enable(false); } + bool IsEnabled() const { return enabled; } + + Ctrl& SetEditable(bool editable = true); + Ctrl& SetReadOnly() { return SetEditable(false); } + bool IsEditable() const { return editable; } + bool IsReadOnly() const { return !editable; } + + void ResetModify() { modify = false; } + bool IsModifySet() const { return modify; } + + void UpdateRefresh(); + void Update(); + void Action(); + void UpdateAction(); + void UpdateActionRefresh(); + + Ctrl& BackPaint(int bp = FULLBACKPAINT) { backpaint = bp; return *this; } + Ctrl& TransparentBackPaint() { backpaint = TRANSPARENTBACKPAINT; return *this; } + Ctrl& NoBackPaint() { return BackPaint(NOBACKPAINT); } + Ctrl& BackPaintHint(); + int GetBackPaint() { return backpaint; } + Ctrl& Transparent(bool bp = true) { transparent = bp; return *this; } + Ctrl& NoTransparent() { return Transparent(false); } + bool IsTransparent() const { return transparent; } +#ifdef PLATFORM_WIN32 + Ctrl& ActiveX(bool ax = true) { activex = ax; return *this; } + Ctrl& NoActiveX() { return ActiveX(false); } + bool IsActiveX() const { return activex; } +#endif + + Ctrl& Info(const char *txt) { info = txt; return *this; } + String GetInfo() const { return info; } + + Ctrl& Tip(const char *txt); + Ctrl& HelpLine(const char *txt); + Ctrl& Description(const char *txt); + Ctrl& HelpTopic(const char *txt); + Ctrl& LayoutId(const char *txt); + + String GetTip() const; + String GetHelpLine() const; + String GetDescription() const; + String GetHelpTopic() const; + String GetLayoutId() const; + + void Add(Ctrl& ctrl) { AddChild(&ctrl); } + Ctrl& operator<<(Ctrl& ctrl) { Add(ctrl); return *this; } + + void Remove(); + + Value operator~() const { return GetData(); } + const Value& operator<<=(const Value& v) { SetData(v); return v; } + bool IsNullInstance() const { return GetData().IsNull(); } + + Callback operator<<=(Callback action) { WhenAction = action; return action; } + Callback& operator<<(Callback action) { return WhenAction << action; } + + void SetTimeCallback(int delay_ms, Callback cb, int id = 0); + void KillTimeCallback(int id = 0); + void KillSetTimeCallback(int delay_ms, Callback cb, int id); + bool ExistsTimeCallback(int id = 0) const; + void PostCallback(Callback cb, int id = 0); + void KillPostCallback(Callback cb, int id); + + static void Call(Callback cb); + + enum { TIMEID_COUNT = 1 }; + + static void SetTimerGranularity(int ms); + + static Ctrl *GetActiveCtrl(); + static Ctrl *GetActiveWindow(); + + static Ctrl *GetVisibleChild(Ctrl *ctrl, Point p, bool pointinframe); + +#ifdef PLATFORM_WIN32 + void PopUpHWND(HWND hwnd, bool savebits = true, bool activate = true, bool dropshadow = false, + bool topmost = false); +#endif + void PopUp(Ctrl *owner = NULL, bool savebits = true, bool activate = true, bool dropshadow = false, + bool topmost = false); + + void SetAlpha(byte alpha); + + static bool IsWaitingEvent(); + static bool ProcessEvent(bool *quit = NULL); + static bool ProcessEvents(bool *quit = NULL); + + bool IsPopUp() const { return popup; } + + static void EventLoop0(Ctrl *ctrl); + static void EventLoop(Ctrl *loopctrl = NULL); + static int GetLoopLevel() { return LoopLevel; } + static Ctrl *GetLoopCtrl() { return LoopCtrl; } + + void EndLoop(); + void EndLoop(int code); + bool InLoop() const; + bool InCurrentLoop() const; + int GetExitCode() const; + + static PasteClip& Clipboard(); + static PasteClip& Selection(); + + void SetSelectionSource(const char *fmts); + + int DoDragAndDrop(const char *fmts, const Image& sample, dword actions, + const VectorMap& data); + int DoDragAndDrop(const char *fmts, const Image& sample = Null, dword actions = DND_ALL); + int DoDragAndDrop(const VectorMap& data, const Image& sample = Null, + dword actions = DND_ALL); + static Ctrl *GetDragAndDropSource(); + static Ctrl *GetDragAndDropTarget(); + bool IsDragAndDropSource() { return this == GetDragAndDropSource(); } + bool IsDragAndDropTarget() { return this == GetDragAndDropTarget(); } + static Size StdSampleSize() { return Size(126, 106); } + + void SetMinSize(Size sz) {} // see CtrlLayout template and WindowCtrl... + +public: + static void SetSkin(void (*skin)()); + + static const char *GetZoomText(); + static void SetZoomSize(Size sz, Size bsz = Size(0, 0)); + static int HorzLayoutZoom(int cx); + static int VertLayoutZoom(int cy); + static Size LayoutZoom(int cx, int cy); + static Size LayoutZoom(Size sz); + static void NoLayoutZoom(); + static void GetZoomRatio(Size& m, Size& d); + + static int HZoom(int cx) { return HorzLayoutZoom(cx); } + + static bool ClickFocus(); + static void ClickFocus(bool cf); + + static Rect GetVirtualWorkArea(); + static Rect GetVirtualScreenArea(); + static Rect GetPrimaryWorkArea(); + static Rect GetPrimaryScreenArea(); + static void GetWorkArea(Array& rc); + static Rect GetWorkArea(Point pt); + static int GetKbdDelay(); + static int GetKbdSpeed(); + static bool IsAlphaSupported(); + static Rect GetDefaultWindowRect(); + static String GetAppName(); + static void SetAppName(const String& appname); + static bool IsCompositedGui(); + + static void GlobalBackPaint(bool b = true); + static void GlobalBackPaintHint(); + + String Name() const; + +#ifdef _DEBUG + virtual void Dump() const; + virtual void Dump(Stream& s) const; + + static bool LogMessages; +#endif + + static void ShowRepaint(int ms); + + static bool MemoryCheck; + +#ifdef PLATFORM_WIN32 + static void InitWin32(HINSTANCE hinst); + static void ExitWin32(); +#ifdef PLATFORM_WINCE + static void GuiFlush() {} +#else + static void GuiFlush() { ::GdiFlush(); } +#endif +#endif + +#ifdef PLATFORM_X11 + static void InitX11(const char *display); + static void ExitX11(); + static void GuiFlush() { XFlush(Xdisplay); } +#endif + + static void GuiSleep(int ms); + + Ctrl(); + virtual ~Ctrl(); +}; + +Font FontZ(int face, int height = 0); +Font StdFontZ(int height = 0); +Font ScreenSansZ(int height = 0); +Font ScreenSerifZ(int height = 0); +Font ScreenFixedZ(int height = 0); +Font RomanZ(int height = 0); +Font ArialZ(int height = 0); +Font CourierZ(int height = 0); + +int EditFieldIsThin(); +Value TopSeparator1(); +Value TopSeparator2(); +int FrameButtonWidth(); +int ScrollBarArrowSize(); +Color FieldFrameColor(); + +enum { GUISTYLE_FLAT, GUISTYLE_CLASSIC, GUISTYLE_XP, GUISTYLE_X }; +int GUI_GlobalStyle(); + +int GUI_DragFullWindow(); + +enum { GUIEFFECT_NONE, GUIEFFECT_SLIDE, GUIEFFECT_FADE }; +int GUI_PopUpEffect(); + +int GUI_DropShadows(); +int GUI_AltAccessKeys(); +int GUI_AKD_Conservative(); +int GUI_DragDistance(); +int GUI_DblClickTime(); + +void GUI_GlobalStyle_Write(int); +void GUI_DragFullWindow_Write(int); +void GUI_PopUpEffect_Write(int); +void GUI_DropShadows_Write(int); +void GUI_AltAccessKeys_Write(int); +void GUI_AKD_Conservative_Write(int); +void GUI_DragDistance_Write(int); +void GUI_DblClickTime_Write(int); + +void EditFieldIsThin_Write(int); +void TopSeparator1_Write(Value); +void TopSeparator2_Write(Value); +void FrameButtonWidth_Write(int); +void ScrollBarArrowSize_Write(int); +void FieldFrameColor_Write(Color); + +String Name(const Ctrl *ctrl); +String Desc(const Ctrl *ctrl); +void Dump(const Ctrl *ctrl); + +inline Ctrl *operator<<(Ctrl *parent, Ctrl& child) +{ + parent->Add(child); + return parent; +} + +inline unsigned GetHashValue(Ctrl *x) +{ + return (unsigned)(intptr_t)x; +} + +String GetKeyDesc(dword key); + +Vector< Ptr > DisableCtrls(const Vector& ctrl, Ctrl *exclude = NULL); +void EnableCtrls(const Vector< Ptr >& ctrl); + +template +class FrameCtrl : public T, public CtrlFrame { +public: + virtual void FrameAdd(Ctrl& parent) { parent.Add(*this); } + virtual void FrameRemove() { this->Ctrl::Remove(); } + + FrameCtrl() { this->NoWantFocus(); } +}; + +template +class FrameLR : public FrameCtrl { +public: + virtual void FrameAddSize(Size& sz) { sz.cx += (cx ? cx : sz.cy) * this->IsShown(); } + +protected: + int cx; + +public: + FrameLR& Width(int _cx) { cx = _cx; this->RefreshParentLayout(); return *this; } + int GetWidth() const { return cx; } + FrameLR() { cx = 0; } +}; + +template +class FrameLeft : public FrameLR { +public: + virtual void FrameLayout(Rect& r) { + LayoutFrameLeft(r, this, this->cx ? this->cx : FrameButtonWidth()); + } +}; + +template +class FrameRight : public FrameLR { +public: + virtual void FrameLayout(Rect& r) { + LayoutFrameRight(r, this, this->cx ? this->cx : FrameButtonWidth()); + } +}; + +template +class FrameTB : public FrameCtrl { +public: + virtual void FrameAddSize(Size& sz) { sz.cy += (cy ? cy : sz.cx) * this->IsShown(); } + +protected: + int cy; + +public: + FrameTB& Height(int _cy) { cy = _cy; this->RefreshParentLayout(); return *this; } + int GetHeight() const { return cy; } + FrameTB() { cy = 0; } +}; + +template +class FrameTop : public FrameTB { +public: + virtual void FrameLayout(Rect& r) { + LayoutFrameTop(r, this, this->cy ? this->cy : r.Width()); + } +}; + +template +class FrameBottom : public FrameTB { +public: + virtual void FrameLayout(Rect& r) { + LayoutFrameBottom(r, this, this->cy ? this->cy : r.Width()); + } +}; + +class Modality { + Ptr active; + bool fore_only; + Vector< Ptr > enable; + +public: + void Begin(Ctrl *modal, bool fore_only = false); + void End(); + + ~Modality() { End(); } +}; + +class ViewDraw : public SystemDraw { +public: + ViewDraw(Ctrl *ctrl); + ~ViewDraw(); + +protected: +#ifdef PLATFORM_WIN32 + HWND hwnd; +#endif +#ifdef PLATFORM_X11 + bool caret; +#endif +}; + +#ifdef PLATFORM_WIN32 +#ifdef COMPILER_MSC +inline unsigned GetHashValue(const HWND& hwnd) +{ + return (unsigned)(intptr_t)hwnd; +} +#endif +#endif + +class LocalLoop : public Ctrl { + Ctrl *master; + +public: + void Run(); + void SetMaster(Ctrl& m) { master = &m; } + Ctrl& GetMaster() const { return *master; } + + LocalLoop() { master = NULL; } +}; + +void DrawDragRect(Ctrl& q, const Rect& rect1, const Rect& rect2, const Rect& clip, int n, + Color color, const word *pattern); + +bool PointLoop(Ctrl& ctrl, const Vector& ani, int ani_ms); +bool PointLoop(Ctrl& ctrl, const Image& img); + +class RectTracker : public LocalLoop { +public: + virtual void LeftUp(Point, dword); + virtual void RightUp(Point, dword); + virtual void MouseMove(Point p, dword); + virtual Image CursorImage(Point, dword); + +public: + struct Rounder { + virtual Rect Round(const Rect& r) = 0; + virtual ~Rounder() {} + }; + +protected: + Rect rect; + int tx, ty; + Rect maxrect; + Size minsize, maxsize; + bool keepratio; + Rect clip; + Color color; + Image cursorimage; + int width; + uint64 pattern; + int animation; + int panim; + Rounder *rounder; + + Rect org; + Rect o; + Point op; + + Rect Round(const Rect& r) { return rounder ? rounder->Round(r) : r; } + + virtual void DrawRect(Rect r1, Rect r2); + +public: + Callback1 sync; + + RectTracker& SetCursorImage(const Image& m) { cursorimage = m; return *this; } + RectTracker& MinSize(Size sz) { minsize = sz; return *this; } + RectTracker& MaxSize(Size sz) { maxsize = sz; return *this; } + RectTracker& MaxRect(const Rect& mr) { maxrect = mr; return *this; } + RectTracker& Clip(const Rect& c) { clip = c; return *this; } + RectTracker& Width(int n) { width = n; return *this; } + RectTracker& SetColor(Color c) { color = c; return *this; } + RectTracker& Pattern(uint64 p) { pattern = p; return *this; } + RectTracker& Dashed(); + RectTracker& Solid(); + RectTracker& Animation(int step_ms = 40) { animation = step_ms; return *this; } + RectTracker& KeepRatio(bool b) { keepratio = b; return *this; } + RectTracker& Round(Rounder& r) { rounder = &r; return *this; } + + Rect Get() { return rect; } + + Rect Track(const Rect& r, int tx = ALIGN_RIGHT, int ty = ALIGN_BOTTOM); + int TrackHorzLine(int x0, int y0, int cx, int line); + int TrackVertLine(int x0, int y0, int cy, int line); + + RectTracker(Ctrl& master); + virtual ~RectTracker(); +}; + +class WaitCursor { + Image prev; + bool flag; + +public: + void Show(); + + WaitCursor(bool show = true); + ~WaitCursor(); +}; + +class AutoWaitCursor : public WaitCursor { +protected: + int& avg; + int time0; + +public: + void Cancel() { time0 = 0; } + + AutoWaitCursor(int& avg); + ~AutoWaitCursor(); +}; + +void ClearClipboard(); +void AppendClipboard(const char *format, const byte *data, int length); +void AppendClipboard(const char *format, const String& data); +void AppendClipboard(const char *format, const Value& data, String (*render)(const Value& data)); +String ReadClipboard(const char *format); +bool IsClipboardAvailable(const char *format); + +inline void WriteClipboard(const char *format, const String& data) + { ClearClipboard(); AppendClipboard(format, data); } + +void AppendClipboardText(const String& s); +String ReadClipboardText(); +void AppendClipboardUnicodeText(const WString& s); +WString ReadClipboardUnicodeText(); +bool IsClipboardAvailableText(); + +inline void WriteClipboardText(const String& s) + { ClearClipboard(); AppendClipboardText(s); } +inline void WriteClipboardUnicodeText(const WString& s) + { ClearClipboard(); AppendClipboardUnicodeText(s); } + +template +inline void AppendClipboardFormat(const T& object) { + AppendClipboard(typeid(T).name(), StoreAsString(const_cast(object))); +} + +template +inline void WriteClipboardFormat(const T& object) { + ClearClipboard(); + AppendClipboardFormat(object); +} + +template +inline bool ReadClipboardFormat(T& object) +{ + String s = ReadClipboard(typeid(T).name()); + return !IsNull(s) && LoadFromString(object, s); +} + +template +bool IsClipboardFormatAvailable() +{ + return IsClipboardAvailable(typeid(T).name()); +} + +template +inline T ReadClipboardFormat() { + T object; + ReadClipboardFormat(object); + return object; +} + +Image ReadClipboardImage(); +void AppendClipboardImage(const Image& img); + +inline void WriteClipboardImage(const Image& img) + { ClearClipboard(); AppendClipboardImage(img); } + +#include + +bool (*&DisplayErrorFn())(const Value& v); +inline bool DisplayError(const Value& v) { return DisplayErrorFn()(v); } + +#ifdef PLATFORM_WIN32 + +Vector& coreCmdLine__(); +Vector SplitCmdLine__(const char *cmd); + +#ifdef PLATFORM_WINCE + +#define GUI_APP_MAIN \ +void GuiMainFn_();\ +\ +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int nCmdShow) \ +{ \ + UPP::Ctrl::InitWin32(hInstance); \ + UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::FromSystemCharset(lpCmdLine)); \ + UPP::AppInitEnvironment__(); \ + GuiMainFn_(); \ + UPP::Ctrl::CloseTopCtrls(); \ + UPP::UsrLog("---------- About to delete this log..."); \ + UPP::DeleteUsrLog(); \ + UPP::Ctrl::ExitWin32(); \ + UPP::AppExit__(); \ + return UPP::GetExitCode(); \ +} \ +\ +void GuiMainFn_() + +#else + +#define GUI_APP_MAIN \ +void GuiMainFn_();\ +\ +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow) \ +{ \ + UPP::Ctrl::InitWin32(hInstance); \ + UPP::coreCmdLine__() = UPP::SplitCmdLine__(lpCmdLine); \ + UPP::AppInitEnvironment__(); \ + GuiMainFn_(); \ + UPP::Ctrl::CloseTopCtrls(); \ + UPP::UsrLog("---------- About to delete this log..."); \ + UPP::DeleteUsrLog(); \ + UPP::Ctrl::ExitWin32(); \ + UPP::AppExit__(); \ + return UPP::GetExitCode(); \ +} \ +\ +void GuiMainFn_() + +#endif +#endif + +#ifdef PLATFORM_POSIX + +#define GUI_APP_MAIN \ +void GuiMainFn_(); \ +\ +int main(int argc, const char **argv, const char **envptr) { \ + UPP::AppInit__(argc, argv, envptr); \ + UPP::Ctrl::InitX11(NULL); \ + GuiMainFn_(); \ + UPP::Ctrl::CloseTopCtrls(); \ + UPP::UsrLog("---------- About to delete this log..."); \ + UPP::DeleteUsrLog(); \ + UPP::Ctrl::ExitX11(); \ + UPP::AppExit__(); \ + return UPP::GetExitCode(); \ +} \ + \ +void GuiMainFn_() + +#endif + +#ifdef PLATFORM_WIN32 +#ifndef PLATFORM_WINCE + +class DHCtrl : public Ctrl { +public: + virtual void State(int reason); + virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); + virtual void NcCreate(HWND hwnd); + virtual void NcDestroy(); + +private: + HWND hwnd; + + void CloseHWND(); + void OpenHWND(); + void SyncHWND(); + +public: + HWND GetHWND() { return hwnd; } +// void Refresh() { InvalidateRect(GetHWND(), NULL, false); } + + DHCtrl(); + ~DHCtrl(); +}; + +#endif +#endif + +#ifdef PLATFORM_X11 + +class DHCtrl : public Ctrl { + bool isInitialized; + int isError; + bool isMapped; + Size CurrentSize; + XVisualInfo* UserVisualInfo; + String ErrorMessage; + + void MapWindow(bool map); + bool Init(void); + void Terminate(void); + + virtual void State(int reason); + +protected: + Visual *GetVisual(void); + XVisualInfo GetVisualInfo(void); + + virtual XVisualInfo *CreateVisual(void) {return 0;} + virtual void SetAttributes(unsigned long &ValueMask, XSetWindowAttributes &attr) {} + virtual void Paint(Draw &draw) {} + virtual void BeforeInit(void) {} + virtual void AfterInit(bool Error) {} + virtual void BeforeTerminate(void) {} + virtual void AfterTerminate(void) {} + virtual void Resize(int w, int h) {} + + void SetError(bool err) { isError = err; } + void SetErrorMessage(String const &msg) { ErrorMessage = msg; } + +public: + typedef DHCtrl CLASSNAME; + + bool IsInitialized(void) { return isInitialized; } + + bool GetError(void) { return isError; } + String GetErrorMessage(void) { return ErrorMessage; } + + DHCtrl(); + ~DHCtrl(); +}; + +#endif + +END_UPP_NAMESPACE + +#ifdef PLATFORM_WIN32 +#ifndef PLATFORM_WINCE + +#include + +#endif +#endif + +#endif diff --git a/olddraw/CtrlCore/CtrlCore.icpp b/olddraw/CtrlCore/CtrlCore.icpp new file mode 100644 index 000000000..f3741126e --- /dev/null +++ b/olddraw/CtrlCore/CtrlCore.icpp @@ -0,0 +1,8 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define TFILE +#include + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/CtrlCore.t b/olddraw/CtrlCore/CtrlCore.t new file mode 100644 index 000000000..a6c258cd0 --- /dev/null +++ b/olddraw/CtrlCore/CtrlCore.t @@ -0,0 +1,355 @@ +#ifdef _MSC_VER +#pragma setlocale("C") +#endif +// CtrlKbd.cpp + +T_("key\vCtrl+") +deDE("Strg+") +esES("Ctrl+") +fiFI("Ctrl+") +frFR("") +huHU("Ctrl+") +nlNL("Ctrl+") +roRO("tastă\vCtrl+") +ruRU("") +skSK("Ctrl+") +trTR("Ctrl+") +zhTW("Ctrl+") + +T_("key\vAlt+") +deDE("Alt+") +esES("Alt+") +fiFI("Alt+") +frFR("") +huHU("Alt+") +nlNL("Alt+") +roRO("tastă\vAlt+") +ruRU("") +skSK("Alt+") +trTR("Alt+") +zhTW("Alt+") + +T_("key\vShift+") +deDE("Umschalt+") +esES("May+") +fiFI("Shift+") +frFR("") +huHU("Shift+") +nlNL("Shift+") +roRO("tastă\vShift+") +ruRU("") +skSK("Shift+") +trTR("Shift+") +zhTW("Shift+") + +T_("key\vTab") +deDE("Tab") +esES("Tab") +fiFI("Tabulaattori") +frFR("") +huHU("Tab") +nlNL("Tab") +roRO("tastă\vTab") +ruRU("") +skSK("Tab") +trTR("Tab") +zhTW("Tab") + +T_("key\vSpace") +deDE("Leertaste") +esES("Espacio") +fiFI("Välilyönti") +frFR("") +huHU("Space") +nlNL("Spatie") +roRO("tastă\vSpaÈ›iu") +ruRU("") +skSK("Space") +trTR("Space") +zhTW("Space") + +T_("key\vEnter") +deDE("Eingabetaste") +esES("Intro") +fiFI("Enter") +frFR("") +huHU("Enter") +nlNL("Enter") +roRO("tastă\vEnter") +ruRU("") +skSK("Enter") +trTR("Enter") +zhTW("Enter") + +T_("key\vBackspace") +deDE("Rückschritt") +esES("Retroceso") +fiFI("Backspace") +frFR("") +huHU("Backspace") +nlNL("Backspace") +roRO("tastă\vBackspace") +ruRU("") +skSK("Backspace") +trTR("Backspace") +zhTW("Backspace") + +T_("key\vCaps Lock") +deDE("Umschaltverriegelung") +esES("Bloq May") +fiFI("Caps Lock") +frFR("") +huHU("Caps Lock") +nlNL("Caps Lock") +roRO("tastă\vCaps Lock") +ruRU("") +skSK("Caps Lock") +trTR("Caps Lock") +zhTW("Caps Lock") + +T_("key\vEsc") +deDE("Esc") +esES("Esc") +fiFI("Esc") +frFR("") +huHU("Esc") +nlNL("Escape") +roRO("tastă\vEsc") +ruRU("") +skSK("Esc") +trTR("Esc") +zhTW("Esc") + +T_("key\vPage Up") +deDE("Bild hoch") +esES("Pág Arriba") +fiFI("Page Down") +frFR("") +huHU("Page Up") +nlNL("Page Up") +roRO("tastă\vPage Up") +ruRU("") +skSK("Page Up") +trTR("Page Up") +zhTW("Page Up") + +T_("key\vPage Down") +deDE("Bild runter") +esES("Pág Abajo") +fiFI("Page Down") +frFR("") +huHU("Page Down") +nlNL("Page Down") +roRO("tastă\vPage Down") +ruRU("") +skSK("Page Down") +trTR("Page Down") +zhTW("Page Down") + +T_("key\vEnd") +deDE("Ende") +esES("Fin") +fiFI("End") +frFR("") +huHU("End") +nlNL("Einde") +roRO("tastă\vEnd") +ruRU("") +skSK("End") +trTR("End") +zhTW("End") + +T_("key\vHome") +deDE("Pos1") +esES("Inicio") +fiFI("Home") +frFR("") +huHU("Home") +nlNL("Begin") +roRO("tastă\vHome") +ruRU("") +skSK("Home") +trTR("Home") +zhTW("Home") + +T_("key\vLeft") +deDE("Links") +esES("Izq") +fiFI("Vasen") +frFR("") +huHU("Bal") +nlNL("Links") +roRO("tastă\vStânga") +ruRU("") +skSK("Doľava") +trTR("Left") +zhTW("Left") + +T_("key\vUp") +deDE("Hoch") +esES("Arriba") +fiFI("Ylös") +frFR("") +huHU("Up") +nlNL("Boven") +roRO("tastă\vSus") +ruRU("") +skSK("Hore") +trTR("Up") +zhTW("Up") + +T_("key\vRight") +deDE("Rechts") +esES("Derecha") +fiFI("Oikea") +frFR("") +huHU("Jobb") +nlNL("Rechts") +roRO("tastă\vDreapta") +ruRU("") +skSK("Doprava") +trTR("Right") +zhTW("Right") + +T_("key\vDown") +deDE("Runter") +esES("Abajo") +fiFI("Alas") +frFR("") +huHU("Down") +nlNL("Beneden") +roRO("tastă\vJos") +ruRU("") +skSK("Dole") +trTR("Down") +zhTW("Down") + +T_("key\vInsert") +deDE("Einfg") +esES("Insertar") +fiFI("Insert") +frFR("") +huHU("Insert") +nlNL("Invoegen") +roRO("tastă\vInsert") +ruRU("") +skSK("Insert") +trTR("Insert") +zhTW("Insert") + +T_("key\vDelete") +deDE("Entf") +esES("Borrar") +fiFI("Delete") +frFR("") +huHU("Delete") +nlNL("Verwijderen") +roRO("tastă\vDelete") +ruRU("") +skSK("Delete") +trTR("Delete") +zhTW("Delete") + +T_("key\vBreak") +deDE("UntBr") +esES("Break") +fiFI("Break") +frFR("") +huHU("Break") +nlNL("Break") +roRO("tastă\vBreak") +ruRU("") +skSK("Break") +trTR("Break") +zhTW("Break") + +T_("key\vNum[*]") +deDE("Num[*]") +esES("Num[*]") +fiFI("Num[*]") +frFR("") +huHU("Num[*]") +nlNL("Num[*]") +roRO("tastă\vNum[*]") +ruRU("") +skSK("Num[*]") +trTR("Num[*]") +zhTW("Num[*]") + +T_("key\vNum[+]") +deDE("Num[+]") +esES("Num[+]") +fiFI("Num[+]") +frFR("") +huHU("Num[+]") +nlNL("Num[+]") +roRO("tastă\vNum[+]") +ruRU("") +skSK("Num[+]") +trTR("Num[+]") +zhTW("Num[+]") + +T_("key\vNum[-]") +deDE("Num[-]") +esES("Num[-]") +fiFI("Num[-]") +frFR("") +huHU("Num[-]") +nlNL("Num[-]") +roRO("tastă\vNum[-]") +ruRU("") +skSK("Num[-]") +trTR("Num[-]") +zhTW("Num[-]") + +T_("key\vNum[/]") +deDE("Num[/]") +esES("Num[/]") +fiFI("Num[/]") +frFR("") +huHU("Num[/]") +nlNL("Num[/]") +roRO("tastă\vNum[/]") +ruRU("") +skSK("Num[/]") +trTR("Num[/]") +zhTW("Num[/]") + +T_("key\vAlt") +deDE("Alt") +esES("Alt") +fiFI("Alt") +frFR("") +huHU("Alt") +nlNL("Alt") +roRO("tastă\vAlt") +ruRU("") +skSK("Alt") +trTR("Alt") +zhTW("Alt") + +T_("key\vShift") +deDE("Umschalt") +esES("May") +fiFI("Shift") +frFR("") +huHU("Shift") +nlNL("Shift") +roRO("tastă\vShift") +ruRU("") +skSK("Shift") +trTR("Shift") +zhTW("Shift") + +T_("key\vCtrl") +deDE("Strg") +esES("Ctrl") +fiFI("Ctrl") +frFR("") +huHU("Ctrl") +nlNL("Ctrl") +roRO("tastă\vCtrl") +ruRU("") +skSK("Ctrl") +trTR("Ctrl") +zhTW("Ctrl") diff --git a/olddraw/CtrlCore/CtrlCore.upp b/olddraw/CtrlCore/CtrlCore.upp new file mode 100644 index 000000000..be3433edd --- /dev/null +++ b/olddraw/CtrlCore/CtrlCore.upp @@ -0,0 +1,56 @@ +description "GUI core system\377B0,0,255"; + +uses + Draw, + plugin\bmp; + +library(WIN32 !MSC8ARM) "advapi32 comdlg32 comctl32"; + +file + Core readonly separator, + CtrlCore.h, + Win32Keys.i, + X11Keys.i, + MKeys.h, + Frame.cpp, + Ctrl.cpp, + CtrlChild.cpp, + CtrlPos.cpp, + CtrlDraw.cpp, + CtrlMouse.cpp, + CtrlKbd.cpp, + CtrlTimer.cpp, + CtrlClip.cpp, + LocalLoop.cpp, + CtrlCore.icpp, + Ctrl.iml, + CtrlCore.t, + TopWindow readonly separator, + TopWindow.h, + TopWindow.cpp, + lay.h, + llay.h, + Win32 readonly separator, + MultiMon.dli, + Win32Wnd.cpp, + Win32Clip.cpp, + Win32DnD.cpp, + Win32Proc.cpp, + TopWin32.cpp, + DHCtrl.cpp, + Win32Msg.i, + X11 readonly separator, + X11Wnd.cpp, + X11Proc.cpp, + TopWinX11.cpp, + X11Clip.cpp, + X11DnD.cpp, + X11ImgClip.cpp, + X11App.cpp, + X11DHCtrl.cpp, + X11Event.i, + Info readonly separator, + src.tpp, + srcdoc.tpp, + Copying; + diff --git a/olddraw/CtrlCore/CtrlDraw.cpp b/olddraw/CtrlCore/CtrlDraw.cpp new file mode 100644 index 000000000..9d6437042 --- /dev/null +++ b/olddraw/CtrlCore/CtrlDraw.cpp @@ -0,0 +1,662 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) // DLOG(x) +#define LTIMING(x) // TIMING(x) + +bool Ctrl::globalbackpaint; + +void Ctrl::RefreshFrame(const Rect& r) { + GuiLock __; + if(!IsOpen() || !IsVisible() || r.IsEmpty()) return; + LTIMING("RefreshFrame"); + LLOG("RefreshRect " << Name() << ' ' << r); +#ifdef PLATFORM_WIN32 + if(isdhctrl) { + InvalidateRect(((DHCtrl *)this)->GetHWND(), r, false); + return; + } +#endif + if(!top) { + if(InFrame()) + parent->RefreshFrame(r + GetRect().TopLeft()); + else + parent->Refresh(r + GetRect().TopLeft()); + } + else { + LLOG("WndInvalidateRect: " << r << ' ' << Name()); + LTIMING("RefreshFrame InvalidateRect"); + WndInvalidateRect(r); +#ifdef PLATFORM_WIN32 + LLOG("UpdateRect: " << GetWndUpdateRect() << ' ' << Name()); +#endif + } +} + +void Ctrl::Refresh(const Rect& area) { + GuiLock __; + if(fullrefresh || !IsVisible() || !IsOpen()) return; + LLOG("Refresh " << Name() << ' ' << area); + RefreshFrame((area + GetView().TopLeft()) & GetView().Inflated(OverPaint())); +} + +void Ctrl::Refresh() { + GuiLock __; + if(fullrefresh || !IsVisible() || !IsOpen()) return; + LLOG("Refresh " << Name() << " full:" << fullrefresh); + Refresh(Rect(GetSize()).Inflated(OverPaint())); +#ifdef PLATFORM_WIN32 + if(!isdhctrl) +#endif + fullrefresh = true; +} + +void Ctrl::Refresh(int x, int y, int cx, int cy) { + Refresh(RectC(x, y, cx, cy)); +} + +void Ctrl::RefreshFrame(int x, int y, int cx, int cy) { + RefreshFrame(RectC(x, y, cx, cy)); +} + +void Ctrl::RefreshFrame() { + LLOG("RefreshFrame " << Name()); + RefreshFrame(Rect(GetRect().Size()).Inflated(overpaint)); +} + +void Ctrl::ScrollRefresh(const Rect& r, int dx, int dy) +{ + GuiLock __; + if(!IsOpen() || !IsVisible() || r.IsEmpty()) return; + int tdx = tabs(dx), tdy = tabs(dy); + if(dx) WndInvalidateRect(RectC(dx >= 0 ? r.left : r.right - tdx, r.top - tdy, tdx, r.Height())); + if(dy) WndInvalidateRect(RectC(r.left - tdx, dy >= 0 ? r.top : r.bottom - tdy, r.Width(), tdy)); +} + +bool Ctrl::AddScroll(const Rect& sr, int dx, int dy) +{ + GuiLock __; + if(!top) + return true; + for(int i = 0; i < top->scroll.GetCount(); i++) { + Scroll& sc = top->scroll[i]; + if(sc.rect == sr && sgn(dx) == sgn(sc.dx) && sgn(dy) == sgn(sc.dy)) { + sc.dx += dx; + sc.dy += dy; + ScrollRefresh(sc.rect, sc.dx, sc.dy); + return false; + } + if(sc.rect.Intersects(sr)) { + sc.rect |= sr; + sc.dx = sc.dy = 0; + WndInvalidateRect(sc.rect); + return true; + } + } + Scroll& sc = top->scroll.Add(); + sc.rect = sr; + sc.dx = dx; + sc.dy = dy; + ScrollRefresh(sc.rect, sc.dx, sc.dy); + return false; +} + +Rect Ctrl::GetClippedView() +{ + GuiLock __; + Rect sv = GetScreenView(); + Rect view = sv; + Ctrl *q = parent; + Ctrl *w = this; + while(q) { + view &= w->InFrame() ? q->GetScreenRect() : q->GetScreenView(); + w = q; + q = q->parent; + } + return view - GetScreenRect().TopLeft(); +} + +void Ctrl::ScrollView(const Rect& _r, int dx, int dy) +{ + GuiLock __; + if(IsFullRefresh() || !IsVisible()) + return; + Size vsz = GetSize(); + dx = sgn(dx) * min(abs(dx), vsz.cx); + dy = sgn(dy) * min(abs(dy), vsz.cy); + Rect r = _r & vsz; + Ctrl *w; + for(w = this; w->parent; w = w->parent) + if(w->InFrame()) { + Refresh(); + return; + } + if(!w || !w->top) return; + Rect view = InFrame() ? GetView() : GetClippedView(); + Rect sr = (r + view.TopLeft()) & view; + sr += GetScreenRect().TopLeft() - w->GetScreenRect().TopLeft(); + if(w->AddScroll(sr, dx, dy)) + Refresh(); + else { + LTIMING("ScrollCtrls1"); + Top *top = GetTopCtrl()->top; + for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) + if(q->InView()) { + Rect cr = q->GetRect(); + if(top && r.Intersects(cr)) { // Uno: Contains -> Intersetcs + Rect to = cr; + GetTopRect(to, false); + if(r.Intersects(cr.Offseted(-dx, -dy))) { // Uno's suggestion 06/11/26 Contains -> Intersetcs + Rect from = cr.Offseted(-dx, -dy); + GetTopRect(from, false); + MoveCtrl *m = FindMoveCtrlPtr(top->move, q); + if(m && m->from == from && m->to == to) { + LLOG("ScrollView Matched " << from << " -> " << to); + m->ctrl = NULL; + goto done; + } + } + + if(r.Intersects(cr.Offseted(dx, dy))) { // Uno's suggestion 06/11/26 Contains -> Intersetcs + Rect from = to; + to = cr.Offseted(dx, dy); + GetTopRect(to, false); + MoveCtrl& m = top->scroll_move.Add(q); + m.from = from; + m.to = to; + m.ctrl = q; + LLOG("ScrollView Add " << UPP::Name(q) << from << " -> " << to); + goto done; + } + cr &= r; + if(!cr.IsEmpty()) { + Refresh(cr); + Refresh(cr + Point(dx, dy)); + } + done:; + } + } + } +} + +void Ctrl::ScrollView(int x, int y, int cx, int cy, int dx, int dy) { + ScrollView(RectC(x, y, cx, cy), dx, dy); +} + +void Ctrl::ScrollView(int dx, int dy) { + ScrollView(Rect(GetSize()), dx, dy); +} + +void Ctrl::SyncScroll() +{ + GuiLock __; + if(!top) + return; + Vector scroll = top->scroll; + top->scroll.Clear(); + if(IsFullRefresh()) + return; + for(int i = 0; i < scroll.GetCount(); i++) { + Scroll& sc = scroll[i]; + if(abs(sc.dx) > 3 * sc.rect.Width() / 4 || abs(sc.dy) > 3 * sc.rect.Height() / 4) { + LLOG("Sync scroll Invalidate rect" << sc.rect); + WndInvalidateRect(sc.rect); + } + else + if(sc.dx || sc.dy) { + LLOG("WndScrollView " << sc.rect); + WndScrollView(sc.rect, sc.dx, sc.dy); + } + } +} + +Rect Ctrl::GetOpaqueRect() +{ + return IsTransparent() ? Rect(0, 0, 0, 0) : GetSize(); +} + +Rect Ctrl::GetVoidRect() +{ + return Rect(0, 0, 0, 0); +} + + +#ifdef _DEBUG +struct sDrawLevelCheck { + Draw& w; + int lvl; + const Ctrl *q; + + void Check() { + ASSERT_(lvl == w.GetCloffLevel(), "Draw::Begin/End mismatch for " + UPP::Name(q)); + } + + sDrawLevelCheck(Draw& w, const Ctrl *q) : w(w), lvl(w.GetCloffLevel()), q(q) {} + ~sDrawLevelCheck() { Check(); } +}; + +#define LEVELCHECK(w, q) sDrawLevelCheck _x_(w, q) +#define DOLEVELCHECK _x_.Check(); +#else +#define LEVELCHECK(w, q) +#define DOLEVELCHECK +#endif + +void Ctrl::PaintCaret(SystemDraw& w) +{ + GuiLock __; +#ifdef PLATFORM_X11 + if(this == caretCtrl && WndCaretVisible) + w.DrawRect(caretx, carety, caretcx, caretcy, InvertColor); +#endif +} + +void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) { + GuiLock __; + LEVELCHECK(w, this); + LTIMING("CtrlPaint"); + Rect rect = GetRect().GetSize(); + Rect orect = rect.Inflated(overpaint); + if(!IsShown() || orect.IsEmpty() || clip.IsEmpty() || !clip.Intersects(orect)) + return; + Ctrl *q; + Rect view = rect; + for(int i = 0; i < frame.GetCount(); i++) { + LEVELCHECK(w, NULL); + frame[i].frame->FramePaint(w, view); + view = frame[i].view; + } + Rect oview = view.Inflated(overpaint); + bool hasviewctrls = false; + bool viewexcluded = false; + for(q = firstchild; q; q = q->next) + if(q->IsShown()) + if(q->InFrame()) { + if(!viewexcluded && IsTransparent() && q->GetRect().Intersects(view)) { + w.Begin(); + w.ExcludeClip(view); + viewexcluded = true; + } + LEVELCHECK(w, q); + Point off = q->GetRect().TopLeft(); + w.Offset(off); + q->CtrlPaint(w, clip - off); + w.End(); + } + else + hasviewctrls = true; + if(viewexcluded) + w.End(); + DOLEVELCHECK; + if(!oview.IsEmpty()) { + if(oview.Intersects(clip) && w.IsPainting(oview)) { + LEVELCHECK(w, this); + if(overpaint) { + w.Clip(oview); + w.Offset(view.left, view.top); + Paint(w); + PaintCaret(w); + w.End(); + w.End(); + } + else { + w.Clipoff(view); + Paint(w); + PaintCaret(w); + w.End(); + } + } + } + if(hasviewctrls && !view.IsEmpty()) { + Rect cl = clip & view; + w.Clip(cl); + for(q = firstchild; q; q = q->next) + if(q->IsShown() && q->InView()) { + LEVELCHECK(w, q); + Rect qr = q->GetRect(); + Point off = qr.TopLeft() + view.TopLeft(); + Rect ocl = cl - off; + if(ocl.Intersects(Rect(qr.GetSize()).Inflated(overpaint))) { + w.Offset(off); + q->CtrlPaint(w, cl - off); + w.End(); + } + } + w.End(); + } +} + +int sShowRepaint; + +void Ctrl::ShowRepaint(int q) +{ + sShowRepaint = q; +} + +void ShowRepaintRect(SystemDraw& w, const Rect& r, Color c) +{ + if(sShowRepaint) { + w.DrawRect(r, c); + SystemDraw::Flush(); + Sleep(sShowRepaint); + } +} + +bool Ctrl::PaintOpaqueAreas(SystemDraw& w, const Rect& r, const Rect& clip, bool nochild) +{ + GuiLock __; + LTIMING("PaintOpaqueAreas"); + if(!IsShown() || r.IsEmpty() || !r.Intersects(clip) || !w.IsPainting(r)) + return true; + Point off = r.TopLeft(); + Point viewpos = off + GetView().TopLeft(); + if(backpaint == EXCLUDEPAINT) + return w.ExcludeClip(r); + Rect cview = clip & (GetView() + off); + for(Ctrl *q = lastchild; q; q = q->prev) + if(!q->PaintOpaqueAreas(w, q->GetRect() + (q->InView() ? viewpos : off), + q->InView() ? cview : clip)) + return false; + if(nochild && (lastchild || GetNext())) + return true; + Rect opaque = (GetOpaqueRect() + viewpos) & clip; + if(opaque.IsEmpty()) + return true; +#ifdef SYSTEMDRAW + if(backpaint == FULLBACKPAINT && !dynamic_cast(&w)) +#else + if(backpaint == FULLBACKPAINT && !w.IsBack()) +#endif + { + ShowRepaintRect(w, opaque, LtRed()); + BackDraw bw; + bw.Create(w, opaque.GetSize()); + bw.Offset(viewpos - opaque.TopLeft()); + bw.SetPaintingDraw(w, opaque.TopLeft()); + { + LEVELCHECK(bw, this); + Paint(bw); + PaintCaret(bw); + } + bw.Put(w, opaque.TopLeft()); + } + else { + w.Clip(opaque); + ShowRepaintRect(w, opaque, Green()); + w.Offset(viewpos); + { + LEVELCHECK(w, this); + Paint(w); + PaintCaret(w); + } + w.End(); + w.End(); + } + LLOG("Exclude " << opaque); + return w.ExcludeClip(opaque); +} + +inline int Area(const Rect& r) +{ + return r.GetHeight() * r.GetWidth(); +} + +void CombineArea(Vector& area, const Rect& r) +{ + LTIMING("CombineArea"); + if(r.IsEmpty()) return; + int ra = Area(r); + for(int i = 0; i < area.GetCount(); i++) { + Rect ur = r | area[i]; + int a = Area(ur); + if(a < 2 * (ra + Area(area[i])) || a < 16000) { + area[i] = ur; + return; + } + } + area.Add(r); +} + +void Ctrl::GatherTransparentAreas(Vector& area, SystemDraw& w, Rect r, const Rect& clip) +{ + GuiLock __; + LTIMING("GatherTransparentAreas"); + Point off = r.TopLeft(); + Point viewpos = off + GetView().TopLeft(); + r.Inflate(overpaint); + Rect notr = GetVoidRect(); + if(notr.IsEmpty()) + notr = GetOpaqueRect(); + notr += viewpos; + if(!IsShown() || r.IsEmpty() || !clip.Intersects(r) || !w.IsPainting(r)) + return; + if(notr.IsEmpty()) + CombineArea(area, r & clip); + else { + if(notr != r) { + CombineArea(area, clip & Rect(r.left, r.top, notr.left, r.bottom)); + CombineArea(area, clip & Rect(notr.right, r.top, r.right, r.bottom)); + CombineArea(area, clip & Rect(notr.left, r.top, notr.right, notr.top)); + CombineArea(area, clip & Rect(notr.left, notr.bottom, notr.right, r.bottom)); + } + for(Ctrl *q = firstchild; q; q = q->next) { + Point qoff = q->InView() ? viewpos : off; + Rect qr = q->GetRect() + qoff; + if(clip.Intersects(qr)) + q->GatherTransparentAreas(area, w, qr, clip); + } + } +} + +Ctrl *Ctrl::FindBestOpaque(const Rect& clip) +{ + GuiLock __; + Ctrl *w = NULL; + for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) { + if(q->IsVisible() && GetScreenView().Contains(q->GetScreenRect())) { + Rect sw = q->GetScreenView(); + if((q->GetOpaqueRect() + sw.TopLeft()).Contains(clip)) { + w = q; + Ctrl *h = q->FindBestOpaque(clip); + if(h) w = h; + } + else + if(q->GetScreenView().Contains(clip)) + w = q->FindBestOpaque(clip); + else + if(q->GetScreenRect().Intersects(clip)) + w = NULL; + } + } + return w; +} + +void Ctrl::UpdateArea0(SystemDraw& draw, const Rect& clip, int backpaint) +{ + GuiLock __; + LTIMING("UpdateArea"); + LLOG("========== UPDATE AREA " << UPP::Name(this) << " =========="); + if(backpaint == FULLBACKPAINT || globalbackpaint && !hasdhctrl && !dynamic_cast(this)) { + ShowRepaintRect(draw, clip, LtRed()); + BackDraw bw; + bw.Create(draw, clip.GetSize()); + bw.Offset(-clip.TopLeft()); + bw.SetPaintingDraw(draw, clip.TopLeft()); + CtrlPaint(bw, clip); + bw.Put(draw, clip.TopLeft()); + LLOG("========== END (FULLBACKPAINT)"); + return; + } + if(backpaint == TRANSPARENTBACKPAINT) { + LLOG("TransparentBackpaint"); + Vector area; + GatherTransparentAreas(area, draw, GetRect().GetSize(), clip); + for(int i = 0; i < area.GetCount(); i++) { + Rect ar = area[i]; + LLOG("Painting area: " << ar); + ShowRepaintRect(draw, ar, LtBlue()); + BackDraw bw; + bw.Create(draw, ar.GetSize()); + bw.Offset(-ar.TopLeft()); + bw.SetPaintingDraw(draw, ar.TopLeft()); + CtrlPaint(bw, ar); + bw.Put(draw, ar.TopLeft()); + if(!draw.ExcludeClip(ar)) { + LLOG("========== END"); + return; + } + } + PaintOpaqueAreas(draw, GetRect().GetSize(), clip); + LLOG("========== END"); + return; + } + CtrlPaint(draw, clip); + LLOG("========== END"); +} + +void Ctrl::UpdateArea(SystemDraw& draw, const Rect& clip) +{ + GuiLock __; + if(IsPanicMode()) + return; + RemoveFullRefresh(); + Point sp = GetScreenRect().TopLeft(); + Ctrl *b = FindBestOpaque(clip + sp); + if(b) { + Point p = b->GetScreenRect().TopLeft() - sp; + draw.Offset(p); + b->UpdateArea0(draw, clip.Offseted(-p), backpaint); + draw.End(); + } + else + UpdateArea0(draw, clip, backpaint); +} + +void Ctrl::RemoveFullRefresh() +{ + GuiLock __; + fullrefresh = false; + for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) + q->RemoveFullRefresh(); +} + +Ctrl *Ctrl::GetTopRect(Rect& r, bool inframe) +{ + GuiLock __; + if(!inframe) { + r &= Rect(GetSize()); + r.Offset(GetView().TopLeft()); + } + if(parent) { + r.Offset(GetRect().TopLeft()); + return parent->GetTopRect(r, InFrame()); + } + return this; +} + +void Ctrl::DoSync(Ctrl *q, Rect r, bool inframe) +{ + GuiLock __; + ASSERT(q); + LLOG("DoSync " << UPP::Name(q) << " " << r); + Ctrl *top = q->GetTopRect(r, inframe); + top->SyncScroll(); + top->WndUpdate(r); +} + +void Ctrl::Sync() +{ + GuiLock __; + LLOG("Sync " << Name()); + if(top && IsOpen()) { + LLOG("Sync UpdateWindow " << Name()); + SyncScroll(); + WndUpdate(); + } + else + if(parent) + DoSync(parent, GetRect(), inframe); + SyncCaret(); +} + +void Ctrl::Sync(const Rect& sr) +{ + GuiLock __; + LLOG("Sync " << Name() << " " << sr); + DoSync(this, sr, true); + SyncCaret(); +} + +void Ctrl::DrawCtrlWithParent(Draw& w, int x, int y) +{ + GuiLock __; + if(parent) { + Rect r = GetRect(); + Ctrl *top = parent->GetTopRect(r, inframe); + w.Clip(x, y, r.Width(), r.Height()); + w.Offset(x - r.left, y - r.top); + SystemDraw *ws = dynamic_cast(&w); + if(ws) + top->UpdateArea(*ws, r); + w.End(); + w.End(); + } + else + DrawCtrl(w, x, y); +} + +void Ctrl::DrawCtrl(Draw& w, int x, int y) +{ + GuiLock __; + w.Offset(x, y); + SystemDraw *ws = dynamic_cast(&w); + if(ws) + UpdateArea(*ws, GetRect().GetSize()); + w.End(); +} + +void Ctrl::SyncMoves() +{ + GuiLock __; + if(!top) + return; + for(int i = 0; i < top->move.GetCount(); i++) { + MoveCtrl& m = top->move[i]; + if(m.ctrl) { + RefreshFrame(m.from); + RefreshFrame(m.to); + } + } + for(int i = 0; i < top->scroll_move.GetCount(); i++) { + MoveCtrl& s = top->scroll_move[i]; + if(s.ctrl) { + RefreshFrame(s.from); + RefreshFrame(s.to); + } + } + top->move.Clear(); + top->scroll_move.Clear(); +} + +Ctrl& Ctrl::BackPaintHint() +{ + GuiLock __; + if(IsDecentMachine()) + BackPaint(); + return *this; +} + +void Ctrl::GlobalBackPaint(bool b) +{ + GuiLock __; + globalbackpaint = b; +} + +void Ctrl::GlobalBackPaintHint() +{ + if(IsDecentMachine()) + GlobalBackPaint(); +} + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/CtrlKbd.cpp b/olddraw/CtrlCore/CtrlKbd.cpp new file mode 100644 index 000000000..1621fdfa5 --- /dev/null +++ b/olddraw/CtrlCore/CtrlKbd.cpp @@ -0,0 +1,417 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) // LOG(x) + +Ptr Ctrl::focusCtrl; +Ptr Ctrl::focusCtrlWnd; +Ptr Ctrl::lastActiveWnd; +Ptr Ctrl::caretCtrl; +Rect Ctrl::caretRect; +bool Ctrl::ignorekeyup; + +Ptr Ctrl::defferedSetFocus; +Vector< Ptr > Ctrl::defferedChildLostFocus; + + +#ifdef flagSO +Ptr Ctrl::FocusCtrl() { return focusCtrl; } +void Ctrl::FocusCtrl(Ptr fc) { focusCtrl = fc; } +#endif + +static bool s_hotkey; + +void Ctrl::RefreshAccessKeys() +{ + GuiLock __; + if(GetAccessKeys()) + Refresh(); + for(Ctrl *ctrl = GetFirstChild(); ctrl; ctrl = ctrl->GetNext()) + ctrl->RefreshAccessKeys(); +} + +void Ctrl::RefreshAccessKeysDo(bool vis) +{ + GuiLock __; + if(GUI_AltAccessKeys() && vis != akv) { + akv = vis; + RefreshAccessKeys(); + } +} + +bool Ctrl::DispatchKey(dword keycode, int count) +{ + GuiLock __; + if(GUI_AltAccessKeys()) { + bool alt = GetAlt(); + Ctrl *c = GetActiveCtrl(); + if(c) + c->RefreshAccessKeysDo(alt); + } +// RLOGBLOCK("Ctrl::DispatchKey"); +// RLOG("DispatchKey: focusCtrl = " << FormatIntHex((int)~focusCtrl) << ", wnd = " << FormatIntHex((int)~focusCtrlWnd) << ")"); + LLOG("DispatchKey " << keycode << " (0x" << Sprintf("%08x", keycode) + << ", " << GetKeyDesc(keycode) << "), count:" << count + << " focusCtrl:" << UPP::Name(focusCtrl) << " focusCtrlWnd:" << UPP::Name(focusCtrlWnd)); + if((keycode & K_KEYUP) && ignorekeyup) + { + ignorekeyup = false; + return true; + } + for(int i = 0; i < keyhook().GetCount(); i++) + if((*keyhook()[i])(focusCtrl, keycode, count)) + return true; + dword k = keycode; + word l = LOWORD(keycode); + if(!(k & K_DELTA) && l >= 32 && l != 127 && GetDefaultCharset() != CHARSET_UNICODE) + k = MAKELONG((word)FromUnicode(l, CHARSET_DEFAULT), HIWORD(keycode)); + if(!focusCtrl) + return false; + Ptr p = focusCtrl; + if(IsUsrLog()) { + String kl; + dword k = keycode; + int l = 0; + if(k < 65536) { + kl << "CHAR \'" << ToUtf8((wchar)keycode) << "\' (" << keycode << ')'; + l = 2; + } + else { + kl << "KEY"; + if(k & K_KEYUP) { + kl << "UP"; + k &= ~K_KEYUP; + l = 2; + } + kl << " " << GetKeyDesc(k); + } + UsrLogT(l, kl); + } + for(;;) { + LLOG("Trying to DispatchKey: p = " << Desc(p)); + if(p->IsEnabled() && p->Key(p->unicode ? keycode : k, count)) + { + LLOG("Ctrl::DispatchKey(" << FormatIntHex(keycode) << ", " << GetKeyDesc(keycode) + << "): eaten in " << Desc(p)); + if(IsUsrLog()) + UsrLogT(2, String().Cat() << "-> " << Desc(p)); + eventCtrl = focusCtrl; + return true; + } + s_hotkey = true; + if(!p->GetParent()) { + if(p->HotKey(keycode)) { + eventCtrl = focusCtrl; + return true; + } + return false; + } + p = p->GetParent(); + } + + UsrLogT(2, "key was ignored"); + + return false; +} + +bool Ctrl::HotKey(dword key) +{ + GuiLock __; + if(!IsEnabled() || !IsVisible()) return false; + for(Ptr ctrl = firstchild; ctrl; ctrl = ctrl->next) + { + if(ctrl->IsOpen() && ctrl->IsVisible() && ctrl->IsEnabled() && ctrl->HotKey(key)) + { + if(IsUsrLog() && s_hotkey) { + UsrLogT(2, String().Cat() << "HOT-> " << UPP::Name(ctrl)); + s_hotkey = false; + } + return true; + } + } + return false; +} + +void Ctrl::DoDeactivate(Ptr pfocusCtrl, Ptr nfocusCtrl) +{ + GuiLock __; + if(pfocusCtrl) { + Ctrl *ptop = pfocusCtrl->GetTopCtrl(); + Ctrl *ntop = nfocusCtrl ? nfocusCtrl->GetTopCtrl() : NULL; + LLOG("DoDeactivate " << UPP::Name(ptop) << " in favor of " << UPP::Name(ntop)); + if(ntop != ptop && !ptop->destroying) { + ptop->Deactivate(); + ptop->StateH(DEACTIVATE); + ptop->RefreshAccessKeysDo(false); + } + } +} + +void Ctrl::DoKillFocus(Ptr pfocusCtrl, Ptr nfocusCtrl) +{ + GuiLock __; + if(pfocusCtrl && !pfocusCtrl->destroying) { + pfocusCtrl->StateH(FOCUS); + LLOG("LostFocus: " << Desc(pfocusCtrl)); + pfocusCtrl->LostFocus(); + } + if(pfocusCtrl && pfocusCtrl->parent && !pfocusCtrl->parent->destroying) + pfocusCtrl->parent->ChildLostFocus(); + SyncCaret(); +} + +void Ctrl::DoSetFocus(Ptr pfocusCtrl, Ptr nfocusCtrl, bool activate) +{ + GuiLock __; + if(activate && focusCtrl == nfocusCtrl && nfocusCtrl) { + Ctrl *top = nfocusCtrl->GetTopCtrl(); + if((!pfocusCtrl || pfocusCtrl->GetTopCtrl() != top) && !top->destroying) { + top->StateH(ACTIVATE); + top->Activate(); + top->RefreshAccessKeysDo(top->VisibleAccessKeys()); + } + } + + if(focusCtrl == nfocusCtrl && nfocusCtrl && !nfocusCtrl->destroying) { + nfocusCtrl->GotFocus(); + nfocusCtrl->StateH(FOCUS); + } + if(focusCtrl == nfocusCtrl && nfocusCtrl && nfocusCtrl->parent && + !nfocusCtrl->parent->destroying) + nfocusCtrl->parent->ChildGotFocus(); + SyncCaret(); +} + +bool Ctrl::SetFocus0(bool activate) +{ + GuiLock __; + if(IsUsrLog()) + UsrLogT(6, String().Cat() << "SETFOCUS " << Desc(this)); + LLOG("Ctrl::SetFocus " << Desc(this)); + LLOG("focusCtrlWnd " << UPP::Name(focusCtrlWnd)); + LLOG("Ctrl::SetFocus0 -> deferredSetFocus = NULL; was: " << UPP::Name(defferedSetFocus)); + defferedSetFocus = NULL; + if(focusCtrl == this) return true; + if(!IsOpen() || !IsEnabled() || !IsVisible()) return false; + Ptr pfocusCtrl = focusCtrl; + Ptr topwindow = GetTopWindow(); + Ptr topctrl = GetTopCtrl(); + Ptr _this = this; + if(!topwindow) topwindow = topctrl; + LLOG("SetFocus -> SetWndFocus: topwindow = " << UPP::Name(topwindow) << ", focusCtrlWnd = " << UPP::Name(focusCtrlWnd)); + if(!topwindow->HasWndFocus() && !topwindow->SetWndFocus()) return false;// cxl 31.1.2004 + topwindow->SetWndForeground(); // cxl 2007-4-27 + LLOG("SetFocus -> focusCtrl = this: " << FormatIntHex(this) << ", _this = " << FormatIntHex(~_this) << ", " << UPP::Name(_this)); + focusCtrl = _this; + focusCtrlWnd = topwindow; + DoKillFocus(pfocusCtrl, _this); + LLOG("SetFocus 2"); + DoDeactivate(pfocusCtrl, _this); + DoSetFocus(pfocusCtrl, _this, activate); + if(topwindow) + lastActiveWnd = topwindow; + return true; +} + +bool Ctrl::SetFocus() +{ + GuiLock __; + LLOG("Ctrl::SetFocus(" << Name() << ")"); + return SetFocus0(true); +} + +void Ctrl::ActivateWnd() +{ + GuiLock __; + // notification, don't set physical focus here + LLOG("ActivateWnd " << Name()); + Ptr nfocusCtrl = this; + Ptr pfocusCtrl = focusCtrl; + LLOG("About to set focus: " << UPP::Name(nfocusCtrl)); + DoDeactivate(pfocusCtrl, nfocusCtrl); + focusCtrl = nfocusCtrl; + focusCtrlWnd = this; + DoKillFocus(pfocusCtrl, nfocusCtrl); + DoSetFocus(pfocusCtrl, nfocusCtrl, true); + LLOG("Focus: " << UPP::Name(focusCtrl) << " FocusWnd:" << UPP::Name(focusCtrlWnd)); +} + +void Ctrl::SetFocusWnd() +{ + GuiLock __; + // notification, don't set physical focus here + LLOG("Ctrl::SetFocusWnd"); + if(focusCtrlWnd != this) { + LLOG("Ctrl::SetFocusWnd->ActivateWnd"); + ActivateWnd(); + } +} + +void Ctrl::KillFocusWnd() +{ + GuiLock __; + // notification, don't set physical focus here + LLOG("KillFocusWnd " << Name()); + if(this == ~focusCtrlWnd) { + Ptr pfocusCtrl = focusCtrl; + DoDeactivate(pfocusCtrl, NULL); + focusCtrl = focusCtrlWnd = NULL; + DoKillFocus(pfocusCtrl, NULL); + } +} + +void Ctrl::ClickActivateWnd() +{ + GuiLock __; + LLOG("Ctrl::ClickActivateWnd"); + if(this == ~focusCtrlWnd && focusCtrl && focusCtrl->GetTopCtrl() != this) { + LLOG("Ctrl::ClickActivateWnd -> ActivateWnd"); + ActivateWnd(); + } +} + +void Ctrl::DefferedFocusSync() +{ + GuiLock __; + while(defferedChildLostFocus.GetCount() || defferedSetFocus) { + LLOG("Ctrl::DeferredFocusSync, defferedSetFocus = " << UPP::Name(defferedSetFocus)); + Vector< Ptr > b = defferedChildLostFocus; + defferedChildLostFocus.Clear(); + for(int i = 0; i < b.GetCount(); i++) + if(b[i]) { + LLOG("Ctrl::DeferredFocusSync -> ChildLostFocus " << UPP::Name(b[i])); + b[i]->ChildLostFocus(); + } + if(defferedSetFocus) { + LLOG("Ctrl::DeferredFocusSync -> SetFocus " << UPP::Name(defferedSetFocus)); + defferedSetFocus->SetFocus(); + } + defferedSetFocus = NULL; + SyncCaret(); + } +} + +void Ctrl::RefreshCaret() +{ + GuiLock __; + if(caretCtrl) + caretCtrl->Refresh(caretCtrl->caretx, caretCtrl->carety, + caretCtrl->caretcx, caretCtrl->caretcy); +} + +void Ctrl::SyncCaret() { + GuiLock __; +#ifdef PLATFORM_X11 + if(focusCtrl != caretCtrl) { + RefreshCaret(); + caretCtrl = focusCtrl; + RefreshCaret(); + } +#else + Rect cr; + cr.Clear(); + if(focusCtrl && focusCtrl->IsVisible()) { + bool inframe = focusCtrl->InFrame(); + cr = focusCtrl->GetScreenView(); + cr = RectC(focusCtrl->caretx + cr.left, focusCtrl->carety + cr.top, + focusCtrl->caretcx, focusCtrl->caretcy) & cr; + for(Ctrl *q = focusCtrl->GetParent(); q; q = q->GetParent()) { + cr &= inframe ? q->GetScreenRect() : q->GetScreenView(); + inframe = q->InFrame(); + } + } + if(focusCtrl != caretCtrl || cr != caretRect) { + LLOG("Do SyncCaret focusCtrl: " << UPP::Name(focusCtrl) + << ", caretCtrl: " << UPP::Name(caretCtrl) + << ", cr: " << cr); + WndDestroyCaret(); + if(focusCtrl && !cr.IsEmpty()) + focusCtrl->GetTopCtrl()->WndCreateCaret(cr); + caretCtrl = focusCtrl; + caretRect = cr; + } +#endif +} + +Ctrl *Ctrl::GetActiveWindow() +{ + GuiLock __; + Ctrl *q = GetActiveCtrl(); + return q ? q->GetTopWindow() : NULL; +} + +bool Ctrl::HasFocusDeep() const +{ + GuiLock __; + if(HasFocus() || HasChildDeep(FocusCtrl())) return true; + Ctrl *a = GetActiveCtrl(); + if(!a || !a->IsPopUp()) return false; + a = a->GetOwnerCtrl(); + return a && HasChildDeep(a); +} + +String GetKeyDesc(dword key) +{ + String desc; +// key &= 0xFFFF; + + if(key == 0) + return desc; + + if(key & K_CTRL) desc << t_("key\vCtrl+"); + if(key & K_ALT) desc << t_("key\vAlt+"); + if(key & K_SHIFT) desc << t_("key\vShift+"); + + + key &= ~(K_CTRL | K_ALT | K_SHIFT); + if(key < K_DELTA && key > 32 && key != K_DELETE) + return desc + String(key, 1); + if(key >= K_NUMPAD0 && key <= K_NUMPAD9) + desc << "Num " << (char)(key - K_NUMPAD0 + '0'); + else if(key >= K_0 && key <= K_9) + desc << (char)('0' + key - K_0); + else if(key >= K_A && key <= K_Z) + desc << (char)('A' + key - K_A); + else if(key >= K_F1 && key <= K_F12) + desc << Format("F%d", (int)key - K_F1 + 1); + else { + static struct { + dword key; + const char *name; + } nkey[] = { + { K_TAB, tt_("key\vTab") }, { K_SPACE, tt_("key\vSpace") }, + { K_RETURN, tt_("key\vEnter") }, { K_BACKSPACE, tt_("key\vBackspace") }, + { K_CAPSLOCK, tt_("key\vCaps Lock") }, { K_ESCAPE, tt_("key\vEsc") }, + { K_PAGEUP, tt_("key\vPage Up") }, { K_PAGEDOWN, tt_("key\vPage Down") }, + { K_END, tt_("key\vEnd") }, { K_HOME, tt_("key\vHome") }, + { K_LEFT, tt_("key\vLeft") }, { K_UP, tt_("key\vUp") }, + { K_RIGHT, tt_("key\vRight") }, { K_DOWN, tt_("key\vDown") }, + { K_INSERT, tt_("key\vInsert") }, { K_DELETE, tt_("key\vDelete") },{ K_BREAK, tt_("key\vBreak") }, + { K_MULTIPLY, tt_("key\vNum[*]") }, { K_ADD, tt_("key\vNum[+]") }, { K_SUBTRACT, tt_("key\vNum[-]") }, { K_DIVIDE, tt_("key\vNum[/]") }, + { K_ALT_KEY, tt_("key\vAlt") }, { K_SHIFT_KEY, tt_("key\vShift") }, { K_CTRL_KEY, tt_("key\vCtrl") }, + #ifdef PLATFORM_X11 + { 0x10060, "[`]" }, { 0x1002d, "[-]" }, { 0x1003d, "[=]" }, { 0x1005c, "[\\]" }, + { 0x1005b, "[[]" }, { 0x1005d, "[]]" }, + { 0x1003b, "[;]" }, { 0x10027, "[']" }, + { 0x1002c, "[,]" }, { 0x1002e, "[.]" }, { 0x1005f, "[/]" }, + #endif + #ifdef PLATFORM_WIN32 + { 0x100c0, "[`]" }, { 0x100bd, "[-]" }, { 0x100bb, "[=]" }, { 0x100dc, "[\\]" }, + { 0x100db, "[[]" }, { 0x100dd, "[]]" }, + { 0x100ba, "[;]" }, { 0x100de, "[']" }, + { 0x100bc, "[,]" }, { 0x100be, "[.]" }, { 0x100bf, "[/]" }, + #endif + { 0, NULL } + }; + for(int i = 0; nkey[i].key; i++) + if(nkey[i].key == key) { + desc << GetLngString(nkey[i].name); + return desc; + } + desc << Format("%04x", (int)key); + } + return desc; +} + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/CtrlMouse.cpp b/olddraw/CtrlCore/CtrlMouse.cpp new file mode 100644 index 000000000..94535e4c4 --- /dev/null +++ b/olddraw/CtrlCore/CtrlMouse.cpp @@ -0,0 +1,660 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) // DLOG(x) + +Ptr Ctrl::eventCtrl; +Ptr Ctrl::mouseCtrl; +Ptr Ctrl::captureCtrl; +Ptr Ctrl::repeatTopCtrl; +Point Ctrl::repeatMousePos; +bool Ctrl::ignoreclick; +bool Ctrl::mouseinframe; +bool Ctrl::mouseinview; +Point Ctrl::mousepos; +Point Ctrl::leftmousepos = Null; +Point Ctrl::rightmousepos = Null; +Point Ctrl::middlemousepos = Null; + +dword GetMouseFlags() { + dword style = 0; + if(GetAlt()) style |= K_ALT; + if(GetCtrl()) style |= K_CTRL; + if(GetShift()) style |= K_SHIFT; + if(GetMouseLeft()) style |= K_MOUSELEFT; + if(GetMouseRight()) style |= K_MOUSERIGHT; + if(GetMouseMiddle()) style |= K_MOUSEMIDDLE; + return style; +} + +void Ctrl::LogMouseEvent(const char *f, const Ctrl *ctrl, int event, Point p, int zdelta, dword keyflags) +{ + if(!IsUsrLog()) + return; + String txt = f; + txt += (event & BUTTON) == RIGHT ? "RIGHT" : (event & BUTTON) == MIDDLE ? "MIDDLE" : "LEFT"; + switch(event & ACTION) { + case DOWN: txt << "DOWN"; break; + case UP: txt << "UP"; break; + case DOUBLE: txt << "DOUBLE"; break; + case MOUSEWHEEL: txt << "WHEEL"; break; + default: + return; + } + txt << ' ' << p << " ("; + if(keyflags & K_ALT) + txt << " ALT"; + if(keyflags & K_CTRL) + txt << " CTRL"; + if(keyflags & K_SHIFT) + txt << " SHIFT"; + if(keyflags & K_MOUSELEFT) + txt << " LEFT"; + if(keyflags & K_MOUSERIGHT) + txt << " RIGHT"; + if(keyflags & K_MOUSEMIDDLE) + txt << " MIDDLE"; + txt << " ) " << Desc(ctrl); + UsrLogT(txt); +} + +Image Ctrl::FrameMouseEventH(int event, Point p, int zdelta, dword keyflags) +{ + GuiLock __; + for(int i = 0; i < mousehook().GetCount(); i++) + if((*mousehook()[i])(this, true, event, p, zdelta, keyflags)) + return Image::Arrow(); + LogMouseEvent("FRAME ", this, event, p, zdelta, keyflags); + eventCtrl = this; + if(parent) + parent->ChildFrameMouseEvent(this, event, p, zdelta, keyflags); + return FrameMouseEvent(event, p, zdelta, keyflags); +} + +Image Ctrl::FrameMouseEvent(int event, Point p, int zdelta, dword keyflags) +{ + return Image::Arrow(); +} + +Image Ctrl::MouseEventH(int event, Point p, int zdelta, dword keyflags) +{ + GuiLock __; + for(int i = 0; i < mousehook().GetCount(); i++) + if((*mousehook()[i])(this, false, event, p, zdelta, keyflags)) + return Image::Arrow(); + LogMouseEvent(NULL, this, event, p, zdelta, keyflags); + if(parent) + parent->ChildMouseEvent(this, event, p, zdelta, keyflags); + return MouseEvent(event, p, zdelta, keyflags); +} + +void Ctrl::ChildFrameMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags) +{ + GuiLock __; + if(parent) + parent->ChildFrameMouseEvent(child, event, p, zdelta, keyflags); +} + +void Ctrl::ChildMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags) +{ + GuiLock __; + if(parent) + parent->ChildMouseEvent(child, event, p, zdelta, keyflags); +} + +Image Ctrl::MouseEvent(int event, Point p, int zdelta, dword keyflags) +{ + LLOG("MouseEvent " << UPP::Name(this) << " " << FormatIntHex(event)); + switch(event) { + case MOUSEENTER: + MouseEnter(p, keyflags); + break; + case MOUSEMOVE: + MouseMove(p, keyflags); + break; + case LEFTDOWN: + LeftDown(p, keyflags); + break; + case LEFTDOUBLE: + LeftDouble(p, keyflags); + break; + case LEFTDRAG: + LeftDrag(p, keyflags); + break; + case LEFTHOLD: + LeftHold(p, keyflags); + break; + case LEFTTRIPLE: + LeftTriple(p, keyflags); + break; + case LEFTREPEAT: + LeftRepeat(p, keyflags); + break; + case LEFTUP: + LeftUp(p, keyflags); + break; + case RIGHTDRAG: + RightDrag(p, keyflags); + break; + case RIGHTHOLD: + RightHold(p, keyflags); + break; + case RIGHTTRIPLE: + RightTriple(p, keyflags); + break; + case RIGHTDOWN: + RightDown(p, keyflags); + break; + case RIGHTDOUBLE: + RightDouble(p, keyflags); + break; + case RIGHTREPEAT: + RightRepeat(p, keyflags); + break; + case RIGHTUP: + RightUp(p, keyflags); + break; + case MIDDLEDRAG: + MiddleDrag(p, keyflags); + break; + case MIDDLEHOLD: + MiddleHold(p, keyflags); + break; + case MIDDLETRIPLE: + MiddleTriple(p, keyflags); + break; + case MIDDLEDOWN: + MiddleDown(p, keyflags); + break; + case MIDDLEDOUBLE: + MiddleDouble(p, keyflags); + break; + case MIDDLEREPEAT: + MiddleRepeat(p, keyflags); + break; + case MIDDLEUP: + MiddleUp(p, keyflags); + break; + case MOUSELEAVE: + MouseLeave(); + break; + case MOUSEWHEEL: + MouseWheel(p, zdelta, keyflags); + break; + case CURSORIMAGE: + return CursorImage(p, keyflags); + } + return Image::Arrow(); +} + +Image Ctrl::CursorImage(Point p, dword keyflags) +{ + return Image::Arrow(); +} + +void Ctrl::IgnoreMouseClick() +{ + GuiLock __; + LLOG("IgnoreMouseClick"); + ignoreclick = true; + KillRepeat(); +} + +void Ctrl::IgnoreMouseUp() +{ + GuiLock __; + LLOG("Ctrl::IgnoreMouseUp"); + if(GetMouseLeft() || GetMouseRight() || GetMouseMiddle()) + IgnoreMouseClick(); +} + +void Ctrl::EndIgnore() +{ + GuiLock __; + LLOG("Ctrl::EndIgnore"); + if(GetMouseLeft() || GetMouseRight() || GetMouseMiddle()) return; + KillRepeat(); + ignoreclick = false; +} + +bool Ctrl::IsMouseActive() const +{ + GuiLock __; + return IsVisible() && IsEnabled() && IsOpen() && !ignoremouse; +} + +Ctrl *Ctrl::ChildFromPoint(Point& pt) const +{ + GuiLock __; + Ctrl *q; + Point p = pt; + Rect rect = GetRect(); + Rect view = GetView(); + if(view.Contains(p)) { + Point vp = p - view.TopLeft(); + for(q = GetLastChild(); q; q = q->prev) { + if(q->InView() && q->IsMouseActive()) { + Rect r = q->GetRect(); + if(r.Contains(vp)) { + pt = vp - r.TopLeft(); + return q; + } + } + } + return NULL; + } + for(q = GetLastChild(); q; q = q->prev) { + if(q->InFrame() && q->IsMouseActive()) { + Rect r = q->GetRect(); + if(r.Contains(p)) { + pt = p - r.TopLeft(); + return q; + } + } + } + return NULL; +} + +Image Ctrl::MEvent0(int e, Point p, int zd) +{ + GuiLock __; + LLOG("MEvent0 " << Name() << " event: " << FormatIntHex(e, 0) << " point:" << p); + Ptr _this = this; + mousepos = p; + dword mm = 0; + if((e & ACTION) == DOUBLE) + mm |= K_MOUSEDOUBLE; + if((e & ACTION) == TRIPLE) + mm |= K_MOUSETRIPLE; + Rect view = GetView(); + if(mouseCtrl != this) { + if(mouseCtrl) { + Ptr mousectrl = mouseCtrl; + mousectrl->MouseEventH(MOUSELEAVE, Point(0, 0), zd, GetMouseFlags() | mm); + if(mousectrl) + mousectrl->FrameMouseEventH(MOUSELEAVE, Point(0, 0), zd, GetMouseFlags() | mm); + } + mouseinframe = mouseinview = false; + if(_this) { + mouseCtrl = _this; + mouseinframe = true; + FrameMouseEventH(MOUSEENTER, p, zd, GetMouseFlags() | mm); + } + } + bool inview = view.Contains(p); + if(inview != mouseinview && _this) { + mouseinview = inview; + MouseEventH(inview ? MOUSEENTER : MOUSELEAVE, p, zd, GetMouseFlags() | mm); + } + if(_this) + if(view.Contains(p) || HasCapture()) { + p -= view.TopLeft(); + return MouseEventH(e, p, zd, GetMouseFlags() | mm); + } + else + return FrameMouseEventH(e, p, zd, GetMouseFlags() | mm); + return Image::Arrow(); +} + +void Ctrl::LRepeat() { + GuiLock __; + if(repeatTopCtrl && repeatTopCtrl->HasFocusDeep() && GetMouseLeft()) // 4.7.2004 cxl, IsForeground... + repeatTopCtrl->DispatchMouseEvent(LEFTREPEAT, repeatMousePos, 0); + else + KillRepeat(); + LLOG("LRepeat " << UPP::Name(mouseCtrl)); +} + +static int sDistMax(Point a, Point b) +{ + return IsNull(a) ? INT_MAX : max(abs(a.x - b.x), abs(a.y - b.y)); +} + +static int sDistMin(Point a, Point b) +{ + return IsNull(a) ? -1 : max(abs(a.x - b.x), abs(a.y - b.y)); +} + +void Ctrl::LRep() { + LLOG("LRep"); + UPP::SetTimeCallback(-GetKbdSpeed(), callback(&Ctrl::LRepeat), &mousepos); +} + +void Ctrl::LHold() { + GuiLock __; + if(sDistMax(leftmousepos, mousepos) < GUI_DragDistance() && repeatTopCtrl && GetMouseLeft()) + repeatTopCtrl->DispatchMouseEvent(LEFTHOLD, repeatMousePos, 0); +} + +void Ctrl::RRepeat() { + GuiLock __; + if(repeatTopCtrl && repeatTopCtrl->IsForeground() && GetMouseRight()) + repeatTopCtrl->DispatchMouseEvent(RIGHTREPEAT, repeatMousePos, 0); + else + KillRepeat(); +} + +void Ctrl::RRep() { + UPP::SetTimeCallback(-GetKbdSpeed(), callback(&Ctrl::RRepeat), &mousepos); +} + +void Ctrl::RHold() { + GuiLock __; + if(sDistMax(rightmousepos, mousepos) < GUI_DragDistance() && repeatTopCtrl && GetMouseRight()) + repeatTopCtrl->DispatchMouseEvent(RIGHTHOLD, repeatMousePos, 0); +} + +void Ctrl::MRepeat() { + GuiLock __; + if(repeatTopCtrl && repeatTopCtrl->IsForeground() && GetMouseMiddle()) + repeatTopCtrl->DispatchMouseEvent(MIDDLEREPEAT, repeatMousePos, 0); + else + KillRepeat(); +} + +void Ctrl::MRep() { + GuiLock __; + UPP::SetTimeCallback(-GetKbdSpeed(), callback(&Ctrl::MRepeat), &mousepos); +} + +void Ctrl::MHold() { + GuiLock __; + if(sDistMax(middlemousepos, mousepos) < GUI_DragDistance() && repeatTopCtrl && GetMouseMiddle()) + repeatTopCtrl->DispatchMouseEvent(MIDDLEHOLD, repeatMousePos, 0); +} + +void Ctrl::KillRepeat() { + GuiLock __; + LLOG("Ctrl::KillRepeat"); + UPP::KillTimeCallback(&mousepos); + repeatTopCtrl = NULL; + leftmousepos = Null; + rightmousepos = Null; + middlemousepos = Null; +} + +bool Ctrl::HasMouse() const +{ + GuiLock __; + return mouseCtrl == this; +} + +bool Ctrl::HasMouseDeep() const +{ + GuiLock __; + return mouseCtrl == this || HasChildDeep(mouseCtrl); +} + +Ctrl *Ctrl::GetMouseCtrl() +{ + GuiLock __; + return mouseCtrl; +} + +bool Ctrl::HasMouseInFrame(const Rect& r) +{ + GuiLock __; + if(!HasMouse()) + return false; + Rect q = GetVisibleScreenRect(); + q = r.Offseted(q.TopLeft()) & q; + return q.Contains(GetMousePos()); +} + +bool Ctrl::HasMouseIn(const Rect& r) const +{ + GuiLock __; + if(!HasMouse()) + return false; + Rect q = GetVisibleScreenView(); + q = r.Offseted(q.TopLeft()) & q; + return q.Contains(GetMousePos()); +} + +Point Ctrl::GetMouseViewPos() const +{ + GuiLock __; + return GetMousePos() - GetVisibleScreenView().TopLeft(); +} + +void Ctrl::DoCursorShape() { + GuiLock __; + Image m = CursorOverride(); + if(IsNull(m)) + if(mouseCtrl) + SetMouseCursor(mouseCtrl->MEvent0(CURSORIMAGE, mousepos, 0)); + else + SetMouseCursor(Image::Arrow()); + else + SetMouseCursor(m); +} + +void Ctrl::CheckMouseCtrl() { + GuiLock __; + Point p = GetMousePos(); + if(mouseCtrl) { + Rect r = mouseCtrl->GetScreenRect(); + LLOG("CheckMouseCtrl mouseCtrl " << UPP::Name(mouseCtrl) << " " << r); + if(!mouseCtrl->HasCapture() && !r.Contains(p)) { + Ptr mousectrl = mouseCtrl; + if(mouseinview) + mousectrl->MouseEventH(MOUSELEAVE, p - mousectrl->GetScreenView().TopLeft(), + 0, GetMouseFlags()); + if(mouseinframe && mousectrl) + mousectrl->FrameMouseEventH(MOUSELEAVE, p - r.TopLeft(), + 0, GetMouseFlags()); + mouseinview = mouseinframe = false; + mouseCtrl = NULL; + leftmousepos = rightmousepos = middlemousepos = Null; + KillRepeat(); + } + } + DoCursorShape(); +} + +Point leftdblpos = Null, rightdblpos = Null, middledblpos = Null; +int leftdbltime = Null, rightdbltime = Null, middledbltime = Null; + +bool sDblTime(int time) +{ + return !IsNull(time) && (int)GetTickCount() - time < GUI_DblClickTime(); +} + +Image Ctrl::DispatchMouse(int e, Point p, int zd) { + GuiLock __; + if(e == MOUSEMOVE) { + if(sDistMin(leftmousepos, p) > GUI_DragDistance() && repeatTopCtrl == this) { + DispatchMouseEvent(LEFTDRAG, leftmousepos, 0); + leftmousepos = Null; + } + if(sDistMin(rightmousepos, p) > GUI_DragDistance() && repeatTopCtrl == this) { + DispatchMouseEvent(RIGHTDRAG, rightmousepos, 0); + rightmousepos = Null; + } + if(sDistMin(middlemousepos, p) > GUI_DragDistance() && repeatTopCtrl == this) { + DispatchMouseEvent(MIDDLEDRAG, middlemousepos, 0); + middlemousepos = Null; + } + } + repeatMousePos = p; + if(e == LEFTDOUBLE) { + leftdbltime = GetTickCount(); + leftdblpos = p; + } + if(e == RIGHTDOUBLE) { + rightdbltime = GetTickCount(); + rightdblpos = p; + } + if(e == MIDDLEDOUBLE) { + middledbltime = GetTickCount(); + middledblpos = p; + } + if(e == LEFTDOWN) { + LLOG("Ctrl::DispatchMouse: init left repeat for " << UPP::Name(this) << " at " << p); + UPP::SetTimeCallback(GetKbdDelay(), callback(&Ctrl::LRep), &mousepos); + UPP::SetTimeCallback(2 * GetKbdDelay(), callback(&Ctrl::LHold), &mousepos); + leftmousepos = p; + if(sDistMax(leftdblpos, p) < GUI_DragDistance() && sDblTime(leftdbltime)) + e = LEFTTRIPLE; + repeatTopCtrl = this; + } + if(e == RIGHTDOWN) { + LLOG("Ctrl::DispatchMouse: init right repeat for " << UPP::Name(this) << " at " << p); + UPP::SetTimeCallback(GetKbdDelay(), callback(&Ctrl::RRep), &mousepos); + UPP::SetTimeCallback(2 * GetKbdDelay(), callback(&Ctrl::RHold), &mousepos); + rightmousepos = p; + if(sDistMax(rightdblpos, p) < GUI_DragDistance() && sDblTime(rightdbltime)) + e = RIGHTTRIPLE; + repeatTopCtrl = this; + } + if(e == MIDDLEDOWN) { + LLOG("Ctrl::DispatchMouse: init middle repeat for " << UPP::Name(this) << " at " << p); + UPP::SetTimeCallback(GetKbdDelay(), callback(&Ctrl::MRep), &mousepos); + UPP::SetTimeCallback(2 * GetKbdDelay(), callback(&Ctrl::MHold), &mousepos); + middlemousepos = p; + if(sDistMax(middledblpos, p) < GUI_DragDistance() && sDblTime(middledbltime)) + e = MIDDLETRIPLE; + repeatTopCtrl = this; + } + if(repeatTopCtrl != this) + repeatTopCtrl = NULL; + if(e == LEFTUP) + leftmousepos = Null; + if(e == RIGHTUP) + rightmousepos = Null; + if(e == MIDDLEUP) + rightmousepos = Null; + if(e == LEFTUP || e == RIGHTUP || e == MIDDLEUP) + KillRepeat(); + Image result = DispatchMouseEvent(e, p, zd); + if(!GetMouseRight() && !GetMouseMiddle() && !GetMouseLeft()) + ReleaseCtrlCapture(); + return result; +} + +Image Ctrl::DispatchMouseEvent(int e, Point p, int zd) { + GuiLock __; + if(!IsEnabled()) + return Image::Arrow(); + if(captureCtrl && captureCtrl != this && captureCtrl->IsMouseActive()) + return captureCtrl->MEvent0(e, p + GetScreenRect().TopLeft() - + captureCtrl->GetScreenRect().TopLeft(), zd); + Ctrl *top = this; + if(e == MOUSEWHEEL && !GetParent()) { + Ctrl *w = GetFocusCtrl(); + if(w) { + top = w->GetTopCtrl(); + p = GetMousePos() - top->GetScreenRect().TopLeft(); + } + } + Ctrl *q = top->ChildFromPoint(p); + return q ? q->DispatchMouseEvent(e, p, zd) : top->MEvent0(e, p, zd); +} + +bool Ctrl::SetCapture() { + GuiLock __; + ReleaseCtrlCapture(); + if(!GetTopCtrl()->SetWndCapture()) return false; + captureCtrl = mouseCtrl = this; + return true; +} + +bool Ctrl::ReleaseCapture() { + GuiLock __; + return this == captureCtrl && ReleaseCtrlCapture(); +} + +bool Ctrl::ReleaseCtrlCapture() { + GuiLock __; + if(captureCtrl) { + captureCtrl->CancelMode(); + Ctrl *w = captureCtrl->GetTopCtrl(); + captureCtrl = NULL; + if(w->HasWndCapture()) { + w->ReleaseWndCapture(); + return true; + } + } + captureCtrl = NULL; + return false; +} + +bool Ctrl::HasCapture() const { + GuiLock __; + return captureCtrl == this && GetTopCtrl()->HasWndCapture(); +} + +Ctrl *Ctrl::GetVisibleChild(Ctrl *ctrl, Point p, bool pointinframe) +{ + GuiLock __; + if(!pointinframe) + p += ctrl->GetView().TopLeft(); + Ctrl *q; + Rect rect = ctrl->GetRect(); + for(q = ctrl->GetLastChild(); q; q = q->GetPrev()) { + if(q->InFrame() && q->IsVisible()) { + Rect r = q->GetRect(); + if(r.Contains(p)) + return GetVisibleChild(q, p - r.TopLeft(), true); + } + } + Rect view = ctrl->GetView(); + if(view.Contains(p)) { + p -= view.TopLeft(); + for(q = ctrl->GetLastChild(); q; q = q->GetPrev()) { + if(q->InView() && q->IsVisible()) { + Rect r = q->GetRect(); + if(r.Contains(p)) + return GetVisibleChild(q, p - r.TopLeft(), true); + } + } + } + return ctrl; +} + +AutoWaitCursor::AutoWaitCursor(int& avg) : WaitCursor(avg >= 0), avg(avg) { + time0 = GetTickCount(); +} + +AutoWaitCursor::~AutoWaitCursor() { + if(time0) avg = GetTickCount() - time0 - 500; + if(avg < -10000) avg = -10000; + if(avg > 10000) avg = 10000; +} + +Image& Ctrl::CursorOverride() +{ + GuiLock __; + static Image m; + return m; +} + +Image Ctrl::OverrideCursor(const Image& m) +{ + GuiLock __; + Image om = CursorOverride(); + CursorOverride() = m; + DoCursorShape(); + if(!mouseCtrl) + SetMouseCursor(IsNull(m) ? Image::Arrow() : m); + return om; +} + +void WaitCursor::Show() { + if(flag) + prev = Ctrl::OverrideCursor(Image::Wait()); + flag = false; +} + +WaitCursor::WaitCursor(bool show) { + flag = true; + if(show) Show(); +} + +WaitCursor::~WaitCursor() { + if(!flag) + Ctrl::OverrideCursor(prev); +} + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/CtrlPos.cpp b/olddraw/CtrlCore/CtrlPos.cpp new file mode 100644 index 000000000..673448b48 --- /dev/null +++ b/olddraw/CtrlCore/CtrlPos.cpp @@ -0,0 +1,486 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) // LOG(x) +#define LTIMING(x) // RTIMING(x) + +bool Ctrl::Logc::IsEmpty() const { + return GetAlign() == SIZE ? GetB() <= GetA() : GetB() <= 0; +} + +Size Ctrl::PosVal(int v) const { + switch(v) { + case MINSIZE: return GetMinSize(); + case STDSIZE: return GetStdSize(); + case MAXSIZE: return GetMaxSize(); + } + return Size(v, v); +} + +void Ctrl::Lay1(int& pos, int& r, int align, int a, int b, int sz) const +{ + pos = a; + int size = b; + switch(align) { + case CENTER: + pos = (sz - b) / 2 + a; + break; + case RIGHT: + pos = sz - (a + b); + break; + case SIZE: + size = sz - (a + b); + break; + } + r = pos + max(size, 0); +} + +Rect Ctrl::CalcRect(LogPos pos, const Rect& prect, const Rect& pview) const +{ + Rect r; + Size sz = InFrame() ? prect.Size() : pview.Size(); + Lay1(r.left, r.right, pos.x.GetAlign(), + PosVal(pos.x.GetA()).cx, PosVal(pos.x.GetB()).cx, sz.cx); + Lay1(r.top, r.bottom, pos.y.GetAlign(), + PosVal(pos.y.GetA()).cy, PosVal(pos.y.GetB()).cy, sz.cy); + return r; +} + +Rect Ctrl::CalcRect(const Rect& prect, const Rect& pview) const +{ + return CalcRect(pos, prect, pview); +} + +Rect Ctrl::GetRect() const +{ + return rect; +} + +Rect Ctrl::GetView() const +{ + GuiLock __; + return frame.GetCount() == 0 ? Rect(Size(rect.Size())) : Rect(frame[frame.GetCount() - 1].view); +} + +Size Ctrl::GetSize() const +{ + return GetView().GetSize(); +} + +Rect Ctrl::GetScreenRect() const +{ + GuiLock __; + Rect r = GetRect(); + if(parent) { + Rect pr = inframe ? parent->GetScreenRect() : parent->GetScreenView(); + r = r + pr.TopLeft(); + } +#ifdef PLATFORM_WIN32 + else if(activex) + r = GetWndScreenRect(); +#endif + return r; +} + +Rect Ctrl::GetScreenView() const +{ + Rect r = GetScreenRect(); + return GetView() + r.TopLeft(); +} + +Rect Ctrl::GetVisibleScreenRect() const +{ + GuiLock __; + Rect r = GetRect(); + if(parent) { + Rect pr = inframe ? parent->GetVisibleScreenRect() : parent->GetVisibleScreenView(); + Rect pr1 = inframe ? parent->GetScreenRect() : parent->GetScreenView(); + r = (r + pr1.TopLeft()) & pr; + } +#ifdef PLATFORM_WIN32 + else if(activex) + r = GetWndScreenRect(); +#endif + return r & GetVirtualScreenArea(); +} + +Rect Ctrl::GetVisibleScreenView() const +{ + Rect r = GetVisibleScreenRect(); + return (GetView() + r.TopLeft()) & r; +} + +Size Ctrl::AddFrameSize(int cx, int cy) const +{ + GuiLock __; + Size sz = Size(cx, cy); + for(int i = frame.GetCount() - 1; i >= 0; i--) + frame[i].frame->FrameAddSize(sz); + return sz; +} + +int EditFieldIsThin(); + +Size Ctrl::GetMinSize() const +{ + int fcy = Draw::GetStdFontCy(); + return AddFrameSize(fcy / 2, fcy + 2 + 2 * EditFieldIsThin()); +} + +Size Ctrl::GetStdSize() const +{ + Size sz = GetMinSize(); + sz.cx *= 10; + return sz; +} + +Size Ctrl::GetMaxSize() const +{ + return GetVirtualWorkArea().Size(); +} + +void Ctrl::SyncLayout(int force) +{ + GuiLock __; + LLOG("SyncLayout " << Name() << " size: " << GetSize()); + bool refresh = false; + Rect oview = GetView(); + Rect view = GetRect().Size(); + overpaint = OverPaint(); + for(int i = 0; i < frame.GetCount(); i++) { + Frame& f = frame[i]; + f.frame->FrameLayout(view); + if(view != f.view) { + f.view = view; + refresh = true; + } + int q = f.frame->OverPaint(); + if(q > overpaint) overpaint = q; + } + if(oview.Size() != view.Size() || force > 1) { + for(Ctrl *q = GetFirstChild(); q; q = q->next) { + q->rect = q->CalcRect(rect, view); + LLOG("Layout set rect " << q->Name() << " " << q->rect); + q->SyncLayout(force > 1 ? force : 0); + } + Refresh(); + } + if(oview != view || force) { + State(LAYOUTPOS); + Layout(); + } + if(refresh) + RefreshFrame(); +} + +int Ctrl::FindMoveCtrl(const VectorMap& m, Ctrl *x) +{ + int q = m.Find(x); + return q >= 0 && m[q].ctrl ? q : -1; +} + +Ctrl::MoveCtrl *Ctrl::FindMoveCtrlPtr(VectorMap& m, Ctrl *x) +{ + int q = FindMoveCtrl(m, x); + return q >= 0 ? &m[q] : NULL; +} + +void Ctrl::SetPos0(LogPos p, bool _inframe) +{ + GuiLock __; + if(p == pos && inframe == _inframe) return; + if(parent) { + Rect from = GetRect().Size(); + Top *top = GetTopRect(from, true)->top; + if(top) { + LTIMING("SetPos0 MoveCtrl"); + pos = p; + inframe = _inframe; + Rect to = GetRect().Size(); + UpdateRect0(); + GetTopRect(to, true); + MoveCtrl *s = FindMoveCtrlPtr(top->scroll_move, this); + if(s && s->from == from && s->to == to) { + s->ctrl = NULL; + LLOG("SetPos Matched " << from << " -> " << to); + } + else { + MoveCtrl& m = top->move.Add(this); + m.ctrl = this; + m.from = from; + m.to = to; + LLOG("SetPos Add " << UPP::Name(this) << from << " -> " << to); + } + return; + } + RefreshFrame(); + } + pos = p; + inframe = _inframe; + UpdateRect(); +} + +void Ctrl::UpdateRect0() +{ + GuiLock __; + LTIMING("UpdateRect0"); + if(parent) + rect = CalcRect(parent->GetRect(), parent->GetView()); + else { + Rect r = GetWorkArea(); + rect = CalcRect(r, r); + } + LTIMING("UpdateRect0 SyncLayout"); + SyncLayout(); +} + + +void Ctrl::UpdateRect() +{ + GuiLock __; + UpdateRect0(); + if(parent) RefreshFrame(); +} + +Ctrl& Ctrl::SetPos(LogPos p, bool _inframe) +{ + GuiLock __; + if(p != pos || inframe != _inframe) { + if(parent || !IsOpen()) + SetPos0(p, _inframe); + else { + Rect wa = GetWorkArea(); + WndSetPos(CalcRect(p, wa, wa)); + } + StateH(POSITION); + } + return *this; +} + +Ctrl& Ctrl::SetPos(LogPos p) +{ + return SetPos(p, false); +} + +Ctrl& Ctrl::SetPosX(Logc x) +{ + return SetPos(LogPos(x, pos.y)); +} + +Ctrl& Ctrl::SetPosY(Logc y) +{ + return SetPos(LogPos(pos.x, y)); +} + +Ctrl& Ctrl::SetFramePos(LogPos p) +{ + return SetPos(p, true); +} + +Ctrl& Ctrl::SetFramePosX(Logc x) { + return SetPos(LogPos(x, pos.y), true); +} + +Ctrl& Ctrl::SetFramePosY(Logc y) { + return SetPos(LogPos(pos.x, y), true); +} + +void Ctrl::SetRect(int x, int y, int cx, int cy) +{ + LLOG("SetRect " << Name() << " rect: " << RectC(x, y, cx, cy)); + LTIMING("SetRect"); + SetPos(PosLeft(x, cx), PosTop(y, cy)); +} + +void Ctrl::SetWndRect(const Rect& r) +{ + LLOG("SetWndRect " << Name() << " rect: " << r << " (Ctrl::GetRect = " << GetRect() << ")"); + SetPos0(LogPos(PosLeft(r.left, r.Width()), PosTop(r.top, r.Height())), false); + StateH(POSITION); +} + +void Ctrl::SetRect(const Rect& r) +{ + SetRect(r.left, r.top, r.Width(), r.Height()); +} + +void Ctrl::SetRectX(int x, int cx) { + SetPosX(PosLeft(x, cx)); +} + +void Ctrl::SetRectY(int y, int cy) { + SetPosY(PosTop(y, cy)); +} + +void Ctrl::SetFrameRect(int x, int y, int cx, int cy) { + SetFramePos(PosLeft(x, cx), PosTop(y, cy)); +} + +void Ctrl::SetFrameRect(const Rect& r) { + SetFrameRect(r.left, r.top, r.Width(), r.Height()); +} + +void Ctrl::SetFrameRectX(int x, int cx) { + SetFramePosX(PosLeft(x, cx)); +} + +void Ctrl::SetFrameRectY(int y, int cy) { + SetFramePosY(PosTop(y, cy)); +} + +Ctrl& Ctrl::SetFrame(int i, CtrlFrame& fr) { + GuiLock __; + LLOG("SetFrame " << typeid(fr).name()); + while(frame.GetCount() <= i) + frame.Add().frame = &NullFrame(); + frame[i].frame->FrameRemove(); + frame[i].frame = &fr; + fr.FrameAdd(*this); + SyncLayout(); + RefreshFrame(); + return *this; +} + +Ctrl& Ctrl::AddFrame(CtrlFrame& fr) { + GuiLock __; + LLOG("AddFrame " << typeid(fr).name()); + frame.Add().frame = &fr; + fr.FrameAdd(*this); + SyncLayout(); + RefreshFrame(); + return *this; +} + +void Ctrl::ClearFrames() { + GuiLock __; + for(int i = 0; i < frame.GetCount(); i++) + frame[i].frame->FrameRemove(); + frame.Clear(); + frame.Add().frame = &NullFrame(); + RefreshFrame(); + SyncLayout(); +} + +void Ctrl::RemoveFrame(int i) { + GuiLock __; + int n = frame.GetCount(); + Mitor m; + if(n > 1) + for(int q = 0; q < n; q++) + if(q != i) + m.Add().frame = frame[q].frame; + else + frame[q].frame->FrameRemove(); + frame = m; + if(frame.GetCount() == 0) + frame.Add().frame = &NullFrame(); + RefreshFrame(); + SyncLayout(); +} + +int Ctrl::FindFrame(CtrlFrame& frm) +{ + GuiLock __; + for(int i = 0; i < frame.GetCount(); i++) + if(frame[i].frame == &frm) + return i; + return -1; +} + +void Ctrl::RemoveFrame(CtrlFrame& frm) +{ + GuiLock __; + int i = FindFrame(frm); + if(i >= 0) + RemoveFrame(i); +} + +void Ctrl::InsertFrame(int i, CtrlFrame& fr) +{ + GuiLock __; + ASSERT(i >= 0 && i <= frame.GetCount()); + int n = frame.GetCount(); + Mitor m; + if(n >= 1) + for(int q = 0; q < n; q++) { + if(q == i) m.Add().frame = &fr; + m.Add().frame = frame[q].frame; + } + if(i == n) + m.Add().frame = &fr; + frame = m; + fr.FrameAdd(*this); + SyncLayout(); + RefreshFrame(); +} + +Ctrl& Ctrl::LeftPos(int a, int size) { + return SetPosX(PosLeft(a, size)); +} + +Ctrl& Ctrl::RightPos(int a, int size) { + return SetPosX(PosRight(a, size)); +} + +Ctrl& Ctrl::TopPos(int a, int size) { + return SetPosY(PosTop(a, size)); +} + +Ctrl& Ctrl::BottomPos(int a, int size) { + return SetPosY(PosBottom(a, size)); +} + +Ctrl& Ctrl::HSizePos(int a, int b) { + return SetPosX(PosSize(a, b)); +} + +Ctrl& Ctrl::VSizePos(int a, int b) { + return SetPosY(PosSize(a, b)); +} + +Ctrl& Ctrl::SizePos() { + return HSizePos().VSizePos(); +} + +Ctrl& Ctrl::HCenterPos(int size, int delta) { + return SetPosX(PosCenter(size, delta)); +} + +Ctrl& Ctrl::VCenterPos(int size, int delta) { + return SetPosY(PosCenter(size, delta)); +} + +Ctrl& Ctrl::LeftPosZ(int a, int size) { + return LeftPos(HorzLayoutZoom(a), HorzLayoutZoom(size)); +} + +Ctrl& Ctrl::RightPosZ(int a, int size) { + return RightPos(HorzLayoutZoom(a), HorzLayoutZoom(size)); +} + +Ctrl& Ctrl::TopPosZ(int a, int size) { + return TopPos(VertLayoutZoom(a), VertLayoutZoom(size)); +} + +Ctrl& Ctrl::BottomPosZ(int a, int size) { + return BottomPos(VertLayoutZoom(a), VertLayoutZoom(size)); +} + +Ctrl& Ctrl::HSizePosZ(int a, int b) { + return HSizePos(HorzLayoutZoom(a), HorzLayoutZoom(b)); +} + +Ctrl& Ctrl::VSizePosZ(int a, int b) { + return VSizePos(VertLayoutZoom(a), VertLayoutZoom(b)); +} + +Ctrl& Ctrl::HCenterPosZ(int size, int delta) { + return HCenterPos(HorzLayoutZoom(size), HorzLayoutZoom(delta)); +} + +Ctrl& Ctrl::VCenterPosZ(int size, int delta) { + return VCenterPos(VertLayoutZoom(size), VertLayoutZoom(delta)); +} + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/CtrlTimer.cpp b/olddraw/CtrlCore/CtrlTimer.cpp new file mode 100644 index 000000000..00ab7b187 --- /dev/null +++ b/olddraw/CtrlCore/CtrlTimer.cpp @@ -0,0 +1,229 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +int MemoryProbeInt; + +struct TimeEvent : public Link { + dword time; + int delay; + Callback cb; + void *id; +}; + +static dword sTClick; + +static StaticCriticalSection sTimerLock; + +struct CtrlTimerOwner__ : public LinkOwner { + CtrlTimerOwner__(); + ~CtrlTimerOwner__(); +}; + +static TimeEvent *tevents() { + static LinkOwner t; + return t.GetPtr(); +} + +static void sTimeCallback(dword time, int delay, Callback cb, void *id) { + TimeEvent *list = tevents(); + TimeEvent *e; + for(e = list->GetNext(); e != list && time >= e->time; e = e->GetNext()); + TimeEvent *ne = e->InsertPrev(); + ne->time = time; + ne->cb = cb; + ne->delay = delay; + ne->id = id; +} + +void SetTimeCallback(int delay_ms, Callback cb, void *id) { + Mutex::Lock __(sTimerLock); + ASSERT(abs(delay_ms) < 0x40000000); + sTimeCallback(GetTickCount() + abs(delay_ms), delay_ms, cb, id); +} + +void KillTimeCallbacks(void *id, void *idlim) { + Mutex::Lock __(sTimerLock); + TimeEvent *list = tevents(); + for(TimeEvent *e = list->GetNext(); e != list;) + if(e->id >= id && e->id < idlim) { + e = e->GetNext(); + delete e->GetPrev(); + } + else + e = e->GetNext(); +} + +EXITBLOCK +{ + Mutex::Lock __(sTimerLock); + while(tevents()->GetNext() != tevents()) + delete tevents()->GetNext(); +} + +bool ExistsTimeCallback(void *id) { + Mutex::Lock __(sTimerLock); + TimeEvent *list = tevents(); + for(TimeEvent *e = list->GetNext(); e != list; e = e->GetNext()) + if(e->id == id) + return true; + return false; +} + +void KillTimeCallback(void *id) { + KillTimeCallbacks(id, (byte *)id + 1); +} + +void Ctrl::TimerProc(dword time) +{ + if(IsPanicMode()) + return; + sTimerLock.Enter(); + TimeEvent *list = tevents(); + if(sTClick > time) + for(TimeEvent *e = list->GetNext(); e != list; e = e->GetNext()) + if(e->time > 0x80000000) + e->time = 0; + sTClick = time; + sTimerLock.Leave(); + Ctrl::CheckMouseCtrl(); + Ctrl::SyncCaret(); + sTimerLock.Enter(); + while(list->GetNext() != list && list->GetNext()->time < time) { + TimeEvent *e = list->GetNext(); + e->Unlink(); + if(e->delay < 0) + sTimeCallback(time - e->delay, e->delay, e->cb, e->id); + sTimerLock.Leave(); + e->cb(); + sTimerLock.Enter(); + delete e; + } + sTimerLock.Leave(); +} + +void Ctrl::InitTimer() +{ + Mutex::Lock __(sTimerLock); + tevents(); +} + +void Ctrl::SetTimeCallback(int delay_ms, Callback cb, int id) { + ASSERT(id >= 0 && (size_t)id < (int)sizeof(Ctrl)); + UPP::SetTimeCallback(delay_ms, cb, (byte *)this + id); +} + +void Ctrl::KillTimeCallback(int id) { + ASSERT(id >= 0 && (size_t)id < sizeof(Ctrl)); + UPP::KillTimeCallback((byte *)this + id); +} + +void Ctrl::KillSetTimeCallback(int delay_ms, Callback cb, int id) +{ + KillTimeCallback(id); + SetTimeCallback(delay_ms, cb, id); +} + +void Ctrl::PostCallback(Callback cb, int id) +{ + SetTimeCallback(0, cb, id); +} + +void Ctrl::KillPostCallback(Callback cb, int id) +{ + KillSetTimeCallback(0, cb, id); +} + +bool Ctrl::ExistsTimeCallback(int id) const { + ASSERT(id >= 0 && (size_t)id < sizeof(Ctrl)); + return UPP::ExistsTimeCallback((byte *)this + id); +} + +dword GetTimeClick() +{ + return sTClick; +} + +void Ctrl::EndLoop() +{ + GuiLock __; + inloop = false; +} + +void Ctrl::EndLoop(int code) +{ + GuiLock __; + ASSERT(!parent); + exitcode = code; + EndLoop(); +} + +bool Ctrl::InLoop() const +{ + GuiLock __; + return inloop; +} + +bool Ctrl::InCurrentLoop() const +{ + GuiLock __; + return GetLoopCtrl() == this; +} + +int Ctrl::GetExitCode() const +{ + GuiLock __; + return exitcode; +} + +#ifdef _MULTITHREADED +struct Ctrl::CallBox { + Semaphore sem; + Callback cb; +}; + +void Ctrl::PerformCall(Ctrl::CallBox *cbox) +{ + cbox->cb(); + cbox->sem.Release(); +} + +void WakeUpGuiThread(); + +void Ctrl::Call(Callback cb) +{ + if(IsMainThread()) + cb(); + else { + CallBox cbox; + cbox.cb = cb; + UPP::PostCallback(callback1(Ctrl::PerformCall, &cbox)); + WakeUpGuiThread(); + int level = LeaveGuiMutexAll(); + cbox.sem.Wait(); + EnterGuiMutex(level); + } +} +#else +void Ctrl::Call(Callback cb) +{ + cb(); +} +#endif + +void Ctrl::EventLoop(Ctrl *ctrl) +{ + Call(callback1(&Ctrl::EventLoop0, ctrl)); +} + +void Ctrl::WndDestroy() +{ + Call(callback(this, &Ctrl::WndDestroy0)); +} + +void Ctrl::GuiSleep(int ms) +{ + Call(callback1(&Ctrl::GuiSleep0, ms)); +} + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/DHCtrl.cpp b/olddraw/CtrlCore/DHCtrl.cpp new file mode 100644 index 000000000..16e930646 --- /dev/null +++ b/olddraw/CtrlCore/DHCtrl.cpp @@ -0,0 +1,87 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#ifdef PLATFORM_WIN32 +#ifndef PLATFORM_WINCE + +void DHCtrl::NcCreate(HWND _hwnd) +{ + hwnd = _hwnd; +} + +void DHCtrl::NcDestroy() +{ + hwnd = NULL; +} + +LRESULT DHCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) +{ + GuiLock __; + return DefWindowProc(hwnd, message, wParam, lParam); +} + +void DHCtrl::CloseHWND() +{ + GuiLock __; + if(hwnd) { + DestroyWindow(hwnd); + hwnd = NULL; + } +} + +void DHCtrl::OpenHWND() +{ + GuiLock __; + CloseHWND(); + HWND phwnd = GetTopCtrl()->GetHWND(); + if(phwnd) { + CreateWindowEx(0, "UPP-CLASS-A", "", + WS_CHILD|WS_DISABLED|WS_VISIBLE, + 0, 0, 20, 20, + phwnd, NULL, hInstance, this); + } +} + +void DHCtrl::SyncHWND() +{ + GuiLock __; + HWND phwnd = GetTopCtrl()->GetHWND(); + if(phwnd) { + Rect r = GetScreenView(); + Rect pr = GetScreenClient(phwnd); + SetWindowPos(hwnd, NULL, r.left - pr.left, r.top - pr.top, r.Width(), r.Height(), + SWP_NOACTIVATE|SWP_NOZORDER); + ShowWindow(hwnd, IsVisible() ? SW_SHOW : SW_HIDE); + } +} + +void DHCtrl::State(int reason) +{ + switch(reason) { + case OPEN: + OpenHWND(); + default: + SyncHWND(); + break; + case CLOSE: + CloseHWND(); + } +} + +DHCtrl::DHCtrl() +{ + hwnd = NULL; + isdhctrl = true; +} + +DHCtrl::~DHCtrl() +{ + CloseHWND(); + BackPaint(EXCLUDEPAINT); +} + +#endif +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/Frame.cpp b/olddraw/CtrlCore/Frame.cpp new file mode 100644 index 000000000..99246ec11 --- /dev/null +++ b/olddraw/CtrlCore/Frame.cpp @@ -0,0 +1,163 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#ifdef flagSO +CtrlFrame::CtrlFrame() {} +CtrlFrame::~CtrlFrame() {} +#endif + +void CtrlFrame::FramePaint(Draw& draw, const Rect& r) {} +void CtrlFrame::FrameAdd(Ctrl& ctrl) {} +void CtrlFrame::FrameRemove() {} +int CtrlFrame::OverPaint() const { return 0; } + +void NullFrameClass::FrameLayout(Rect& r) {} +void NullFrameClass::FramePaint(Draw& draw, const Rect& r) {} +void NullFrameClass::FrameAddSize(Size& sz) {} + +CtrlFrame& GLOBAL_V(NullFrameClass, NullFrame); + +#ifdef flagSO +BorderFrame::BorderFrame(const ColorF *border) : border(border) {} +BorderFrame::~BorderFrame() {} +#endif + +void BorderFrame::FrameLayout(Rect& r) +{ + Size sz = r.GetSize(); + int n = (int)(intptr_t)*border; + if(sz.cx >= 2 * n && sz.cy >= 2 * n) + r.Deflate(n); +} + +void BorderFrame::FrameAddSize(Size& sz) +{ + sz += 2 * (int)(intptr_t)*border; +} + +void BorderFrame::FramePaint(Draw& draw, const Rect& r) +{ + Size sz = r.GetSize(); + int n = (int)(intptr_t)*border; + if(sz.cx >= 2 * n && sz.cy >= 2 * n) + DrawBorder(draw, r.left, r.top, r.Width(), r.Height(), border); +} + +CtrlFrame& GLOBAL_VP(BorderFrame, InsetFrame, (InsetBorder())); +CtrlFrame& GLOBAL_VP(BorderFrame, ThinInsetFrame, (ThinInsetBorder())); +CtrlFrame& GLOBAL_VP(BorderFrame, ButtonFrame, (ButtonBorder())); +CtrlFrame& GLOBAL_VP(BorderFrame, BlackFrame, (BlackBorder())); +CtrlFrame& GLOBAL_VP(BorderFrame, OutsetFrame, (OutsetBorder())); +CtrlFrame& GLOBAL_VP(BorderFrame, ThinOutsetFrame, (ThinOutsetBorder())); + +CH_COLOR(FieldFrameColor, Blend(SColorHighlight, SColorShadow)); + +class XPFieldFrameCls : public CtrlFrame { + virtual void FrameLayout(Rect& r) { r.Deflate(2); } + virtual void FramePaint(Draw& w, const Rect& r) { + DrawFrame(w, r, FieldFrameColor()); + DrawFrame(w, r.Deflated(1), SColorPaper); + } + virtual void FrameAddSize(Size& sz) { sz += 4; } +}; + +class XPEditFieldFrameCls : public CtrlFrame { + virtual void FrameLayout(Rect& r) { r.Deflate(1); } + virtual void FramePaint(Draw& w, const Rect& r) { + DrawFrame(w, r, FieldFrameColor()); + } + virtual void FrameAddSize(Size& sz) { sz += 2; } +}; + +CtrlFrame& XPFieldFrame() { return Single(); } +CtrlFrame& XPEditFieldFrame() { return Single(); } + +CH_INT(EditFieldIsThin, 0); + +CtrlFrame& FieldFrame() { return GUI_GlobalStyle() >= GUISTYLE_XP ? XPFieldFrame() : InsetFrame(); } + +CH_VALUE(TopSeparator1, SColorShadow()); +CH_VALUE(TopSeparator2, SColorLight()); + +class TopSeparatorFrameCls : public CtrlFrame { + virtual void FrameLayout(Rect& r) { r.top += 2; } + virtual void FramePaint(Draw& w, const Rect& r) { + ChPaint(w, r.left, r.top, r.Width(), 1, TopSeparator1()); + ChPaint(w, r.left, r.top + 1, r.Width(), 1, TopSeparator2()); + } + virtual void FrameAddSize(Size& sz) { sz.cy += 2; } +}; + +class BottomSeparatorFrameCls : public CtrlFrame { + virtual void FrameLayout(Rect& r) { r.bottom -= 2; } + virtual void FramePaint(Draw& w, const Rect& r) { + w.DrawRect(r.left, r.bottom - 2, r.Width(), 1, SColorShadow); + w.DrawRect(r.left, r.bottom - 1, r.Width(), 1, SColorLight); + } + virtual void FrameAddSize(Size& sz) { sz.cy += 2; } +}; + +class LeftSeparatorFrameCls : public CtrlFrame { + virtual void FrameLayout(Rect& r) { r.left += 2; } + virtual void FramePaint(Draw& w, const Rect& r) { + w.DrawRect(r.left, r.top, 1, r.Height(), SColorShadow); + w.DrawRect(r.left + 1, r.top, 1, r.Height(), SColorLight); + } + virtual void FrameAddSize(Size& sz) { sz.cx += 2; } +}; + +class RightSeparatorFrameCls : public CtrlFrame { + virtual void FrameLayout(Rect& r) { r.right -= 2; } + virtual void FramePaint(Draw& w, const Rect& r) { + w.DrawRect(r.right - 2, r.top, 1, r.Height(), SColorShadow); + w.DrawRect(r.right - 1, r.top, 1, r.Height(), SColorLight); + } + virtual void FrameAddSize(Size& sz) { sz.cx += 2; } +}; + +CtrlFrame& BottomSeparatorFrame() { return Single(); } +CtrlFrame& TopSeparatorFrame() { return Single(); } +CtrlFrame& RightSeparatorFrame() { return Single(); } +CtrlFrame& LeftSeparatorFrame() { return Single(); } + +CH_INT(FrameButtonWidth, 17); +CH_INT(ScrollBarArrowSize, FrameButtonWidth()); + +void LayoutFrameLeft(Rect& r, Ctrl *ctrl, int cx) +{ + if(ctrl) { + cx *= ctrl->IsShown(); + ctrl->SetFrameRect(r.left, r.top, cx, r.Height()); + r.left += cx; + } +} + +void LayoutFrameRight(Rect& r, Ctrl *ctrl, int cx) +{ + if(ctrl) { + cx *= ctrl->IsShown(); + ctrl->SetFrameRect(r.right - cx, r.top, cx, r.Height()); + r.right -= cx; + } +} + +void LayoutFrameTop(Rect& r, Ctrl *ctrl, int cy) +{ + if(ctrl) { + cy *= ctrl->IsShown(); + ctrl->SetFrameRect(r.left, r.top, r.Width(), cy); + r.top += cy; + } +} + +void LayoutFrameBottom(Rect& r, Ctrl *ctrl, int cy) +{ + if(ctrl) { + cy *= ctrl->IsShown(); + ctrl->SetFrameRect(r.left, r.bottom - cy, r.Width(), cy); + r.bottom -= cy; + } +} + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/LocalLoop.cpp b/olddraw/CtrlCore/LocalLoop.cpp new file mode 100644 index 000000000..5c84621ce --- /dev/null +++ b/olddraw/CtrlCore/LocalLoop.cpp @@ -0,0 +1,317 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) // DLOG(x) + +void LocalLoop::Run() +{ + ASSERT(master); + master->AddChild(this); + Ptr focus = GetFocusCtrl(); + SetCapture(); + SetFocus(); + LLOG("LocalLoop::Run"); + EventLoop(this); + LLOG("LocalLoop Finished"); + Remove(); + if(focus) + focus->SetFocus(); +} + +void DrawDragRect(Ctrl& q, const Rect& rect1, const Rect& rect2, const Rect& clip, int n, + Color color, uint64 pattern) +{ + ViewDraw w(&q); + DrawDragRect(w, rect1, rect2, clip, n, color, pattern); +} + +void RectTracker::LeftUp(Point, dword) +{ + EndLoop(); +} + +void RectTracker::RightUp(Point, dword) +{ + EndLoop(); +} + +Image RectTracker::CursorImage(Point, dword) +{ + if(animation) + DrawRect(rect, rect); + return cursorimage; +} + +static uint64 RectTracker_normal = I64(0x55aa55aa55aa55aa); +static uint64 RectTracker_dashed = I64(0xf0783c1e0f87c3e1); +static uint64 RectTracker_solid = I64(0); + +RectTracker::RectTracker(Ctrl& master) +{ + SetMaster(master); + Clip(Rect(0, 0, 100000, 100000)); + width = 1; + minsize = Size(0, 0); + maxsize = Size(100000, 100000); + maxrect = Rect(-100000, -100000, 100000, 100000); + keepratio = false; + cursorimage = Image::Arrow(); + color = SColorPaper; + pattern = RectTracker_normal; + animation = 0; + rounder = NULL; +} + +RectTracker::~RectTracker() {} + +RectTracker& RectTracker::Dashed() { pattern = RectTracker_dashed; return *this; } +RectTracker& RectTracker::Solid() { pattern = RectTracker_solid; return *this; } + +static uint64 sGetAniPat(uint64 src, int pos) +{ + uint64 out = 0; + pos &= 7; + for(int i = 8; --i >= 0;) { + byte sr = (byte)(src >> (8 * ((7 - i - pos) & 7))); + out = (out << 8) | (byte)((sr | (sr << 8)) >> pos); + } + return out; +} + +void RectTracker::DrawRect(Rect r1, Rect r2) +{ + if(ty < 0) { + r1.left = r1.right - 1; + r2.left = r2.right - 1; + } + if(tx < 0) { + r1.top = r1.bottom - 1; + r2.top = r2.bottom - 1; + } + Rect c = clip & GetMaster().GetSize(); + if(animation) { + int nanim = (GetTickCount() / animation) % 8; + DrawDragRect(GetMaster(), Rect(0, 0, 0, 0), r2, c, width, color, sGetAniPat(pattern, nanim)); + DrawDragRect(GetMaster(), r1, Rect(0, 0, 0, 0), c, width, color, sGetAniPat(pattern, panim)); + panim = nanim; + } + else + DrawDragRect(GetMaster(), r1, r2, c, width, color, pattern); +} + +Rect RectTracker::Track(const Rect& r, int _tx, int _ty) +{ + rect = r; + tx = _tx; + ty = _ty; + org = rect; + o = rect; + op = GetMousePos(); + GetMaster().Sync(); + DrawRect(Rect(0, 0, 0, 0), rect); + Run(); + DrawRect(o, Rect(0, 0, 0, 0)); + return rect; +} + +int RectTracker::TrackHorzLine(int x0, int y0, int cx, int line) +{ + return Track(RectC(x0, y0, cx, line + 1), -1, ALIGN_BOTTOM).bottom - 1; +} + +int RectTracker::TrackVertLine(int x0, int y0, int cy, int line) +{ + return Track(RectC(x0, y0, line + 1, cy), ALIGN_RIGHT, -1).right - 1; +} + +void RectTracker::MouseMove(Point, dword) +{ + Point p = GetMousePos(); + rect = org; + if(tx == ALIGN_CENTER && ty == ALIGN_CENTER) { + int x = org.left - op.x + p.x; + int y = org.top - op.y + p.y; + if(x + org.Width() > maxrect.right) + x = maxrect.right - org.Width(); + if(x < maxrect.left) + x = maxrect.left; + if(y + org.Height() > maxrect.bottom) + y = maxrect.bottom - org.Height(); + if(y < maxrect.top) + y = maxrect.top; + rect = RectC(x, y, org.Width(), org.Height()); + } + else { + if(tx == ALIGN_LEFT) { + rect.left = max(org.left - op.x + p.x, maxrect.left); + rect.left = minmax(rect.left, rect.right - maxsize.cx, rect.right - minsize.cx); + } + if(tx == ALIGN_RIGHT) { + rect.right = min(org.right - op.x + p.x, maxrect.right); + rect.right = minmax(rect.right, rect.left + minsize.cx, rect.left + maxsize.cx); + } + if(ty == ALIGN_TOP) { + rect.top = max(org.top - op.y + p.y, maxrect.top); + rect.top = minmax(rect.top, rect.bottom - maxsize.cy, rect.bottom - minsize.cy); + } + if(ty == ALIGN_BOTTOM) { + rect.bottom = min(org.bottom - op.y + p.y, maxrect.bottom); + rect.bottom = minmax(rect.bottom, rect.top + minsize.cy, rect.top + maxsize.cy); + } + if(tx == ALIGN_NULL) { + rect.right = min(org.right - op.x + p.x, maxrect.right); + if (rect.right < rect.left) { + Swap(rect.right, rect.left); + rect.InflateHorz(1); + } + } + if(ty == ALIGN_NULL) { + rect.bottom = min(org.bottom - op.y + p.y, maxrect.bottom); + if (rect.bottom < rect.top) { + Swap(rect.bottom, rect.top); + rect.InflateVert(1); + } + } + if(keepratio) { + int cy = org.Width() ? rect.Width() * org.Height() / org.Width() : 0; + int cx = org.Height() ? rect.Height() * org.Width() / org.Height() : 0; + if(tx == ALIGN_BOTTOM && ty == ALIGN_RIGHT) { + Size sz = rect.Size(); + if(cx > sz.cx) + rect.right = rect.left + cx; + else + rect.bottom = rect.top + cy; + } + else + if(tx == ALIGN_RIGHT) + rect.bottom = rect.top + cy; + else + if(ty == ALIGN_BOTTOM) + rect.right = rect.left + cx; + } + } + if(rect != o) { + rect = Round(rect); + if(rect != o) { + DrawRect(o, rect); + sync(rect); + o = rect; + } + } +} + +/* +void RectTracker::MouseMove(Point, dword) +{ + Point p = GetMousePos(); + rect = org; + if(tx == ALIGN_CENTER && ty == ALIGN_CENTER) { + int x = org.left - op.x + p.x; + int y = org.top - op.y + p.y; + if(x + org.Width() > maxrect.right) + x = maxrect.right - org.Width(); + if(x < maxrect.left) + x = maxrect.left; + if(y + org.Height() > maxrect.bottom) + y = maxrect.bottom - org.Height(); + if(y < maxrect.top) + y = maxrect.top; + rect = RectC(x, y, org.Width(), org.Height()); + } + else { + if(tx == ALIGN_LEFT) { + rect.left = max(org.left - op.x + p.x, maxrect.left); + rect.left = minmax(rect.left, rect.right - maxsize.cx, rect.right - minsize.cx); + } + if(tx == ALIGN_RIGHT) { + rect.right = min(org.right - op.x + p.x, maxrect.right); + rect.right = minmax(rect.right, rect.left + minsize.cx, rect.left + maxsize.cx); + } + if(ty == ALIGN_TOP) { + rect.top = max(org.top - op.y + p.y, maxrect.top); + rect.top = minmax(rect.top, rect.bottom - maxsize.cy, rect.bottom - minsize.cy); + } + if(ty == ALIGN_BOTTOM) { + rect.bottom = min(org.bottom - op.y + p.y, maxrect.bottom); + rect.bottom = minmax(rect.bottom, rect.top + minsize.cy, rect.top + maxsize.cy); + } + if(keepratio) { + int cy = org.Width() ? rect.Width() * org.Height() / org.Width() : 0; + int cx = org.Height() ? rect.Height() * org.Width() / org.Height() : 0; + if(tx == ALIGN_BOTTOM && ty == ALIGN_RIGHT) { + Size sz = rect.Size(); + if(cx > sz.cx) + rect.right = rect.left + cx; + else + rect.bottom = rect.top + cy; + } + else + if(tx == ALIGN_RIGHT) + rect.bottom = rect.top + cy; + else + if(ty == ALIGN_BOTTOM) + rect.right = rect.left + cx; + } + } + if(rect != o) { + rect = Round(rect); + if(rect != o) { + DrawRect(o, rect); + sync(rect); + o = rect; + } + } +} +*/ +class PointLooper : public LocalLoop { + const Vector& ani; + int ani_ms; + bool result; + +public: + virtual void LeftUp(Point, dword); + virtual Image CursorImage(Point p, dword keyflags); + virtual bool Key(dword key, int); + + operator bool() const { return result; } + + PointLooper(Ctrl& ctrl, const Vector& ani, int ani_ms) + : ani(ani), ani_ms(ani_ms) { SetMaster(ctrl); } +}; + +void PointLooper::LeftUp(Point, dword) +{ + result = true; + EndLoop(); +} + +Image PointLooper::CursorImage(Point p, dword keyflags) +{ + return ani[int(GetTimeClick() / ani_ms % ani.GetCount())]; +} + +bool PointLooper::Key(dword key, int) +{ + if(key == K_ESCAPE) { + result = false; + EndLoop(); + } + return true; +} + +bool PointLoop(Ctrl& ctrl, const Vector& ani, int ani_ms) +{ + PointLooper p(ctrl, ani, ani_ms); + p.Run(); + return p; +} + +bool PointLoop(Ctrl& ctrl, const Image& img) +{ + Vector m; + m.Add(img); + return PointLoop(ctrl, m, 1); +} + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/MKeys.h b/olddraw/CtrlCore/MKeys.h new file mode 100644 index 000000000..12100037b --- /dev/null +++ b/olddraw/CtrlCore/MKeys.h @@ -0,0 +1,367 @@ +#ifdef PLATFORM_X11 +#include "X11/keysym.h" +#endif + +enum { +#ifdef PLATFORM_X11 + #include "X11Keys.i" +#endif + +#ifdef PLATFORM_WIN32 + #include "Win32Keys.i" +#endif + + K_CTRL_BACK = K_CTRL|K_BACKSPACE, + K_CTRL_BACKSPACE = K_CTRL|K_BACKSPACE, + K_CTRL_TAB = K_CTRL|K_TAB, + K_CTRL_RETURN = K_CTRL|K_ENTER, + K_CTRL_ENTER = K_CTRL|K_ENTER, + K_CTRL_ESCAPE = K_CTRL|K_ESCAPE, + K_CTRL_SPACE = K_CTRL|K_SPACE, + K_CTRL_PRIOR = K_CTRL|K_PAGEUP, + K_CTRL_PAGEUP = K_CTRL|K_PAGEUP, + K_CTRL_NEXT = K_CTRL|K_PAGEDOWN, + K_CTRL_PAGEDOWN = K_CTRL|K_PAGEDOWN, + K_CTRL_END = K_CTRL|K_END, + K_CTRL_HOME = K_CTRL|K_HOME, + K_CTRL_LEFT = K_CTRL|K_LEFT, + K_CTRL_UP = K_CTRL|K_UP, + K_CTRL_RIGHT = K_CTRL|K_RIGHT, + K_CTRL_DOWN = K_CTRL|K_DOWN, + K_CTRL_INSERT = K_CTRL|K_INSERT, + K_CTRL_DELETE = K_CTRL|K_DELETE, + + + K_CTRL_NUMPAD0 = K_CTRL|K_NUMPAD0, + K_CTRL_NUMPAD1 = K_CTRL|K_NUMPAD1, + K_CTRL_NUMPAD2 = K_CTRL|K_NUMPAD2, + K_CTRL_NUMPAD3 = K_CTRL|K_NUMPAD3, + K_CTRL_NUMPAD4 = K_CTRL|K_NUMPAD4, + K_CTRL_NUMPAD5 = K_CTRL|K_NUMPAD5, + K_CTRL_NUMPAD6 = K_CTRL|K_NUMPAD6, + K_CTRL_NUMPAD7 = K_CTRL|K_NUMPAD7, + K_CTRL_NUMPAD8 = K_CTRL|K_NUMPAD8, + K_CTRL_NUMPAD9 = K_CTRL|K_NUMPAD9, + K_CTRL_MULTIPLY = K_CTRL|K_MULTIPLY, + K_CTRL_ADD = K_CTRL|K_ADD, + K_CTRL_SEPARATOR = K_CTRL|K_SEPARATOR, + K_CTRL_SUBTRACT = K_CTRL|K_SUBTRACT, + K_CTRL_DECIMAL = K_CTRL|K_DECIMAL, + K_CTRL_DIVIDE = K_CTRL|K_DIVIDE, + + K_CTRL_F1 = K_CTRL|K_F1, + K_CTRL_F2 = K_CTRL|K_F2, + K_CTRL_F3 = K_CTRL|K_F3, + K_CTRL_F4 = K_CTRL|K_F4, + K_CTRL_F5 = K_CTRL|K_F5, + K_CTRL_F6 = K_CTRL|K_F6, + K_CTRL_F7 = K_CTRL|K_F7, + K_CTRL_F8 = K_CTRL|K_F8, + K_CTRL_F9 = K_CTRL|K_F9, + K_CTRL_F10 = K_CTRL|K_F10, + K_CTRL_F11 = K_CTRL|K_F11, + K_CTRL_F12 = K_CTRL|K_F12, + K_CTRL_SCROLL = K_CTRL|K_SCROLL, + + K_CTRL_A = K_CTRL|K_A, + K_CTRL_B = K_CTRL|K_B, + K_CTRL_C = K_CTRL|K_C, + K_CTRL_D = K_CTRL|K_D, + K_CTRL_E = K_CTRL|K_E, + K_CTRL_F = K_CTRL|K_F, + K_CTRL_G = K_CTRL|K_G, + K_CTRL_H = K_CTRL|K_H, + K_CTRL_I = K_CTRL|K_I, + K_CTRL_J = K_CTRL|K_J, + K_CTRL_K = K_CTRL|K_K, + K_CTRL_L = K_CTRL|K_L, + K_CTRL_M = K_CTRL|K_M, + K_CTRL_N = K_CTRL|K_N, + K_CTRL_O = K_CTRL|K_O, + K_CTRL_P = K_CTRL|K_P, + K_CTRL_Q = K_CTRL|K_Q, + K_CTRL_R = K_CTRL|K_R, + K_CTRL_S = K_CTRL|K_S, + K_CTRL_T = K_CTRL|K_T, + K_CTRL_U = K_CTRL|K_U, + K_CTRL_V = K_CTRL|K_V, + K_CTRL_W = K_CTRL|K_W, + K_CTRL_X = K_CTRL|K_X, + K_CTRL_Y = K_CTRL|K_Y, + K_CTRL_Z = K_CTRL|K_Z, + K_CTRL_0 = K_CTRL|K_0, + K_CTRL_1 = K_CTRL|K_1, + K_CTRL_2 = K_CTRL|K_2, + K_CTRL_3 = K_CTRL|K_3, + K_CTRL_4 = K_CTRL|K_4, + K_CTRL_5 = K_CTRL|K_5, + K_CTRL_6 = K_CTRL|K_6, + K_CTRL_7 = K_CTRL|K_7, + K_CTRL_8 = K_CTRL|K_8, + K_CTRL_9 = K_CTRL|K_9, + + K_SHIFT_BACK = K_SHIFT|K_BACKSPACE, + K_SHIFT_BACKSPACE = K_SHIFT|K_BACKSPACE, + K_SHIFT_TAB = K_SHIFT|K_TAB, + K_SHIFT_RETURN = K_SHIFT|K_ENTER, + K_SHIFT_ENTER = K_SHIFT|K_ENTER, + K_SHIFT_ESCAPE = K_SHIFT|K_ESCAPE, + K_SHIFT_SPACE = K_SHIFT|K_SPACE, + K_SHIFT_PRIOR = K_SHIFT|K_PAGEUP, + K_SHIFT_PAGEUP = K_SHIFT|K_PAGEUP, + K_SHIFT_NEXT = K_SHIFT|K_PAGEDOWN, + K_SHIFT_PAGEDOWN = K_SHIFT|K_PAGEDOWN, + K_SHIFT_END = K_SHIFT|K_END, + K_SHIFT_HOME = K_SHIFT|K_HOME, + K_SHIFT_LEFT = K_SHIFT|K_LEFT, + K_SHIFT_UP = K_SHIFT|K_UP, + K_SHIFT_RIGHT = K_SHIFT|K_RIGHT, + K_SHIFT_DOWN = K_SHIFT|K_DOWN, + K_SHIFT_INSERT = K_SHIFT|K_INSERT, + K_SHIFT_DELETE = K_SHIFT|K_DELETE, + + K_SHIFT_NUMPAD0 = K_SHIFT|K_NUMPAD0, + K_SHIFT_NUMPAD1 = K_SHIFT|K_NUMPAD1, + K_SHIFT_NUMPAD2 = K_SHIFT|K_NUMPAD2, + K_SHIFT_NUMPAD3 = K_SHIFT|K_NUMPAD3, + K_SHIFT_NUMPAD4 = K_SHIFT|K_NUMPAD4, + K_SHIFT_NUMPAD5 = K_SHIFT|K_NUMPAD5, + K_SHIFT_NUMPAD6 = K_SHIFT|K_NUMPAD6, + K_SHIFT_NUMPAD7 = K_SHIFT|K_NUMPAD7, + K_SHIFT_NUMPAD8 = K_SHIFT|K_NUMPAD8, + K_SHIFT_NUMPAD9 = K_SHIFT|K_NUMPAD9, + K_SHIFT_MULTIPLY = K_SHIFT|K_MULTIPLY, + K_SHIFT_ADD = K_SHIFT|K_ADD, + K_SHIFT_SEPARATOR = K_SHIFT|K_SEPARATOR, + K_SHIFT_SUBRACT = K_SHIFT|K_SUBTRACT, + K_SHIFT_DECIMAL = K_SHIFT|K_DECIMAL, + K_SHIFT_DIVIDE = K_SHIFT|K_DIVIDE, + K_SHIFT_F1 = K_SHIFT|K_F1, + K_SHIFT_F2 = K_SHIFT|K_F2, + K_SHIFT_F3 = K_SHIFT|K_F3, + K_SHIFT_F4 = K_SHIFT|K_F4, + K_SHIFT_F5 = K_SHIFT|K_F5, + K_SHIFT_F6 = K_SHIFT|K_F6, + K_SHIFT_F7 = K_SHIFT|K_F7, + K_SHIFT_F8 = K_SHIFT|K_F8, + K_SHIFT_F9 = K_SHIFT|K_F9, + K_SHIFT_F10 = K_SHIFT|K_F10, + K_SHIFT_F11 = K_SHIFT|K_F11, + K_SHIFT_F12 = K_SHIFT|K_F12, + K_SHIFT_SCROLL = K_SHIFT|K_SCROLL, + + K_SHIFT_A = K_SHIFT|K_A, + K_SHIFT_B = K_SHIFT|K_B, + K_SHIFT_C = K_SHIFT|K_C, + K_SHIFT_D = K_SHIFT|K_D, + K_SHIFT_E = K_SHIFT|K_E, + K_SHIFT_F = K_SHIFT|K_F, + K_SHIFT_G = K_SHIFT|K_G, + K_SHIFT_H = K_SHIFT|K_H, + K_SHIFT_I = K_SHIFT|K_I, + K_SHIFT_J = K_SHIFT|K_J, + K_SHIFT_K = K_SHIFT|K_K, + K_SHIFT_L = K_SHIFT|K_L, + K_SHIFT_M = K_SHIFT|K_M, + K_SHIFT_N = K_SHIFT|K_N, + K_SHIFT_O = K_SHIFT|K_O, + K_SHIFT_P = K_SHIFT|K_P, + K_SHIFT_Q = K_SHIFT|K_Q, + K_SHIFT_R = K_SHIFT|K_R, + K_SHIFT_S = K_SHIFT|K_S, + K_SHIFT_T = K_SHIFT|K_T, + K_SHIFT_U = K_SHIFT|K_U, + K_SHIFT_V = K_SHIFT|K_V, + K_SHIFT_W = K_SHIFT|K_W, + K_SHIFT_X = K_SHIFT|K_X, + K_SHIFT_Y = K_SHIFT|K_Y, + K_SHIFT_Z = K_SHIFT|K_Z, + K_SHIFT_0 = K_SHIFT|K_0, + K_SHIFT_1 = K_SHIFT|K_1, + K_SHIFT_2 = K_SHIFT|K_2, + K_SHIFT_3 = K_SHIFT|K_3, + K_SHIFT_4 = K_SHIFT|K_4, + K_SHIFT_5 = K_SHIFT|K_5, + K_SHIFT_6 = K_SHIFT|K_6, + K_SHIFT_7 = K_SHIFT|K_7, + K_SHIFT_8 = K_SHIFT|K_8, + K_SHIFT_9 = K_SHIFT|K_9, + + K_SHIFT_CTRL_BACK = K_SHIFT_CTRL|K_BACKSPACE, + K_SHIFT_CTRL_BACKSPACE = K_SHIFT_CTRL|K_BACKSPACE, + K_SHIFT_CTRL_TAB = K_SHIFT_CTRL|K_TAB, + K_SHIFT_CTRL_RETURN = K_SHIFT_CTRL|K_ENTER, + K_SHIFT_CTRL_ENTER = K_SHIFT_CTRL|K_ENTER, + K_SHIFT_CTRL_ESCAPE = K_SHIFT_CTRL|K_ESCAPE, + K_SHIFT_CTRL_SPACE = K_SHIFT_CTRL|K_SPACE, + K_SHIFT_CTRL_PRIOR = K_SHIFT_CTRL|K_PAGEUP, + K_SHIFT_CTRL_PAGEUP = K_SHIFT_CTRL|K_PAGEUP, + K_SHIFT_CTRL_NEXT = K_SHIFT_CTRL|K_PAGEDOWN, + K_SHIFT_CTRL_PAGEDOWN = K_SHIFT_CTRL|K_PAGEDOWN, + K_SHIFT_CTRL_END = K_SHIFT_CTRL|K_END, + K_SHIFT_CTRL_HOME = K_SHIFT_CTRL|K_HOME, + K_SHIFT_CTRL_LEFT = K_SHIFT_CTRL|K_LEFT, + K_SHIFT_CTRL_UP = K_SHIFT_CTRL|K_UP, + K_SHIFT_CTRL_RIGHT = K_SHIFT_CTRL|K_RIGHT, + K_SHIFT_CTRL_DOWN = K_SHIFT_CTRL|K_DOWN, + K_SHIFT_CTRL_INSERT = K_SHIFT_CTRL|K_INSERT, + K_SHIFT_CTRL_DELETE = K_SHIFT_CTRL|K_DELETE, + K_SHIFT_CTRL_LBRACKET = K_SHIFT_CTRL|219|K_DELTA, + K_SHIFT_CTRL_RBRACKET = K_SHIFT_CTRL|221|K_DELTA, + + K_SHIFT_CTRL_NUMPAD0 = K_SHIFT_CTRL|K_NUMPAD0, + K_SHIFT_CTRL_NUMPAD1 = K_SHIFT_CTRL|K_NUMPAD1, + K_SHIFT_CTRL_NUMPAD2 = K_SHIFT_CTRL|K_NUMPAD2, + K_SHIFT_CTRL_NUMPAD3 = K_SHIFT_CTRL|K_NUMPAD3, + K_SHIFT_CTRL_NUMPAD4 = K_SHIFT_CTRL|K_NUMPAD4, + K_SHIFT_CTRL_NUMPAD5 = K_SHIFT_CTRL|K_NUMPAD5, + K_SHIFT_CTRL_NUMPAD6 = K_SHIFT_CTRL|K_NUMPAD6, + K_SHIFT_CTRL_NUMPAD7 = K_SHIFT_CTRL|K_NUMPAD7, + K_SHIFT_CTRL_NUMPAD8 = K_SHIFT_CTRL|K_NUMPAD8, + K_SHIFT_CTRL_NUMPAD9 = K_SHIFT_CTRL|K_NUMPAD9, + K_SHIFT_CTRL_MULTIPLY = K_SHIFT_CTRL|K_MULTIPLY, + K_SHIFT_CTRL_ADD = K_SHIFT_CTRL|K_ADD, + K_SHIFT_CTRL_SEPARATOR = K_SHIFT_CTRL|K_SEPARATOR, + K_SHIFT_CTRL_SUBRACT = K_SHIFT_CTRL|K_SUBTRACT, + K_SHIFT_CTRL_DECIMAL = K_SHIFT_CTRL|K_DECIMAL, + K_SHIFT_CTRL_DIVIDE = K_SHIFT_CTRL|K_DIVIDE, + K_SHIFT_CTRL_F1 = K_SHIFT_CTRL|K_F1, + K_SHIFT_CTRL_F2 = K_SHIFT_CTRL|K_F2, + K_SHIFT_CTRL_F3 = K_SHIFT_CTRL|K_F3, + K_SHIFT_CTRL_F4 = K_SHIFT_CTRL|K_F4, + K_SHIFT_CTRL_F5 = K_SHIFT_CTRL|K_F5, + K_SHIFT_CTRL_F6 = K_SHIFT_CTRL|K_F6, + K_SHIFT_CTRL_F7 = K_SHIFT_CTRL|K_F7, + K_SHIFT_CTRL_F8 = K_SHIFT_CTRL|K_F8, + K_SHIFT_CTRL_F9 = K_SHIFT_CTRL|K_F9, + K_SHIFT_CTRL_F10 = K_SHIFT_CTRL|K_F10, + K_SHIFT_CTRL_F11 = K_SHIFT_CTRL|K_F11, + K_SHIFT_CTRL_F12 = K_SHIFT_CTRL|K_F12, + K_SHIFT_CTRL_SCROLL = K_SHIFT_CTRL|K_SCROLL, + + K_SHIFT_CTRL_A = K_SHIFT_CTRL|K_A, + K_SHIFT_CTRL_B = K_SHIFT_CTRL|K_B, + K_SHIFT_CTRL_C = K_SHIFT_CTRL|K_C, + K_SHIFT_CTRL_D = K_SHIFT_CTRL|K_D, + K_SHIFT_CTRL_E = K_SHIFT_CTRL|K_E, + K_SHIFT_CTRL_F = K_SHIFT_CTRL|K_F, + K_SHIFT_CTRL_G = K_SHIFT_CTRL|K_G, + K_SHIFT_CTRL_H = K_SHIFT_CTRL|K_H, + K_SHIFT_CTRL_I = K_SHIFT_CTRL|K_I, + K_SHIFT_CTRL_J = K_SHIFT_CTRL|K_J, + K_SHIFT_CTRL_K = K_SHIFT_CTRL|K_K, + K_SHIFT_CTRL_L = K_SHIFT_CTRL|K_L, + K_SHIFT_CTRL_M = K_SHIFT_CTRL|K_M, + K_SHIFT_CTRL_N = K_SHIFT_CTRL|K_N, + K_SHIFT_CTRL_O = K_SHIFT_CTRL|K_O, + K_SHIFT_CTRL_P = K_SHIFT_CTRL|K_P, + K_SHIFT_CTRL_Q = K_SHIFT_CTRL|K_Q, + K_SHIFT_CTRL_R = K_SHIFT_CTRL|K_R, + K_SHIFT_CTRL_S = K_SHIFT_CTRL|K_S, + K_SHIFT_CTRL_T = K_SHIFT_CTRL|K_T, + K_SHIFT_CTRL_U = K_SHIFT_CTRL|K_U, + K_SHIFT_CTRL_V = K_SHIFT_CTRL|K_V, + K_SHIFT_CTRL_W = K_SHIFT_CTRL|K_W, + K_SHIFT_CTRL_X = K_SHIFT_CTRL|K_X, + K_SHIFT_CTRL_Y = K_SHIFT_CTRL|K_Y, + K_SHIFT_CTRL_Z = K_SHIFT_CTRL|K_Z, + K_SHIFT_CTRL_0 = K_SHIFT_CTRL|K_0, + K_SHIFT_CTRL_1 = K_SHIFT_CTRL|K_1, + K_SHIFT_CTRL_2 = K_SHIFT_CTRL|K_2, + K_SHIFT_CTRL_3 = K_SHIFT_CTRL|K_3, + K_SHIFT_CTRL_4 = K_SHIFT_CTRL|K_4, + K_SHIFT_CTRL_5 = K_SHIFT_CTRL|K_5, + K_SHIFT_CTRL_6 = K_SHIFT_CTRL|K_6, + K_SHIFT_CTRL_7 = K_SHIFT_CTRL|K_7, + K_SHIFT_CTRL_8 = K_SHIFT_CTRL|K_8, + K_SHIFT_CTRL_9 = K_SHIFT_CTRL|K_9, + + K_ALT_BACK = K_ALT|K_BACKSPACE, + K_ALT_BACKSPACE = K_ALT|K_BACKSPACE, + K_ALT_TAB = K_ALT|K_TAB, + K_ALT_RETURN = K_ALT|K_ENTER, + K_ALT_ENTER = K_ALT|K_ENTER, + K_ALT_ESCAPE = K_ALT|K_ESCAPE, + K_ALT_SPACE = K_ALT|K_SPACE, + K_ALT_PRIOR = K_ALT|K_PAGEUP, + K_ALT_PAGEUP = K_ALT|K_PAGEUP, + K_ALT_NEXT = K_ALT|K_PAGEDOWN, + K_ALT_PAGEDOWN = K_ALT|K_PAGEDOWN, + K_ALT_END = K_ALT|K_END, + K_ALT_HOME = K_ALT|K_HOME, + K_ALT_LEFT = K_ALT|K_LEFT, + K_ALT_UP = K_ALT|K_UP, + K_ALT_RIGHT = K_ALT|K_RIGHT, + K_ALT_DOWN = K_ALT|K_DOWN, + K_ALT_INSERT = K_ALT|K_INSERT, + K_ALT_DELETE = K_ALT|K_DELETE, + + K_ALT_NUMPAD0 = K_ALT|K_NUMPAD0, + K_ALT_NUMPAD1 = K_ALT|K_NUMPAD1, + K_ALT_NUMPAD2 = K_ALT|K_NUMPAD2, + K_ALT_NUMPAD3 = K_ALT|K_NUMPAD3, + K_ALT_NUMPAD4 = K_ALT|K_NUMPAD4, + K_ALT_NUMPAD5 = K_ALT|K_NUMPAD5, + K_ALT_NUMPAD6 = K_ALT|K_NUMPAD6, + K_ALT_NUMPAD7 = K_ALT|K_NUMPAD7, + K_ALT_NUMPAD8 = K_ALT|K_NUMPAD8, + K_ALT_NUMPAD9 = K_ALT|K_NUMPAD9, + K_ALT_MULTIPLY = K_ALT|K_MULTIPLY, + K_ALT_ADD = K_ALT|K_ADD, + K_ALT_SEPARATOR = K_ALT|K_SEPARATOR, + K_ALT_SUBTRACT = K_ALT|K_SUBTRACT, + K_ALT_DECIMAL = K_ALT|K_DECIMAL, + K_ALT_DIVIDE = K_ALT|K_DIVIDE, + K_ALT_F1 = K_ALT|K_F1, + K_ALT_F2 = K_ALT|K_F2, + K_ALT_F3 = K_ALT|K_F3, + K_ALT_F4 = K_ALT|K_F4, + K_ALT_F5 = K_ALT|K_F5, + K_ALT_F6 = K_ALT|K_F6, + K_ALT_F7 = K_ALT|K_F7, + K_ALT_F8 = K_ALT|K_F8, + K_ALT_F9 = K_ALT|K_F9, + K_ALT_F10 = K_ALT|K_F10, + K_ALT_F11 = K_ALT|K_F11, + K_ALT_F12 = K_ALT|K_F12, + K_ALT_SCROLL = K_ALT|K_SCROLL, + + K_ALT_A = K_ALT|K_A, + K_ALT_B = K_ALT|K_B, + K_ALT_C = K_ALT|K_C, + K_ALT_D = K_ALT|K_D, + K_ALT_E = K_ALT|K_E, + K_ALT_F = K_ALT|K_F, + K_ALT_G = K_ALT|K_G, + K_ALT_H = K_ALT|K_H, + K_ALT_I = K_ALT|K_I, + K_ALT_J = K_ALT|K_J, + K_ALT_K = K_ALT|K_K, + K_ALT_L = K_ALT|K_L, + K_ALT_M = K_ALT|K_M, + K_ALT_N = K_ALT|K_N, + K_ALT_O = K_ALT|K_O, + K_ALT_P = K_ALT|K_P, + K_ALT_Q = K_ALT|K_Q, + K_ALT_R = K_ALT|K_R, + K_ALT_S = K_ALT|K_S, + K_ALT_T = K_ALT|K_T, + K_ALT_U = K_ALT|K_U, + K_ALT_V = K_ALT|K_V, + K_ALT_W = K_ALT|K_W, + K_ALT_X = K_ALT|K_X, + K_ALT_Y = K_ALT|K_Y, + K_ALT_Z = K_ALT|K_Z, + K_ALT_0 = K_ALT|K_0, + K_ALT_1 = K_ALT|K_1, + K_ALT_2 = K_ALT|K_2, + K_ALT_3 = K_ALT|K_3, + K_ALT_4 = K_ALT|K_4, + K_ALT_5 = K_ALT|K_5, + K_ALT_6 = K_ALT|K_6, + K_ALT_7 = K_ALT|K_7, + K_ALT_8 = K_ALT|K_8, + K_ALT_9 = K_ALT|K_9, + + K_CTRL_BREAK = K_CTRL|K_BREAK, +}; diff --git a/olddraw/CtrlCore/MultiMon.dli b/olddraw/CtrlCore/MultiMon.dli new file mode 100644 index 000000000..38aa60c0b --- /dev/null +++ b/olddraw/CtrlCore/MultiMon.dli @@ -0,0 +1,6 @@ +FN_C(HMONITOR, WINAPI, MonitorFromWindow, (HWND, DWORD)) +FN_C(HMONITOR, WINAPI, MonitorFromRect, (LPCRECT, DWORD)) +FN_C(HMONITOR, WINAPI, MonitorFromPoint, (POINT, DWORD)) +FN_C(BOOL, WINAPI, GetMonitorInfo, (HMONITOR, LPMONITORINFO)) +FN_C(BOOL, WINAPI, EnumDisplayMonitors, (HDC, LPCRECT, MONITORENUMPROC, LPARAM)) +FN_C(BOOL, WINAPI, EnumDisplayDevices, (PVOID, DWORD, PDISPLAY_DEVICE,DWORD)) diff --git a/olddraw/CtrlCore/TopWin32.cpp b/olddraw/CtrlCore/TopWin32.cpp new file mode 100644 index 000000000..a08afd9e6 --- /dev/null +++ b/olddraw/CtrlCore/TopWin32.cpp @@ -0,0 +1,282 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) // LOG(x) + +#ifdef PLATFORM_WIN32 + +void TopWindow::SyncSizeHints() {} + +LRESULT TopWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) +{ + GuiLock __; + HWND hwnd = GetHWND(); +#ifndef PLATFORM_WINCE + bool inloop; +#endif + switch(message) { +#ifndef PLATFORM_WINCE + case WM_QUERYENDSESSION: + inloop = InLoop(); + WhenClose(); + return inloop ? !InLoop() : !IsOpen(); + case WM_ENDSESSION: + EndSession() = true; + PostQuitMessage(0); + return 0; +#endif + case WM_CLOSE: + if(IsEnabled()) { + IgnoreMouseUp(); + WhenClose(); + } + return 0; + case WM_WINDOWPOSCHANGED: +#ifndef PLATFORM_WINCE + if(IsIconic(hwnd)) + state = MINIMIZED; + else + if(IsZoomed(hwnd)) + state = MAXIMIZED; + else +#endif + { + state = OVERLAPPED; + overlapped = GetScreenClient(hwnd); + } + Layout(); + break; + } + return Ctrl::WindowProc(message, wParam, lParam); +} + +void TopWindow::SyncTitle0() +{ + GuiLock __; + HWND hwnd = GetHWND(); +#ifndef PLATFORM_WINCE + if(hwnd) + if(IsWindowUnicode(hwnd)) + ::SetWindowTextW(hwnd, (const WCHAR*)~title); + else +#endif + ::SetWindowText(hwnd, ToSystemCharset(title.ToString())); +} + +void TopWindow::DeleteIco0() +{ + GuiLock __; + if(ico) + DestroyIcon(ico); + if(lico) + DestroyIcon(lico); + ico = lico = NULL; +} + +void TopWindow::DeleteIco() +{ + Call(THISBACK(DeleteIco0)); +} + +void TopWindow::SyncCaption0() +{ + GuiLock __; + LLOG("SyncCaption"); + if(fullscreen) + return; + HWND hwnd = GetHWND(); + if(hwnd) { + style = ::GetWindowLong(hwnd, GWL_STYLE); + exstyle = ::GetWindowLong(hwnd, GWL_EXSTYLE); + } + style &= ~(WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU|WS_POPUP|WS_DLGFRAME); + exstyle &= ~(WS_EX_TOOLWINDOW|WS_EX_DLGMODALFRAME); + style |= WS_CAPTION; + if(hasdhctrl) + style |= WS_CLIPSIBLINGS|WS_CLIPCHILDREN; + if(minimizebox) + style |= WS_MINIMIZEBOX; + if(maximizebox) + style |= WS_MAXIMIZEBOX; + if(sizeable) + style |= WS_THICKFRAME; +#ifndef PLATFORM_WINCE + if(frameless) + style = (style & ~WS_CAPTION) | WS_POPUP; + else + if(IsNull(icon) && !maximizebox && !minimizebox || noclosebox) { + style |= WS_POPUPWINDOW|WS_DLGFRAME; + exstyle |= WS_EX_DLGMODALFRAME; + if(noclosebox) + style &= ~WS_SYSMENU; + } + else +#endif + style |= WS_SYSMENU; + if(tool) + exstyle |= WS_EX_TOOLWINDOW; + if(hwnd) { + ::SetWindowLong(hwnd, GWL_STYLE, style); + ::SetWindowLong(hwnd, GWL_EXSTYLE, exstyle); + SyncTitle(); + } + DeleteIco(); +#ifndef PLATFORM_WINCE //TODO!!! + if(hwnd) { + ::SendMessage(hwnd, WM_SETICON, false, (LPARAM)(ico = IconWin32(icon))); + ::SendMessage(hwnd, WM_SETICON, true, (LPARAM)(lico = IconWin32(largeicon))); + } +#endif +} + +void TopWindow::CenterRect(HWND hwnd, int center) +{ + GuiLock __; + SetupRect(); + if(hwnd && center == 1 || center == 2) { + Size sz = GetRect().Size(); + Rect frmrc(sz); + #ifndef PLATFORM_WINCE + ::AdjustWindowRect(frmrc, WS_OVERLAPPEDWINDOW, FALSE); + #endif + Rect r, wr; + wr = Ctrl::GetWorkArea().Deflated(-frmrc.left, -frmrc.top, + frmrc.right - sz.cx, frmrc.bottom - sz.cy); + sz.cx = min(sz.cx, wr.Width()); + sz.cy = min(sz.cy, wr.Height()); + if(center == 1) { + ::GetClientRect(hwnd, r); + if(r.IsEmpty()) + r = wr; + else { + Point p = r.TopLeft(); + ::ClientToScreen(hwnd, p); + r.Offset(p); + } + } + else + r = wr; + Point p = r.CenterPos(sz); + if(p.x + sz.cx > wr.right) p.x = wr.right - sz.cx; + if(p.y + sz.cy > wr.bottom) p.y = wr.bottom - sz.cy; + if(p.x < wr.left) p.x = wr.left; + if(p.y < wr.top) p.y = wr.top; + SetRect(p.x, p.y, sz.cx, sz.cy); + } +} + +static HWND trayHWND__; +HWND GetTrayHWND__() { return trayHWND__; } +void SetTrayHWND__(HWND hwnd) { trayHWND__ = hwnd; } + +void TopWindow::Open(HWND hwnd) +{ + GuiLock __; + if(dokeys && (!GUI_AKD_Conservative() || GetAccessKeysDeep() <= 1)) + DistributeAccessKeys(); + UsrLogT(3, "OPEN " + Desc(this)); + LLOG("TopWindow::Open, owner HWND = " << FormatIntHex((int)hwnd, 8) << ", Active = " << FormatIntHex((int)::GetActiveWindow(), 8)); + IgnoreMouseUp(); + SyncCaption(); +#ifdef PLATFORM_WINCE + if(!GetRect().IsEmpty()) +#endif + if(fullscreen) { + SetRect(GetScreenSize()); + Create(hwnd, WS_POPUP, 0, false, SW_SHOWMAXIMIZED, false); + } + else { + CenterRect(hwnd, hwnd && hwnd == GetTrayHWND__() ? center ? 2 : 0 : center); + Create(hwnd, style, exstyle, false, state == OVERLAPPED ? SW_SHOWNORMAL : + state == MINIMIZED ? SW_MINIMIZE : + SW_MAXIMIZE, false); + } + PlaceFocus(); + SyncCaption(); + FixIcons(); +} + +void TopWindow::Open(Ctrl *owner) +{ + GuiLock __; + LLOG("TopWindow::Open(Ctrl) -> " << UPP::Name(owner)); + Open(owner ? owner->GetTopCtrl()->GetHWND() : NULL); + if(IsOpen() && top) + top->owner = owner; +} + +void TopWindow::Open() +{ + Open(::GetActiveWindow()); // :: needed because of ActiveX controls (to create modal dlgs owned by a HWND) +} + +void TopWindow::OpenMain() +{ + Open((HWND) NULL); +} + +void TopWindow::Minimize(bool effect) +{ + state = MINIMIZED; + if(IsOpen()) +#ifdef PLATFORM_WINCE + ::ShowWindow(GetHWND(), SW_MINIMIZE); +#else + ::ShowWindow(GetHWND(), effect ? SW_MINIMIZE : SW_SHOWMINIMIZED); +#endif +} + +void TopWindow::Maximize(bool effect) +{ + state = MAXIMIZED; + if(IsOpen()) + ::ShowWindow(GetHWND(), effect ? SW_MAXIMIZE : SW_SHOWMAXIMIZED); +} + +void TopWindow::Overlap(bool effect) +{ + GuiLock __; + state = OVERLAPPED; + if(IsOpen()) + ::ShowWindow(GetHWND(), effect ? SW_SHOWNORMAL : SW_RESTORE); +} + +TopWindow& TopWindow::Style(dword _style) +{ + GuiLock __; + style = _style; + if(GetHWND()) + ::SetWindowLong(GetHWND(), GWL_STYLE, style); + SyncCaption(); + return *this; +} + +TopWindow& TopWindow::ExStyle(dword _exstyle) +{ + GuiLock __; + exstyle = _exstyle; + if(GetHWND()) + ::SetWindowLong(GetHWND(), GWL_EXSTYLE, exstyle); + SyncCaption(); + return *this; +} + +TopWindow& TopWindow::TopMost(bool b, bool stay_top) +{ + GuiLock __; + HWND hwnd; + if(hwnd = GetHWND()) + SetWindowPos(hwnd, b ? HWND_TOPMOST : (stay_top ? HWND_NOTOPMOST : HWND_BOTTOM), + 0,0,0,0,SWP_NOMOVE|SWP_NOSIZE ); + return ExStyle(b ? GetExStyle() | WS_EX_TOPMOST : GetExStyle() & ~WS_EX_TOPMOST); +} + +bool TopWindow::IsTopMost() const +{ + return GetExStyle() & WS_EX_TOPMOST; +} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/TopWinX11.cpp b/olddraw/CtrlCore/TopWinX11.cpp new file mode 100644 index 000000000..20809685d --- /dev/null +++ b/olddraw/CtrlCore/TopWinX11.cpp @@ -0,0 +1,312 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) //DLOG(x) + +#ifdef PLATFORM_X11 + +void TopWindow::SyncSizeHints() +{ + GuiLock __; + Size min = GetMinSize(); + Size max = GetMaxSize(); + if(!sizeable) + min = max = GetRect().Size(); + Window w = GetWindow(); + if(w && (min != xminsize || max != xmaxsize)) { + xminsize = min; + xmaxsize = max; + size_hints->min_width = min.cx; + size_hints->min_height = min.cy; + size_hints->max_width = max.cx; + size_hints->max_height = max.cy; + size_hints->flags = PMinSize|PMaxSize; + XSetWMNormalHints(Xdisplay, w, size_hints); + } +} + +void TopWindow::EndIgnoreTakeFocus() +{ + GuiLock __; + ignoretakefocus = false; +} + +void TopWindow::EventProc(XWindow& w, XEvent *event) +{ + GuiLock __; + Ptr this_ = this; + if(event->type == ClientMessage) { + if(event->xclient.format == 32 && event->xclient.message_type) + if(event->xclient.message_type == XAtom("WM_PROTOCOLS")) { + Atom a = event->xclient.data.l[0]; + if(a == XAtom("WM_DELETE_WINDOW") && IsEnabled()) { + LLOG("DELETE_WINDOW " << Name()); + WhenClose(); + return; + } + if(a == XAtom("WM_TAKE_FOCUS")) { + LLOG("TAKE_FOCUS serial: " << event->xclient.serial); + Xeventtime = event->xclient.data.l[1]; + TakeFocus(); + return; + } + LLOG("Unknown WM_PROTOCOLS: " << XAtomName(a)); + } + } + if(this_) Ctrl::EventProc(w, event); + if(this_) SyncSizeHints(); +} + +void TopWindow::DefSyncTitle() +{ + GuiLock __; + if(title2 == title) + return; + title2 = title; + if(IsOpen() && GetWindow()) { + Window w = GetWindow(); + XStoreName(Xdisplay, w, title.ToString()); + XSetIconName(Xdisplay, w, title.ToString()); + String utf8title = FromUnicode(title, CHARSET_UTF8); + XChangeProperty(Xdisplay, w, XAtom("_NET_WM_NAME"), XAtom("UTF8_STRING"), + 8, PropModeReplace, + (const unsigned char *)~utf8title, utf8title.GetLength()); + XChangeProperty(Xdisplay, w, XAtom("_NET_WM_ICON_NAME"), XAtom("UTF8_STRING"), + 8, PropModeReplace, + (const unsigned char *)~utf8title, utf8title.GetLength()); + } +} + +void TopWindow::SyncTitle0() +{ + GuiLock __; + LLOG("SyncTitle: " << title); + KillTimeCallback(TIMEID_DEFSYNCTITLE); + SetTimeCallback(0, THISBACK(DefSyncTitle), TIMEID_DEFSYNCTITLE); + LLOG("*SyncTitle: " << title); +} + +void TopWindow::SyncCaption0() +{ + GuiLock __; + LLOG("SyncCaption"); + SyncTitle(); + if(IsOpen() && GetWindow()) { + unsigned long wina[6]; + int n = 0; + Window w = GetWindow(); + if(tool) + wina[n++] = XAtom("_NET_WM_WINDOW_TYPE_TOOLBAR"); + if(GetOwner()) + wina[n++] = XAtom("_NET_WM_WINDOW_TYPE_DIALOG"); + wina[n++] = XAtom("_NET_WM_WINDOW_TYPE_NORMAL"); + XChangeProperty(Xdisplay, GetWindow(), XAtom("_NET_WM_WINDOW_TYPE"), XAtom("ATOM"), 32, + PropModeReplace, (const unsigned char *)wina, n); + n = 0; + if(topmost) + wina[n++] = XAtom("_NET_WM_STATE_ABOVE"); + if(state == MAXIMIZED) { + wina[n++] = XAtom("_NET_WM_STATE_MAXIMIZED_HORZ"); + wina[n++] = XAtom("_NET_WM_STATE_MAXIMIZED_VERT"); + } + if(fullscreen) + wina[n++] = XAtom("_NET_WM_STATE_FULLSCREEN"); + XChangeProperty(Xdisplay, GetWindow(), XAtom("_NET_WM_STATE"), XAtom("ATOM"), 32, + PropModeReplace, (const unsigned char *)wina, n); + wm_hints->flags = InputHint|WindowGroupHint|StateHint; + wm_hints->initial_state = NormalState; + wm_hints->input = XTrue; + Ctrl *owner = GetOwner(); + wm_hints->window_group = owner ? owner->GetWindow() : w; + if(!icon.IsEmpty()) { + Size isz = icon.GetSize(); + int len = 2 + isz.cx * isz.cy; + Buffer data(len); + unsigned long *t = data; + *t++ = isz.cx; + *t++ = isz.cy; + for(int y = 0; y < isz.cy; y++) { + const RGBA *q = icon[y]; + for(int x = isz.cx; x--;) { + *t++ = ((dword)q->a << 24) | + (dword)q->b | ((dword)q->g << 8) | ((dword)q->r << 16); + q++; + } + } + XChangeProperty(Xdisplay, w, XAtom("_NET_WM_ICON"), XA_CARDINAL, 32, PropModeReplace, + (const unsigned char *)~data, len); + } + XSetWMHints(Xdisplay, w, wm_hints); + } +} + +void TopWindow::CenterRect(Ctrl *owner) +{ + GuiLock __; + SetupRect(); + if(owner && center == 1 || center == 2) { + Size sz = GetRect().Size(); + Rect r, wr; + wr = Ctrl::GetWorkArea(); + GuiLock __; + Rect fm = windowFrameMargin; + if((fm.left|fm.right|fm.top|fm.bottom) == 0) + fm = Rect(8, 32, 8, 8); + if(center == 1) + r = owner->GetRect(); + else + r = wr; + Point p = r.CenterPos(sz); + r = RectC(p.x, p.y, sz.cx, sz.cy); + wr.left += fm.left; + wr.right -= fm.right; + wr.top += fm.top; + wr.bottom -= fm.bottom; + if(r.top < wr.top) { + r.bottom += wr.top - r.top; + r.top = wr.top; + } + if(r.bottom > wr.bottom) + r.bottom = wr.bottom; + minsize.cx = min(minsize.cx, r.GetWidth()); + minsize.cy = min(minsize.cy, r.GetHeight()); + SetRect(r); + } +} + +void TopWindow::Open(Ctrl *owner) +{ + GuiLock __; + if(dokeys && (!GUI_AKD_Conservative() || GetAccessKeysDeep() <= 1)) + DistributeAccessKeys(); + UsrLogT(3, "OPEN " + Desc(this)); + LLOG("OPEN " << Name() << " owner: " << UPP::Name(owner)); + IgnoreMouseUp(); + if(fullscreen) + SetRect(0, 0, Xwidth, Xheight); + else + CenterRect(owner); + LLOG("Open NextRequest " << NextRequest(Xdisplay)); + Create(owner, false, false); + xminsize.cx = xmaxsize.cx = Null; + title2.Clear(); + LLOG("SyncCaption"); + SyncCaption(); + LLOG("SyncSizeHints"); + size_hints->flags = 0; + SyncSizeHints(); + Rect r = GetRect(); + size_hints->x = r.left; + size_hints->y = r.top; + size_hints->width = r.Width(); + size_hints->height = r.Height(); + size_hints->win_gravity = StaticGravity; + size_hints->flags |= PPosition|PSize|PWinGravity; + if(owner) { + ASSERT(owner->IsOpen()); + LLOG("XSetTransientForHint"); + XSetTransientForHint(Xdisplay, GetWindow(), owner->GetWindow()); + } + LLOG("XSetWMNormalHints"); + XSetWMNormalHints(Xdisplay, GetWindow(), size_hints); + Atom protocols[2]; + protocols[0] = XAtom("WM_DELETE_WINDOW"); + protocols[1] = XAtom("WM_TAKE_FOCUS"); + LLOG("XSetWMProtocols"); + XSetWMProtocols(Xdisplay, GetWindow(), protocols, 2); + String x = GetExeTitle().ToString(); + const char *progname = ~x; + class_hint->res_name = (char *)progname; + class_hint->res_class = (char *)progname; + XSetClassHint(Xdisplay, GetWindow(), class_hint); + LLOG("WndShow(" << visible << ")"); + WndShow(visible); + if(visible) { + XEvent e; + LLOG("XWindowEvent"); + XWindowEvent(Xdisplay, top->window, VisibilityChangeMask, &e); + ignoretakefocus = true; + SetTimeCallback(500, THISBACK(EndIgnoreTakeFocus)); + LLOG("SetWndFocus"); + SetWndFocus(); + for(int i = 0; i < 50; i++) { + if(XCheckTypedWindowEvent(Xdisplay, top->window, FocusIn, &e)) { + ProcessEvent(&e); + if(e.xfocus.window == top->window) + break; + } + Sleep(10); + } + } + LLOG(">Open NextRequest " << NextRequest(Xdisplay)); + LLOG(">OPENED " << Name()); + PlaceFocus(); + StateH(OPEN); + Vector fe = GetPropertyInts(top->window, XAtom("_NET_FRAME_EXTENTS")); + if(fe.GetCount() >= 4 && + fe[0] >= 0 && fe[0] <= 16 && fe[1] >= 0 && fe[1] <= 16 && //fluxbox returns wrong numbers - quick&dirty workaround + fe[2] >= 0 && fe[2] <= 64 && fe[3] >= 0 && fe[3] <= 48) + { + GuiLock __; + windowFrameMargin.left = max(windowFrameMargin.left, fe[0]); + windowFrameMargin.right = max(windowFrameMargin.right, fe[1]); + windowFrameMargin.top = max(windowFrameMargin.top, fe[2]); + windowFrameMargin.bottom = max(windowFrameMargin.bottom, fe[3]); + } + if(IsOpen() && top) + top->owner = owner; + + int version = 5; + XChangeProperty(Xdisplay, GetWindow(), XAtom("XdndAware"), XA_ATOM, 32, + 0, (byte *)&version, 1); + FixIcons(); +} + +void TopWindow::Open() +{ + GuiLock __; + Open(GetActiveWindow()); +} + +void TopWindow::OpenMain() +{ + GuiLock __; + Open(NULL); +} + +void TopWindow::Minimize(bool) +{ + GuiLock __; + state = MINIMIZED; + XIconifyWindow(Xdisplay, GetWindow(), Xscreenno); +} + +void TopWindow::Maximize(bool effect) +{ + GuiLock __; + state = MAXIMIZED; +} + +void TopWindow::Overlap(bool effect) +{ + GuiLock __; + state = OVERLAPPED; +} + +TopWindow& TopWindow::TopMost(bool b, bool) +{ + GuiLock __; + topmost = b; + return *this; +} + +bool TopWindow::IsTopMost() const +{ + GuiLock __; + return topmost; +} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/TopWindow.cpp b/olddraw/CtrlCore/TopWindow.cpp new file mode 100644 index 000000000..575939c0d --- /dev/null +++ b/olddraw/CtrlCore/TopWindow.cpp @@ -0,0 +1,551 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) // LOG(x) + +Rect TopWindow::windowFrameMargin; + +String TopWindow::GetDesc() const +{ + return title.ToString(); +} + +Size TopWindow::GetMinSize() const +{ + return minsize; +} + +Size TopWindow::GetStdSize() const +{ + return GetMinSize(); +} + +void TopWindow::ActiveFocus0(Ctrl& ctrl) +{ + if(IsChild()) return; + activefocus = &ctrl; + if(IsForeground()) ctrl.SetWantFocus(); +} + +void TopWindow::Activate() +{ + LLOG("Activate " << Name() << " activefocus = " << UPP::Name(activefocus)); + UsrLogT(3, "ACTIVATE " + Desc(this)); + if(activefocus && (HasFocus() || !GetFocusChildDeep()) && IsEnabled()) + activefocus->SetWantFocus(); + LLOG("Activate End"); +} + +void TopWindow::ChildGotFocus() +{ + activefocus = GetFocusCtrl(); +} + +void TopWindow::Deactivate() +{ + LLOG("DeActivate current focus " << UPP::Name(GetFocusCtrl())); + if(HasFocusDeep()) + activefocus = GetFocusCtrl(); + UsrLogT(3, "DEACTIVATE " + Desc(this)); + LLOG("DeActivate " << Name() << " activefocus = " << UPP::Name(activefocus)); +} + +void TopWindow::PlaceFocus() +{ + if(activefocus) + activefocus->SetFocus(); + else + IterateFocusForward(this, this, true, true); +} + +bool TopWindow::IsShowEnabled() const +{ + return true; +} + +void TopWindow::SyncCaption() +{ + Call(THISBACK(SyncCaption0)); +} + +void TopWindow::SyncTitle() +{ + Call(THISBACK(SyncTitle0)); +} + +void TopWindow::Close() +{ + if(InLoop()) { + if(!InCurrentLoop()) return; + if(FindAction(IDCANCEL)) + RejectBreak(IDCANCEL); + else + if(FindAction(IDYES)) + AcceptBreak(IDYES); + else + AcceptBreak(IDOK); + return; + } + backup.Clear(); + if(IsOpen()) IgnoreMouseUp(); + Ctrl::Close(); +} + +void TopWindow::Backup() +{ + StringStream s; + Ctrl::Serialize(s); + backup = s; +} + +void TopWindow::Restore() +{ + StringStream s(backup); + Ctrl::Serialize(s); +} + +bool TopWindow::Accept() +{ + Ctrl *q; + for(q = GetFirstChild(); q; q = q->GetNext()) + if(!q->Accept()) + return false; + return true; +} + +void TopWindow::Reject() +{ + for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) + q->Reject(); + if(!backup.IsEmpty()) + Restore(); +} + +void TopWindow::Break(int ID) +{ + EndLoop(ID); +} + +bool TopWindow::AcceptBreak(int ID) +{ + if(Accept()) { + Break(ID); + return true; + } + return false; +} + +void TopWindow::RejectBreak(int ID) +{ + Reject(); + Break(ID); +} + +void TopWindow::SetupRect() +{ + Rect r = GetRect(); + if(r.IsEmpty()) + SetRect(GetDefaultWindowRect()); + else + if(r.left == 0 && r.top == 0 && center == 1) { + Rect area = Ctrl::GetWorkArea(); + SetRect(area.CenterRect(min(area.Size(), r.Size()))); + } +} + +void TopWindow::FixIcons() +{ + TopWindow *q = GetMainWindow(); + if(q) { + if(IsNull(icon)) { + icon = q->GetIcon(); + SyncCaption(); + } + if(IsNull(largeicon)) { + largeicon = q->GetIcon(); + SyncCaption(); + } + } +} + +TopWindow::Abreak *TopWindow::FindAction(int ID) +{ + for(int i = 0; i < action.GetCount(); i++) + if(action[i].ID == ID) return &action[i]; + return NULL; +} + +TopWindow::Abreak *TopWindow::FindAddAction(int ID) +{ + Abreak *x = FindAction(ID); + if(x) return x; + Abreak& a = action.Add(); + a.ID = ID; + a.dlg = this; + return &a; +} + +Callback TopWindow::Breaker(int ID) +{ + return callback(FindAddAction(ID), &Abreak::Break); +} + +Callback TopWindow::Acceptor(int ID) +{ + return callback(FindAddAction(ID), &Abreak::Accept); +} + +Callback TopWindow::Rejector(int ID) +{ + return callback(FindAddAction(ID), &Abreak::Reject); +} + +TopWindow& TopWindow::Breaker(Ctrl& m, int ID) +{ + m.WhenAction = Breaker(ID); + return *this; +} + +TopWindow& TopWindow::Acceptor(Ctrl& m, int ID) +{ + m.WhenAction = Acceptor(ID); + return *this; +} + +TopWindow& TopWindow::Rejector(Ctrl& m, int ID) +{ + m.WhenAction = Rejector(ID); + return *this; +} + +void TopWindow::Paint(Draw& w) +{ + background.Paint(w, Rect(GetSize()), SColorText, SColorShadow); +} + +TopWindow& TopWindow::Background(const PaintRect& prect) +{ + background = prect; + Refresh(); + return *this; +} + +bool TopWindow::Key(dword key, int count) +{ + if(Ctrl::Key(key, count)) + return true; + if(IsChild()) return false; + if(key == K_DOWN || key == K_RIGHT || key == K_TAB) { + Ctrl *ctrl = GetFocusChildDeep(); + if(ctrl && IterateFocusForward(ctrl, this)) + return true; + ctrl = GetFirstChild(); + if(ctrl) { + if(ctrl->SetWantFocus()) return true; + return IterateFocusForward(ctrl, this); + } + } + if(key == K_UP || key == K_LEFT || key == K_SHIFT_TAB) { + Ctrl *ctrl = GetFocusChildDeep(); + if(ctrl && IterateFocusBackward(ctrl, this)) + return true; + ctrl = GetLastChild(); + if(ctrl) { + if(ctrl->SetWantFocus()) return true; + return IterateFocusBackward(ctrl, this); + } + } + return false; +} + +void TopWindow::WorkAreaTrim() +{ + Rect a = GetWorkArea(); + Rect h = GetRect(); + h.left = max(h.left, a.left); + h.right = min(h.right, a.right); + h.top = max(h.top, a.top); + h.bottom = min(h.bottom, a.bottom); + if(h != GetRect() && !IsChild()) + SetRect(h); +} + + +void GatherWindowTree(Ctrl *w, const Vector& ws, Vector& es) +{ + if(!w->InLoop()) + es.Add(w); + for(int i = 0; i < ws.GetCount(); i++) + if(ws[i]->GetOwner() == w) + GatherWindowTree(ws[i], ws, es); +} + +int TopWindow::Run(bool appmodal) +{ + GuiLock __; + LLOG("TopWindow::Run() <- " << typeid(*this).name()); + LLOG("Focus = " << UPP::Name(GetFocusCtrl())); + if(!IsOpen()) + Open(); + if(!IsVisible()) Show(); + bool pinloop = inloop; + int pexitcode = exitcode; + exitcode = Null; + Vector es; + if(appmodal) + es = GetTopCtrls(); + else { + Vector ws = GetTopCtrls(); + for(int i = 0; i < ws.GetCount(); i++) + if(ws[i]->InLoop()) + es.Add(ws[i]); + Ctrl *mw = GetMainWindow(); + if(mw) GatherWindowTree(mw, ws, es); + } + Vector< Ptr > disabled = DisableCtrls(es, this); +#ifdef _DEBUG + for(int d = 0; d < disabled.GetCount(); d++) + LLOG("DisableCtrls[" << d << "] = " << UPP::Name(disabled[d])); + LLOG("Running EventLoop in " << UPP::Name(this)); +#endif + EventLoop(this); +#ifdef _DEBUG + LLOG("Finished EventLoop in " << UPP::Name(this)); + for(int e = 0; e < disabled.GetCount(); e++) + LLOG("EnableCtrls[" << e << "] = " << UPP::Name(disabled[e])); +#endif + EnableCtrls(disabled); + int q = exitcode; + inloop = pinloop; + exitcode = pexitcode; + LLOG("TopWindow::Run() = " << q << " -> " << typeid(*this).name()); +#ifdef PLATFORM_WIN32 + LLOG("Focus = " << UPP::Name(GetFocusCtrl()) << ", raw " << (void *)::GetFocus()); +#endif + return q; +} + +int TopWindow::Execute() +{ + int m = Run(); + Close(); + return m; +} + +TopWindow& TopWindow::Title(const WString& _title) +{ + if(title != _title) { + title = _title; + SyncTitle(); + } + return *this; +} + +TopWindow& TopWindow::Title(const char *s) +{ + return Title(WString(s)); +} + +TopWindow& TopWindow::Sizeable(bool b) +{ + sizeable = b; + SyncCaption(); + SyncSizeHints(); + return *this; +} + +TopWindow& TopWindow::MinimizeBox(bool b) +{ + minimizebox = b; + SyncCaption(); + SyncSizeHints(); + return *this; +} + +TopWindow& TopWindow::MaximizeBox(bool b) +{ + maximizebox = b; + SyncCaption(); + SyncSizeHints(); + return *this; +} + +TopWindow& TopWindow::Icon(const Image& m) +{ + if(!icon.IsSame(m)) { + icon = m; + SyncCaption(); + } + return *this; +} + +TopWindow& TopWindow::LargeIcon(const Image& m) +{ + if(!largeicon.IsSame(m)) { + largeicon = m; + SyncCaption(); + } + return *this; +} + +TopWindow& TopWindow::Icon(const Image& smallicon, const Image& _largeicon) +{ + if(!icon.IsSame(smallicon) || !largeicon.IsSame(_largeicon)) { + icon = smallicon; + largeicon = _largeicon; + SyncCaption(); + } + SyncCaption(); + return *this; +} + +TopWindow& TopWindow::ToolWindow(bool b) +{ + tool = b; + SyncCaption(); + return *this; +} + +void TopWindow::SerializePlacement(Stream& s, bool reminimize) +{ + GuiLock __; +#ifndef PLATFORM_WINCE + int version = 0; + s / version; + Rect rect = GetRect(); + s % overlapped % rect; + bool mn = state == MINIMIZED; + bool mx = state == MAXIMIZED; + s.Pack(mn, mx); + LLOG("TopWindow::SerializePlacement / " << (s.IsStoring() ? "write" : "read")); + LLOG("minimized = " << mn << ", maximized = " << mx); + LLOG("rect = " << rect << ", overlapped = " << overlapped); + if(s.IsLoading()) { + if(mn) rect = overlapped; + Rect limit = GetWorkArea(); +#ifdef PLATFORM_WIN32 + Rect outer = rect; + ::AdjustWindowRect(outer, WS_OVERLAPPEDWINDOW, FALSE); + limit.left += rect.left - outer.left; + limit.top += rect.top - outer.top; + limit.right += rect.right - outer.right; + limit.bottom += rect.bottom - outer.bottom; +#endif +#ifdef PLATFORM_X11 + Rect fm = windowFrameMargin; + if((fm.left|fm.right|fm.top|fm.bottom) == 0) + fm = Rect(8, 32, 8, 8); + limit.left += fm.left; + limit.right -= fm.right; + limit.top += fm.top; + limit.bottom -= fm.bottom; +#endif + Size sz = min(rect.Size(), limit.Size()); + rect = RectC( + minmax(rect.left, limit.left, limit.right - sz.cx), + minmax(rect.top, limit.top, limit.bottom - sz.cy), + sz.cx, sz.cy); + state = OVERLAPPED; + if(mn && reminimize) + state = MINIMIZED; + if(mx) + state = MAXIMIZED; +#ifdef PLATFORM_WIN32 + if(state == OVERLAPPED) +#endif + SetRect(rect); + if(IsOpen()) { + #ifdef PLATFORM_WIN32 + HWND hwnd = GetHWND(); + switch(state) { + case MINIMIZED: + if(!IsIconic(hwnd)) + ::ShowWindow(hwnd, SW_MINIMIZE); + break; + case MAXIMIZED: + if(!IsZoomed(hwnd)) + ::ShowWindow(hwnd, SW_MAXIMIZE); + break; + default: + if(IsIconic(hwnd) || IsZoomed(hwnd)) + ::ShowWindow(hwnd, SW_RESTORE); + break; + } + #endif + } + } +#endif +} + +struct DialogBackground : public Display { + void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const + { + w.DrawRect(r, SColorFace()); + } +}; + +TopWindow::TopWindow() +{ + GuiLock __; + TransparentBackPaint(); + background = PaintRect(Single(), Null); + center = 1; + minsize = Size(80, 20); + +#ifdef PLATFORM_WIN32 + style = 0; + exstyle = 0; + ico = lico = NULL; +#endif +#ifdef PLATFORM_X11 + size_hints = XAllocSizeHints(); + wm_hints = XAllocWMHints(); + class_hint = XAllocClassHint(); + topmost = false; +#endif + maximizebox = minimizebox = sizeable = tool = noclosebox = false; + state = OVERLAPPED; + WhenClose = THISBACK(Close); + overlapped.Clear(); + dokeys = true; + fullscreen = frameless = false; +} + +TopWindow::~TopWindow() +{ + GuiLock __; + if(InLoop()) + EndLoop(IDOK); + if(!IsChild()) + Close(); +#ifdef PLATFORM_WIN32 + DeleteIco(); +#endif +#ifdef PLATFORM_X11 + XFree(size_hints); + XFree(wm_hints); + XFree(class_hint); +#endif +} + +void Maxisize(TopWindow& win, int screencxmax) +{ + if(win.GetWorkArea().Width() <= screencxmax) + win.Maximize(); +} + +CH_INT(SwapOKCancel, 0); + +void ArrangeOKCancel(Ctrl& ok, Ctrl& cancel) +{ + if(SwapOKCancel() && + ok.GetPos().x.GetB() == cancel.GetPos().x.GetB() && + ok.GetPos().y.GetB() == cancel.GetPos().y.GetB()) { + Ctrl::LogPos h = ok.GetPos(); + ok.SetPos(cancel.GetPos()); + cancel.SetPos(h); + } +} + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/TopWindow.h b/olddraw/CtrlCore/TopWindow.h new file mode 100644 index 000000000..e6c17911e --- /dev/null +++ b/olddraw/CtrlCore/TopWindow.h @@ -0,0 +1,278 @@ +#ifdef PLATFORM_X11 + +enum { + IDOK = 1, + IDCANCEL = 2, + IDABORT = 3, + IDRETRY = 4, + IDIGNORE = 5, + IDYES = 6, + IDNO = 7, + IDCLOSE = 8, + IDHELP = 9, +}; + +#endif + +enum { + IDEXIT = IDYES +}; + +class TopWindow : public Ctrl { +public: + virtual Size GetMinSize() const; + virtual Size GetStdSize() const; + virtual void Activate(); + virtual void Deactivate(); + virtual bool Accept(); + virtual void Reject(); + virtual void Paint(Draw& w); + virtual bool IsShowEnabled() const; + virtual bool Key(dword key, int count); + virtual void Close(); + virtual String GetDesc() const; + virtual void ChildGotFocus(); + +#ifdef PLATFORM_WIN32 +public: + virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); + +private: + dword style; + dword exstyle; + HICON ico, lico; + + void DeleteIco0(); + void DeleteIco(); +#endif + +protected: + enum { + TIMEID_DEFSYNCTITLE = Ctrl::TIMEID_COUNT, + TIMEID_COUNT, + }; + +#ifdef PLATFORM_X11 + virtual void EventProc(XWindow& w, XEvent *event); +private: + XSizeHints *size_hints; + XWMHints *wm_hints; + XClassHint *class_hint; + Size xminsize, xmaxsize; + bool topmost; +#endif + + static Rect windowFrameMargin; + +private: + struct Abreak : Pte { + int ID; + TopWindow *dlg; + + void Accept() { dlg->AcceptBreak(ID); } + void Reject() { dlg->RejectBreak(ID); } + void Break() { dlg->Break(ID); } + }; + + Array action; + Ptr activefocus; + String backup; + PaintRect background; + Size minsize; + bool dokeys; + bool fullscreen; + + byte center:2; + + void PlaceFocus(); + void ActiveFocus0(Ctrl& ctrl); + Abreak *FindAddAction(int ID); + Abreak *FindAction(int ID); + +#ifdef PLATFORM_WIN32 + void CenterRect(HWND owner, int center); +#endif + +#ifdef PLATFORM_X11 + void CenterRect(Ctrl *owner); + void DefSyncTitle(); + void EndIgnoreTakeFocus(); +#endif + + Rect overlapped; + + void SyncTitle0(); + void SyncSizeHints(); + void SyncTitle(); + void SyncCaption0(); + void SyncCaption(); + + void SetupRect(); + + void FixIcons(); + + enum { MINIMIZED, MAXIMIZED, OVERLAPPED }; + + WString title; + bool minimizebox:1; + bool maximizebox:1; + bool noclosebox:1; + bool sizeable:1; + bool tool:1; + bool frameless:1; + byte state; + Image icon, largeicon; +#ifdef PLATFORM_X11 + Image invert; + WString title2; +#endif + +public: + Callback WhenClose; + + void Backup(); + void Restore(); + + void Break(int ID = IDEXIT); + bool AcceptBreak(int ID); + void RejectBreak(int ID); + + void WorkAreaTrim(); + + Callback Breaker(int ID = IDEXIT); + Callback Acceptor(int ID); + Callback Rejector(int ID); + + TopWindow& Breaker(Ctrl& m, int ID = -1); + TopWindow& Acceptor(Ctrl& m, int ID); + TopWindow& Rejector(Ctrl& m, int ID); + + TopWindow& NoCenter() { center = 0; return *this; } + TopWindow& CenterOwner() { center = 1; return *this; } + TopWindow& CenterScreen() { center = 2; return *this; } + + void SetMinSize(Size sz) { minsize = sz; } + +#ifdef PLATFORM_WIN32 + void Open(HWND ownerhwnd); + TopWindow& Style(dword _style); + dword GetStyle() const { return style; } + TopWindow& ExStyle(dword _exstyle); + dword GetExStyle() const { return exstyle; } +#endif + + void Open(Ctrl *owner); + void Open(); + void OpenMain(); + int Run(bool appmodal = false); + int RunAppModal() { return Run(true); } + int Execute(); + bool ExecuteOK() { return Execute() == IDOK; } + bool ExecuteCancel() { return Execute() == IDCANCEL; } + + void Minimize(bool effect = false); + void Maximize(bool effect = false); + void Overlap(bool effect = false); + + bool IsMaximized() const { return state == MAXIMIZED; } + bool IsMinimized() const { return state == MINIMIZED; } + bool IsOverlapped() const { return state == OVERLAPPED; } + + TopWindow& ActiveFocus(Ctrl& ctrl) { ActiveFocus0(ctrl); return *this; } + + TopWindow& Title(const WString& _title); + TopWindow& Title(const char *s); + const WString& GetTitle() const { return title; } + TopWindow& Sizeable(bool b = true); + TopWindow& NoSizeable() { return Sizeable(false); } + bool IsSizeable() const { return sizeable; } + TopWindow& MinimizeBox(bool b = true); + TopWindow& MaximizeBox(bool b = true); + TopWindow& Zoomable(bool b = true) { MinimizeBox(b); return MaximizeBox(b); } + TopWindow& NoZoomable() { return Zoomable(false); } + bool IsZoomable() const { return maximizebox; } + TopWindow& Background(const PaintRect& prect); + const PaintRect& GetBackground() const { return background; } + TopWindow& ToolWindow(bool b = true); + TopWindow& NoToolWindow() { return ToolWindow(false); } + bool IsToolWindow() const { return tool; } + TopWindow& TopMost(bool b = true, bool stay_top = true); + TopWindow& NoTopMost() { return TopMost(false); } + bool IsTopMost() const; + TopWindow& FullScreen(bool b = true) { fullscreen = b; return *this; } + bool IsFullScreen() const { return fullscreen; } + TopWindow& FrameLess(bool b = true) { frameless = b; return *this; } + bool IsFrameLess() const { return frameless; } + TopWindow& NoAccessKeysDistribution() { dokeys = false; return *this; } + TopWindow& NoCloseBox(bool b = true) { noclosebox = b; return *this; } + + TopWindow& Icon(const Image& m); + TopWindow& LargeIcon(const Image& m); + TopWindow& Icon(const Image& smallicon, const Image& largeicon); + + Image GetIcon() const { return icon; } + Image GetLargeIcon() const { return largeicon; } + + void SerializePlacement(Stream& s, bool reminimize = false); + + typedef TopWindow CLASSNAME; + + TopWindow(); + ~TopWindow(); +}; + +void Maxisize(TopWindow& win, int screencxmax); + +void ArrangeOKCancel(Ctrl& ok, Ctrl& cancel); + +int SwapOKCancel(); +void SwapOKCancel_Write(int b); + +template +void InitLayout(Ctrl& ctrl, L& layout) +{ + InitLayout(ctrl, layout, layout, layout); +} + +template +void CtrlLayout(T& ctrl) { + InitLayout(ctrl, ctrl, ctrl, ctrl); + Size sz = ctrl.AddFrameSize(T::GetLayoutSize()); + ctrl.SetMinSize(sz); + ctrl.SetRect(sz); +} + +template +void CtrlLayout(T& ctrl, const char *title) { + CtrlLayout(ctrl); + ctrl.Title(title); +} + +template +void CtrlLayoutOK(T& ctrl, const char *title) { + CtrlLayout(ctrl, title); + ctrl.Acceptor(ctrl.ok, IDOK); + ctrl.ok.Ok(); +} + +template +void CtrlLayoutCancel(T& ctrl, const char *title) { + CtrlLayout(ctrl, title); + ctrl.Rejector(ctrl.cancel, IDCANCEL); + ctrl.cancel.Cancel(); +} + +template +void CtrlLayoutOKCancel(T& ctrl, const char *title) { + CtrlLayoutOK(ctrl, title); + ctrl.Rejector(ctrl.cancel, IDCANCEL); + ctrl.cancel.Cancel(); + ArrangeOKCancel(ctrl.ok, ctrl.cancel); +} + +template +void CtrlLayoutExit(T& ctrl, const char *title) { + CtrlLayout(ctrl, title); + ctrl.Acceptor(ctrl.exit, IDEXIT); + ctrl.exit.Exit(); +} diff --git a/olddraw/CtrlCore/Win32Clip.cpp b/olddraw/CtrlCore/Win32Clip.cpp new file mode 100644 index 000000000..a6f24b5d5 --- /dev/null +++ b/olddraw/CtrlCore/Win32Clip.cpp @@ -0,0 +1,435 @@ +#include "CtrlCore.h" +#include + +NAMESPACE_UPP + +#ifdef PLATFORM_WIN32 + +#define LLOG(x) // LOG(x) + +VectorMap& sClipMap() +{ + static VectorMap x; + return x; +} + +extern HWND utilityHWND; + + +int GetClipboardFormatCode(const char *format_id) +{ + GuiLock ___; + int x = (int)(intptr_t)format_id; + if(x >= 0 && x < 65535) + return x; + String fmt = format_id; + if(fmt == "text") + return CF_TEXT; + if(fmt == "wtext") + return CF_UNICODETEXT; + if(fmt == "dib") + return CF_DIB; + if(fmt == "files") + return CF_HDROP; + static StaticMutex m; + Mutex::Lock __(m); + static VectorMap format_map; + int f = format_map.Find(format_id); + if(f < 0) { + f = format_map.GetCount(); + format_map.Add(format_id, +#ifdef PLATFORM_WINCE + ::RegisterClipboardFormat(ToSystemCharset(format_id)) +#else + ::RegisterClipboardFormat(format_id) +#endif + ); + } + return format_map[f]; +} + +void ClearClipboard() +{ + GuiLock __; + sClipMap().Clear(); + if(OpenClipboard(utilityHWND)) { + EmptyClipboard(); + CloseClipboard(); + } +} + +void SetClipboardRaw(int format, const byte *data, int length) +{ + GuiLock __; + HANDLE handle = NULL; + if(data) { + handle = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, length + 2); + byte *ptr; + if(!handle) + return; + if(!(ptr = (byte *)GlobalLock(handle))) { + GlobalFree(handle); + return; + } + memcpy(ptr, data, length); + ptr[length] = 0; + ptr[length + 1] = 0; + GlobalUnlock(handle); + } + if(!SetClipboardData(format, handle)) { + LLOG("SetClipboardData error: " << GetLastErrorMessage()); + GlobalFree(handle); + } +} + +void AppendClipboard(int format, const byte *data, int length) +{ + GuiLock __; + if(OpenClipboard(utilityHWND)) { + SetClipboardRaw(format, data, length); + CloseClipboard(); + } +} + +void AppendClipboard(const char *format, const byte *data, int length) +{ + GuiLock __; + Vector f = Split(format, ';'); + for(int i = 0; i < f.GetCount(); i++) + AppendClipboard(GetClipboardFormatCode(f[i]), data, length); +} + +void AppendClipboard(const char *format, const String& data) +{ + GuiLock __; + AppendClipboard(format, data, data.GetLength()); +} + +void AppendClipboard(const char *format, const Value& data, String (*render)(const Value&)) +{ + GuiLock __; + Vector f = Split(format, ';'); + for(int i = 0; i < f.GetCount(); i++) { + int c = GetClipboardFormatCode(f[i]); + sClipMap().GetAdd(c) = ClipData(data, render); + AppendClipboard(c, NULL, 0); + } +} + +void Ctrl::RenderFormat(int format) +{ + GuiLock __; + int q = sClipMap().Find(format); + if(q >= 0) { + String s = sClipMap()[q].Render(); + SetClipboardRaw(format, s, s.GetLength()); + } +} + +void Ctrl::RenderAllFormats() +{ + GuiLock __; + if(sClipMap().GetCount() && OpenClipboard(utilityHWND)) { + for(int i = 0; i < sClipMap().GetCount(); i++) + RenderFormat(sClipMap().GetKey(i)); + CloseClipboard(); + } +} + +void Ctrl::DestroyClipboard() +{ + GuiLock __; + sClipMap().Clear(); +} + +String ReadClipboard(const char *format) +{ + GuiLock __; + if(!OpenClipboard(NULL)) + return Null; + HGLOBAL hmem = GetClipboardData(GetClipboardFormatCode(format)); + if(hmem == 0) { + CloseClipboard(); + return Null; + } + const byte *src = (const byte *)GlobalLock(hmem); + ASSERT(src); + int length = (int)GlobalSize(hmem); + if(length < 0) { + CloseClipboard(); + return Null; + } + String out(src, length); + GlobalUnlock(hmem); + CloseClipboard(); + return out; +} + +void AppendClipboardText(const String& s) +{ +#ifdef PLATFORM_WINCE + AppendClipboardUnicodeText(s.ToWString()); +#else + AppendClipboard("text", ToSystemCharset(s)); +#endif +} + +void AppendClipboardUnicodeText(const WString& s) +{ +#ifndef PLATFORM_WINCE + AppendClipboardText(s.ToString()); +#endif + AppendClipboard("wtext", (byte *)~s, 2 * s.GetLength()); +} + +const char *ClipFmtsText() +{ + return "wtext;text"; +} + +String GetString(PasteClip& clip) +{ + GuiLock __; + if(clip.Accept("wtext")) { + String s = ~clip; + return WString((const wchar *)~s, wstrlen((const wchar *)~s)).ToString(); + } + if(clip.IsAvailable("text")) + return ~clip; + return Null; +} + +WString GetWString(PasteClip& clip) +{ + GuiLock __; + if(clip.Accept("wtext")) { + String s = ~clip; + return WString((const wchar *)~s, wstrlen((const wchar *)~s)); + } + if(clip.IsAvailable("text")) + return (~clip).ToWString(); + return Null; +} + + +bool AcceptText(PasteClip& clip) +{ + return clip.Accept(ClipFmtsText()); +} + +static String sText(const Value& data) +{ + return data; +} + +static String sWText(const Value& data) +{ + return Unicode__(WString(data)); +} + +void Append(VectorMap& data, const String& text) +{ + data.GetAdd("text", ClipData(text, sText)); + data.GetAdd("wtext", ClipData(text, sWText)); +} + +void Append(VectorMap& data, const WString& text) +{ + data.GetAdd("text", ClipData(text, sText)); + data.GetAdd("wtext", ClipData(text, sWText)); +} + +String GetTextClip(const WString& text, const String& fmt) +{ + if(fmt == "text") + return text.ToString(); + if(fmt == "wtext") + return Unicode__(text); + return Null; +} + +String GetTextClip(const String& text, const String& fmt) +{ + if(fmt == "text") + return text; + if(fmt == "wtext") + return Unicode__(text.ToWString()); + return Null; +} + +String ReadClipboardText() +{ +#ifdef PLATFORM_WINCE + return ReadClipboardUnicodeText().ToString(); +#else + String s = ReadClipboard((const char *)CF_TEXT); + return String(s, (int)strlen(~s)); +#endif +} + +WString ReadClipboardUnicodeText() +{ + String s = ReadClipboard((const char *)CF_UNICODETEXT); + return WString((const wchar *)~s, wstrlen((const wchar *)~s)); +} + +bool IsClipboardAvailable(const char *id) +{ + return ::IsClipboardFormatAvailable(GetClipboardFormatCode(id)); +} + +bool IsClipboardAvailableText() +{ + return IsClipboardAvailable((const char *)CF_TEXT); +} + +const char *ClipFmtsImage() +{ + static const char *q; + ONCELOCK { + static String s = "dib;" + ClipFmt(); + q = s; + } + return q; +} + +bool AcceptImage(PasteClip& clip) +{ + GuiLock __; + return clip.Accept(ClipFmtsImage()); +} + +Image GetImage(PasteClip& clip) +{ + GuiLock __; + Image m; + if(Accept(clip)) { + LoadFromString(m, ~clip); + if(!m.IsEmpty()) + return m; + } + if(clip.Accept("dib")) { + String data = ~clip; + if(data.GetCount() < sizeof(BITMAPINFO)) return Null; + BITMAPINFO *lpBI = (BITMAPINFO *)~data; + BITMAPINFOHEADER& hdr = lpBI->bmiHeader; + byte *bits = (byte *)lpBI + hdr.biSize; + if(hdr.biBitCount <= 8) + bits += (hdr.biClrUsed ? hdr.biClrUsed : 1 << hdr.biBitCount) * sizeof(RGBQUAD); + if(hdr.biBitCount >= 16 || hdr.biBitCount == 32) { + if(hdr.biCompression == 3) + bits += 12; + if(hdr.biClrUsed != 0) + bits += hdr.biClrUsed * sizeof(RGBQUAD); + } + int h = abs((int)hdr.biHeight); + ImageDraw iw(hdr.biWidth, h); + ::StretchDIBits(iw.GetHandle(), + 0, 0, hdr.biWidth, h, + 0, 0, hdr.biWidth, h, + bits, lpBI, DIB_RGB_COLORS, SRCCOPY); + return iw; + } + return Null; +} + +Image ReadClipboardImage() +{ + GuiLock __; + PasteClip d = Ctrl::Clipboard(); + return GetImage(d); +} + +String sDib(const Value& image) +{ + Image img = image; + BITMAPINFOHEADER header; + Zero(header); + header.biSize = sizeof(header); + header.biWidth = img.GetWidth(); + header.biHeight = -img.GetHeight(); + header.biBitCount = 32; + header.biPlanes = 1; + header.biCompression = BI_RGB; + StringBuffer b(sizeof(header) + 4 * img.GetLength()); + byte *p = (byte *)~b; + memcpy(p, &header, sizeof(header)); + memcpy(p + sizeof(header), ~img, 4 * img.GetLength()); + return b; +} + +String sImage(const Value& image) +{ + Image img = image; + return StoreAsString(const_cast(img)); +} + +String GetImageClip(const Image& img, const String& fmt) +{ + GuiLock __; + if(img.IsEmpty()) return Null; + if(fmt == "dib") + return sDib(img); + if(fmt == ClipFmt()) + return sImage(img); + return Null; +} + +void AppendClipboardImage(const Image& img) +{ + GuiLock __; + if(img.IsEmpty()) return; + AppendClipboard(ClipFmt(), img, sImage); + AppendClipboard("dib", img, sDib); +} + +bool AcceptFiles(PasteClip& clip) +{ + if(clip.Accept("files")) { + clip.SetAction(DND_COPY); + return true; + } + return false; +} + + +struct sDROPFILES { + DWORD offset; + POINT dummy; + BOOL dummy2; + BOOL unicode; +}; + +Vector GetFiles(PasteClip& clip) +{ + GuiLock __; + Vector f; + String data = clip; + if(data.GetCount() < sizeof(sDROPFILES) + 2) + return f; + const sDROPFILES *df = (const sDROPFILES *)~data; + const char *s = ((const char *)df + df->offset); + if(df->unicode) { + const wchar *ws = (wchar *)s; + while(*ws) { + WString fn; + while(*ws) + fn.Cat(*ws++); + f.Add(fn.ToString()); + ws++; + } + } + else + while(*s) { + String fn; + while(*s) + fn.Cat(*s++); + f.Add(fn.ToString()); + s++; + } + return f; +} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/Win32DnD.cpp b/olddraw/CtrlCore/Win32DnD.cpp new file mode 100644 index 000000000..5a94be7d2 --- /dev/null +++ b/olddraw/CtrlCore/Win32DnD.cpp @@ -0,0 +1,542 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#ifdef PLATFORM_WIN32 + +#define LLOG(x) // LOG(x) + +int GetClipboardFormatCode(const char *format_id); + +int ToWin32CF(const char *s) +{ + return GetClipboardFormatCode(s); +} + +String FromWin32CF(int cf) +{ + GuiLock __; + if(cf == CF_TEXT) + return "text"; + if(cf == CF_UNICODETEXT) + return "wtext"; + if(cf == CF_DIB) + return "dib"; +#ifndef PLATFORM_WINCE + if(cf == CF_HDROP) + return "files"; +#endif + char h[256]; + GetClipboardFormatNameA(cf, h, 255); + return h; +} + +FORMATETC ToFORMATETC(const char *s) +{ + FORMATETC fmtetc; + fmtetc.cfFormat = ToWin32CF(s); + fmtetc.dwAspect = DVASPECT_CONTENT; + fmtetc.lindex = -1; + fmtetc.ptd = NULL; + fmtetc.tymed = TYMED_HGLOBAL; + return fmtetc; +} + +String AsString(POINTL p) +{ + return String().Cat() << "[" << p.x << ", " << p.y << "]"; +} + +struct UDropTarget : public IDropTarget { + ULONG rc; + LPDATAOBJECT data; + Ptr ctrl; + Index fmt; + + STDMETHOD(QueryInterface)(REFIID riid, void **ppvObj); + STDMETHOD_(ULONG, AddRef)(void) { return ++rc; } + STDMETHOD_(ULONG, Release)(void) { if(--rc == 0) { delete this; return 0; } return rc; } + + STDMETHOD(DragEnter)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); + STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); + STDMETHOD(DragLeave)(); + STDMETHOD(Drop)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); + + void DnD(POINTL p, bool drop, DWORD *effect, DWORD keys); + void FreeData(); + void Repeat(); + void EndDrag(); + String Get(const char *fmt) const; + + UDropTarget() { rc = 1; data = NULL; } + ~UDropTarget(); +}; + +bool Has(UDropTarget *dt, const char *fmt) +{ + return dt->fmt.Find(fmt) >= 0; +} + +String Get(UDropTarget *dt, const char *fmt) +{ + return dt->Get(fmt); +} + +STDMETHODIMP UDropTarget::QueryInterface(REFIID iid, void ** ppv) +{ + if(iid == IID_IUnknown || iid == IID_IDropTarget) { + *ppv = this; + AddRef(); + return S_OK; + } + *ppv = NULL; + return E_NOINTERFACE; +} + +String UDropTarget::Get(const char *fmt) const +{ + FORMATETC fmtetc = ToFORMATETC(fmt); + STGMEDIUM s; + if(data->GetData(&fmtetc, &s) == S_OK && s.tymed == TYMED_HGLOBAL) { + char *val = (char *)GlobalLock(s.hGlobal); + String data(val, (int)GlobalSize(s.hGlobal)); + GlobalUnlock(s.hGlobal); + ReleaseStgMedium(&s); + return data; + } + return Null; +} + +void UDropTarget::DnD(POINTL pl, bool drop, DWORD *effect, DWORD keys) +{ + GuiLock __; + LLOG("DnD effect: " << *effect); + dword e = *effect; + *effect = DROPEFFECT_NONE; + if(!ctrl) + return; + PasteClip d; + d.dt = this; + d.paste = drop; + d.accepted = false; + d.allowed = 0; + d.action = 0; + if(e & DROPEFFECT_COPY) { + LLOG("DnD DROPEFFECT_COPY"); + d.allowed = DND_COPY; + d.action = DND_COPY; + } + if(e & DROPEFFECT_MOVE) { + LLOG("DnD DROPEFFECT_MOVE"); + d.allowed |= DND_MOVE; + if(Ctrl::GetDragAndDropSource()) + d.action = DND_MOVE; + } + LLOG("DnD keys & MK_CONTROL:" << (keys & MK_CONTROL)); + if((keys & MK_CONTROL) && (d.allowed & DND_COPY)) + d.action = DND_COPY; + if((keys & (MK_ALT|MK_SHIFT)) && (d.allowed & DND_MOVE)) + d.action = DND_MOVE; + ctrl->DnD(Point(pl.x, pl.y), d); + if(d.IsAccepted()) { + LLOG("DnD accepted, action: " << (int)d.action); + if(d.action == DND_MOVE) + *effect = DROPEFFECT_MOVE; + if(d.action == DND_COPY) + *effect = DROPEFFECT_COPY; + } +} + +void UDropTarget::Repeat() +{ + Ctrl::DnDRepeat(); +} + +STDMETHODIMP UDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) +{ + GuiLock __; + LLOG("DragEnter " << pt); + data = pDataObj; + data->AddRef(); + fmt.Clear(); + IEnumFORMATETC *fe; + if(!ctrl || pDataObj->EnumFormatEtc(DATADIR_GET, &fe) != NOERROR) { + *pdwEffect = DROPEFFECT_NONE; + return NOERROR; + } + FORMATETC fmtetc; + while(fe->Next(1, &fmtetc, 0) == S_OK) { + fmt.FindAdd(FromWin32CF(fmtetc.cfFormat)); + if(fmtetc.ptd) + CoTaskMemFree(fmtetc.ptd); + } + fe->Release(); + DnD(pt, false, pdwEffect, grfKeyState); + return NOERROR; +} + + +STDMETHODIMP UDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) +{ + LLOG("DragOver " << pt << " keys: " << grfKeyState); + DnD(pt, false, pdwEffect, grfKeyState); + return NOERROR; +} + +void UDropTarget::FreeData() +{ + if(data) { + data->Release(); + data = NULL; + } +} + +void UDropTarget::EndDrag() +{ + Ctrl::DnDLeave(); +} + +STDMETHODIMP UDropTarget::DragLeave() +{ + LLOG("DragLeave"); + EndDrag(); + FreeData(); + return NOERROR; +} + +STDMETHODIMP UDropTarget::Drop(LPDATAOBJECT, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) +{ + LLOG("Drop"); + if(Ctrl::GetDragAndDropSource()) + Ctrl::OverrideCursor(Null); + DnD(pt, true, pdwEffect, grfKeyState); + EndDrag(); + FreeData(); + return NOERROR; +} + +UDropTarget::~UDropTarget() +{ + if(data) data->Release(); + EndDrag(); +} + +// -------------------------------------------------------------------------------------------- + +Ptr sDnDSource; + +Ctrl * Ctrl::GetDragAndDropSource() +{ + return sDnDSource; +} + +struct UDataObject : public IDataObject { + ULONG rc; + dword effect; + VectorMap data; + + STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); + STDMETHOD_(ULONG, AddRef)(void) { return ++rc; } + STDMETHOD_(ULONG, Release)(void) { if(--rc == 0) { delete this; return 0; } return rc; } + + STDMETHOD(GetData)(FORMATETC *fmtetc, STGMEDIUM *medium); + STDMETHOD(GetDataHere)(FORMATETC *, STGMEDIUM *); + STDMETHOD(QueryGetData)(FORMATETC *fmtetc); + STDMETHOD(GetCanonicalFormatEtc)(FORMATETC *, FORMATETC *pformatetcOut); + STDMETHOD(SetData)(FORMATETC *fmtetc, STGMEDIUM *medium, BOOL release); + STDMETHOD(EnumFormatEtc)(DWORD dwDirection, IEnumFORMATETC **ief); + STDMETHOD(DAdvise)(FORMATETC *, DWORD, IAdviseSink *, DWORD *); + STDMETHOD(DUnadvise)(DWORD); + STDMETHOD(EnumDAdvise)(LPENUMSTATDATA *); + + UDataObject() { rc = 1; effect = 0; } +}; + +struct UEnumFORMATETC : public IEnumFORMATETC { + ULONG rc; + int ii; + UDataObject *data; + + STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); + STDMETHOD_(ULONG, AddRef)(void) { return ++rc; } + STDMETHOD_(ULONG, Release)(void) { if(--rc == 0) { delete this; return 0; } return rc; } + + STDMETHOD(Next)(ULONG n, FORMATETC *fmtetc, ULONG *fetched); + STDMETHOD(Skip)(ULONG n); + STDMETHOD(Reset)(void); + STDMETHOD(Clone)(IEnumFORMATETC **newEnum); + + UEnumFORMATETC() { ii = 0; rc = 1; } + ~UEnumFORMATETC() { data->Release(); } +}; + +struct UDropSource : public IDropSource { + ULONG rc; + Image no, move, copy; + + STDMETHOD(QueryInterface)(REFIID riid, void ** ppvObj); + STDMETHOD_(ULONG, AddRef)(void) { return ++rc; } + STDMETHOD_(ULONG, Release)(void) { if(--rc == 0) { delete this; return 0; } return rc; } + + STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD grfKeyState); + STDMETHOD(GiveFeedback)(DWORD dwEffect); + + UDropSource() { rc = 1; } +}; + +STDMETHODIMP UDataObject::QueryInterface(REFIID iid, void ** ppv) +{ + if(iid == IID_IUnknown || iid == IID_IDataObject) { + *ppv = this; + AddRef(); + return S_OK; + } + *ppv = NULL; + return E_NOINTERFACE; +} + +void SetMedium(STGMEDIUM *medium, const String& data) +{ + int sz = data.GetCount(); + HGLOBAL hData = GlobalAlloc(0, sz + 4); + if (hData) { + char *ptr = (char *) GlobalLock(hData); + memcpy(ptr, ~data, sz); + memset(ptr + sz, 0, 4); + GlobalUnlock(hData); + medium->tymed = TYMED_HGLOBAL; + medium->hGlobal = hData; + medium->pUnkForRelease = 0; + } +} + +STDMETHODIMP UDataObject::GetData(FORMATETC *fmtetc, STGMEDIUM *medium) +{ + String fmt = FromWin32CF(fmtetc->cfFormat); + ClipData *s = data.FindPtr(fmt); + if(s) { + String q = s->Render(); + SetMedium(medium, q.GetCount() ? q : sDnDSource ? sDnDSource->GetDropData(fmt) : String()); + return S_OK; + } + return DV_E_FORMATETC; +} + +STDMETHODIMP UDataObject::GetDataHere(FORMATETC *, STGMEDIUM *) +{ + return DV_E_FORMATETC; +} + +STDMETHODIMP UDataObject::QueryGetData(FORMATETC *fmtetc) +{ + return data.Find(FromWin32CF(fmtetc->cfFormat)) >= 0 ? S_OK : DV_E_FORMATETC; +} + +STDMETHODIMP UDataObject::GetCanonicalFormatEtc(FORMATETC *, FORMATETC *pformatetcOut) +{ + pformatetcOut->ptd = NULL; + return E_NOTIMPL; +} + +#ifdef PLATFORM_WINCE +static int CF_PERFORMEDDROPEFFECT = RegisterClipboardFormat(_T("Performed DropEffect")); +#else +static int CF_PERFORMEDDROPEFFECT = RegisterClipboardFormat("Performed DropEffect"); +#endif + +STDMETHODIMP UDataObject::SetData(FORMATETC *fmtetc, STGMEDIUM *medium, BOOL release) +{ + if(fmtetc->cfFormat == CF_PERFORMEDDROPEFFECT && medium->tymed == TYMED_HGLOBAL) { + DWORD *val = (DWORD*)GlobalLock(medium->hGlobal); + effect = *val; + GlobalUnlock(medium->hGlobal); + if(release) + ReleaseStgMedium(medium); + return S_OK; + } + return E_NOTIMPL; +} + +STDMETHODIMP UDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ief) +{ + UEnumFORMATETC *ef = new UEnumFORMATETC; + ef->data = this; + AddRef(); + *ief = ef; + return S_OK; +} + +STDMETHODIMP UDataObject::DAdvise(FORMATETC *, DWORD, IAdviseSink *, DWORD *) +{ + return OLE_E_ADVISENOTSUPPORTED; +} + + +STDMETHODIMP UDataObject::DUnadvise(DWORD) +{ + return OLE_E_ADVISENOTSUPPORTED; +} + +STDMETHODIMP UDataObject::EnumDAdvise(LPENUMSTATDATA FAR*) +{ + return OLE_E_ADVISENOTSUPPORTED; +} + +STDMETHODIMP UEnumFORMATETC::QueryInterface(REFIID riid, void FAR* FAR* ppvObj) +{ + if (riid == IID_IUnknown || riid == IID_IEnumFORMATETC) { + *ppvObj = this; + AddRef(); + return NOERROR; + } + *ppvObj = NULL; + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP UEnumFORMATETC::Next(ULONG n, FORMATETC *t, ULONG *fetched) { + if(t == NULL) + return E_INVALIDARG; + if(fetched) *fetched = 0; + while(ii < data->data.GetCount() && n > 0) { + if(fetched) (*fetched)++; + n--; + *t++ = ToFORMATETC(data->data.GetKey(ii++)); + } + return n ? S_FALSE : NOERROR; +} + +STDMETHODIMP UEnumFORMATETC::Skip(ULONG n) { + ii += n; + if(ii >= data->data.GetCount()) + return S_FALSE; + return NOERROR; +} + +STDMETHODIMP UEnumFORMATETC::Reset() +{ + ii = 0; + return NOERROR; +} + +STDMETHODIMP UEnumFORMATETC::Clone(IEnumFORMATETC **newEnum) +{ + if(newEnum == NULL) + return E_INVALIDARG; + UEnumFORMATETC *ef = new UEnumFORMATETC; + ef->data = data; + data->AddRef(); + ef->ii = ii; + *newEnum = ef; + return NOERROR; +} + +STDMETHODIMP UDropSource::QueryInterface(REFIID riid, void **ppvObj) +{ + if (riid == IID_IUnknown || riid == IID_IDropSource) { + *ppvObj = this; + AddRef(); + return NOERROR; + } + *ppvObj = NULL; + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP UDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) +{ + if(fEscapePressed) + return DRAGDROP_S_CANCEL; + else + if(!(grfKeyState & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON))) + return DRAGDROP_S_DROP; + Ctrl::ProcessEvents(); + return NOERROR; +} + +STDMETHODIMP UDropSource::GiveFeedback(DWORD dwEffect) +{ + LLOG("GiveFeedback"); + Image m = IsNull(move) ? copy : move; + if((dwEffect & DROPEFFECT_COPY) == DROPEFFECT_COPY) { + LLOG("GiveFeedback COPY"); + if(!IsNull(copy)) m = copy; + } + else + if((dwEffect & DROPEFFECT_MOVE) == DROPEFFECT_MOVE) { + LLOG("GiveFeedback MOVE"); + if(!IsNull(move)) m = move; + } + else + m = no; + Ctrl::OverrideCursor(m); + Ctrl::SetMouseCursor(m); + return S_OK; +} + +Image MakeDragImage(const Image& arrow, Image sample); + +Image MakeDragImage(const Image& arrow, const Image& arrow98, Image sample) +{ + if(IsWin2K()) + return MakeDragImage(arrow, sample); + else + return arrow98; +} + +int Ctrl::DoDragAndDrop(const char *fmts, const Image& sample, dword actions, + const VectorMap& data) +{ + UDataObject *obj = new UDataObject; + obj->data <<= data; + if(fmts) { + Vector f = Split(fmts, ';'); + for(int i = 0; i < f.GetCount(); i++) + obj->data.GetAdd(f[i]); + } + UDropSource *dsrc = new UDropSource; + DWORD result = 0; + Image m = Ctrl::OverrideCursor(CtrlCoreImg::DndMove()); + dsrc->no = MakeDragImage(CtrlCoreImg::DndNone(), CtrlCoreImg::DndNone98(), sample); + if(actions & DND_COPY) + dsrc->copy = actions & DND_EXACTIMAGE ? sample : MakeDragImage(CtrlCoreImg::DndCopy(), CtrlCoreImg::DndCopy98(), sample); + if(actions & DND_MOVE) + dsrc->move = actions & DND_EXACTIMAGE ? sample : MakeDragImage(CtrlCoreImg::DndMove(), CtrlCoreImg::DndMove98(), sample); + sDnDSource = this; + int level = LeaveGuiMutexAll(); + HRESULT r = DoDragDrop(obj, dsrc, + (actions & DND_COPY ? DROPEFFECT_COPY : 0) | + (actions & DND_MOVE ? DROPEFFECT_MOVE : 0), &result); + EnterGuiMutex(level); + DWORD re = obj->effect; + obj->Release(); + dsrc->Release(); + OverrideCursor(m); + SyncCaret(); + CheckMouseCtrl(); + KillRepeat(); + sDnDSource = NULL; + if(r == DRAGDROP_S_DROP) { + if(((result | re) & DROPEFFECT_MOVE) == DROPEFFECT_MOVE && (actions & DND_MOVE)) + return DND_MOVE; + if(((result | re) & DROPEFFECT_COPY) == DROPEFFECT_COPY && (actions & DND_COPY)) + return DND_COPY; + } + return DND_NONE; +} + +void ReleaseUDropTarget(UDropTarget *dt) +{ + dt->Release(); +} + +UDropTarget *NewUDropTarget(Ctrl *ctrl) +{ + UDropTarget *dt = new UDropTarget; + dt->ctrl = ctrl; + return dt; +} + +void Ctrl::SetSelectionSource(const char *fmts) {} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/Win32Keys.i b/olddraw/CtrlCore/Win32Keys.i new file mode 100644 index 000000000..15e8ff858 --- /dev/null +++ b/olddraw/CtrlCore/Win32Keys.i @@ -0,0 +1,109 @@ +K_BACK = VK_BACK + K_DELTA, +K_BACKSPACE = VK_BACK + K_DELTA, + +K_TAB = 9, + +K_SPACE = 32, + +K_RETURN = 13, +K_ENTER = K_RETURN, + +K_SHIFT_KEY = VK_SHIFT + K_DELTA, +K_CTRL_KEY = VK_CONTROL + K_DELTA, +K_ALT_KEY = VK_MENU + K_DELTA, +K_CAPSLOCK = VK_CAPITAL + K_DELTA, +K_ESCAPE = VK_ESCAPE + K_DELTA, +K_PRIOR = VK_PRIOR + K_DELTA, +K_PAGEUP = VK_PRIOR + K_DELTA, +K_NEXT = VK_NEXT + K_DELTA, +K_PAGEDOWN = VK_NEXT + K_DELTA, +K_END = VK_END + K_DELTA, +K_HOME = VK_HOME + K_DELTA, +K_LEFT = VK_LEFT + K_DELTA, +K_UP = VK_UP + K_DELTA, +K_RIGHT = VK_RIGHT + K_DELTA, +K_DOWN = VK_DOWN + K_DELTA, +K_INSERT = VK_INSERT + K_DELTA, +K_DELETE = VK_DELETE + K_DELTA, + +K_NUMPAD0 = VK_NUMPAD0 + K_DELTA, +K_NUMPAD1 = VK_NUMPAD1 + K_DELTA, +K_NUMPAD2 = VK_NUMPAD2 + K_DELTA, +K_NUMPAD3 = VK_NUMPAD3 + K_DELTA, +K_NUMPAD4 = VK_NUMPAD4 + K_DELTA, +K_NUMPAD5 = VK_NUMPAD5 + K_DELTA, +K_NUMPAD6 = VK_NUMPAD6 + K_DELTA, +K_NUMPAD7 = VK_NUMPAD7 + K_DELTA, +K_NUMPAD8 = VK_NUMPAD8 + K_DELTA, +K_NUMPAD9 = VK_NUMPAD9 + K_DELTA, +K_MULTIPLY = VK_MULTIPLY + K_DELTA, +K_ADD = VK_ADD + K_DELTA, +K_SEPARATOR = VK_SEPARATOR + K_DELTA, +K_SUBTRACT = VK_SUBTRACT + K_DELTA, +K_DECIMAL = VK_DECIMAL + K_DELTA, +K_DIVIDE = VK_DIVIDE + K_DELTA, +K_SCROLL = VK_SCROLL + K_DELTA, + +K_F1 = VK_F1 + K_DELTA, +K_F2 = VK_F2 + K_DELTA, +K_F3 = VK_F3 + K_DELTA, +K_F4 = VK_F4 + K_DELTA, +K_F5 = VK_F5 + K_DELTA, +K_F6 = VK_F6 + K_DELTA, +K_F7 = VK_F7 + K_DELTA, +K_F8 = VK_F8 + K_DELTA, +K_F9 = VK_F9 + K_DELTA, +K_F10 = VK_F10 + K_DELTA, +K_F11 = VK_F11 + K_DELTA, +K_F12 = VK_F12 + K_DELTA, + +K_A = 'A' + K_DELTA, +K_B = 'B' + K_DELTA, +K_C = 'C' + K_DELTA, +K_D = 'D' + K_DELTA, +K_E = 'E' + K_DELTA, +K_F = 'F' + K_DELTA, +K_G = 'G' + K_DELTA, +K_H = 'H' + K_DELTA, +K_I = 'I' + K_DELTA, +K_J = 'J' + K_DELTA, +K_K = 'K' + K_DELTA, +K_L = 'L' + K_DELTA, +K_M = 'M' + K_DELTA, +K_N = 'N' + K_DELTA, +K_O = 'O' + K_DELTA, +K_P = 'P' + K_DELTA, +K_Q = 'Q' + K_DELTA, +K_R = 'R' + K_DELTA, +K_S = 'S' + K_DELTA, +K_T = 'T' + K_DELTA, +K_U = 'U' + K_DELTA, +K_V = 'V' + K_DELTA, +K_W = 'W' + K_DELTA, +K_X = 'X' + K_DELTA, +K_Y = 'Y' + K_DELTA, +K_Z = 'Z' + K_DELTA, +K_0 = '0' + K_DELTA, +K_1 = '1' + K_DELTA, +K_2 = '2' + K_DELTA, +K_3 = '3' + K_DELTA, +K_4 = '4' + K_DELTA, +K_5 = '5' + K_DELTA, +K_6 = '6' + K_DELTA, +K_7 = '7' + K_DELTA, +K_8 = '8' + K_DELTA, +K_9 = '9' + K_DELTA, + +K_CTRL_LBRACKET = K_CTRL|219|K_DELTA, +K_CTRL_RBRACKET = K_CTRL|221|K_DELTA, +K_CTRL_MINUS = K_CTRL|0xbd|K_DELTA, +K_CTRL_GRAVE = K_CTRL|0xc0|K_DELTA, +K_CTRL_SLASH = K_CTRL|0xbf|K_DELTA, +K_CTRL_BACKSLASH = K_CTRL|0xdc|K_DELTA, +K_CTRL_COMMA = K_CTRL|0xbc|K_DELTA, +K_CTRL_PERIOD = K_CTRL|0xbe|K_DELTA, +K_CTRL_SEMICOLON = K_CTRL|0xbe|K_DELTA, +K_CTRL_EQUAL = K_CTRL|0xbb|K_DELTA, +K_CTRL_APOSTROPHE= K_CTRL|0xde|K_DELTA, + +K_BREAK = VK_CANCEL + K_DELTA, diff --git a/olddraw/CtrlCore/Win32Msg.i b/olddraw/CtrlCore/Win32Msg.i new file mode 100644 index 000000000..765db43d6 --- /dev/null +++ b/olddraw/CtrlCore/Win32Msg.i @@ -0,0 +1,126 @@ +#pragma BLITZ_APPROVE + +x_MSG(WM_CREATE) +x_MSG(WM_DESTROY) +x_MSG(WM_MOVE) +x_MSG(WM_SIZE) +x_MSG(WM_ACTIVATE) +x_MSG(WM_SETFOCUS) +x_MSG(WM_KILLFOCUS) +x_MSG(WM_ENABLE) +x_MSG(WM_SETREDRAW) +x_MSG(WM_SETTEXT) +x_MSG(WM_GETTEXT) +x_MSG(WM_GETTEXTLENGTH) +x_MSG(WM_PAINT) +x_MSG(WM_CLOSE) +x_MSG(WM_QUIT) +x_MSG(WM_ERASEBKGND) +x_MSG(WM_SYSCOLORCHANGE) +x_MSG(WM_SHOWWINDOW) +x_MSG(WM_WININICHANGE) +x_MSG(WM_FONTCHANGE) +x_MSG(WM_NEXTDLGCTL) +x_MSG(WM_DRAWITEM) +x_MSG(WM_MEASUREITEM) +x_MSG(WM_DELETEITEM) +x_MSG(WM_VKEYTOITEM) +x_MSG(WM_CHARTOITEM) +x_MSG(WM_SETFONT) +x_MSG(WM_GETFONT) +x_MSG(WM_QUERYDRAGICON) +x_MSG(WM_COMPAREITEM) +x_MSG(WM_GETDLGCODE) +x_MSG(WM_KEYDOWN) +x_MSG(WM_KEYUP) +x_MSG(WM_CHAR) +x_MSG(WM_DEADCHAR) +x_MSG(WM_SYSKEYDOWN) +x_MSG(WM_SYSKEYUP) +x_MSG(WM_SYSCHAR) +x_MSG(WM_SYSDEADCHAR) +x_MSG(WM_KEYLAST) +x_MSG(WM_INITDIALOG) +x_MSG(WM_COMMAND) +x_MSG(WM_SYSCOMMAND) +x_MSG(WM_TIMER) +x_MSG(WM_HSCROLL) +x_MSG(WM_VSCROLL) +x_MSG(WM_INITMENUPOPUP) +x_MSG(WM_MENUCHAR) +x_MSG(WM_LBUTTONDOWN) +x_MSG(WM_LBUTTONUP) +x_MSG(WM_LBUTTONDBLCLK) +x_MSG(WM_RBUTTONDOWN) +x_MSG(WM_RBUTTONUP) +x_MSG(WM_RBUTTONDBLCLK) +x_MSG(WM_MBUTTONDOWN) +x_MSG(WM_MBUTTONUP) +x_MSG(WM_MBUTTONDBLCLK) +x_MSG(WM_MOUSEMOVE) +x_MSG(WM_CUT) +x_MSG(WM_COPY) +x_MSG(WM_PASTE) +x_MSG(WM_CLEAR) +x_MSG(WM_UNDO) +x_MSG(WM_RENDERFORMAT) +x_MSG(WM_RENDERALLFORMATS) +x_MSG(WM_DESTROYCLIPBOARD) +x_MSG(WM_QUERYNEWPALETTE) +x_MSG(WM_PALETTECHANGED) +x_MSG(WM_WINDOWPOSCHANGED) + +#ifndef PLATFORM_WINCE +x_MSG(WM_QUERYENDSESSION) +x_MSG(WM_ENDSESSION) +x_MSG(WM_QUERYOPEN) +x_MSG(WM_DEVMODECHANGE) +x_MSG(WM_ACTIVATEAPP) +x_MSG(WM_TIMECHANGE) +x_MSG(WM_MOUSEACTIVATE) +x_MSG(WM_CHILDACTIVATE) +x_MSG(WM_QUEUESYNC) +x_MSG(WM_GETMINMAXINFO) +x_MSG(WM_ICONERASEBKGND) +x_MSG(WM_SPOOLERSTATUS) +x_MSG(WM_COMPACTING) +x_MSG(WM_NCLBUTTONDOWN) +x_MSG(WM_NCLBUTTONUP) +x_MSG(WM_NCLBUTTONDBLCLK) +x_MSG(WM_NCRBUTTONDOWN) +x_MSG(WM_NCRBUTTONUP) +x_MSG(WM_NCRBUTTONDBLCLK) +x_MSG(WM_NCMBUTTONDOWN) +x_MSG(WM_NCMBUTTONUP) +x_MSG(WM_NCMBUTTONDBLCLK) +x_MSG(WM_NCCREATE) +x_MSG(WM_NCDESTROY) +x_MSG(WM_NCCALCSIZE) +x_MSG(WM_NCPAINT) +x_MSG(WM_NCACTIVATE) +x_MSG(WM_INITMENU) +x_MSG(WM_MENUSELECT) +x_MSG(WM_PARENTNOTIFY) +x_MSG(WM_MDICREATE) +x_MSG(WM_MDIDESTROY) +x_MSG(WM_MDIACTIVATE) +x_MSG(WM_MDIRESTORE) +x_MSG(WM_MDINEXT) +x_MSG(WM_MDIMAXIMIZE) +x_MSG(WM_MDITILE) +x_MSG(WM_MDICASCADE) +x_MSG(WM_MDIICONARRANGE) +x_MSG(WM_MDIGETACTIVE) +x_MSG(WM_MDISETMENU) +x_MSG(WM_DRAWCLIPBOARD) +x_MSG(WM_PAINTCLIPBOARD) +x_MSG(WM_VSCROLLCLIPBOARD) +x_MSG(WM_SIZECLIPBOARD) +x_MSG(WM_ASKCBFORMATNAME) +x_MSG(WM_CHANGECBCHAIN) +x_MSG(WM_HSCROLLCLIPBOARD) +x_MSG(WM_PALETTEISCHANGING) +x_MSG(WM_DROPFILES) +x_MSG(WM_POWER) +x_MSG(WM_WINDOWPOSCHANGING) +#endif diff --git a/olddraw/CtrlCore/Win32Proc.cpp b/olddraw/CtrlCore/Win32Proc.cpp new file mode 100644 index 000000000..d91d8a706 --- /dev/null +++ b/olddraw/CtrlCore/Win32Proc.cpp @@ -0,0 +1,488 @@ +#include "CtrlCore.h" + +#ifdef PLATFORM_WIN32 +#include +#endif + +//#include "imm.h" + +NAMESPACE_UPP + +#define LLOG(x) // LOG(x) + +#ifdef PLATFORM_WIN32 + +dword Ctrl::KEYtoK(dword chr) { + if(chr == VK_TAB) + chr = K_TAB; + else + if(chr == VK_SPACE) + chr = K_SPACE; + else + if(chr == VK_RETURN) + chr = K_RETURN; + else + chr = chr + K_DELTA; + if(chr == K_ALT_KEY || chr == K_CTRL_KEY || chr == K_SHIFT_KEY) + return chr; + if(GetCtrl()) chr |= K_CTRL; + if(GetAlt()) chr |= K_ALT; + if(GetShift()) chr |= K_SHIFT; + return chr; +} + + +class NilDrawFull : public NilDraw { + virtual bool IsPaintingOp(const Rect& r) const { return true; } +}; + +#ifdef PLATFORM_WINCE + + +bool GetShift() { return false; } +bool GetCtrl() { return false; } +bool GetAlt() { return false; } +bool GetCapsLock() { return false; } + +bool wince_mouseleft; +bool wince_mouseright; + +bool GetMouseLeft() { return wince_mouseleft; } +bool GetMouseRight() { return wince_mouseright; } +bool GetMouseMiddle() { return false; } + +Point wince_mousepos = Null; + +Point GetMousePos() { + return wince_mousepos; +} + +void SetWinceMouse(HWND hwnd, LPARAM lparam) +{ + Point p(lparam); + ClientToScreen(hwnd, p); + wince_mousepos = p; +} +#else +void SetWinceMouse(HWND hwnd, LPARAM lparam) {} +#endif + +#ifdef _DEBUG +static String sPainting; +#endif + +bool PassWindowsKey(int wParam); + +LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { + GuiLock __; + ASSERT_(IsNull(sPainting), "WindowProc invoked while in Paint routine"); +// LLOG("Ctrl::WindowProc(" << message << ") in " << ::Name(this) << ", focus " << (void *)::GetFocus()); + Ptr _this = this; + HWND hwnd = GetHWND(); + switch(message) { + case WM_PALETTECHANGED: + if((HWND)wParam == hwnd) + break; +#ifndef PLATFORM_WINCE + case WM_QUERYNEWPALETTE: + if(!SystemDraw::AutoPalette()) break; + { + HDC hDC = GetDC(hwnd); + HPALETTE hOldPal = SelectPalette(hDC, GetQlibPalette(), FALSE); + int i = RealizePalette(hDC); + SelectPalette(hDC, hOldPal, TRUE); + RealizePalette(hDC); + ReleaseDC(hwnd, hDC); + LLOG("Realized " << i << " colors"); + if(i) InvalidateRect(hwnd, NULL, TRUE); + return i; + } +#endif + case WM_PAINT: + ASSERT(hwnd); + if(IsVisible() && hwnd) { + PAINTSTRUCT ps; + SyncScroll(); + HDC dc = BeginPaint(hwnd, &ps); + fullrefresh = false; + SystemDraw draw(dc); +#ifndef PLATFORM_WINCE + HPALETTE hOldPal; + if(draw.PaletteMode() && SystemDraw::AutoPalette()) { + hOldPal = SelectPalette(dc, GetQlibPalette(), TRUE); + int n = RealizePalette(dc); + LLOG("In paint realized " << n << " colors"); + } +#endif +#ifdef _DEBUG + sPainting = Name(); +#endif + UpdateArea(draw, Rect(ps.rcPaint)); +#ifdef _DEBUG + sPainting = Null; +#endif +#ifndef PLATFORM_WINCE + if(draw.PaletteMode() && SystemDraw::AutoPalette()) + SelectPalette(dc, hOldPal, TRUE); +#endif + EndPaint(hwnd, &ps); + } + return 0L; +#ifndef PLATFORM_WINCE + case WM_NCHITTEST: + CheckMouseCtrl(); + if(ignoremouse) return HTTRANSPARENT; + break; +#endif + case WM_LBUTTONDOWN: +#ifdef PLARFORM_WINCE + wince_mouseleft = true; +#endif + SetWinceMouse(hwnd, lParam); + ClickActivateWnd(); + if(ignoreclick) return 0L; + DoMouse(LEFTDOWN, Point((dword)lParam), 0); + if(_this) PostInput(); + return 0L; + case WM_LBUTTONUP: + if(ignoreclick) + EndIgnore(); + else + DoMouse(LEFTUP, Point((dword)lParam), 0); +#ifdef PLATFORM_WINCE + wince_mouseleft = false; +#endif +#ifdef PLATFORM_WINCE + wince_mousepos = Point(-99999, -99999); + if(!ignoreclick) + if(_this) DoMouse(MOUSEMOVE, Point(-99999, -99999)); +#endif + if(_this) PostInput(); + return 0L; + case WM_LBUTTONDBLCLK: + ClickActivateWnd(); + if(ignoreclick) return 0L; + DoMouse(LEFTDOUBLE, Point((dword)lParam), 0); + if(_this) PostInput(); + return 0L; + case WM_RBUTTONDOWN: + ClickActivateWnd(); + if(ignoreclick) return 0L; + DoMouse(RIGHTDOWN, Point((dword)lParam)); + if(_this) PostInput(); + return 0L; + case WM_RBUTTONUP: + if(ignoreclick) + EndIgnore(); + else + DoMouse(RIGHTUP, Point((dword)lParam)); + if(_this) PostInput(); + return 0L; + case WM_RBUTTONDBLCLK: + ClickActivateWnd(); + if(ignoreclick) return 0L; + DoMouse(RIGHTDOUBLE, Point((dword)lParam)); + if(_this) PostInput(); + return 0L; + case WM_MBUTTONDOWN: + ClickActivateWnd(); + if(ignoreclick) return 0L; + DoMouse(MIDDLEDOWN, Point((dword)lParam)); + if(_this) PostInput(); + return 0L; + case WM_MBUTTONUP: + if(ignoreclick) + EndIgnore(); + else + DoMouse(MIDDLEUP, Point((dword)lParam)); + if(_this) PostInput(); + return 0L; + case WM_MBUTTONDBLCLK: + ClickActivateWnd(); + if(ignoreclick) return 0L; + DoMouse(MIDDLEDOUBLE, Point((dword)lParam)); + if(_this) PostInput(); + return 0L; +#ifndef PLATFORM_WINCE + case WM_NCLBUTTONDOWN: + case WM_NCRBUTTONDOWN: + case WM_NCMBUTTONDOWN: + ClickActivateWnd(); + IgnoreMouseUp(); + break; +#endif + case WM_MOUSEMOVE: + SetWinceMouse(hwnd, lParam); + LLOG("WM_MOUSEMOVE: ignoreclick = " << ignoreclick); + if(ignoreclick) { + EndIgnore(); + return 0L; + } + if(_this) + DoMouse(MOUSEMOVE, Point((dword)lParam)); + DoCursorShape(); + return 0L; + case 0x20a: // WM_MOUSEWHEEL: + if(ignoreclick) { + EndIgnore(); + return 0L; + } + if(_this) + DoMouse(MOUSEWHEEL, Point((dword)lParam), (short)HIWORD(wParam)); + if(_this) PostInput(); + return 0L; + case WM_SETCURSOR: + if((HWND)wParam == hwnd && LOWORD((dword)lParam) == HTCLIENT) { + if(hCursor) SetCursor(hCursor); + return TRUE; + } + break; +// case WM_MENUCHAR: +// return MAKELONG(0, MNC_SELECT); + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + case WM_CHAR: + ignorekeyup = false; + case WM_KEYUP: + case WM_SYSKEYUP: + { +#if 0 + String msgdump; + switch(message) + { + case WM_KEYDOWN: msgdump << "WM_KEYDOWN"; break; + case WM_KEYUP: msgdump << "WM_KEYUP"; break; + case WM_SYSKEYDOWN: msgdump << "WM_SYSKEYDOWN"; break; + case WM_SYSKEYUP: msgdump << "WM_SYSKEYUP"; break; + case WM_CHAR: msgdump << "WM_CHAR"; break; + } + msgdump << " wParam = 0x" << FormatIntHex(wParam, 8) + << ", lParam = 0x" << FormatIntHex(lParam, 8) + << ", ignorekeyup = " << (ignorekeyup ? "true" : "false"); + LLOG(msgdump); +#endif + dword keycode = 0; + if(message == WM_KEYDOWN) + keycode = KEYtoK((dword)wParam); + else + if(message == WM_KEYUP) + keycode = KEYtoK((dword)wParam) | K_KEYUP; + else + if(message == WM_SYSKEYDOWN /*&& ((lParam & 0x20000000) || wParam == VK_F10)*/) + keycode = KEYtoK((dword)wParam); + else + if(message == WM_SYSKEYUP /*&& ((lParam & 0x20000000) || wParam == VK_F10)*/) + keycode = KEYtoK((dword)wParam) | K_KEYUP; + else + if(message == WM_CHAR && wParam != 127 && wParam > 32) { +#ifdef PLATFORM_WINCE + keycode = wParam; +#else + if(IsWindowUnicode(hwnd)) // TRC 04/10/17: ActiveX Unicode patch + keycode = (dword)wParam; + else { + char b[20]; + ::GetLocaleInfo(MAKELCID(LOWORD(GetKeyboardLayout(0)), SORT_DEFAULT), + LOCALE_IDEFAULTANSICODEPAGE, b, 20); + int codepage = atoi(b); + if(codepage >= 1250 && codepage <= 1258) + keycode = ToUnicode((dword)wParam, codepage - 1250 + CHARSET_WIN1250); + else + keycode = (dword)wParam; + } +#endif + } + bool b = false; + if(keycode) { + b = DispatchKey(keycode, LOWORD(lParam)); + SyncCaret(); + if(_this) PostInput(); + } +// LOG("key processed = " << b); + if(b || (message == WM_SYSKEYDOWN || message == WM_SYSKEYUP) + && wParam != VK_F4 && !PassWindowsKey((dword)wParam)) // 17.11.2003 Mirek -> invoke system menu + return 0L; + break; + } + break; +// case WM_GETDLGCODE: +// return wantfocus ? 0 : DLGC_STATIC; + case WM_ERASEBKGND: + return 1L; + case WM_DESTROY: + PreDestroy(); +#ifndef PLATFORM_WINCE + break; + case WM_NCDESTROY: +#endif + if(!hwnd) break; + if(HasChildDeep(mouseCtrl) || this == ~mouseCtrl) mouseCtrl = NULL; + if(HasChildDeep(focusCtrl) || this == ~focusCtrl) focusCtrl = NULL; + if(HasChildDeep(focusCtrlWnd) || this == ~focusCtrlWnd) { + LLOG("WM_NCDESTROY: clearing focusCtrlWnd = " << ::Name(focusCtrlWnd)); + focusCtrlWnd = NULL; + focusCtrl = NULL; + } + if(::GetFocus() == NULL) { + Ctrl *owner = GetOwner(); + if(owner && (owner->IsForeground() || IsForeground()) && !owner->SetWantFocus()) + IterateFocusForward(owner, owner); + } +#ifdef PLATFORM_WINCE + DefWindowProc(hwnd, message, wParam, lParam); +#else + if(IsWindowUnicode(hwnd)) // TRC 04/10/17: ActiveX unicode patch + DefWindowProcW(hwnd, message, wParam, lParam); + else + DefWindowProc(hwnd, message, wParam, lParam); +#endif + hwnd = NULL; + return 0L; + case WM_CANCELMODE: + if(this == ~captureCtrl || HasChildDeep(captureCtrl)) + ReleaseCtrlCapture(); + break; + case WM_SHOWWINDOW: + visible = (BOOL) wParam; + StateH(SHOW); + break; +#ifndef PLATFORM_WINCE + case WM_MOUSEACTIVATE: + LLOG("WM_MOUSEACTIVATE " << Name() << ", focusCtrlWnd = " << UPP::Name(focusCtrlWnd) << ", raw = " << (void *)::GetFocus()); + if(!IsEnabled()) { + if(lastActiveWnd && lastActiveWnd->IsEnabled()) { + LLOG("WM_MOUSEACTIVATE -> ::SetFocus for " << UPP::Name(lastActiveWnd)); + ::SetFocus(lastActiveWnd->GetHWND()); + } + else + MessageBeep(MB_OK); + return MA_NOACTIVATEANDEAT; + } + if(IsPopUp()) return MA_NOACTIVATE; + break; +#endif + case WM_SIZE: + case WM_MOVE: + if(hwnd) { + Rect rect; +#ifndef PLATFORM_WINCE + if(activex) { + WINDOWPLACEMENT wp; + wp.length = sizeof(WINDOWINFO); + ::GetWindowPlacement(hwnd, &wp); + rect = wp.rcNormalPosition; + } + else +#endif + rect = GetScreenClient(hwnd); + LLOG("WM_MOVE / WM_SIZE: screen client = " << rect); + if(GetRect() != rect) + SetWndRect(rect); + WndDestroyCaret(); + caretCtrl = NULL; + SyncCaret(); + } + return 0L; + case WM_HELP: + return TRUE; + case WM_ACTIVATE: + LLOG("WM_ACTIVATE " << Name() << ", wParam = " << (int)wParam << ", focusCtrlWnd = " << ::Name(focusCtrlWnd) << ", raw = " << (void *)::GetFocus()); + ignorekeyup = true; + break; + case WM_SETFOCUS: + LLOG("WM_SETFOCUS " << Name() << ", focusCtrlWnd = " << UPP::Name(focusCtrlWnd) << ", raw = " << (void *)::GetFocus()); + if(this != focusCtrlWnd) + if(IsEnabled()) { + LLOG("WM_SETFOCUS -> ActivateWnd: this != focusCtrlWnd, this = " + << Name() << ", focusCtrlWnd = " << UPP::Name(focusCtrlWnd)); + ActivateWnd(); + } + else { + if(focusCtrlWnd && focusCtrlWnd->IsEnabled()) { + if(!IsEnabled()) + MessageBeep(MB_OK); + LLOG("WM_SETFOCUS -> ::SetFocus for " << UPP::Name(focusCtrlWnd)); + ::SetFocus(focusCtrlWnd->GetHWND()); + } + else + if(lastActiveWnd && lastActiveWnd->IsEnabled()) { + LLOG("WM_SETFOCUS -> ::SetFocus for " << UPP::Name(lastActiveWnd)); + ::SetFocus(lastActiveWnd->GetHWND()); + } + else { + LLOG("WM_SETFOCUS - ::SetFocus(NULL)"); + ::SetFocus(NULL); + } + } + LLOG("//WM_SETFOCUS " << (void *)hwnd << ", focusCtrlWnd = " << UPP::Name(focusCtrlWnd) << ", raw = " << (void *)::GetFocus()); + return 0L; + case WM_KILLFOCUS: + LLOG("WM_KILLFOCUS " << (void *)(HWND)wParam << ", this = " << UPP::Name(this) << ", focusCtrlWnd = " << UPP::Name(focusCtrlWnd) << ", raw = " << (void *)::GetFocus()); + LLOG("Kill " << ::Name(CtrlFromHWND((HWND)wParam))); + if(!CtrlFromHWND((HWND)wParam)) { + LLOG("WM_KILLFOCUS -> KillFocusWnd: " << UPP::Name(this)); + KillFocusWnd(); + } + LLOG("//WM_KILLFOCUS " << (void *)(HWND)wParam << ", focusCtrlWnd = " << ::Name(focusCtrlWnd) << ", raw = " << (void *)::GetFocus()); + return 0L; + case WM_ENABLE: + if(!!wParam != enabled) { + enabled = !!wParam; + RefreshFrame(); + StateH(ENABLE); + } + return 0L; +#ifndef PLATFORM_WINCE + case WM_GETMINMAXINFO: + { + MINMAXINFO *mmi = (MINMAXINFO *)lParam; + Rect minr(Point(50, 50), GetMinSize()); + Rect maxr(Point(50, 50), GetMaxSize()); + dword style = ::GetWindowLong(hwnd, GWL_STYLE); + dword exstyle = ::GetWindowLong(hwnd, GWL_EXSTYLE); + AdjustWindowRectEx(minr, style, FALSE, exstyle); + AdjustWindowRectEx(maxr, style, FALSE, exstyle); + mmi->ptMinTrackSize = Point(minr.Size()); + mmi->ptMaxTrackSize = Point(maxr.Size()); + LLOG("WM_GETMINMAXINFO: MinTrackSize = " << Point(mmi->ptMinTrackSize) << ", MaxTrackSize = " << Point(mmi->ptMaxTrackSize)); + LLOG("ptMaxSize = " << Point(mmi->ptMaxSize) << ", ptMaxPosition = " << Point(mmi->ptMaxPosition)); + } + return 0L; +#endif + case WM_SETTINGCHANGE: + case 0x031A: // WM_THEMECHANGED + ChSync(); + RefreshLayoutDeep(); + RefreshFrame(); + break; +/* + case WM_IME_COMPOSITION: + HIMC himc = ImmGetContext(hwnd); + if(!himc) break; + CANDIDATEFORM cf; + Rect r = GetScreenRect(); + cf.dwIndex = 0; + cf.dwStyle = CFS_CANDIDATEPOS; + cf.ptCurrentPos.x = r.left + caretx; + cf.ptCurrentPos.y = r.top + carety + caretcy; + ImmSetCandidateWindow (himc, &cf); + break; +*/ + } + if(hwnd) +#ifdef PLATFORM_WINCE + return DefWindowProc(hwnd, message, wParam, lParam); +#else + if(IsWindowUnicode(hwnd)) // TRC 04/10/17: ActiveX unicode patch + return DefWindowProcW(hwnd, message, wParam, lParam); + else + return DefWindowProc(hwnd, message, wParam, lParam); +#endif + return 0L; +} + +void Ctrl::PreDestroy() {} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/Win32Wnd.cpp b/olddraw/CtrlCore/Win32Wnd.cpp new file mode 100644 index 000000000..d5ae3accf --- /dev/null +++ b/olddraw/CtrlCore/Win32Wnd.cpp @@ -0,0 +1,1215 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#ifdef PLATFORM_WIN32 + +#define LLOG(x) // LOG(x) +#define LOGTIMING 0 + +#ifdef _DEBUG +#define LOGMESSAGES 0 +#endif + +#define ELOG(x) // RLOG(GetSysTime() << ": " << x) + +template<> +unsigned GetHashValue(const HWND& h) +{ + return (unsigned)(intptr_t)h; +} + +static bool PeekMsg(MSG& msg) +{ + if(!PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) return false; + return IsWindowUnicode(msg.hwnd) ? PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE) + : PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); +} + +static bool sFinished; + +static BOOL CALLBACK sDumpWindow(HWND hwnd, LPARAM lParam) { + String dump; + dump << (IsWindowEnabled(hwnd) ? "ena" : "dis") << ' ' + << (IsWindowVisible(hwnd) ? "vis" : "hid") << ' ' + << Sprintf("owner=0x%x ", GetWindow(hwnd, GW_OWNER)); + Ctrl *ctrl = Ctrl::CtrlFromHWND(hwnd); + if(ctrl) { +#ifdef _DEBUG + dump << "Ctrl: " << UPP::Name(ctrl); +#endif + } + else if(!lParam) + return TRUE; + else + { +#ifdef PLATFORM_WINCE + wchar clsname[256], title[1024]; +#else + char clsname[256], title[1024]; +#endif + ::GetClassName(hwnd, clsname, __countof(clsname)); + ::GetWindowText(hwnd, title, __countof(title)); + dump << "HWND: " << Sprintf("0x%x", hwnd) << ", class = " + << clsname << ", title = " << title; + } + LLOG(dump); + return TRUE; +} + +void DumpWindowOrder(bool aliens) { +#ifndef PLATFORM_WINCE + LLOG("DumpWindowOrder" << BeginIndent); + EnumChildWindows(NULL, &sDumpWindow, (LPARAM)(aliens ? 1 : 0)); + LLOG(EndIndent << "//DumpWindowOrder"); +#endif +} + +#ifndef PLATFORM_WINCE +Point GetMousePos() { + Point p; + return ::GetCursorPos(p) ? p : Null; + ::GetCursorPos(p); + return p; +} +#endif + +HCURSOR Ctrl::hCursor; +HINSTANCE Ctrl::hInstance; +#ifndef flagDLL +#ifndef PLATFORM_WINCE +HANDLE Ctrl::OverwatchThread; +HWND Ctrl::OverwatchHWND; + +Event Ctrl::OverwatchEndSession; +GLOBAL_VAR(Event, Ctrl::ExitLoopEvent) +#endif +#endif + +GLOBAL_VAR(bool, Ctrl::EndSession) + +#ifndef flagDLL +#ifndef PLATFORM_WINCE +LRESULT CALLBACK Ctrl::OverwatchWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + if(msg == WM_USER) { + ELOG("WM_USER"); + PostQuitMessage(0); + } + if(msg == WM_ENDSESSION) { + EndSession() = true; + ELOG("WM_ENDSESSION 1"); + ExitLoopEvent().Set(); + ELOG("WM_ENDSESSION 2"); + OverwatchEndSession.Wait(); + ELOG("WM_ENDSESSION 3"); + } + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +DWORD WINAPI Ctrl::Win32OverwatchThread(LPVOID) +{ + WNDCLASS wc; + Zero(wc); + wc.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW; + wc.lpfnWndProc = (WNDPROC)OverwatchWndProc; + wc.hInstance = hInstance; + wc.hCursor = NULL; + wc.hbrBackground = NULL; + wc.lpszClassName = "UPP-OVERWATCH"; + RegisterClass(&wc); + + OverwatchHWND = CreateWindowEx(0, "UPP-OVERWATCH", "", WS_OVERLAPPEDWINDOW, + -1000, -1000, 50, 50, NULL, NULL, hInstance, NULL); + + ELOG("OverWatch 1"); + ExitLoopEvent().Set(); + ELOG("OverWatch 2"); + MSG Msg; + while(GetMessage(&Msg, NULL, 0, 0) > 0) { + TranslateMessage(&Msg); + if(IsWindowUnicode(Msg.hwnd)) + DispatchMessageW(&Msg); + else + DispatchMessage(&Msg); + } + ELOG("OverWatch 3"); + return 0; +} +#endif +#endif + +HWND utilityHWND = 0; + +extern VectorMap& sClipMap(); + +INITBLOCK +{ + sClipMap(); +} + +EXITBLOCK +{ + if(utilityHWND) DestroyWindow(utilityHWND); +} + +LRESULT CALLBACK Ctrl::UtilityProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + sClipMap(); + switch(message) { + case WM_TIMER: + TimerProc(GetTickCount()); + return 0; + case WM_RENDERFORMAT: + RenderFormat((dword)wParam); + return 0; + case WM_DESTROYCLIPBOARD: + DestroyClipboard(); + return 0; + } + return ::DefWindowProc(hWnd, message, wParam, lParam); +} + +#ifdef PLATFORM_WINCE +#define L_(x) L##x +#else +#define L_(x) x +#endif + +static DWORD sMainThreadId; + +void WakeUpGuiThread() +{ + ::PostThreadMessage(sMainThreadId, WM_NULL, 0, 0); +} + +void Ctrl::InitWin32(HINSTANCE hInstance) +{ + GuiLock __; + LLOG("InitWin32"); +// RLOGBLOCK("Ctrl::InitWin32"); + sMainThreadId = GetCurrentThreadId(); +#define ILOG(x) // RLOG(x) + Ctrl::hInstance = hInstance; + ILOG("RegisterClassW"); +#ifndef PLATFORM_WINCE + if(IsWinNT()) +#endif + { + WNDCLASSW wc; + Zero(wc); + wc.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW; + wc.lpfnWndProc = (WNDPROC)Ctrl::WndProc; + wc.hInstance = hInstance; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = IsWinVista() ? (HBRUSH)(COLOR_WINDOW+1) : (HBRUSH)NULL; + wc.lpszClassName = L"UPP-CLASS-W"; + RegisterClassW(&wc); + wc.style = 0x20000|CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW; + wc.lpszClassName = L"UPP-CLASS-DS-W"; + RegisterClassW(&wc); + wc.style = CS_SAVEBITS|CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW; + wc.lpszClassName = L"UPP-CLASS-SB-W"; + RegisterClassW(&wc); + wc.style = 0x20000|CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW|CS_SAVEBITS; + wc.lpszClassName = L"UPP-CLASS-SB-DS-W"; + RegisterClassW(&wc); + } + + ILOG("RegisterClassA"); + WNDCLASS wc; + Zero(wc); + wc.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW; + wc.lpfnWndProc = (WNDPROC)Ctrl::WndProc; + wc.hInstance = hInstance; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = IsWinVista() ? (HBRUSH)(COLOR_WINDOW+1) : (HBRUSH)NULL; + wc.lpszClassName = L_("UPP-CLASS-A"); + RegisterClass(&wc); + if(IsWinXP()) { + wc.style = 0x20000|CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW; + wc.lpszClassName = L_("UPP-CLASS-DS-A"); + RegisterClass(&wc); + } + wc.style = CS_SAVEBITS|CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW; + wc.lpszClassName = L_("UPP-CLASS-SB-A"); + RegisterClass(&wc); + if(IsWinXP()) { + wc.style = 0x20000|CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW|CS_SAVEBITS; + wc.lpszClassName = L_("UPP-CLASS-SB-DS-A"); + RegisterClass(&wc); + } + wc.style = 0; + wc.lpszClassName = L_("UPP-TIMER"); + wc.hCursor = NULL; + wc.lpfnWndProc = &Ctrl::UtilityProc; + RegisterClass(&wc); + + ILOG("InitTimer"); + InitTimer(); + ILOG("SetTimer"); + utilityHWND = CreateWindow(L_("UPP-TIMER"), L_(""), WS_OVERLAPPED, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + NULL, NULL, hInstance, NULL); + SetTimer(utilityHWND, 1, 10, NULL); + ILOG("Windows"); + Windows(); //?? TRC: what's the use of this? + + ChSync(); + + OleInitialize(NULL); + +/* TRC 05/11/14: moved to GuiSleep to avoid thread creation in OCX DllMain + DWORD dummy; + OverwatchThread = CreateThread(NULL, 0x100000, Win32OverwatchThread, NULL, 0, &dummy); + ExitLoopEvent().Wait(); +*/ + +// TRC 05/11/18: pSetLayeredWindowAttributes moved to GLOBAL_VAR (see below) to make OCX initialization simpler +#undef ILOG +} + +typedef DWORD (WINAPI *PSLWA)(HWND, DWORD, BYTE, DWORD); + +static PSLWA SetLayeredWindowAttributes() +{ + static PSLWA pSet; +#ifndef PLATFORM_WINCE + static bool inited = false; + if(!inited) { + inited = true; + if(HMODULE hDLL = LoadLibrary ("user32")) + pSet = (PSLWA) GetProcAddress(hDLL, "SetLayeredWindowAttributes"); + } +#endif + return pSet; +} + +bool Ctrl::IsAlphaSupported() +{ + return SetLayeredWindowAttributes(); +} + +bool Ctrl::IsCompositedGui() +{ + return false; +} + +void Ctrl::ExitWin32() +{ + RenderAllFormats(); + + OleUninitialize(); + + sFinished = true; + for(int i = 0; i < Windows().GetCount(); i++) { + HWND hwnd = Windows().GetKey(i); + if(hwnd) + ::DestroyWindow(hwnd); + } + MSG msg; + while(PeekMsg(msg)) + if(msg.message != WM_QUIT) + ::PostQuitMessage(0); +#ifndef flagDLL +#ifndef PLATFORM_WINCE + ELOG("ExitWin32 1"); + OverwatchEndSession.Set(); + ELOG("ExitWin32 2"); + PostMessage(OverwatchHWND, WM_USER, 0, 0); + ELOG("ExitWin32 3"); + LLOG("Waiting for overwatch thread to finish..."); + WaitForSingleObject(OverwatchThread, INFINITE); + ELOG("ExitWin32 4"); + LLOG("...overwatch thread finished"); +#endif +#endif +} + +void Ctrl::SetTimerGranularity(int ms) +{ + if(ms > 0) + SetTimer(utilityHWND, 1, ms, NULL); + else + KillTimer(utilityHWND, 1); +} + +VectorMap< HWND, Ptr >& Ctrl::Windows() +{ + static VectorMap< HWND, Ptr > map; + return map; +} + +Vector Ctrl::GetTopCtrls() +{ + Vector v; + VectorMap< HWND, Ptr >& w = Windows(); + for(int i = 0; i < w.GetCount(); i++) + if(w.GetKey(i) && w[i] && !w[i]->parent) + v.Add(w[i]); + return v; +} + +void Ctrl::SetMouseCursor(const Image& image) +{ + GuiLock __; +#ifndef PLATFORM_WINCE + static Image img; + if(image.GetSerialId() != img.GetSerialId()) { + img = image; + HCURSOR hc = IconWin32(img, true); + SetCursor(hc); + if(hCursor) + DestroyCursor(hCursor); + hCursor = hc; + } +#endif +} + +Ctrl *Ctrl::CtrlFromHWND(HWND hwnd) +{ + GuiLock __; + return hwnd ? Windows().Get(hwnd, NULL) : NULL; +} + +HWND Ctrl::GetOwnerHWND() const +{ + GuiLock __; + HWND hwnd = GetHWND(); + if(!hwnd) return NULL; + return GetWindow(hwnd, GW_OWNER); +} + +Ctrl *Ctrl::GetOwner() +{ + GuiLock __; + HWND hwnd = GetOwnerHWND(); + return hwnd ? CtrlFromHWND(hwnd) : NULL; +} + +Ctrl *Ctrl::GetActiveCtrl() +{ + GuiLock __; + if(focusCtrl) + return focusCtrl->GetTopCtrl(); + HWND actwnd = ::GetActiveWindow(); + Vector top = GetTopCtrls(); + for(int i = 0; i < top.GetCount(); i++) + if(top[i]->IsActiveX() && top[i]->GetHWND()) { + LLOG("-> top[" << i << "] = " << FormatIntHex(top[i]->GetHWND())); + for(HWND hwnd = top[i]->GetHWND(); hwnd; hwnd = ::GetParent(hwnd)) + if(hwnd == actwnd) { + LLOG("-> match for " < not found (NULL)"); + return NULL; +} + +UDropTarget *NewUDropTarget(Ctrl *); + +struct Ctrl::CreateBox { + HWND parent; + DWORD style; + DWORD exstyle; + bool savebits; + int show; + bool dropshadow; +}; + +void Ctrl::Create(HWND parent, DWORD style, DWORD exstyle, bool savebits, int show, bool dropshadow) +{ + CreateBox cr; + cr.parent = parent; + cr.style = style; + cr.exstyle = exstyle; + cr.savebits = savebits; + cr.show = show; + cr.dropshadow = dropshadow; + Call(callback1(this, &Ctrl::Create0, &cr)); +} + +void Ctrl::Create0(Ctrl::CreateBox *cr) +{ + GuiLock __; + ASSERT(IsMainThread()); + LLOG("Ctrl::Create(parent = " << (void *)parent << ") in " <style, FALSE, cr->exstyle); + isopen = true; + top = new Top; + ASSERT(!cr->parent || IsWindow(cr->parent)); + if(!IsWinXP()) + cr->dropshadow = false; +#ifdef PLATFORM_WINCE + if(parent) + top->hwnd = CreateWindowExW(cr->exstyle, + cr->savebits ? cr->dropshadow ? L"UPP-CLASS-SB-DS-W" : L"UPP-CLASS-SB-W" + : cr->dropshadow ? L"UPP-CLASS-DS-W" : L"UPP-CLASS-W", + L"", cr->style, r.left, r.top, r.Width(), r.Height(), + cr->parent, NULL, hInstance, this); + else + top->hwnd = CreateWindowW(L"UPP-CLASS-W", + L"", WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + cr->parent, NULL, hInstance, this); +#else + if(IsWinNT() && (!cr->parent || IsWindowUnicode(cr->parent))) + top->hwnd = CreateWindowExW(cr->exstyle, + cr->savebits ? cr->dropshadow ? L"UPP-CLASS-SB-DS-W" : L"UPP-CLASS-SB-W" + : cr->dropshadow ? L"UPP-CLASS-DS-W" : L"UPP-CLASS-W", + L"", cr->style, r.left, r.top, r.Width(), r.Height(), + cr->parent, NULL, hInstance, this); + else + top->hwnd = CreateWindowEx(cr->exstyle, + cr->savebits ? cr->dropshadow ? "UPP-CLASS-SB-DS-A" : "UPP-CLASS-SB-A" + : cr->dropshadow ? "UPP-CLASS-DS-A" : "UPP-CLASS-A", + "", cr->style, r.left, r.top, r.Width(), r.Height(), + cr->parent, NULL, hInstance, this); +#endif + + inloop = false; + + ASSERT(top->hwnd); + + ::ShowWindow(top->hwnd, visible ? cr->show : SW_HIDE); +// ::UpdateWindow(hwnd); + StateH(OPEN); + LLOG(EndIndent << "//Ctrl::Create in " <hwnd, (LPDROPTARGET) (top->dndtgt = NewUDropTarget(this))); + CancelMode(); + RefreshLayoutDeep(); +} + +void ReleaseUDropTarget(UDropTarget *dt); + +void Ctrl::WndFree() +{ + GuiLock __; + if(!top) return; + RevokeDragDrop(GetHWND()); + ReleaseUDropTarget(top->dndtgt); + isopen = false; + if(!top) return; + HWND owner = GetWindow(top->hwnd, GW_OWNER);// CXL 31.10.2003 z DoRemove + bool focus = ::GetFocus() == top->hwnd; + LLOG("Ctrl::WndDestroy owner " << (void *)owner + << " focus " << focus + << " ::GetFocus() " << (void *)::GetFocus()); + if(owner && focus) { // CXL 7.11.2003 presun - melo by to fungovat take a neblikat... + LLOG("Ctrl::WndFree->SetFocus " << UPP::Name(Ctrl::CtrlFromHWND(owner))); + ::SetFocus(owner); + } + LLOG(EndIndent << "//Ctrl::WndFree() in " <hwnd) { + HWND hwnd = top->hwnd; + WndFree(); // CXL 2007-06-04 to avoid loosing focus with maximize box owned dialogs + ::DestroyWindow(hwnd); + } +} + +Image Ctrl::DoMouse(int e, Point p, int zd) +{ +// LLOG("Ctrl::DoMouse(" << p << ", " << e << ")"); + GuiLock __; + eventCtrl = this; + Image img = DispatchMouse(e, p, zd); + SyncCaret(); + return img; +} + +#ifdef _DEBUG + +bool Ctrl::LogMessages; + +#define x_MSG(x) { x, #x }, + +struct WinMsg { + int ID; + const char *name; +} +sWinMsg[] = { +#include "Win32Msg.i" + 0, NULL +}; + +#endif + +void Ctrl::NcCreate(HWND hwnd) +{ + GuiLock __; + if(!parent) + top->hwnd = hwnd; +} + +void Ctrl::NcDestroy() +{ + GuiLock __; + if(!parent) + WndFree(); +} + +LRESULT CALLBACK Ctrl::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + GuiLock __; + if(sFinished) + return DefWindowProc(hWnd, message, wParam, lParam); +#ifdef PLATFORM_WINCE + if(message == WM_CREATE) +#else + if(message == WM_NCCREATE) +#endif + { + Ctrl *w = (Ctrl *)((LPCREATESTRUCT) lParam)->lpCreateParams; + if(w) { + w->NcCreate(hWnd); + int i = Windows().Find(NULL); + if(i >= 0) { + Windows().SetKey(i, hWnd); + Windows()[i] = w; + } + else + Windows().Add(hWnd) = w; + } + } + Ctrl *w = Windows().Get(hWnd, NULL); +#ifdef PLATFORM_WINCE + if(message == WM_DESTROY) +#else + if(message == WM_NCDESTROY) +#endif + { + if(w) w->NcDestroy(); + int i = Windows().Find(hWnd); + if(i >= 0) + Windows().SetKey(i, NULL); + } + #if LOGMESSAGES + bool logblk = false; + if(message != WM_SETCURSOR && message != WM_CTLCOLORBTN && message != WM_TIMER && +#ifndef PLATFORM_WINCE + message != WM_NCHITTEST && message != WM_ENTERIDLE && +#endif + message != WM_CTLCOLORDLG && message != WM_CTLCOLOREDIT && message != WM_CTLCOLORLISTBOX && + message != WM_CTLCOLORMSGBOX && message != WM_CTLCOLORSCROLLBAR && + message != WM_CTLCOLORSTATIC && message != WM_CANCELMODE && + message != 0x0118) + for(WinMsg *m = sWinMsg; m->ID; m++) + if(m->ID == message) { + RLOG(m->name << ' ' << UPP::Name(w) << + Sprintf(", wParam = %d (0x%x), lParam = %d (0x%x)", + wParam, wParam, lParam, lParam)); + VppLog() << LOG_BEGIN; + logblk = true; + break; + } + #endif + LRESULT l = 0; + if(w) { + try + { +#if defined(_DEBUG) && LOGTIMING + int ticks = msecs(); + String wname = w->Name(); +#endif + Ptr pw = w; + l = w->WindowProc(message, wParam, lParam); + if(pw) + pw->SyncMoves(); +#if defined(_DEBUG) && LOGTIMING + String msgname; + for(WinMsg *m = sWinMsg; m->ID; m++) + if(m->ID == message) { + msgname = m->name; + break; + } + if(IsNull(msgname)) + msgname = NFormat("0x%04x", (int)message); + LLOG(NFormat("T+%d %s 0x%08x 0x%08x -> %s", msecs(ticks), msgname, (int)wParam, (int)lParam, wname)); +#endif + } + catch(Exc e) + { + LOG("Ctrl::WindowProc -> Exc: " << e); + NEVER(); + } + } + else + l = DefWindowProc(hWnd, message, wParam, lParam); +#if LOGMESSAGES + if(logblk) + VppLog() << LOG_END; +#endif + return l; +} + +bool PassWindowsKey(int wParam) +{ + return wParam >= VK_NUMPAD0 && wParam <= VK_NUMPAD9 + || wParam == VK_INSERT || wParam == VK_DELETE + || wParam == VK_HOME || wParam == VK_END + || wParam == VK_PRIOR || wParam == VK_NEXT + || wParam == VK_UP || wParam == VK_DOWN + || wParam == VK_LEFT || wParam == VK_RIGHT + || wParam == VK_CLEAR || wParam == VK_SPACE + || wParam >= 0x90; // OEM keys +} + +static void sProcessMSG(MSG& msg) +{ + if(msg.message != WM_SYSKEYDOWN && msg.message != WM_SYSKEYUP + || PassWindowsKey((dword)msg.wParam) || msg.wParam == VK_MENU) //17.11 Mirek - fix to get windows menu invoked on Alt+Space + TranslateMessage(&msg); // 04/09/07: TRC fix to make barcode reader going better + if(IsWindowUnicode(msg.hwnd)) + DispatchMessageW(&msg); + else + DispatchMessage(&msg); +} + +bool Ctrl::IsWaitingEvent() +{ + MSG msg; + return PeekMsg(msg); +} + +bool Ctrl::ProcessEvent(bool *quit) +{ + if(EndSession()) + return false; + if(!GetMouseLeft() && !GetMouseRight() && !GetMouseMiddle()) + ReleaseCtrlCapture(); + MSG msg; + if(PeekMsg(msg)) { + if(msg.message == WM_QUIT && quit) + *quit = true; +// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": sProcessMSG " << FormatIntHex(msg.message)); + sProcessMSG(msg); +// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": //sProcessMSG " << FormatIntHex(msg.message)); + DefferedFocusSync(); + SyncCaret(); + return true; + } + return false; +} + +void SweepMkImageCache(); + +bool Ctrl::ProcessEvents(bool *quit) +{ + if(ProcessEvent(quit)) { + while(ProcessEvent(quit) && (!LoopCtrl || LoopCtrl->InLoop())); // LoopCtrl-MF 071008 + SweepMkImageCache(); + return true; + } + SweepMkImageCache(); + return false; +} + +void Ctrl::EventLoop0(Ctrl *ctrl) +{ + GuiLock __; + ASSERT(IsMainThread()); + ASSERT(LoopLevel == 0 || ctrl); + LoopLevel++; + LLOG("Entering event loop at level " << LoopLevel << BeginIndent); + Ptr ploop; + if(ctrl) { + ploop = LoopCtrl; + LoopCtrl = ctrl; + ctrl->inloop = true; + } + + bool quit = false; + ProcessEvents(&quit); + while(!EndSession() && !quit && ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount()) + { +// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / GuiSleep"); + SyncCaret(); + GuiSleep(1000); + if(EndSession()) break; +// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / ProcessEvents"); + ProcessEvents(&quit); +// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / after ProcessEvents"); + } + + if(ctrl) + LoopCtrl = ploop; + LoopLevel--; + LLOG(EndIndent << "Leaving event loop "); +} + +void Ctrl::GuiSleep0(int ms) +{ + GuiLock __; + ASSERT(IsMainThread()); + ELOG("GuiSleep"); + if(EndSession()) + return; + ELOG("GuiSleep 2"); + int level = LeaveGuiMutexAll(); +#if !defined(flagDLL) && !defined(PLATFORM_WINCE) + if(!OverwatchThread) { + DWORD dummy; + OverwatchThread = CreateThread(NULL, 0x100000, Win32OverwatchThread, NULL, 0, &dummy); + ELOG("ExitLoopEventWait 1"); + ExitLoopEvent().Wait(); + } + HANDLE h[1]; + *h = ExitLoopEvent().GetHandle(); + ELOG("ExitLoopEventWait 2 " << (void *)*h); + MsgWaitForMultipleObjects(1, h, FALSE, ms, QS_ALLINPUT); +#else + MsgWaitForMultipleObjects(0, NULL, FALSE, ms, QS_ALLINPUT); +#endif + EnterGuiMutex(level); +} + +void Ctrl::WndDestroyCaret() +{ + LLOG("Ctrl::WndDestroyCaret()"); + ::DestroyCaret(); +} + +void Ctrl::WndCreateCaret(const Rect& cr) +{ + GuiLock __; + LLOG("Ctrl::WndCreateCaret(" << cr << ") in " << UPP::Name(this)); + HWND hwnd = GetHWND(); + if(!hwnd) return; + Rect r; + ::GetClientRect(hwnd, r); + Point p = r.TopLeft(); + ::ClientToScreen(hwnd, p); + ::CreateCaret(hwnd, NULL, cr.Width(), cr.Height()); + ::SetCaretPos(cr.left - p.x, cr.top - p.y); + ::ShowCaret(hwnd); +} + +Rect Ctrl::GetWndUpdateRect() const +{ + GuiLock __; + HWND hwnd = GetHWND(); + if(!hwnd) return Null; + Rect r; + ::GetUpdateRect(hwnd, r, FALSE); + return r; +} + +Rect Ctrl::GetWndScreenRect() const +{ + GuiLock __; + HWND hwnd = GetHWND(); + if(!hwnd) return Null; + Rect r; + ::GetWindowRect(hwnd, r); + return r; +} + +void Ctrl::WndShow(bool b) +{ + GuiLock __; + HWND hwnd = GetHWND(); + if(hwnd) + ::ShowWindow(hwnd, b ? SW_SHOW : SW_HIDE); +} + +void Ctrl::WndUpdate() +{ + GuiLock __; + HWND hwnd = GetHWND(); + if(hwnd) ::UpdateWindow(hwnd); +} + +bool Ctrl::IsWndOpen() const { + GuiLock __; + return GetHWND(); +} + +void Ctrl::SetAlpha(byte alpha) +{ + GuiLock __; + HWND hwnd = GetHWND(); + if(!IsAlphaSupported() || parent || !top || !hwnd) + return; + if(alpha == 255) { + SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~0x80000); + return; + } + SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | 0x80000); + SetLayeredWindowAttributes() (hwnd, 0, alpha, 2); +} + +#define DLLFILENAME "User32.dll" +#define DLIMODULE MultiMon +#define DLIHEADER +#include + +Rect MonitorRectForHWND(HWND hwnd) +{ + if(hwnd && MultiMon()) + if(HMONITOR monitor = MultiMon().MonitorFromWindow(hwnd, 2/*MONITOR_DEFAULTTONEAREST*/)) { + MONITORINFO moninfo; + Zero(moninfo); + moninfo.cbSize = sizeof(moninfo); + MultiMon().GetMonitorInfo(monitor, &moninfo); + return Rect(moninfo.rcWork); + } + return Ctrl::GetPrimaryWorkArea(); +} + +Rect Ctrl::GetWorkArea() const +{ +// return MonitorRectForHWND(GetHWND()); +// mst:2008-12-08, hack for better multimonitor support. + GuiLock __; + const Ctrl *topctl = GetTopCtrl(); + HWND hwnd = topctl->GetHWND(); + if(!hwnd && !((topctl = topctl->GetOwnerCtrl()) && (hwnd = topctl->GetHWND()))) + hwnd = ::GetFocus(); + return MonitorRectForHWND(hwnd); +} + +static BOOL CALLBACK sMonEnumProc(HMONITOR monitor, HDC hdc, LPRECT lprcMonitor, LPARAM data) +{ + MONITORINFO moninfo; + Zero(moninfo); + moninfo.cbSize = sizeof(moninfo); + MultiMon().GetMonitorInfo(monitor, &moninfo); + ((Array *)data)->Add(Rect(moninfo.rcWork)); + return TRUE; +} + +void Ctrl::GetWorkArea(Array& rc) +{ + GuiLock __; + MultiMon().EnumDisplayMonitors(NULL, NULL, &sMonEnumProc, (LPARAM)&rc); +} + +Rect Ctrl::GetVirtualWorkArea() +{ + Rect out = GetPrimaryWorkArea(); + Array rc; + GetWorkArea(rc); + for(int i = 0; i < rc.GetCount(); i++) + out |= rc[i]; + return out; +} + +Rect Ctrl::GetWorkArea(Point pt) +{ + Array rc; + GetWorkArea(rc); + for(int i = 0; i < rc.GetCount(); i++) + if(rc[i].Contains(pt)) + return rc[i]; + return GetPrimaryWorkArea(); +} + +Rect Ctrl::GetVirtualScreenArea() +{ + GuiLock __; + return RectC(GetSystemMetrics(SM_XVIRTUALSCREEN), + GetSystemMetrics(SM_YVIRTUALSCREEN), + GetSystemMetrics(SM_CXVIRTUALSCREEN), + GetSystemMetrics(SM_CYVIRTUALSCREEN)); +} + +Rect Ctrl::GetPrimaryWorkArea() +{ + Rect r; + SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0); + LLOG("Ctrl::GetWorkArea -> " << r); + return r; +} + +Rect Ctrl::GetPrimaryScreenArea() +{ + return Size(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); +} + +int Ctrl::GetKbdDelay() +{ + GuiLock __; +#ifdef PLATFORM_WINCE + return 500; +#else + int a; + SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &a, 0); + return 250 + a * 750 / 4; +#endif +} + +int Ctrl::GetKbdSpeed() +{ + GuiLock __; +#ifdef PLATFORM_WINCE + return 1000 / 32; +#else + int a; + SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &a, 0); + return 1000 / (a + 2); +#endif +} + +void Ctrl::SetWndForeground() +{ + GuiLock __; + LLOG("Ctrl::SetWndForeground() in " << UPP::Name(this)); + HWND hwnd = GetHWND(); + if(hwnd) + ::SetForegroundWindow(hwnd); +} + +bool Ctrl::IsWndForeground() const +{ + GuiLock __; + HWND hwnd = GetHWND(); + if(!hwnd) + return false; + HWND fore = ::GetForegroundWindow(); + LLOG("Ctrl::IsWndForeground(): hwnd = " << (void *)hwnd + << ", fore = " << (void *)fore << " - " << UPP::Name(CtrlFromHWND(fore))); + if(IsActiveX()) { + while(hwnd && hwnd != fore && !!::GetParent(hwnd)) + hwnd = ::GetParent(hwnd); + } + return hwnd == fore; +} + +bool Ctrl::WndEnable(bool b) +{ + GuiLock __; + LLOG("Ctrl::WndEnable(" << b << ") in " << UPP::Name(this) << ", focusCtrlWnd = " << UPP::Name(focusCtrlWnd) << ", raw = " << (void *)::GetFocus()); + HWND hwnd = GetHWND(); + if(!b) { + ReleaseCapture(); + LLOG("//Ctrl::WndEnable(" << b << ") -> true " << UPP::Name(this) << ", focusCtrlWnd = " < false " < ::SetFocus(" << (void *)hwnd << ")"); +// ::SetActiveWindow(hwnd); + ::SetFocus(hwnd); + return true; + } + LLOG("//Ctrl::SetWndFocus() in " <GetTopCtrl(); + hwnd = top->GetHWND(); + ASSERT(hwnd); + Attach(GetDC(hwnd)); + Clipoff(ctrl->GetScreenView() - top->GetScreenRect().TopLeft()); +} + +ViewDraw::~ViewDraw() +{ + End(); + HDC hdc = Detach(); + if(hwnd && hdc) + ReleaseDC(hwnd, hdc); + LeaveGuiMutex(); +} + +Vector SplitCmdLine__(const char *cmd) +{ + Vector out; + while(*cmd) + if((byte)*cmd <= ' ') + cmd++; + else if(*cmd == '\"') + { + String quoted; + while(*++cmd && (*cmd != '\"' || *++cmd == '\"')) + quoted.Cat(*cmd); + out.Add(quoted); + } + else + { + const char *begin = cmd; + while((byte)*cmd > ' ') + cmd++; + out.Add(String(begin, cmd)); + } + return out; +} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/X11App.cpp b/olddraw/CtrlCore/X11App.cpp new file mode 100644 index 000000000..32dc7b25d --- /dev/null +++ b/olddraw/CtrlCore/X11App.cpp @@ -0,0 +1,505 @@ +#include "CtrlCore.h" + +#ifdef PLATFORM_X11 +#include +#endif + +NAMESPACE_UPP + +#ifdef PLATFORM_X11 + +#define LLOG(x) // LOG(x) + +XIM Ctrl::xim; + +Atom XAtom(const char *name) +{ + GuiLock __; + Atom x; + INTERLOCKED { + static VectorMap atoms; + int q = atoms.Get(name, Null); + if(IsNull(q)) { + q = XInternAtom(Xdisplay, name, XFalse); + atoms.Add(name, q); + } + x = q; + } + return x; +} + +String XAtomName(Atom atom) +{ + GuiLock __; + LLOG("GetAtomName"); + return XGetAtomName(Xdisplay, atom); +} + +String GetProperty(Window w, Atom property, Atom rtype) +{ + GuiLock __; + LLOG("GetProperty"); + String result; + int format; + unsigned long nitems, after = 1; + long offset = 0; + Atom type = None; + unsigned char *data; + long rsize = minmax((long)(XMaxRequestSize(Xdisplay) - 100), (long)256, (long)65536); + while(after > 0) { + if(XGetWindowProperty(Xdisplay, w, property, offset, rsize, XFalse, + rtype, &type, &format, &nitems, &after, &data) != Success) + break; + if(type == None) + break; + if(data) { + int len = format == 32 ? sizeof(unsigned long) * nitems : nitems * (format >> 3); + result.Cat(data, len); + XFree((char *)data); + offset += nitems / (32 / format); + } + else + break; + } + result.Shrink(); + XFlush(Xdisplay); + return result; +} + +bool WaitForEvent(Window w, int type, XEvent& event){ + GuiLock __; + for(int i = 0; i < 80; i++) { + if(XCheckTypedWindowEvent(Xdisplay, w, type, &event)) + return true; + XFlush(Xdisplay); + Sleep(50); + } + LOG("WaitForEvent failed"); + return false; +} + + +String ReadPropertyData(Window w, Atom property, Atom rtype) +{ + GuiLock __; + static Atom XA_INCR = XAtom("INCR"); + Atom type; + int format; + unsigned long nitems, after; + unsigned char *ptr; + String r; + if(XGetWindowProperty(Xdisplay, w, property, 0, 0, XFalse, AnyPropertyType, + &type, &format, &nitems, &after, &ptr) == Success && type != None) { + XFree(ptr); + if(type == XA_INCR) { + XDeleteProperty(Xdisplay, w, property); + XEvent event; + for(;;) { + XFlush(Xdisplay); + if(!WaitForEvent(w, PropertyNotify, event)) + break; + if(event.xproperty.atom == property && event.xproperty.state == PropertyNewValue) { + String x = GetProperty(w, property); + if(!x.GetLength()) + break; + r.Cat(x); + XDeleteProperty(Xdisplay, w, property); + } + } + } + else { + r = GetProperty(w, property); + XDeleteProperty(Xdisplay, w, property); + } + } + return r; +} + +Vector GetPropertyInts(Window w, Atom property, Atom rtype) +{ + GuiLock __; + Vector result; + String p = GetProperty(w, property, rtype); + const long int *ptr = (const long int *)~p; + const long int *lim = ptr + p.GetLength() / 4; + result.Reserve(p.GetLength() / 4); + while(ptr < lim) + result.Add(*ptr++); + return result; +} + +Index& _NET_Supported() +{ + static Index q; + return q; +} + +bool X11ErrorTrap; + +bool Ctrl::TrapX11Errors() +{ + GuiLock __; + bool b = X11ErrorTrap; + X11ErrorTrap = true; + return b; +} + +void Ctrl::UntrapX11Errors(bool b) +{ + GuiLock __; + X11ErrorTrap = b; +} + +static void sPanicMessageBox(const char *title, const char *text) +{ + GuiLock __; + Ctrl::ReleaseCtrlCapture(); + XDisplay *display = XOpenDisplay(NULL); + if(!display) + return; + int screen = DefaultScreen(display); + int x = (DisplayWidth(display, screen) - 600) / 2; + int y = (DisplayHeight(display, screen) - 120) / 2; + Window win = XCreateSimpleWindow(display, RootWindow(display, screen), + x, y, 600, 120, 4, + BlackPixel(display, screen), + WhitePixel(display, screen)); + XSizeHints size_hints; + size_hints.flags = PPosition|PSize|PMinSize; + size_hints.x = x; + size_hints.y = x; + size_hints.width = 600; + size_hints.height = 120; + size_hints.min_width = 600; + size_hints.min_height = 120; + char *h[1]; + char hh[1]; + *hh = 0; + h[0] = hh; + XSetStandardProperties(display, win, title, title, None, h, 0, &size_hints); + XSelectInput(display, win, ExposureMask|KeyPressMask|ButtonPressMask|StructureNotifyMask); + XGCValues values; + GC gc = XCreateGC(display, win, 0, &values); + // New section + unsigned long wina[1]; + wina[0] = XAtom("_NET_WM_STATE_ABOVE"); + XChangeProperty(display, win, XAtom("_NET_WM_STATE"), XAtom("ATOM"), 32, + PropModeReplace, (const unsigned char *)&wina, 1); + XMapWindow(display, win); + XSetInputFocus(display, win, RevertToParent, CurrentTime); + // End section + XRaiseWindow(display, win); + XFontStruct *font_info = XQueryFont(display, XGContextFromGC(gc)); + for(;;) { + XEvent e; + XNextEvent(display, &e); + switch(e.type) { + case ButtonPress: + XFreeFont(display, font_info); + XFreeGC(display, gc); + XCloseDisplay(display); + #ifdef _DEBUG + __BREAK__; + #endif + return; + case Expose: + int y = 20; + const char *b = text; + for(;;) { + const char *e = strchr(b, '\n'); + if(!e) break; + XDrawString(display, win, gc, 20, y, b, e - b); + y += font_info->max_bounds.ascent + font_info->max_bounds.descent; + b = e + 1; + } + XDrawString(display, win, gc, 20, y, b, strlen(b)); + break; + } + } +} + +#ifdef _DEBUG +#define INI_PREFIX "DEBUG_" +#else +#define INI_PREFIX +#endif + +int X11ErrorHandler(XDisplay *, XErrorEvent *error) +{ + if(GetIniKey(INI_PREFIX "X11_ERRORS") != "1") + return 0; + + if(X11ErrorTrap || IsPanicMode()) return 0; + + static const char *request[] = { + "", + "X_CreateWindow", + "X_ChangeWindowAttributes", + "X_GetWindowAttributes", + "X_DestroyWindow", + "X_DestroySubwindows", + "X_ChangeSaveSet", + "X_ReparentWindow", + "X_MapWindow", + "X_MapSubwindows", + "X_UnmapWindow", + "X_UnmapSubwindows", + "X_ConfigureWindow", + "X_CirculateWindow", + "X_GetGeometry", + "X_QueryTree", + "X_InternAtom", + "X_GetAtomName", + "X_ChangeProperty", + "X_DeleteProperty", + "X_GetProperty", + "X_ListProperties", + "X_SetSelectionOwner", + "X_GetSelectionOwner", + "X_ConvertSelection", + "X_SendEvent", + "X_GrabPointer", + "X_UngrabPointer", + "X_GrabButton", + "X_UngrabButton", + "X_ChangeActivePointerGrab", + "X_GrabKeyboard", + "X_UngrabKeyboard", + "X_GrabKey", + "X_UngrabKey", + "X_AllowEvents", + "X_GrabServer", + "X_UngrabServer", + "X_QueryPointer", + "X_GetMotionEvents", + "X_TranslateCoords", + "X_WarpPointer", + "X_SetInputFocus", + "X_GetInputFocus", + "X_QueryKeymap", + "X_OpenFont", + "X_CloseFont", + "X_QueryFont", + "X_QueryTextExtents", + "X_ListFonts", + "X_ListFontsWithInfo", + "X_SetFontPath", + "X_GetFontPath", + "X_CreatePixmap", + "X_FreePixmap", + "X_CreateGC", + "X_ChangeGC", + "X_CopyGC", + "X_SetDashes", + "X_SetClipRectangles", + "X_FreeGC", + "X_ClearArea", + "X_CopyArea", + "X_CopyPlane", + "X_PolyPoint", + "X_PolyLine", + "X_PolySegment", + "X_PolyRectangle", + "X_PolyArc", + "X_FillPoly", + "X_PolyFillRectangle", + "X_PolyFillArc", + "X_PutImage", + "X_GetImage", + "X_PolyText8", + "X_PolyText16", + "X_ImageText8", + "X_ImageText16", + "X_CreateColormap", + "X_FreeColormap", + "X_CopyColormapAndFree", + "X_InstallColormap", + "X_UninstallColormap", + "X_ListInstalledColormaps", + "X_AllocColor", + "X_AllocNamedColor", + "X_AllocColorCells", + "X_AllocColorPlanes", + "X_FreeColors", + "X_StoreColors", + "X_StoreNamedColor", + "X_QueryColors", + "X_LookupColor", + "X_CreateCursor", + "X_CreateGlyphCursor", + "X_FreeCursor", + "X_RecolorCursor", + "X_QueryBestSize", + "X_QueryExtension", + "X_ListExtensions", + "X_ChangeKeyboardMapping", + "X_GetKeyboardMapping", + "X_ChangeKeyboardControl", + "X_GetKeyboardControl", + "X_Bell", + "X_ChangePointerControl", + "X_GetPointerControl", + "X_SetScreenSaver", + "X_GetScreenSaver", + "X_ChangeHosts", + "X_ListHosts", + "X_SetAccessControl", + "X_SetCloseDownMode", + "X_KillClient", + "X_RotateProperties", + "X_ForceScreenSaver", + "X_SetPointerMapping", + "X_GetPointerMapping", + "X_SetModifierMapping", + "X_GetModifierMapping", + "X_NoOperation", + }; + + char h[512]; + XGetErrorText(Xdisplay, error->error_code, h, 512); + String e; + e << "X Error: " << h; + if(error->request_code < __countof(request)) + e << "\nrequest: " << request[error->request_code]; + e << "\nresource id: " << (int)error->resourceid << " = " << Format("%0X", (int)error->resourceid); + + RLOG(e); + puts(e); + BugLog() << e << "\r\n"; + UsrLogT(e); + + Panic(e); + + return 0; +} + +void SetX11ErrorHandler() +{ + XSetErrorHandler(X11ErrorHandler); +} + +void WakeUpGuiThread() +{ +} + +void Ctrl::InitX11(const char *display) +{ + GuiLock __; + InstallPanicMessageBox(sPanicMessageBox); + + InitX11Draw(display); + InitTimer(); + byte dummy[5]; + Xbuttons = XGetPointerMapping(Xdisplay, dummy, 5); + + Xeventtime = CurrentTime; + SetX11ErrorHandler(); + if(GetIniKey(INI_PREFIX "X11_SYNCHRONIZE") == "1") + XSynchronize(Xdisplay, 1); + Vector nets = GetPropertyInts(Xroot, XAtom("_NET_SUPPORTED")); + for(int i = 0; i < nets.GetCount(); i++) + _NET_Supported().Add(nets[i]); + + ChSync(); + + GUI_GlobalStyle_Write(GUISTYLE_XP); + GUI_DragFullWindow_Write(1); + GUI_PopUpEffect_Write(IsCompositedGui() ? GUIEFFECT_NONE : GUIEFFECT_SLIDE); + GUI_DropShadows_Write(1); + GUI_AltAccessKeys_Write(1); + GUI_AKD_Conservative_Write(0); + + setlocale(LC_ALL, "en_US.utf8"); + if(XSupportsLocale()) { + XSetLocaleModifiers(""); + xim = XOpenIM(Xdisplay, NULL, NULL, NULL); + } + else { + xim = NULL; + LOG("IM unsupported!"); + } +} + +void Ctrl::ExitX11() +{ + GuiLock __; +// if(xic) +// XDestroyIC(xic); + if(xim) + XCloseIM(xim); +} + +Rect Ctrl::GetDefaultWindowRect() +{ + GuiLock __; + static int pos = 0; + pos += 10; + int cx = Xwidth * 2 / 3; + int cy = Xheight * 2 / 3; + if(pos + cx + 50 > Xwidth || pos + cy + 50 > Xheight) + pos = 0; + return RectC(pos + 20, pos + 20, cx, cy); +} + +void Ctrl::GetWorkArea(Array& out) +{ + out.Add(GetPrimaryWorkArea()); +} + +Rect Ctrl::GetWorkArea() const +{ + return GetPrimaryWorkArea(); +} + +Rect Ctrl::GetWorkArea(Point pt) +{ + Array rc; + GetWorkArea(rc); + for(int i = 0; i < rc.GetCount(); i++) + if(rc[i].Contains(pt)) + return rc[i]; + return GetPrimaryWorkArea(); +} + +Rect Ctrl::GetVirtualWorkArea() +{ + return GetPrimaryWorkArea(); +} + +Rect Ctrl::GetVirtualScreenArea() +{ + return GetPrimaryScreenArea(); +} + +Rect Ctrl::GetPrimaryWorkArea() +{ + GuiLock __; + static Rect r; + if(r.right == 0) { + Vector x = GetPropertyInts(Xroot, XAtom("_NET_WORKAREA")); + if(x.GetCount()) + r = RectC(x[0], x[1], x[2], x[3]); + else + r = RectC(0, 0, Xwidth, Xheight); + } + return r; +} + +Rect Ctrl::GetPrimaryScreenArea() +{ + return RectC(0, 0, Xwidth, Xheight); +} + +int Ctrl::GetKbdDelay() +{ + return 250; +} + +int Ctrl::GetKbdSpeed() +{ + return 25; +} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/X11Clip.cpp b/olddraw/CtrlCore/X11Clip.cpp new file mode 100644 index 000000000..91452884b --- /dev/null +++ b/olddraw/CtrlCore/X11Clip.cpp @@ -0,0 +1,365 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#define LLOG(x) // LOG(x) + +#ifdef PLATFORM_X11 + +Index Ctrl::sel_formats; +Ptr Ctrl::sel_ctrl; + +void Ctrl::SetSelectionSource(const char *fmts) +{ + GuiLock __; + LLOG("SetSelectionSource " << UPP::Name(this) << ": " << fmts); + sel_formats = Split(fmts, ';'); + sel_ctrl = this; + XSetSelectionOwner(Xdisplay, XAtom("PRIMARY"), xclipboard().win, CurrentTime); +} + +Ctrl::Xclipboard::Xclipboard() +{ + GuiLock __; + XSetWindowAttributes swa; + win = XCreateWindow(Xdisplay, RootWindow(Xdisplay, Xscreenno), + 0, 0, 10, 10, 0, CopyFromParent, InputOnly, CopyFromParent, + 0, &swa); + XSelectInput(Xdisplay, win, PropertyChangeMask); +} + +Ctrl::Xclipboard::~Xclipboard() +{ + GuiLock __; + XDestroyWindow(Xdisplay, win); +} + +void Ctrl::Xclipboard::Write(int fmt, const ClipData& _data) +{ + GuiLock __; + LLOG("SetSelectionOwner " << XAtomName(fmt)); + data.GetAdd(fmt) = _data; + XSetSelectionOwner(Xdisplay, XAtom("CLIPBOARD"), win, CurrentTime); +} + +void Ctrl::Xclipboard::Request(XSelectionRequestEvent *se) +{ + GuiLock __; + LLOG("Request " << XAtomName(se->target)); + XEvent e; + e.xselection.type = SelectionNotify; + e.xselection.display = Xdisplay; + e.xselection.requestor = se->requestor; + e.xselection.selection = se->selection; + e.xselection.target = se->target; + e.xselection.time = se->time; + e.xselection.property = se->property; + if(se->target == XAtom("TARGETS")) { + LLOG("Request targets:"); + if(se->selection == XAtom("PRIMARY")) { + Buffer x(sel_formats.GetCount()); + for(int i = 0; i < sel_formats.GetCount(); i++) { + x[i] = XAtom(sel_formats[i]); + LLOG('\t' << sel_formats[i]); + } + XChangeProperty(Xdisplay, se->requestor, se->property, XAtom("ATOM"), + 32, 0, (unsigned char*)~x, + sel_formats.GetCount()); + } + else { + Buffer x(data.GetCount()); + for(int i = 0; i < data.GetCount(); i++) { + x[i] = data.GetKey(i); + LLOG('\t' << XAtomName(x[i])); + } + XChangeProperty(Xdisplay, se->requestor, se->property, XAtom("ATOM"), + 32, 0, (unsigned char*)~x, + data.GetCount()); + } + } + else { + if(se->selection == XAtom("PRIMARY")) { + LLOG("Request PRIMARY data " << XAtomName(se->target)); + String fmt = XAtomName(se->target); + int i = sel_formats.Find(fmt); + if(i >= 0 && sel_ctrl) { + String d = sel_ctrl->GetSelectionData(fmt); + XChangeProperty(Xdisplay, se->requestor, se->property, se->target, 8, PropModeReplace, + d, d.GetLength()); + } + else + e.xselection.property = None; + } + else { + LLOG("Request CLIPBOARD data " << XAtomName(se->target)); + int i = data.Find(se->target); + if(i >= 0) { + String d = data[i].Render(); + XChangeProperty(Xdisplay, se->requestor, se->property, se->target, 8, PropModeReplace, + d, d.GetLength()); + } + else + e.xselection.property = None; + } + } + XSendEvent(Xdisplay, se->requestor, XFalse, 0, &e); +} + +String Ctrl::Xclipboard::Read(int fmt, int selection, int property) +{ + GuiLock __; + if(data.GetCount() && (dword)selection == XAtom("CLIPBOARD")) { + int q = data.Find(fmt); + return q >= 0 ? data[q].Render() : String(); + } + if(sel_ctrl && (dword)selection == XAtom("PRIMARY")) + return sel_ctrl->GetSelectionData(XAtomName(fmt)); + XConvertSelection(Xdisplay, selection, fmt, property, win, CurrentTime); + XFlush(Xdisplay); + XEvent event; + for(int i = 0; i < 20; i++) { + if(XCheckTypedWindowEvent(Xdisplay, win, SelectionNotify, &event)) { + if(event.xselection.property != None) { + XSync(Xdisplay, false); + return ReadPropertyData(win, event.xselection.property); + } + return Null; + } + if(XCheckTypedWindowEvent(Xdisplay, win, SelectionRequest, &event) && + event.xselectionrequest.owner == win) + Request(&event.xselectionrequest); + if(XCheckTypedWindowEvent(Xdisplay, win, SelectionClear, &event) && + event.xselectionclear.window == win) { + if(event.xselectionclear.selection == XAtom("CLIPBOARD")) + Clear(); + if(event.xselectionclear.selection == XAtom("PRIMARY")) { + sel_ctrl = NULL; + sel_formats.Clear(); + } + } + Sleep(10); + } + return Null; +} + +Ctrl::Xclipboard& Ctrl::xclipboard() +{ + static Xclipboard xc; + return xc; +} + +void ClearClipboard() +{ + GuiLock __; + Ctrl::xclipboard().Clear(); +} + +void AppendClipboard(const char *format, const Value& data, String (*render)(const Value& data)) +{ + GuiLock __; + Vector s = Split(format, ';'); + for(int i = 0; i < s.GetCount(); i++) + Ctrl::xclipboard().Write(XAtom(s[i]), ClipData(data, render)); +} + +String sRawClipData(const Value& data); + +void AppendClipboard(const char *fmt, const String& data) +{ + GuiLock __; + AppendClipboard(fmt, data, sRawClipData); +} + +String ReadClipboard(const char *fmt) +{ + GuiLock __; + return Ctrl::xclipboard().Read(XAtom(fmt), XAtom("CLIPBOARD"), XAtom("CLIPDATA")); +} + +void AppendClipboardText(const String& s) +{ + GuiLock __; + AppendClipboard("STRING", s); +} + +String ReadClipboardText() +{ + GuiLock __; + return ReadClipboard("STRING"); +} + +void AppendClipboardUnicodeText(const WString& s) +{ + GuiLock __; + AppendClipboard("UTF8_STRING", ToUtf8(s)); +} + +WString ReadClipboardUnicodeText() +{ + GuiLock __; + return FromUtf8(ReadClipboard("UTF8_STRING")); +} + +bool Ctrl::Xclipboard::IsAvailable(int fmt, const char *type) +{ + GuiLock __; + if(data.GetCount()) + return data.Find(fmt) >= 0; + String formats = Read(XAtom("TARGETS"), XAtom(type), XAtom("CLIPDATA")); + int c = formats.GetCount() / sizeof(Atom); + const Atom *m = (Atom *) ~formats; + for(int i = 0; i < c; i++) { + if(m[i] == (dword)fmt) + return true; + } + return false; +} + +bool Ctrl::ClipHas(int type, const char *fmt) +{ + GuiLock __; + LLOG("ClipHas " << type << ": " << fmt); + if(type == 0) + return Ctrl::xclipboard().IsAvailable(XAtom(fmt), "CLIPBOARD"); + if(type == 2) { + if(sel_ctrl) + return sel_formats.Find(fmt) >= 0; + return Ctrl::xclipboard().IsAvailable(XAtom(fmt), "PRIMARY"); + } + return drop_formats.Find(fmt) >= 0; +} + +String DnDGetData(const String& f); + +String Ctrl::ClipGet(int type, const char *fmt) +{ + GuiLock __; + LLOG("ClipGet " << type << ": " << fmt); + if(type && GetDragAndDropSource()) + return DnDGetData(fmt); + return Ctrl::xclipboard().Read( + XAtom(fmt), + XAtom(type == 2 ? "PRIMARY" : type == 1 ? "XdndSelection" : "CLIPBOARD"), + type == 1 ? XA_SECONDARY : XAtom("CLIPDATA") + ); +} + +const char *ClipFmtsText() +{ + return "STRING;UTF8_STRING;text/plain;text/unicode"; +} + +String GetString(PasteClip& clip) +{ + GuiLock __; + if(clip.Accept("STRING") || clip.Accept("text/plain")) + return ~clip; + if(clip.Accept("UTF8_STRING")) + return FromUtf8(~clip).ToString(); + if(clip.Accept("text/unicode")) + return Unicode__(~clip).ToString(); + return Null; +} + +WString GetWString(PasteClip& clip) +{ + GuiLock __; + if(clip.Accept("STRING") || clip.Accept("text/plain")) + return (~clip).ToWString(); + if(clip.Accept("UTF8_STRING")) + return FromUtf8(~clip); + if(clip.Accept("text/unicode")) + return Unicode__(~clip); + return Null; +} + +String GetTextClip(const WString& text, const String& fmt) +{ + GuiLock __; + if(fmt == "STRING" || fmt == "text/plain") + return text.ToString(); + if(fmt == "UTF8_STRING") + return ToUtf8(text); + if(fmt == "text/unicode") + return Unicode__(text); + return Null; +} + +String GetTextClip(const String& text, const String& fmt) +{ + GuiLock __; + if(fmt == "STRING" || fmt == "text/plain") + return text; + if(fmt == "UTF8_STRING") + return ToUtf8(text.ToWString()); + if(fmt == "text/unicode") + return Unicode__(text.ToWString()); + return Null; +} + +bool AcceptText(PasteClip& clip) +{ + GuiLock __; + return clip.Accept(ClipFmtsText()); +} + +void Append(VectorMap& data, const String& text) // optimize +{ + GuiLock __; + data.GetAdd("STRING", text); + data.GetAdd("text/plain", text); + data.GetAdd("UTF8_STRING", ToUtf8(text.ToWString())); + data.GetAdd("text/unicode", Unicode__(text.ToWString())); +} + +void Append(VectorMap& data, const WString& text) // optimize +{ + GuiLock __; + data.GetAdd("STRING", text.ToString()); + data.GetAdd("text/plain", text.ToString()); + data.GetAdd("UTF8_STRING", ToUtf8(text)); + data.GetAdd("text/unicode", Unicode__(text)); +} + +bool IsClipboardAvailable(const char *fmt) +{ + GuiLock __; + return Ctrl::xclipboard().IsAvailable(XAtom(fmt), "CLIPBOARD"); +} + +bool IsClipboardAvailableText() +{ + GuiLock __; + return IsClipboardAvailable("STRING") || + IsClipboardAvailable("UTF8_STRING") || + IsClipboardAvailable("text/plain") || + IsClipboardAvailable("text/unicode"); +} + +bool AcceptFiles(PasteClip& clip) +{ + GuiLock __; + return clip.Accept("text/uri-list"); +} + +int JustLf(int c) +{ + return (byte)c >= 32 || c == '\n' ? c : 0; +} + +Vector GetFiles(PasteClip& clip) { + GuiLock __; + Vector r; + if(clip.Accept("text/uri-list")) { + String txt = clip; + Vector f = Split(Filter(txt, JustLf), '\n'); + for(int i = 0; i < f.GetCount(); i++) + if(f[i].StartsWith("file://")) + r.Add(f[i].Mid(7)); + } + return r; +} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/X11DHCtrl.cpp b/olddraw/CtrlCore/X11DHCtrl.cpp new file mode 100644 index 000000000..261038027 --- /dev/null +++ b/olddraw/CtrlCore/X11DHCtrl.cpp @@ -0,0 +1,417 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#ifdef PLATFORM_X11 + +///////////////////////////////////////////////////////////////////////////////////////// +// Constructor +DHCtrl::DHCtrl() +{ + // Sets control NOT initialized + isInitialized = false; + + // Sets control NOT mapped + isMapped = false; + + // Resets error contition + isError = false; + + // Sets the user visual to null + UserVisualInfo = 0; + + // No background painting + backpaint = NOBACKPAINT; +// transparent = true; + +} // END Constructor class DHCtrl + +///////////////////////////////////////////////////////////////////////////////////////// +// Destructor +DHCtrl::~DHCtrl() +{ + // Destroys the associated window and clean up stuffs + Terminate(); + +} // END Destructor class DHCtrl + +///////////////////////////////////////////////////////////////////////////////////////// +// Maps/unmaps the window +void DHCtrl::MapWindow(bool map) +{ + GuiLock __; + // no action if not initialized + if(!isInitialized) + return; + + if(map && !isMapped) + XMapWindow(Xdisplay, top->window); + else if(!map && isMapped) + XUnmapWindow(Xdisplay, top->window); + + isMapped = map; + +} // END DHCtrl::MapWndow() + + +///////////////////////////////////////////////////////////////////////////////////////// +// Initializes the view +bool DHCtrl::Init() +{ + GuiLock __; + static bool isInitializing = false; + + // Just for security sakes... + if(isInitialized) + return true; + + // Prevents reentrant call.... + if(isInitializing) + return false; + isInitializing = true; + + // Call BeforeInit user func... + BeforeInit(); + + // if display is null, error + if(!Xdisplay) + { + // Call AfterInit user func... + AfterInit(true); + + // Sets the appropriate error message + SetErrorMessage("DHCtrl : Bad display"); + + isError = true; + isInitializing = false; + return false; + } + + // Calls the user visual function + UserVisualInfo = CreateVisual(); + + // If error, returns + if(isError) + { + isInitializing = false; + return false; + } + + // Gets the default visual, if none is given + Visual *visual; + int Depth; + if(UserVisualInfo) + { + visual = UserVisualInfo->visual; + Depth = UserVisualInfo->depth; + } + else + { + visual = DefaultVisual(Xdisplay, DefaultScreen(Xdisplay)); + Depth = DefaultDepth(Xdisplay, DefaultScreen(Xdisplay)); + } + + // Initializes attribute setting flags + unsigned long ValueMask = + CWBorderPixel + | CWColormap + | CWSaveUnder +// | CWBackPixel +// | CWBorderPixel + | CWColormap +// | CWEventMask +// | CWWinGravity +// | CWBitGravity + ; // END ValueMask + + // Initializes attribute structure + XSetWindowAttributes winAttributes; + // creates a ColorMap, in case we're not using default visual + winAttributes.colormap = XCreateColormap(Xdisplay, GetTopWindow()->GetWindow(), visual, AllocNone); + winAttributes.border_pixel = 0; + winAttributes.save_under = XFalse; +// winAttributes.win_gravity = StaticGravity; +// winAttributes.bit_gravity = ForgetGravity; + + // Calls the attributes user setting routine + SetAttributes(ValueMask, winAttributes); + + // Creates the X11 window + Rect r = GetRectInParentWindow(); + Window WindowHandle = XCreateWindow + ( + Xdisplay, // display +// GetTopWindow()->GetWindow(), // parent + GetParentWindow(), + + r.left, r.top, r.Width(), r.Height(), // x, y, width, height + 0, // border width + Depth, // depth + InputOutput, // class + visual, // visual + ValueMask, // value mask + &winAttributes // attributes + ); + + // Frees VisualInfo + if (UserVisualInfo) + { + XFree( (char *)UserVisualInfo); + UserVisualInfo = 0; + } + + // If problem creating window, error + if(!WindowHandle) + { + // Call AfterInit user func... + AfterInit(true); + + // Sets the appropriate error message + SetErrorMessage("DHCtrl : Can't create window"); + + isError = true; + isInitializing = false; + return false; + } + + // Adds window to UPP managed windows + XWindow *cw = AddXWindow(WindowHandle); + + cw->xic = xim ? XCreateIC + ( + xim, + XNInputStyle, + XIMPreeditNothing | XIMStatusNothing, + XNClientWindow, + WindowHandle, + XNFocusWindow, + WindowHandle, + NULL + ) + : NULL; + + top = new Top; + top->window = WindowHandle; + + long im_event_mask = 0; + if(cw->xic) + XGetICValues(cw->xic, XNFilterEvents, &im_event_mask, NULL); + XSelectInput + ( + Xdisplay, + WindowHandle, + ExposureMask +// | StructureNotifyMask // *very* important, flag MUST NOT be set + | KeyPressMask + | FocusChangeMask + | KeyPressMask + | KeyReleaseMask + | PointerMotionMask + | ButtonPressMask + | ButtonReleaseMask + | PropertyChangeMask + | VisibilityChangeMask + | im_event_mask + ); + + int version = 5; + XChangeProperty + ( + Xdisplay, + WindowHandle, + XAtom("XdndAware"), + XA_ATOM, + 32, + 0, + (byte *)&version, + 1 + ); + + // Maps the window if needed + if(IsShown()) + MapWindow(true); + + // Flushes the display + XFlush(Xdisplay); + + // Stores the initial control size + CurrentSize = GetSize(); + + // Exits from initializing lock + isInitializing = false; + + // mark control as initialized + isInitialized = true; + + // Resets the message + isError = false; + SetErrorMessage(""); + + // Call AfterInit user func... + AfterInit(false); + + return true; + +} // END DHCtrl::Init() + + +///////////////////////////////////////////////////////////////////////////////////////// +// Terminates the view +void DHCtrl::Terminate(void) +{ + GuiLock __; + BeforeTerminate(); + + if(!isInitialized) + return; + + // Unmaps the window + MapWindow(false); + + // gathers data from XWindow (needs Input Context...) + XWindow *cw = XWindowFromWindow(top->window); + + // Frees input context as needed + if(cw->xic) + { + XDestroyIC(cw->xic); + cw->xic = NULL; + } + + // Removes XWindow from Upp list + RemoveXWindow(top->window); + + // Destroys the window + // Not to do, it's done destroying the parent window by X11 system +// XDestroyWindow(Xdisplay, top->window); + + // Destroys created Top struct + delete top; + top = NULL; + + // Resets initialization and error flags + isInitialized = false; + isError = false; + +} // END DHCtrl::Terminate() + +///////////////////////////////////////////////////////////////////////////////////////// +// State handler +void DHCtrl::State(int reason) +{ + GuiLock __; +// Window dummy; +// int x, y; +// unsigned int width, height, border, depth; + Rect r; + + // No handling if in error state + if( isError) + return; + + // Initializes the control if needed (and possible...) + if(!isInitialized && GetTopWindow() && GetTopWindow()->GetWindow()) + Init(); + + if(isInitialized) + { + switch( reason ) + { + case FOCUS : // = 10, + break; + + case ACTIVATE : // = 11, + break; + + case DEACTIVATE : // = 12, + break; + + case SHOW : // = 13, + MapWindow(IsVisible()); + break; + + case ENABLE : // = 14, + break; + + case EDITABLE : // = 15, + break; + + case OPEN : // = 16, + MapWindow(IsShown()); + break; + + case CLOSE : // = 17, + Terminate(); + break; + + case POSITION : // = 100, + case LAYOUTPOS : // = 101, + SyncNativeWindows(); + break; + + default: + break; + + } // switch(reason) + } +} + +///////////////////////////////////////////////////////////////////////////////////////// +// Property Visual +Visual *DHCtrl::GetVisual(void) +{ + GuiLock __; + if(UserVisualInfo) + return UserVisualInfo->visual; + else + return DefaultVisual(Xdisplay, DefaultScreen(Xdisplay)); + +} // END DHCtrl::getVisual() + + +///////////////////////////////////////////////////////////////////////////////////////// +// Property VisualInfo +XVisualInfo DHCtrl::GetVisualInfo(void) +{ + GuiLock __; + // if present an user visual info, just return it + if(UserVisualInfo) + return *UserVisualInfo; + + XVisualInfo visualInfo; + + // get the active visual + Visual *visual = GetVisual(); + + // gets a list of all available XVsualinfo + XVisualInfo *v = 0; + XVisualInfo vtemplate; + int nVis; + XVisualInfo *vlist = XGetVisualInfo(Xdisplay, VisualNoMask, &vtemplate, &nVis); + + // search for current visual inside the list + if(vlist) + { + for (v = vlist; v < vlist + nVis; v++) + { + if (v->visual == visual) + { + visualInfo = *v; + break; + } + } + XFree(vlist); + } + else + { + isError = true; + ErrorMessage = "DHCtrl: no XVisualInfo for current Visual"; + } + + // returns the found XVisualInfo struct + return visualInfo; +} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/X11DnD.cpp b/olddraw/CtrlCore/X11DnD.cpp new file mode 100644 index 000000000..c8ad429b2 --- /dev/null +++ b/olddraw/CtrlCore/X11DnD.cpp @@ -0,0 +1,428 @@ +#include "CtrlCore.h" + +#define LLOG(x) // LOG(x) + +#ifdef PLATFORM_X11 + +NAMESPACE_UPP + +bool Xdnd_waiting_status; +bool Xdnd_waiting_finished; +int Xdnd_status; +int Xdnd_version; + +static Atom XdndEnter; +static Atom XdndPosition; +static Atom XdndLeave; +static Atom XdndDrop; +static Atom XdndStatus; +static Atom XdndFinished; +static Atom XdndActionCopy; +static Atom XdndActionMove; + +void InitDndAtoms() +{ + ONCELOCK { + XdndEnter = XAtom("XdndEnter"); + XdndPosition = XAtom("XdndPosition"); + XdndLeave = XAtom("XdndLeave"); + XdndDrop = XAtom("XdndDrop"); + XdndStatus = XAtom("XdndStatus"); + XdndFinished = XAtom("XdndFinished"); + XdndActionCopy = XAtom("XdndActionCopy"); + XdndActionMove = XAtom("XdndActionMove"); + } +} + +XEvent ClientMsg(Window src, Atom type, int format = 32) +{ + XEvent e; + Zero(e); + e.xclient.type = ClientMessage; + e.xclient.display = Xdisplay; + e.xclient.window = src; + e.xclient.message_type = type; + e.xclient.format = format; + return e; +} + +struct DnDLoop : LocalLoop { + Image move, copy, reject; + Vector fmt; + const VectorMap *data; + Ptr source; + void SetFmts(Window w, Atom property); + Window src, target; + int action; + + void Request(XSelectionRequestEvent *se); + void Sync(); + String GetData(const String& f); + void Leave(); + virtual void LeftUp(Point, dword); + virtual bool Key(dword, int); + virtual void MouseMove(Point p, dword); + virtual Image CursorImage(Point, dword); +}; + +Ptr dndloop; + +void DnDLoop::Leave() +{ + GuiLock __; + if(target) { + LLOG("Sending XdndLeave to " << target); + XEvent e = ClientMsg(target, XdndLeave); + e.xclient.data.l[0] = src; + XSendEvent(Xdisplay, target, XFalse, 0, &e); + } +} + +void DnDLoop::Sync() +{ + GuiLock __; + if(Xdnd_waiting_status || Xdnd_waiting_finished) + return; + bool tx = Ctrl::TrapX11Errors(); + Window root; + unsigned int d1; + int x, y, d2; + Window tgt = Xroot; + int version; + for(;;) { + if(XQueryPointer(Xdisplay, tgt, &root, &tgt, &x, &y, &d2, &d2, &d1)) { + if(!tgt) + break; + Vector x = GetPropertyInts(tgt, XAtom("XdndAware")); + LLOG("XdndAware " << tgt << ": " << x.GetCount()); + if(x.GetCount()) { + Xdnd_version = x[0]; + break; + } + } + else { + tgt = None; + break; + } + } + if(Xdnd_version < 3) + tgt = None; + if(tgt != target) { + Leave(); + target = tgt; + if(target) { + LLOG("Sending XdndEnter to " << target << ", src = " << src); + XEvent e = ClientMsg(target, XdndEnter); + e.xclient.data.l[0] = src; + e.xclient.data.l[1] = (fmt.GetCount() > 3) | (version << 24); + for(int i = 0; i < min(3, fmt.GetCount()); i++) + e.xclient.data.l[i + 2] = fmt[i]; + XSendEvent(Xdisplay, target, XFalse, 0, &e); + } + } + + if(target) { + LLOG("Sending XdndPosition to " << target << " " << x << ", " << y); + XEvent e = ClientMsg(target, XdndPosition); + e.xclient.data.l[0] = src; + e.xclient.data.l[1] = 0; + e.xclient.data.l[2] = MAKELONG(y, x); + e.xclient.data.l[3] = Xeventtime; + int action = XdndActionCopy; + if(source && source->GetTopCtrl()->GetWindow() == target) + action = XdndActionMove; + if(GetShift()) + action = XdndActionMove; + if(GetCtrl()) + action = XdndActionCopy; + e.xclient.data.l[4] = action; + XSendEvent(Xdisplay, target, XFalse, 0, &e); + XFlush(Xdisplay); + Xdnd_waiting_status = true; + dword timeout = GetTickCount(); + LLOG("Waiting for XdndStatus"); + while(Xdnd_waiting_status && GetTickCount() - timeout < 200) { + GuiSleep(0); + ProcessEvents(); + } + LLOG("Waiting status " << GetTickCount() - timeout << "ms"); + if(Xdnd_waiting_status) { + LLOG("XdndStatus timeout"); + Xdnd_status = DND_NONE; + Xdnd_waiting_status = false; + } + else + LLOG("XdndStatus recieved " << Xdnd_status); + } + Ctrl::UntrapX11Errors(tx); +} + +void Ctrl::DropStatusEvent(XEvent *event) +{ + GuiLock __; + InitDndAtoms(); + if(event->type != ClientMessage) + return; + LLOG("DropStatus Client Message " << XAtomName(event->xclient.message_type)); + if(event->type == ClientMessage && dndloop && event->xclient.data.l[0] == (int)dndloop->target) { + if(event->xclient.message_type == XdndStatus && Xdnd_waiting_status) { + LLOG("XdndStatus, xdnd action: " << XAtomName(event->xclient.data.l[4])); + if(Xdnd_status == DND_NONE) + Xdnd_status = (event->xclient.data.l[1] & 1) ? + event->xclient.data.l[4] == (int)XdndActionMove ? DND_MOVE : DND_COPY + : DND_NONE; + Xdnd_waiting_status = false; + } + if(event->xclient.message_type == XdndFinished && Xdnd_waiting_finished) { + LLOG("XdndFinished, xdnd action: " << XAtomName(event->xclient.data.l[2])); + if(Xdnd_version == 5) + Xdnd_status = (event->xclient.data.l[1] & 1) ? + event->xclient.data.l[2] == (int)XdndActionMove ? DND_MOVE : DND_COPY + : DND_NONE; + Xdnd_waiting_finished = false; + } + } +} + +void DnDLoop::LeftUp(Point, dword) +{ + GuiLock __; + LLOG("DnDLoop::LeftUp"); + bool tx = TrapX11Errors(); + if(target) { + LLOG("Sending XdndDrop to " << target); + XEvent e = ClientMsg(target, XdndDrop); + e.xclient.data.l[0] = src; + e.xclient.data.l[1] = 0; + e.xclient.data.l[2] = Xeventtime; + Xdnd_waiting_finished = true; + XSendEvent(Xdisplay, target, XFalse, 0, &e); + XFlush(Xdisplay); + int timeout = GetTickCount(); + LLOG("Waiting for XdndFinished"); + while(Xdnd_waiting_finished && GetTickCount() - timeout < 200) { + GuiSleep(0); + ProcessEvents(); + } + LLOG("Waiting finished " << GetTickCount() - timeout << "ms"); + if(Xdnd_waiting_status) { + LLOG("XdndFinished timeout"); + Xdnd_status = DND_NONE; + Xdnd_waiting_finished = false; + } + else + LLOG("XdndFinished recieved"); + } + EndLoop(); + UntrapX11Errors(tx); +} + +void DnDLoop::MouseMove(Point p, dword) +{ + GuiLock __; + LLOG("DnDLoop::MouseMove"); + Sync(); +} + +bool DnDLoop::Key(dword, int) +{ + GuiLock __; + LLOG("DnDLoop::Key"); + Sync(); + return false; +} + +Image DnDLoop::CursorImage(Point, dword) +{ + GuiLock __; + return Xdnd_status == DND_MOVE ? move : Xdnd_status == DND_COPY ? copy : reject; +} + +void DnDLoop::SetFmts(Window w, Atom property) +{ + GuiLock __; + Buffer x(fmt.GetCount()); + for(int i = 0; i < fmt.GetCount(); i++) { + x[i] = fmt[i]; + LLOG('\t' << XAtomName(x[i])); + } + XChangeProperty(Xdisplay, w, property, XAtom("ATOM"), + 32, 0, (unsigned char*)~x, + fmt.GetCount()); +} + +String DnDLoop::GetData(const String& f) +{ + GuiLock __; + int i = data->Find(f); + String d; + if(i >= 0) + d = (*data)[i].Render(); + else + if(source) + d = source->GetDropData(f); + return d; +} + +String DnDGetData(const String& f) +{ + GuiLock __; + String d; + if(dndloop) + d = dndloop->GetData(f); + return d; +} + +void DnDLoop::Request(XSelectionRequestEvent *se) +{ + GuiLock __; + LLOG("DnDRequest " << XAtomName(se->target)); + XEvent e; + e.xselection.type = SelectionNotify; + e.xselection.display = Xdisplay; + e.xselection.requestor = se->requestor; + e.xselection.selection = XAtom("XdndSelection"); + e.xselection.target = se->target; + e.xselection.time = se->time; + e.xselection.property = se->property; + if(se->target == XAtom("TARGETS")) { + LLOG("DnDRequest targets:"); + SetFmts(se->requestor, se->property); + } + else { + String d = GetData(XAtomName(se->target)); + if(d.GetCount()) + XChangeProperty(Xdisplay, se->requestor, se->property, se->target, 8, PropModeReplace, + d, d.GetCount()); + else + e.xselection.property = None; + } + XSendEvent(Xdisplay, se->requestor, XFalse, 0, &e); +} + +void DnDRequest(XSelectionRequestEvent *se) +{ + GuiLock __; + if(dndloop) dndloop->Request(se); +} + +void DnDClear() {} + +Image MakeDragImage(const Image& arrow, Image sample); + +Ptr sDnDSource; + +int Ctrl::DoDragAndDrop(const char *fmts, const Image& sample, dword actions, + const VectorMap& data) +{ + GuiLock __; + InitDndAtoms(); + DnDLoop d; + Xdnd_waiting_status = Xdnd_waiting_finished = false; + d.reject = actions & DND_EXACTIMAGE ? CtrlCoreImg::DndNone() : MakeDragImage(CtrlCoreImg::DndNone(), sample); + if(actions & DND_COPY) + d.copy = actions & DND_EXACTIMAGE ? sample : MakeDragImage(CtrlCoreImg::DndCopy(), sample); + if(actions & DND_MOVE) + d.move = actions & DND_EXACTIMAGE ? sample : MakeDragImage(CtrlCoreImg::DndMoveX11(), sample); + d.SetMaster(*this); + d.data = &data; + d.source = this; + dndloop = &d; + Vector f = Split(fmts, ';'); + for(int i = 0; i < f.GetCount(); i++) + d.fmt.Add(XAtom(f[i])); + for(int i = 0; i < data.GetCount(); i++) + d.fmt.Add(XAtom(data.GetKey(i))); + d.SetFmts(xclipboard().win, XAtom("XdndTypeList")); + XSetSelectionOwner(Xdisplay, XAtom("XdndSelection"), xclipboard().win, CurrentTime); + d.src = xclipboard().win; + d.target = None; + sDnDSource = this; + d.Run(); + sDnDSource = NULL; + SyncCaret(); + LLOG("DoDragAndDrop finished"); + return Xdnd_status; +} + +Ctrl *Ctrl::GetDragAndDropSource() +{ + GuiLock __; + return sDnDSource; +} + +Index Ctrl::drop_formats; + +int XdndAction; +Point XdndPos; + +PasteClip sMakeDropClip(bool paste) +{ + PasteClip d; + d.type = 1; + d.paste = paste; + d.accepted = false; + d.allowed = DND_MOVE|DND_COPY; + d.action = XdndAction; + return d; +} + +void Ctrl::DnD(Window src, bool paste) +{ + GuiLock __; + PasteClip d = sMakeDropClip(paste); + LLOG("Source action " << XdndAction); + DnD(XdndPos, d); + XdndAction = d.GetAction(); + LLOG("Target action " << XdndAction); + XEvent e = ClientMsg(src, paste ? XdndFinished : XdndStatus); + e.xclient.data.l[0] = GetWindow(); + (paste ? e.xclient.data.l[2] : e.xclient.data.l[4]) + = XdndAction == DND_MOVE ? XdndActionMove : XdndActionCopy; + if(d.IsAccepted()) + e.xclient.data.l[1] = 1; + LLOG("Sending status/finished to " << src << " accepted: " << d.IsAccepted()); + XSendEvent(Xdisplay, src, XFalse, 0, &e); +} + +void Ctrl::DropEvent(XWindow& w, XEvent *event) +{ + GuiLock __; + InitDndAtoms(); + if(event->type != ClientMessage) + return; + Window src = event->xclient.data.l[0]; + LLOG("Client Message " << GetWindow() << " " << XAtomName(event->xclient.message_type) + << ", src: " << src); + if(event->xclient.message_type == XdndEnter) { + LLOG("DnDEnter"); + drop_formats.Clear(); + if(event->xclient.data.l[1] & 1) { + Vector v = GetPropertyInts(src, XAtom("XdndTypeList"), XA_ATOM); + for(int i = 0; i < v.GetCount(); i++) + drop_formats.Add(XAtomName(v[i])); + } + else + for(int i = 2; i <= 4; i++) + drop_formats.Add(XAtomName(event->xclient.data.l[i])); + } + static Point xdndpos; + if(event->xclient.message_type == XdndPosition) { + dword x = event->xclient.data.l[2]; + XdndPos = Point(HIWORD(x), LOWORD(x)); + LLOG("XdndPosition " << XdndPos << ", action " << XAtomName(event->xclient.data.l[4])); + XdndAction = event->xclient.data.l[4] == (int)XdndActionMove ? DND_MOVE : DND_COPY; + DnD(src, false); + } + if(event->xclient.message_type == XdndLeave) + DnDLeave(); + if(event->xclient.message_type == XdndDrop && dndctrl) { + LLOG("XdndDrop to " << UPP::Name(dndctrl)); + DnD(src, true); + DnDLeave(); + } +} + +END_UPP_NAMESPACE + +#endif diff --git a/olddraw/CtrlCore/X11Event.i b/olddraw/CtrlCore/X11Event.i new file mode 100644 index 000000000..071549e88 --- /dev/null +++ b/olddraw/CtrlCore/X11Event.i @@ -0,0 +1,35 @@ +//#BLITZ_APPROVE + +x_Event(KeyPress) +x_Event(KeyRelease) +x_Event(ButtonPress) +x_Event(ButtonRelease) +x_Event(MotionNotify) +x_Event(EnterNotify) +x_Event(LeaveNotify) +x_Event(FocusIn) +x_Event(FocusOut) +x_Event(KeymapNotify) +x_Event(Expose) +x_Event(GraphicsExpose) +x_Event(NoExpose) +x_Event(VisibilityNotify) +x_Event(CreateNotify) +x_Event(DestroyNotify) +x_Event(UnmapNotify) +x_Event(MapNotify) +x_Event(MapRequest) +x_Event(ReparentNotify) +x_Event(ConfigureNotify) +x_Event(ConfigureRequest) +x_Event(GravityNotify) +x_Event(ResizeRequest) +x_Event(CirculateNotify) +x_Event(CirculateRequest) +x_Event(PropertyNotify) +x_Event(SelectionClear) +x_Event(SelectionRequest) +x_Event(SelectionNotify) +x_Event(ColormapNotify) +x_Event(ClientMessage) +x_Event(MappingNotify) diff --git a/olddraw/CtrlCore/X11ImgClip.cpp b/olddraw/CtrlCore/X11ImgClip.cpp new file mode 100644 index 000000000..13a396eb2 --- /dev/null +++ b/olddraw/CtrlCore/X11ImgClip.cpp @@ -0,0 +1,75 @@ +#include "CtrlCore.h" + +#include + +NAMESPACE_UPP + +#ifdef PLATFORM_X11 + + +const char *ClipFmtsImage() +{ + static const char *q; + ONCELOCK { + static String s(ClipFmt() + ";image/png"); + q = s; + } + return q; +} + +bool AcceptImage(PasteClip& clip) +{ + return clip.Accept(ClipFmt()) || clip.Accept("image/png"); +} + +Image GetImage(PasteClip& clip) +{ + Image m; + if(Accept(clip)) { + LoadFromString(m, ~clip); + if(!m.IsEmpty()) + return m; + } + if(clip.Accept("image/png")) + return StreamRaster::LoadStringAny(~clip); + return Null; +} + +Image ReadClipboardImage() +{ + return GetImage(Ctrl::Clipboard()); +} + +static String sBmp(const Value& data) +{ + Image img = data; + return BMPEncoder().SaveString(img); +} + +static String sImg(const Value& data) +{ + Image img = data; + return StoreAsString(const_cast(img)); +} + +String GetImageClip(const Image& img, const String& fmt) +{ + if(img.IsEmpty()) + return Null; + if(fmt == "image/bmp") + return BMPEncoder().SaveString(img); + if(fmt == ClipFmt()) + return StoreAsString(const_cast(img)); + return Null; +} + +void AppendClipboardImage(const Image& img) +{ + if(img.IsEmpty()) return; + AppendClipboard(ClipFmt(), img, sImg); + AppendClipboard("image/bmp", img, sBmp); +} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/X11Keys.i b/olddraw/CtrlCore/X11Keys.i new file mode 100644 index 000000000..f9c89fbe0 --- /dev/null +++ b/olddraw/CtrlCore/X11Keys.i @@ -0,0 +1,111 @@ +K_BACK = 8, +K_BACKSPACE = 8, + +K_TAB = 9, + +K_RETURN = 13, +K_ENTER = 13, +K_ESCAPE = 27, + +K_SPACE = 32, + +K_DELETE = XK_Delete + K_DELTA, + +K_SHIFT_KEY = XK_Shift_L + K_DELTA, +K_CTRL_KEY = XK_Control_L + K_DELTA, +K_ALT_KEY = XK_Meta_L + K_DELTA, +K_CAPSLOCK = XK_Caps_Lock + K_DELTA, +K_PRIOR = XK_Page_Up + K_DELTA, +K_PAGEUP = XK_Page_Up + K_DELTA, +K_NEXT = XK_Page_Down + K_DELTA, +K_PAGEDOWN = XK_Page_Down + K_DELTA, +K_END = XK_End + K_DELTA, +K_HOME = XK_Home + K_DELTA, +K_LEFT = XK_Left + K_DELTA, +K_UP = XK_Up + K_DELTA, +K_RIGHT = XK_Right + K_DELTA, +K_DOWN = XK_Down + K_DELTA, +K_INSERT = XK_Insert + K_DELTA, + +K_NUMPAD0 = XK_KP_0 + K_DELTA, +K_NUMPAD1 = XK_KP_1 + K_DELTA, +K_NUMPAD2 = XK_KP_2 + K_DELTA, +K_NUMPAD3 = XK_KP_3 + K_DELTA, +K_NUMPAD4 = XK_KP_4 + K_DELTA, +K_NUMPAD5 = XK_KP_5 + K_DELTA, +K_NUMPAD6 = XK_KP_6 + K_DELTA, +K_NUMPAD7 = XK_KP_7 + K_DELTA, +K_NUMPAD8 = XK_KP_8 + K_DELTA, +K_NUMPAD9 = XK_KP_9 + K_DELTA, +K_MULTIPLY = XK_KP_Multiply + K_DELTA, +K_ADD = XK_KP_Add + K_DELTA, +K_SEPARATOR = XK_KP_Separator + K_DELTA, +K_SUBTRACT = XK_KP_Subtract + K_DELTA, +K_DECIMAL = XK_KP_Decimal + K_DELTA, +K_DIVIDE = XK_KP_Divide + K_DELTA, + +K_SCROLL = XK_Scroll_Lock + K_DELTA, + +K_F1 = XK_F1 + K_DELTA, +K_F2 = XK_F2 + K_DELTA, +K_F3 = XK_F3 + K_DELTA, +K_F4 = XK_F4 + K_DELTA, +K_F5 = XK_F5 + K_DELTA, +K_F6 = XK_F6 + K_DELTA, +K_F7 = XK_F7 + K_DELTA, +K_F8 = XK_F8 + K_DELTA, +K_F9 = XK_F9 + K_DELTA, +K_F10 = XK_F10 + K_DELTA, +K_F11 = XK_F11 + K_DELTA, +K_F12 = XK_F12 + K_DELTA, + +K_A = 'A' + K_DELTA, +K_B = 'B' + K_DELTA, +K_C = 'C' + K_DELTA, +K_D = 'D' + K_DELTA, +K_E = 'E' + K_DELTA, +K_F = 'F' + K_DELTA, +K_G = 'G' + K_DELTA, +K_H = 'H' + K_DELTA, +K_I = 'I' + K_DELTA, +K_J = 'J' + K_DELTA, +K_K = 'K' + K_DELTA, +K_L = 'L' + K_DELTA, +K_M = 'M' + K_DELTA, +K_N = 'N' + K_DELTA, +K_O = 'O' + K_DELTA, +K_P = 'P' + K_DELTA, +K_Q = 'Q' + K_DELTA, +K_R = 'R' + K_DELTA, +K_S = 'S' + K_DELTA, +K_T = 'T' + K_DELTA, +K_U = 'U' + K_DELTA, +K_V = 'V' + K_DELTA, +K_W = 'W' + K_DELTA, +K_X = 'X' + K_DELTA, +K_Y = 'Y' + K_DELTA, +K_Z = 'Z' + K_DELTA, +K_0 = '0' + 128 + K_DELTA, +K_1 = '1' + 128 + K_DELTA, +K_2 = '2' + 128 + K_DELTA, +K_3 = '3' + 128 + K_DELTA, +K_4 = '4' + 128 + K_DELTA, +K_5 = '5' + 128 + K_DELTA, +K_6 = '6' + 128 + K_DELTA, +K_7 = '7' + 128 + K_DELTA, +K_8 = '8' + 128 + K_DELTA, +K_9 = '9' + 128 + K_DELTA, + +K_CTRL_LBRACKET = K_CTRL|XK_bracketleft|K_DELTA, +K_CTRL_RBRACKET = K_CTRL|XK_bracketright|K_DELTA, +K_CTRL_MINUS = K_CTRL|0x2d|K_DELTA, +K_CTRL_GRAVE = K_CTRL|XK_grave|K_DELTA, +K_CTRL_SLASH = K_CTRL|0x5f|K_DELTA, +K_CTRL_BACKSLASH = K_CTRL|0x5c|K_DELTA, +K_CTRL_COMMA = K_CTRL|0x2c|K_DELTA, +K_CTRL_PERIOD = K_CTRL|XK_period|K_DELTA, +K_CTRL_SEMICOLON = K_CTRL|XK_semicolon|K_DELTA, +K_CTRL_EQUAL = K_CTRL|0x3d|K_DELTA, +K_CTRL_APOSTROPHE= K_CTRL|0x27|K_DELTA, + +K_BREAK = XK_Pause|K_DELTA, diff --git a/olddraw/CtrlCore/X11Proc.cpp b/olddraw/CtrlCore/X11Proc.cpp new file mode 100644 index 000000000..a089c2aa6 --- /dev/null +++ b/olddraw/CtrlCore/X11Proc.cpp @@ -0,0 +1,384 @@ +#include "CtrlCore.h" + +NAMESPACE_UPP + +#ifdef PLATFORM_X11 + +#define LLOG(x) // DLOG(x) + +#define LTIMING(x) //TIMING(x) + +static dword sKbdState; +static dword sModState; + +void ClearKbdState_() +{ + GuiLock __; + sKbdState = 0; +} + +Point GetMousePos() +{ + GuiLock __; + LTIMING("GetMousePos"); + return Ctrl::mousePos; +} + +void Ctrl::SyncMousePos() +{ + GuiLock __; + LTIMING("XQueryPointer"); + int x, y, xx, yy; + Window dm1, dm2; + Ctrl::mousePos = Null; + if(XQueryPointer(Xdisplay, Xroot, &dm1, &dm2, &x, &y, &xx, &yy, &sKbdState)) + Ctrl::mousePos = Point(x, y); +} + +bool GetShift() { GuiLock __; return sKbdState & ShiftMask; } +bool GetCtrl() { GuiLock __; return sKbdState & ControlMask; } +bool GetAlt() { GuiLock __; return sKbdState & Mod1Mask; } +bool GetCapsLock() { GuiLock __; return sKbdState & LockMask; } +bool GetMouseLeft() { GuiLock __; return sModState & Button1Mask; } +bool GetMouseRight() { GuiLock __; return sModState & (Ctrl::Xbuttons >= 3 ? Button3Mask : Button2Mask); } +bool GetMouseMiddle() { GuiLock __; return sModState & (Ctrl::Xbuttons >= 3 ? Button2Mask : 0); } + +int Ctrl::Xbuttontime; + +dword Ctrl::KEYtoK(dword key) +{ + if(key != K_CTRL_KEY && key != K_SHIFT_KEY) { + if(GetCtrl()) key |= K_CTRL; + if(GetAlt()) key |= K_ALT; + if(GetShift()) key |= K_SHIFT; + } + return key; +} + +void Ctrl::SetLastActive(XWindow *w, Ctrl *la) +{ + GuiLock __; + while(w) { + LLOG(" to " << UPP::Name(w->ctrl)); + w->last_active = la; + w = w->owner ? w->owner->GetXWindow() : NULL; + } +} + +void Ctrl::EventProc(XWindow& w, XEvent *event) +{ + GuiLock __; + Ptr _this = this; + bool pressed = false; + int count = 1; + switch(event->type) { + case NoExpose: + LLOG("NoExpose serial " << event->xnoexpose.serial); + break; + case GraphicsExpose: + LLOG("GraphicsExpose serial " << event->xgraphicsexpose.serial); + case Expose: { + XExposeEvent& e = event->xexpose; + w.exposed = true; + LLOG("Expose " << RectC(e.x, e.y, e.width, e.height)); + Invalidate(w, RectC(e.x, e.y, e.width, e.height)); + } + return; + case ConfigureNotify: { + XConfigureEvent& e = event->xconfigure; + int x, y; + Window dummy; +// 01/12/2007 - mdelfede +// added support for windowed controls +// if(top) +// XTranslateCoordinates(Xdisplay, top->window, Xroot, 0, 0, &x, &y, &dummy); + if(top) { + Window DestW = (parent ? GetParentWindow() : Xroot); + XTranslateCoordinates(Xdisplay, top->window, DestW, 0, 0, &x, &y, &dummy); + } + Rect rect = RectC(x, y, e.width, e.height); + LLOG("CongigureNotify " << rect); + if(GetRect() != rect) + SetWndRect(rect); + // Synchronizes native windows (NOT the main one) + SyncNativeWindows(); +// 01/12/2007 - END + + } + return; + default: + if(!IsEnabled()) return; + } + LTIMING("XUserInput"); + switch(event->type) { + case FocusIn: + if(w.xic) + XSetICFocus(w.xic); + break; + case FocusOut: + if(w.xic) + XUnsetICFocus(w.xic); + break; + case KeyPress: + pressed = true; + LLOG("event type:" << event->type << " state:" << event->xkey.state << + "keycode:" << event->xkey.keycode); + for(;;) { + XEvent ev1[1], ev2[1]; + bool hasev2 = false; + if(!IsWaitingEvent()) break; + do + XNextEvent(Xdisplay, ev1); + while(ev1->type == NoExpose && IsWaitingEvent()); + LLOG("ev1 type:" << ev1->type << " state:" << ev1->xkey.state << + "keycode:" << ev1->xkey.keycode); + if(ev1->type == KeyPress) + *ev2 = *ev1; + else { + if(ev1->type != KeyRelease || + ev1->xkey.state != event->xkey.state || + ev1->xkey.keycode != event->xkey.keycode || + !IsWaitingEvent()) { + XPutBackEvent(Xdisplay, ev1); + break; + } + do + XNextEvent(Xdisplay, ev2); + while(ev2->type == NoExpose && IsWaitingEvent()); + LLOG("ev2 type:" << ev2->type << " state:" << ev2->xkey.state << + "keycode:" << ev2->xkey.keycode); + hasev2 = true; + } + if(ev2->type != KeyPress || + ev2->xkey.state != event->xkey.state || + ev2->xkey.keycode != event->xkey.keycode) { + if(hasev2) + XPutBackEvent(Xdisplay, ev2); + XPutBackEvent(Xdisplay, ev1); + break; + } + else { + XFilterEvent(ev1, None); + if(hasev2) + XFilterEvent(ev2, None); + } + count++; + } + case KeyRelease: { + mousePos = Point(event->xkey.x_root, event->xkey.y_root); + char buff[128]; + Xeventtime = event->xkey.time; + LLOG("Key Xeventtime: " << Xeventtime << " count:" << count); + KeySym keysym; + int chr = 0; + WString wtext; + if(pressed && w.xic) { + Status status; + int len = Xutf8LookupString(w.xic, &event->xkey, buff, sizeof(buff), &keysym, &status); + buff[len] = 0; + if(status == XLookupChars || status == XLookupBoth) { + chr = FromUtf8(buff, len)[0]; + if(status == XLookupChars) + wtext = FromUtf8(buff, len); + } + else + if(status != XLookupKeySym && status != XLookupBoth) + keysym = 0; + } + else { + int len = XLookupString(&event->xkey, buff, sizeof(buff), &keysym, NULL); + buff[len] = 0; + chr = FromUtf8(buff, len)[0]; + if(len > 1) + wtext = FromUtf8(buff, len); + } + if(keysym == XK_Control_L || keysym == XK_Control_R) { + keysym = XK_Control_L; + if(pressed) + sKbdState |= ControlMask; + else + sKbdState &= ~ControlMask; + } + if(keysym == XK_Shift_L || keysym == XK_Shift_R) { + keysym = XK_Shift_L; + if(pressed) + sKbdState |= ShiftMask; + else + sKbdState &= ~ShiftMask; + } + if(keysym == XK_Meta_L || keysym == XK_Meta_R || keysym == XK_Alt_L || + keysym == XK_Alt_R || keysym == XK_Super_L || keysym == XK_Super_R || + keysym == XK_Hyper_L || keysym == XK_Hyper_R || keysym == XK_ISO_Prev_Group) { + keysym = XK_Meta_L; + if(pressed) + sKbdState |= Mod1Mask; + else + sKbdState &= ~Mod1Mask; + } + LLOG("KeySym:" << FormatIntHex(keysym) << " " << (char)keysym << " " << count); + dword up = pressed ? 0 : K_KEYUP; + static struct { KeySym keysym; dword key; } tab[] = { + { XK_ISO_Left_Tab, K_TAB|K_SHIFT }, + { XK_BackSpace, K_BACKSPACE }, + { XK_Tab, K_TAB }, + { XK_Return, K_ENTER }, + { XK_KP_Enter, K_ENTER }, + { XK_Escape, K_ESCAPE }, + { XK_space, K_SPACE }, + + { XK_KP_Space, K_SPACE }, + { XK_KP_Tab, K_TAB }, + { XK_KP_Enter, K_ENTER }, + { XK_KP_F1, K_F1 }, + { XK_KP_F2, K_F2 }, + { XK_KP_F3, K_F3 }, + { XK_KP_F4, K_F4 }, + { XK_KP_Home, K_HOME }, + { XK_KP_Left, K_LEFT }, + { XK_KP_Up, K_UP }, + { XK_KP_Right, K_RIGHT }, + { XK_KP_Down, K_DOWN }, + { XK_KP_Page_Up, K_PAGEUP }, + { XK_KP_Page_Down, K_PAGEDOWN }, + { XK_KP_End, K_END }, + { XK_KP_Begin, K_HOME }, + { XK_KP_Insert, K_INSERT }, + { XK_KP_Delete, K_DELETE }, + }; + for(int i = 0; i < __countof(tab); i++) + if(tab[i].keysym == keysym) { + DispatchKey(KEYtoK(tab[i].key)|up, count); + return; + } + if(GetShift() && chr == 0) { + static dword k[] = { 41, 33, 64, 35, 36, 37, 94, 38, 42, 40 }; + for(int i = 0; i < 10; i++) + if(keysym == k[i]) { + DispatchKey(KEYtoK(i + K_0)|up, count); + return; + } + } + if(keysym >= 48 && keysym <= 57 && chr == 0) { + DispatchKey(KEYtoK(keysym - 48 + K_0)|up, count); + return; + } + if(chr >= 1 && chr < 32) { + DispatchKey(KEYtoK(chr - 1 + K_CTRL_A)|up, count); + return; + } + if(keysym >= 0xff80 && keysym <= 0xffb9 && chr) { + DispatchKey(KEYtoK(chr)|up, count); + return; + } + if(keysym >= 0xff00 && chr < 128 || + (GetCtrl() || GetAlt()) && keysym >= 0x20 && keysym < 0x7f) { + if(keysym >= 'a' && keysym <= 'z') + keysym = keysym - 'a' + 'A'; + DispatchKey(KEYtoK(keysym|K_DELTA)|up, count); + return; + } + + if((chr == 32 || chr == 9 || chr == 13) && !pressed) + DispatchKey(chr|K_KEYUP, count); + if(chr && pressed) { + DispatchKey(chr, count); + for(int ii = 1; ii < wtext.GetLength(); ii++) + DispatchKey(wtext[ii], count); + } + } + break; + case ButtonPress: { + if(!HasWndFocus() && !popup) + SetWndFocus(); + ClickActivateWnd(); + mousePos = Point(event->xbutton.x_root, event->xbutton.y_root); + ReleaseGrab(); + XButtonEvent& e = event->xbutton; + sModState = e.state; + Xeventtime = e.time; + if(ignoreclick) break; + Point p = Point(e.x, e.y); + dword action = DOWN; + if((dword)e.time - (dword)Xbuttontime < 800) + action = DOUBLE; + Xbuttontime = e.time; + switch(e.button) { + case Button1: + sModState |= Button1Mask; + DispatchMouse(LEFT|action, p, 0); + break; + case Button2: + sModState |= Button2Mask; + if(Xbuttons < 3) + DispatchMouse(RIGHT|action, p, 0); + else + DispatchMouse(MIDDLE|action, p, 0); + break; + case Button3: + sModState |= Button3Mask; + DispatchMouse(RIGHT|action, p, 0); + break; + } + if(_this) PostInput(); + } + break; + case ButtonRelease: { + mousePos = Point(event->xbutton.x_root, event->xbutton.y_root); + XButtonEvent& e = event->xbutton; + sModState = e.state; + Xeventtime = e.time; + Point p = Point(e.x, e.y); + switch(e.button) { + case Button1: + sModState &= ~Button1Mask; + break; + case Button2: + sModState &= ~Button2Mask; + break; + case Button3: + sModState &= ~Button3Mask; + break; + } + if(ignoreclick) + EndIgnore(); + else + switch(e.button) { + case Button1: + DispatchMouse(LEFTUP, p, 0); + break; + case Button2: + if(Xbuttons < 3) + DispatchMouse(RIGHTUP, p, 0); + else + DispatchMouse(MIDDLEUP, p, 0); + break; + case Button3: + DispatchMouse(RIGHTUP, p, 0); + break; + case Button4: + DispatchMouse(MOUSEWHEEL, p, 120); + break; + case Button5: + DispatchMouse(MOUSEWHEEL, p, -120); + break; + } + if(_this) PostInput(); + } + break; + case MotionNotify: + while(XCheckWindowEvent(Xdisplay, top->window, PointerMotionMask, event)); + EndIgnore(); + mousePos = Point(event->xmotion.x_root, event->xmotion.y_root); + Xeventtime = event->xmotion.time; + Xbuttontime = Xeventtime - 0x80000000; + sModState = event->xmotion.state; + DispatchMouse(MOUSEMOVE, Point(event->xmotion.x, event->xmotion.y)); + DoCursorShape(); + break; + } + DropEvent(w, event); +} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/X11Wnd.cpp b/olddraw/CtrlCore/X11Wnd.cpp new file mode 100644 index 000000000..5f36a6a7d --- /dev/null +++ b/olddraw/CtrlCore/X11Wnd.cpp @@ -0,0 +1,1070 @@ +#include "CtrlCore.h" + +#ifdef PLATFORM_X11 +#include +#endif + +NAMESPACE_UPP + +#ifdef PLATFORM_X11 + +#ifdef _DEBUG + + +bool Ctrl::LogMessages +// = true +; +#endif + +#define LLOG(x) // DLOG(x) +#define LTIMING(x) // RTIMING(x) +#define LDUMP(x) // DDUMP(x) +#define LDUMPC(x) // DDUMPC(x) + +// #define SYNCHRONIZE + +#define x_Event(x) { x, #x }, + +static +struct XEventMap { + int ID; + const char *name; +} +sXevent[] = { +#include "X11Event.i" + { 0, NULL } +}; + +ArrayMap& Ctrl::Xwindow() +{ + return Single< ArrayMap >(); +} + +int Ctrl::WndCaretTime; +bool Ctrl::WndCaretVisible; +int Ctrl::Xbuttons; +Window Ctrl::grabWindow, Ctrl::focusWindow; +int Ctrl::Xeventtime; + +int Ctrl::PopupGrab; +Ptr Ctrl::popupWnd; + +Point Ctrl::mousePos; + +static int s_starttime; + +void Ctrl::DoPaint(const Vector& invalid) +{ + GuiLock __; + if(IsVisible()) { + LTIMING("DoPaint"); + fullrefresh = false; +// if(GLX) return; + GC gc = XCreateGC(Xdisplay, (Drawable)top->window, 0, 0); + XftDraw *xftdraw = XftDrawCreate(Xdisplay, (Drawable) top->window, + DefaultVisual(Xdisplay, Xscreenno), Xcolormap); + SystemDraw draw(top->window, gc, xftdraw, invalid); + UpdateArea(draw, draw.GetClip()); + XftDrawDestroy(xftdraw); + XFreeGC(Xdisplay, gc); + } +} + +void Ctrl::WndScrollView(const Rect& r, int dx, int dy) +{ + GuiLock __; + if(r.IsEmpty() || !GetWindow()) return; + int cx = r.Width() - abs(dx); + int cy = r.Height() - abs(dy); + GC gc = XCreateGC(Xdisplay, GetWindow(), 0, 0); + XCopyArea(Xdisplay, GetWindow(), GetWindow(), gc, + r.left + max(-dx, 0), r.top + max(-dy, 0), cx, cy, + r.left + max(dx, 0), r.top + max(dy, 0)); + XFreeGC(Xdisplay, gc); + XWindow *xw = GetXWindow(); + Vector ur; + if(xw) + for(int i = 0; i < xw->invalid.GetCount(); i++) + if(xw->invalid[i].Intersects(r)) + ur.Add(xw->invalid[i]); + for(int i = 0; i < ur.GetCount(); i++) + Invalidate(*xw, ur[i].Offseted(dx, dy)); +} + +bool Ctrl::IsWaitingEvent() +{ + GuiLock __; + return XPending(Xdisplay); +} + +Ctrl *Ctrl::CtrlFromWindow(Window w) +{ + GuiLock __; + int q = Xwindow().Find(w); + return q >= 0 ? Xwindow()[q].ctrl : NULL; +} + +Ctrl::XWindow *Ctrl::GetXWindow() +{ + GuiLock __; + if(!top) return NULL; + int q = Xwindow().Find(top->window); + return q >= 0 ? &Xwindow()[q] : NULL; +} +// 01/12/2007 - mdelfede +// added support for windowed controls + +// Gets handle of window containing control +Window Ctrl::GetParentWindow(void) const +{ + GuiLock __; + Ctrl const *q = GetParentWindowCtrl(); + if(q) + return q->top->window; + else + return 0; + +} // END Ctrl::GetParentWindow() + +// Get control with parentwindow as handle +Ctrl *Ctrl::GetParentWindowCtrl(void) const +{ + GuiLock __; + Ctrl *q = parent; + while(q && !q->top) + q = q->parent; + return q; + +} // END Ctrl::GetParentWindowCtrl() + +// Gets the rect inside the parent window +Rect Ctrl::GetRectInParentWindow(void) const +{ + GuiLock __; + Rect r = GetRect(); + Ctrl *q = parent; + while(q) + { + if(q->top) + break; + r += q->GetRect().TopLeft() + q->GetView().TopLeft(); + q = q->parent; + } + if(q) + r += q->GetView().TopLeft(); + return r; +} +// 01/12/2007 - END + +bool Ctrl::HookProc(XEvent *event) { return false; } + +void DnDRequest(XSelectionRequestEvent *se); +void DnDClear(); + +void Ctrl::ProcessEvent(XEvent *event) +{ + GuiLock __; + if(xim && XFilterEvent(event, None)) + return; + ArrayMap& xmap = Xwindow(); + for(int i = 0; i < xmap.GetCount(); i++) + if(xmap[i].ctrl && xmap[i].ctrl->HookProc(event)) + return; + FocusSync(); + if(event->type == PropertyNotify && + (event->xproperty.atom == XAtom("_QT_SETTINGS_TIMESTAMP_") || + event->xproperty.atom == XAtom("_KDE_NET_USER_TIME"))) { + LLOG("Property notify " << XAtomName(event->xproperty.atom) + << " " << (void *)event->xany.window); + for(int i = 0; i < Xwindow().GetCount(); i++) { + if(Xwindow().GetKey(i)) { + Ctrl *q = Xwindow()[i].ctrl; + if(q) q->Refresh(); + } + } + } + if(event->type == SelectionRequest && + event->xselectionrequest.owner == xclipboard().win) { + if(event->xselectionrequest.selection == XAtom("XdndSelection")) + DnDRequest(&event->xselectionrequest); + else + xclipboard().Request(&event->xselectionrequest); + return; + } + if(event->type == SelectionClear && + event->xselectionclear.window == xclipboard().win) { + if(event->xselectionclear.selection == XAtom("PRIMARY")) { + sel_formats.Clear(); + sel_ctrl = NULL; + } + if(event->xselectionclear.selection == XAtom("CLIPBOARD")) + xclipboard().Clear(); + if(event->xselectionrequest.selection == XAtom("XdndSelection")) + DnDClear(); + return; + } + int q = xmap.Find(event->xany.window); +#ifdef _DEBUG + bool eo = false; + if(LogMessages && event->type != NoExpose && event->type != PropertyNotify + && event->type != MotionNotify) + for(XEventMap *m = sXevent; m->ID; m++) + if(m->ID == event->type) { + if(!s_starttime) + s_starttime = GetTickCount(); + int t = GetTickCount() - s_starttime; + VppLog() << Format("%d.%01d", t / 1000, t % 1000); + VppLog() << " EVENT " << Format("%-20.20s", m->name); + VppLog() << "[window: " << event->xany.window << "] "; + if(q >= 0) + VppLog() << '<' << UPP::Name(Xwindow()[q].ctrl) << '>'; + else + VppLog() << " "; + if(event->type == ClientMessage) + VppLog() << ": " << XAtomName(event->xclient.message_type); + VppLog() << '\n'; + eo = true; + break; + } +#endif + DropStatusEvent(event); + if(q < 0) { + if(event->type == ButtonRelease && popupWnd) + popupWnd->SetFocus(); + return; + } + XWindow& w = xmap[q]; + if(w.ctrl) { + w.ctrl->EventProc(w, event); + if(w.ctrl) + w.ctrl->SyncMoves(); + } + else + xmap.SetKey(q, None); + DefferedFocusSync(); +#ifdef _DEBUG +#ifdef UPP_HEAP + if(MemoryCheck) + UPP::MemoryCheck(); +#endif + if(eo) + LLOG("------ end of event processing ----------"); +#endif +} + +void Ctrl::TimerAndPaint() { + GuiLock __; + LTIMING("TimerAndPaint"); + TimerProc(GetTickCount()); + for(int i = 0; i < Xwindow().GetCount(); i++) { + XWindow& xw = Xwindow()[i]; + if(Xwindow().GetKey(i) && xw.exposed && xw.invalid.GetCount()) { + if(xw.ctrl) { + LLOG("..and paint " << UPP::Name(xw.ctrl)); + FocusSync(); + xw.ctrl->SyncScroll(); + Vector x = xw.invalid; + xw.invalid.Clear(); + xw.ctrl->DoPaint(x); + } + else + Xwindow().SetKey(i, None); + } + } + SyncCaret(); + AnimateCaret(); + XSync(Xdisplay, false); + SyncIMPosition(); +} + +bool Ctrl::ProcessEvent(bool *) +{ + GuiLock __; + if(!IsWaitingEvent()) return false; + XEvent event; + XNextEvent(Xdisplay, &event); + ProcessEvent(&event); + return true; +} + +void SweepMkImageCache(); + +bool Ctrl::ProcessEvents(bool *) +{ + GuiLock __; + if(ProcessEvent()) { + while(ProcessEvent() && (!LoopCtrl || LoopCtrl->InLoop())); // LoopCtrl-MF 071008 + TimerAndPaint(); + SweepMkImageCache(); + return true; + } + TimerAndPaint(); + SweepMkImageCache(); + return false; +} + +void Ctrl::GuiSleep0(int ms) +{ + GuiLock __; + ASSERT(IsMainThread()); + fd_set fdset; + FD_ZERO(&fdset); + FD_SET(Xconnection, &fdset); + timeval timeout; + timeout.tv_sec = ms / 1000; + timeout.tv_usec = ms % 1000 * 1000; + XFlush(Xdisplay); + int level = LeaveGuiMutexAll(); + select(Xconnection + 1, &fdset, NULL, NULL, &timeout); + EnterGuiMutex(level); +} + +static int granularity = 10; + +void Ctrl::SetTimerGranularity(int ms) +{ + GuiLock __; + granularity = ms; +} + +void Ctrl::EventLoop0(Ctrl *ctrl) +{ + GuiLock __; + ASSERT(IsMainThread()); + ASSERT(LoopLevel == 0 || ctrl); + LoopLevel++; + LLOG("Entering event loop at level " << LoopLevel << BeginIndent); + Ctrl *ploop; + if(ctrl) { + ploop = LoopCtrl; + LoopCtrl = ctrl; + ctrl->inloop = true; + } + + while(ctrl ? ctrl->InLoop() && ctrl->IsOpen() : GetTopCtrls().GetCount()) { + XEvent event; + fd_set fdset; + FD_ZERO(&fdset); + FD_SET(Xconnection, &fdset); + timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 1000 * granularity; + XFlush(Xdisplay); + int level = LeaveGuiMutexAll(); + select(Xconnection + 1, &fdset, NULL, NULL, &timeout); + EnterGuiMutex(level); +// GuiSleep()(granularity); + SyncMousePos(); + while(IsWaitingEvent()) { + LTIMING("XNextEvent"); + XNextEvent(Xdisplay, &event); + ProcessEvent(&event); + } + TimerAndPaint(); + } + + if(ctrl) + LoopCtrl = ploop; + + LoopLevel--; + LLOG(EndIndent << "Leaving event loop "); +} + +void Ctrl::SyncExpose() +{ + GuiLock __; + if(!top) return; + XEvent event; + while(XCheckTypedWindowEvent(Xdisplay, top->window, Expose, &event)) + ProcessEvent(&event); + while(XCheckTypedWindowEvent(Xdisplay, top->window, GraphicsExpose, &event)) + ProcessEvent(&event); +} + +void Ctrl::Create(Ctrl *owner, bool redirect, bool savebits) +{ + Call(callback3(this, &Ctrl::Create0, owner, redirect, savebits)); +} + +void Ctrl::Create0(Ctrl *owner, bool redirect, bool savebits) +{ + GuiLock __; + ASSERT(IsMainThread()); + LLOG("Create " << Name() << " " << GetRect()); + ASSERT(!IsChild() && !IsOpen()); + LLOG("Ungrab1"); + ReleaseGrab(); + XSetWindowAttributes swa; + swa.bit_gravity = ForgetGravity; + swa.background_pixmap = None; + swa.override_redirect = redirect; + swa.save_under = savebits; + Color c = SColorPaper(); + swa.background_pixel = GetXPixel(c.GetR(), c.GetG(), c.GetB()); + Rect r = GetRect(); + isopen = true; + Window w = XCreateWindow(Xdisplay, RootWindow(Xdisplay, Xscreenno), + r.left, r.top, r.Width(), r.Height(), + 0, CopyFromParent, InputOutput, CopyFromParent, + CWBitGravity|CWSaveUnder|CWOverrideRedirect| + (IsCompositedGui() ? CWBackPixel : CWBackPixmap), + &swa); + if(!w) XError("XCreateWindow failed !"); + int i = Xwindow().Find(None); + if(i >= 0) Xwindow().SetKey(i, w); + XWindow& cw = i >= 0 ? Xwindow()[i] : Xwindow().Add(w); + cw.ctrl = this; + cw.exposed = false; + cw.owner = owner; + + cw.xic = NULL; + + if(xim) { +/* char **missing_list; + int missing_count; + char *def_string; + + static XFontSet dummy_fs = XCreateFontSet(Xdisplay, "-*-*-*-*-*-*-*-*-*-*-*-*-*-", + &missing_list, &missing_count, &def_string); + DDUMP((void *)dummy_fs); + + XPoint spot; + spot.x = 1; + spot.y = 1; + XVaNestedList preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, XNFontSet, dummy_fs, NULL); + + DDUMP((void *)preedit_attr); + + cw.xic = XCreateIC(xim, + XNInputStyle, XIMPreeditPosition|XIMStatusNothing, + XNPreeditAttributes, preedit_attr, + XNClientWindow, w, + NULL); + XFree(preedit_attr); + DDUMP((void *)cw.xic);*/ + cw.xic = XCreateIC(xim, + XNInputStyle, XIMPreeditNothing|XIMStatusNothing, + XNClientWindow, w, + NULL); + } + top = new Top; + top->window = w; + long im_event_mask = 0; + if(cw.xic) + XGetICValues(cw.xic, XNFilterEvents, &im_event_mask, NULL); + XSelectInput(Xdisplay, w, ExposureMask|StructureNotifyMask|KeyPressMask| + FocusChangeMask|KeyPressMask|KeyReleaseMask|PointerMotionMask| + ButtonPressMask|ButtonReleaseMask|PropertyChangeMask| + VisibilityChangeMask|im_event_mask); + int version = 5; + XChangeProperty(Xdisplay, w, XAtom("XdndAware"), XA_ATOM, 32, + 0, (byte *)&version, 1); + CancelMode(); + if(r.Contains(GetMousePos())) + DispatchMouse(MOUSEMOVE, GetMousePos() - r.TopLeft()); + + if(redirect) { + int windowType = XInternAtom(Xdisplay, "_NET_WM_WINDOW_TYPE_POPUP_MENU", false); + XChangeProperty(Xdisplay, w, XInternAtom(Xdisplay, "_NET_WM_WINDOW_TYPE", false), XA_ATOM, 32, + PropModeReplace, (byte *)&windowType, 1); + } + + RefreshLayoutDeep(); + + SyncIMPosition(); +} + +void Ctrl::WndDestroy0() +{ + GuiLock __; + LLOG("WndDestroy " << Name()); + if(!top || !isopen) return; + AddGlobalRepaint(); + bool revertfocus = HasWndFocus(); + for(int i = 0; i < Xwindow().GetCount(); i++) { + LOGBEGIN(); + XWindow& w = Xwindow()[i]; + if(Xwindow().GetKey(i) != None && w.owner == this && w.ctrl->IsOpen()) + w.ctrl->WndDestroy(); + LOGEND(); + } + Ptr owner; + int i = Xwindow().Find(top->window); + if(i >= 0) { + XWindow& w = Xwindow()[i]; + owner = w.owner; + w.invalid.Clear(); + if(w.xic) + XDestroyIC(w.xic); + } + isopen = false; + if(focusWindow == top->window) + focusWindow = None; + if(grabWindow == top->window) + grabWindow = None; + XDestroyWindow(Xdisplay, top->window); + if(i >= 0) { + Xwindow().SetKey(i, None); + top->window = None; + Xwindow()[i].ctrl = NULL; + } + + if(revertfocus && owner) + owner->TakeFocus(); + + if(focusWindow) { + int q = Xwindow().Find(focusWindow); + if(q >= 0) { + XIC xic = Xwindow()[q].xic; + if(xic) { + XSetICFocus(xic); + SyncIMPosition(); + } + } + } + + delete top; + top = NULL; +} + +Vector Ctrl::GetTopCtrls() +{ + GuiLock __; + Vector v; + const ArrayMap& w = Xwindow(); + for(int i = 0; i < w.GetCount(); i++) + if(w.GetKey(i) && w[i].ctrl && !w[i].ctrl->parent) + v.Add(w[i].ctrl); + return v; +} + +void Ctrl::StartPopupGrab() +{ + GuiLock __; + if(PopupGrab == 0) { + if(!top) return; + if(XGrabPointer( + Xdisplay, top->window, true, + ButtonPressMask|ButtonReleaseMask|PointerMotionMask|EnterWindowMask|LeaveWindowMask, + GrabModeAsync, GrabModeAsync, None, None, CurrentTime) == GrabSuccess) { + PopupGrab++; + popupWnd = GetTopWindow(); + } + } +} + +void Ctrl::EndPopupGrab() +{ + GuiLock __; + if(PopupGrab == 0) return; + if(--PopupGrab == 0) { + XUngrabPointer(Xdisplay, CurrentTime); + XFlush(Xdisplay); + } +} + +void Ctrl::PopUp(Ctrl *owner, bool savebits, bool activate, bool, bool) +{ + GuiLock __; + LLOG("POPUP: " << UPP::Name(this)); + Ctrl *q = owner ? owner->GetTopCtrl() : GetActiveCtrl(); + ignoretakefocus = true; + Create(q, true, savebits); + if(activate) { + q->StartPopupGrab(); + popupgrab = true; + } + if(top) popup = true; + WndShow(visible); + if(activate && IsEnabled()) + SetFocus(); + if(top) top->owner = owner; + StateH(OPEN); +} + +Ctrl *Ctrl::GetActiveCtrl() +{ + GuiLock __; + return focusCtrl ? focusCtrl->GetTopCtrl() : NULL; +} + +bool Ctrl::IsAlphaSupported() { return false; } +void Ctrl::SetAlpha(byte alpha) {} + +bool Ctrl::IsCompositedGui() +{ + GuiLock __; + static bool b = XGetSelectionOwner(Xdisplay, XAtom(String().Cat() << "_NET_WM_CM_S" << Xscreenno)) != None; + return b; +} + +Ctrl *Ctrl::GetOwner() +{ + GuiLock __; + if(!IsOpen()) return NULL; + int q = Xwindow().Find(GetWindow()); + return q >= 0 ? Xwindow()[q].owner : NULL; +} + +void Ctrl::WndShow(bool b) +{ + GuiLock __; + LLOG("WndShow " << b); + if(top) { + XWindowAttributes xwa; + XGetWindowAttributes(Xdisplay, top->window, &xwa); + bool v = xwa.map_state == IsViewable; + if(b == v) return; + if(b) + XMapWindow(Xdisplay, top->window); + else + XUnmapWindow(Xdisplay, top->window); + visible = b; + StateH(SHOW); + } +} + +void Ctrl::WndUpdate() +{ + GuiLock __; + LTIMING("WndUpdate"); + LLOG("WNDUPDATE"); + if(!top) return; + SyncExpose(); + XWindow& xw = Xwindow().Get(top->window); + if(xw.exposed && xw.invalid.GetCount()) { + SyncScroll(); + DoPaint(xw.invalid); + xw.invalid.Clear(); + LTIMING("WndUpdate XSync"); + XSync(Xdisplay, false); + } +} + +void Ctrl::WndUpdate(const Rect& r) +{ + GuiLock __; + LTIMING("WndUpdate Rect"); + LLOG("WNDUPDATE " << r); + if(!top) return; + SyncExpose(); + XWindow& xw = Xwindow().Get(top->window); + bool dummy; + SyncScroll(); + DoPaint(Intersect(xw.invalid, r, dummy)); + LTIMING("WndUpdate XSync"); + XSync(Xdisplay, false); + xw.invalid = Subtract(xw.invalid, r, dummy); +} + +void Ctrl::WndSetPos(const Rect& r) +{ + GuiLock __; + if(!top) return; + LLOG("WndSetPos " << Name() << r); + AddGlobalRepaint(); + XMoveResizeWindow(Xdisplay, top->window, r.left, r.top, r.Width(), r.Height()); + rect = r; + SetWndRect(r); +} + +bool Ctrl::IsWndOpen() const +{ + return top; +} + +bool Ctrl::SetWndCapture() +{ + GuiLock __; + if(!IsEnabled() || !top || !IsVisible()) return false; + if(top->window == grabWindow) return true; + int status = XGrabPointer( + Xdisplay, top->window, false, + ButtonPressMask|ButtonReleaseMask|PointerMotionMask|EnterWindowMask|LeaveWindowMask, + GrabModeAsync, GrabModeAsync, None, None, CurrentTime + ); + if(status) return false; + LLOG("Capture set ok"); + grabWindow = top->window; + return true; +} + +bool Ctrl::HasWndCapture() const +{ + GuiLock __; + return top && top->window == grabWindow; +} + +void Ctrl::ReleaseGrab() +{ + GuiLock __; + if(grabWindow) { + LLOG("RELEASE GRAB"); + XUngrabPointer(Xdisplay, CurrentTime); + XFlush(Xdisplay); + grabWindow = None; + } +} + +bool Ctrl::ReleaseWndCapture() +{ + GuiLock __; + LLOG("Releasing capture"); + if(top && top->window == grabWindow) { + LLOG("Ungrab3"); + ReleaseGrab(); + return true; + } + return false; +} + +void Ctrl::SetMouseCursor(const Image& image) +{ + GuiLock __; + static Image img; + static Cursor shc; + if(img.GetSerialId() != image.GetSerialId()) { + img = image; + Cursor hc = X11Cursor(IsNull(img) ? Image::Arrow() : img); + for(int i = 0; i < Xwindow().GetCount(); i++) { + Window wnd = Xwindow().GetKey(i); + if(wnd) + XDefineCursor(Xdisplay, wnd, hc); + } + if(shc) + XFreeCursor(Xdisplay, shc); + shc = hc; + XFlush(Xdisplay); + } +} + +void ClearKbdState_(); + +void Ctrl::TakeFocus() +{ + LLOG("TAKE_FOCUS0 " << Name()); + GuiLock __; + if(IsChild()) { + Ctrl *w = GetTopCtrl(); + if(w) w->TakeFocus(); + return; + } + XWindow *w = GetXWindow(); + if(!w) + return; + if(ignoretakefocus) { + LLOG("IGNORED TAKE_FOCUS (caused by CreateWindow)"); + if(focusWindow != top->window && focusWindow != None) + XSetInputFocus(Xdisplay, focusWindow, RevertToParent, CurrentTime); + return; + } + if(w->owner) { + LLOG("IGNORED TAKE_FOCUS (window is owned)"); + return; + } + LLOG("TAKE_FOCUS " << Name()); + ClearKbdState_(); + if(IsEnabled() && IsVisible() && top->window != GetXServerFocusWindow()) + SetWndFocus(); + if(this != focusCtrlWnd) { + if(IsEnabled()) { + SetLastActive(w, this); + LLOG("Activate " << Name()); + SetFocusWnd(); + } + else { + LLOG("Activate of disabled window" << Name()); + if(w->last_active && w->last_active->IsOpen() && w->last_active->IsEnabled() && + w->last_active != this) { + LLOG(" activating last active: " << UPP::Name(w->last_active)); + w->last_active->TakeFocus(); + } + } + } + + return; +} + +void Ctrl::KillFocus(Window window) +{ + GuiLock __; + if(!window) + return; + int q = Xwindow().Find(window); + if(q < 0) + return; + XWindow& w = Xwindow()[q]; + if(w.ctrl) + w.ctrl->KillFocusWnd(); +} + +bool Ctrl::SetWndFocus() +{ + GuiLock __; + LLOG("SetWndFocus " << Name()); + if(top && top->window != focusWindow && IsEnabled() && IsVisible()) { + LLOG("Setting focus... "); + LTIMING("XSetInfputFocus"); + KillFocus(focusWindow); + XSetInputFocus(Xdisplay, top->window, RevertToParent, CurrentTime); + focusWindow = top->window; + SetFocusWnd(); + return true; + } + return false; +} + +bool Ctrl::HasWndFocus() const +{ + GuiLock __; + return top && top->window == focusWindow; +} + +Window Ctrl::GetXServerFocusWindow() +{ + GuiLock __; + Window w; + int dummy; + XGetInputFocus(Xdisplay, &w, &dummy); + return w; +} + +void Ctrl::FocusSync() +{ + GuiLock __; + Window fw = GetXServerFocusWindow(); + if(fw != focusWindow) { + LLOG("FocusSync to " << FormatIntHex(fw)); + if(fw) { + int q = Xwindow().Find(fw); + if(q >= 0) { + LLOG("Focus to app window"); + focusWindow = fw; + XWindow& w = Xwindow()[q]; + if(w.ctrl) { + if(w.ctrl->IsPopUp()) { + AnimateCaret(); + return; + } + KillFocus(focusWindow); + focusWindow = None; + w.ctrl->SetFocusWnd(); + AnimateCaret(); + return; + } + } + } + KillFocus(focusWindow); + focusWindow = None; + AnimateCaret(); + } +} + +void Ctrl::SyncIMPosition() +{ +/* + if(!focusWindow) + return; + int q = Xwindow().Find(focusWindow); + if(q < 0) + return; + XWindow& xw = Xwindow()[q]; + XIC xic = xw.xic; + if(xw.xic && xw.ctrl) { + XVaNestedList preedit_attr; + XPoint spot; + spot.x = xw.ctrl->caretx + xw.ctrl->caretcx; + spot.y = xw.ctrl->carety + xw.ctrl->caretcy; + preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); + XSetICValues(xw.xic, XNPreeditAttributes, preedit_attr, NULL); + XFree(preedit_attr); + } +*/ +} + +void Ctrl::AnimateCaret() +{ + GuiLock __; + int v = !(((GetTickCount() - WndCaretTime) / 500) & 1); + if(v != WndCaretVisible) { + RefreshCaret(); + WndCaretVisible = v; + } +} + +void Ctrl::Invalidate(XWindow& xw, const Rect& _r) +{ + GuiLock __; + LTIMING("Invalidate"); + LLOG("Invalidate " << UPP::Name(xw.ctrl) << " " << _r); + Vector inv; + Rect r = _r; + int ra = r.Width() * r.Height(); + for(int i = 0; i < xw.invalid.GetCount(); i++) { + const Rect& ir = xw.invalid[i]; + Rect ur = r | ir; + if(ur.Width() * ur.Height() < 2 * (ir.Width() * ir.Height() + ra)) + r = ur; + else + if(!r.Contains(xw.invalid[i])) + inv.Add(xw.invalid[i]); + } + Vector rs; + rs.Add(r); + for(int i = 0; i < inv.GetCount(); i++) { + bool ch = false; + Vector rs1 = Subtract(rs, inv[i], ch); + if(ch) rs = rs1; + } + inv.AppendPick(rs); + xw.invalid = inv; +} + +void Ctrl::AddGlobalRepaint() +{ + GuiLock __; + Rect rect = GetRect(); + rect.Inflate(32, 32);//TODO !!! Not correct !!! should read frame extent instead... - or shift GraphicsExposes / NoExposes... + ArrayMap& w = Xwindow(); + for(int i = 0; i < w.GetCount(); i++) + if(w.GetKey(i) && w[i].ctrl) { + const Rect& r = w[i].ctrl->rect; + if(rect.Intersects(r)) + Invalidate(w[i], Rect(rect.Offseted(-r.TopLeft()))); + } +} + +void Ctrl::WndInvalidateRect(const Rect& r) +{ + GuiLock __; + if(!top) return; + LLOG("WndInvalidateRect " << r); + Invalidate(Xwindow().Get(top->window), r); +} + +void Ctrl::SetWndForeground() +{ + GuiLock __; + LLOG("SetWndForeground " << Name()); + if(!top || !IsVisible()) return; + if(!IsEnabled()) { + LLOG("Not enabled"); + XWindow *w = GetXWindow(); + if(w && w->last_active && w->last_active != this && + w->last_active->IsOpen() && w->last_active->IsEnabled()) + w->last_active->SetWndForeground(); + } + else { + SetWndFocus(); + XRaiseWindow(Xdisplay, top->window); + } +} + +bool Ctrl::IsWndForeground() const +{ + GuiLock __; + const Ctrl *q = GetTopWindow(); + return ~focusCtrlWnd == (q ? q : GetTopCtrl()); +} + +bool Ctrl::WndEnable(bool b) +{ + GuiLock __; + LLOG("WndEnable"); + if(!top) return false; + if(!b) { + ReleaseCapture(); + if(HasWndFocus()) + XSetInputFocus(Xdisplay, None, RevertToPointerRoot, CurrentTime); + } + return true; +} + +// 01/12/2007 - mdelfede +// added support for windowed controls +Ctrl::XWindow *Ctrl::AddXWindow(Window &w) +{ + GuiLock __; + int i = Xwindow().Find(None); + if(i >= 0) + Xwindow().SetKey(i, w); + XWindow& cw = i >= 0 ? Xwindow()[i] : Xwindow().Add(w); + cw.ctrl = this; + cw.exposed = true; + cw.owner = GetParent(); + cw.xic = NULL; + return &cw; +} + +void Ctrl::RemoveXWindow(Window &w) +{ + GuiLock __; + int i = Xwindow().Find(w); + if(i >= 0) { + Xwindow().SetKey(i, None); + Xwindow()[i].ctrl = NULL; + } + +} +Ctrl::XWindow *Ctrl::XWindowFromWindow(Window &w) +{ + GuiLock __; + int i = Xwindow().Find(w); + if(i >= 0) + return &Xwindow()[i]; + else + return NULL; +} + +// Synchronizes the native windows inside ctrls +void Ctrl::SyncNativeWindows(void) +{ + GuiLock __; + ArrayMap& xwindows = Xwindow(); + for(int i = 0; i < xwindows.GetCount(); i++) + { + XWindow &xw = xwindows[i]; + Window w = xwindows.GetKey(i); + if(xw.ctrl && xw.ctrl->parent && w) + { + Window dummy; + int x, y; + unsigned int width, height, border, depth; + XGetGeometry(Xdisplay, w, &dummy, &x, &y, &width, &height, &border, &depth); + Rect r = xw.ctrl->GetRectInParentWindow(); + if( (x != r.left || y != r.top) && ((int)width == r.Width() && (int)height == r.Height())) + XMoveWindow(Xdisplay, w, r.left, r.top); + else if( (x == r.left && y == r.top) && ((int)width != r.Width() || (int)height != r.Height())) + XResizeWindow(Xdisplay, w, r.Width(), r.Height()); + else if( x != r.left || y != r.top || (int)width != r.Width() || (int)height != r.Height()) + XMoveResizeWindow(Xdisplay, w, r.left, r.top, r.Width(), r.Height()); + } + } + +} // END Ctrl::SyncNativeWindows() + +// 01/12/2007 - END + +ViewDraw::ViewDraw(Ctrl *ctrl) +{ + EnterGuiMutex(); + Ctrl *top = ctrl->GetTopCtrl(); + Rect r = ctrl->GetScreenView() - top->GetScreenRect().TopLeft(); + Vector clip; + clip.Add(r); + dw = top->GetWindow(); + gc = XCreateGC(Xdisplay, dw, 0, 0); + xftdraw = XftDrawCreate(Xdisplay, (Drawable) dw, + DefaultVisual(Xdisplay, Xscreenno), Xcolormap); + Init(clip, r.TopLeft()); +} + +ViewDraw::~ViewDraw() +{ + XFreeGC(Xdisplay, gc); + LeaveGuiMutex(); +} + +#endif + +END_UPP_NAMESPACE diff --git a/olddraw/CtrlCore/init b/olddraw/CtrlCore/init new file mode 100644 index 000000000..635cfa7a7 --- /dev/null +++ b/olddraw/CtrlCore/init @@ -0,0 +1,8 @@ +#ifndef _CtrlCore_icpp_init_stub +#define _CtrlCore_icpp_init_stub +#include "Draw/init" +#include "plugin\bmp/init" +#define BLITZ_INDEX__ F3E00C8C1D354C9B98AA929A9E9F39109 +#include "CtrlCore.icpp" +#undef BLITZ_INDEX__ +#endif diff --git a/olddraw/CtrlCore/lay.h b/olddraw/CtrlCore/lay.h new file mode 100644 index 000000000..c771144f2 --- /dev/null +++ b/olddraw/CtrlCore/lay.h @@ -0,0 +1,43 @@ +//#BLITZ_APPROVE + +#define LAYOUT(name, x, y) struct name##__layid {}; +#define UNTYPED(variable, param) +#define ITEM(classname, var, param) +#define END_LAYOUT + +#include LAYOUTFILE + +#undef LAYOUT +#undef UNTYPED +#undef ITEM +#undef END_LAYOUT + +#define LAYOUT(name, x, y) template \ + struct With##name : public T, public name##__layid { \ + static UPP::Size GetLayoutSize() { return UPP::Ctrl::LayoutZoom(x, y); } +#define UNTYPED(variable, param) +#define ITEM(classname, var, param) classname var; +#define END_LAYOUT }; + +#include LAYOUTFILE + +#undef LAYOUT +#undef UNTYPED +#undef ITEM +#undef END_LAYOUT + +#define LAYOUT(nm, x, y) template \ + void InitLayout(UPP::Ctrl& parent, L& layout, D& uts, nm##__layid&) { \ + parent.LayoutId(#nm); +#define UNTYPED(var, param) uts.var.param; uts.var.LayoutId(#var); parent.Add(uts.var); +#define ITEM(clss, var, param) layout.var.param; layout.var.LayoutId(#var); parent.Add(layout.var); +#define END_LAYOUT }; + +#include LAYOUTFILE + +#undef LAYOUT +#undef UNTYPED +#undef ITEM +#undef END_LAYOUT + +#undef LAYOUTFILE diff --git a/olddraw/CtrlCore/llay.h b/olddraw/CtrlCore/llay.h new file mode 100644 index 000000000..07e045fea --- /dev/null +++ b/olddraw/CtrlCore/llay.h @@ -0,0 +1,3 @@ +#include +#include +#include diff --git a/olddraw/CtrlCore/prj.aux b/olddraw/CtrlCore/prj.aux new file mode 100644 index 000000000..6fe7daf4f --- /dev/null +++ b/olddraw/CtrlCore/prj.aux @@ -0,0 +1,10 @@ +file + "D:\\Program Files\\Microsoft Visual Studio\\Vc98\\Mfc\\Src\\Thrdcore.cpp", + "D:\\Program Files\\Microsoft Visual Studio\\Vc98\\Mfc\\Src\\Afxtls.cpp", + "D:\\Program Files\\Microsoft Visual Studio\\Vc98\\Mfc\\Src\\Winmain.cpp", + "D:\\Program Files\\Microsoft Visual Studio\\Vc98\\Mfc\\Src\\Cmdtarg.cpp", + "D:\\Program Files\\Microsoft Visual Studio\\Vc98\\Mfc\\Src\\Appui.cpp", + "D:\\Program Files\\Microsoft Visual Studio\\Vc98\\Mfc\\Src\\Appcore.cpp", + "D:\\Program Files\\Microsoft Visual Studio\\Vc98\\Mfc\\Src\\Wincore.cpp", + F:\Source\repository, + F:\Source\Qlib.txt; diff --git a/olddraw/CtrlCore/src.tpp/Ctrl$en-us.tpp b/olddraw/CtrlCore/src.tpp/Ctrl$en-us.tpp new file mode 100644 index 000000000..af0ec31f2 --- /dev/null +++ b/olddraw/CtrlCore/src.tpp/Ctrl$en-us.tpp @@ -0,0 +1,2407 @@ +topic "Ctrl"; +[2 $$0,0#00000000000000000000000000000000:Default] +[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class] +[l288;2 $$2,0#27521748481378242620020725143825:desc] +[0 $$3,0#96390100711032703541132217272105:end] +[H6;0 $$4,0#05600065144404261032431302351956:begin] +[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:item] +[l288;a4;*@5;1 $$6,6#70004532496200323422659154056402:requirement] +[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param] +[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam] +[b42;2 $$9,9#13035079074754324216151401829390:normal] +[{_}%EN-US +[s0;a83;%- [*R6 Ctrl]&] +[s5;:`:`:Ctrl`:`:class:%- [*@(0.0.255) class][*@(64) _][* Ctrl][*@(64) _:_][*@(0.0.255) public][*@(64) _ +][*^`:`:Data^@(64) Data][*@(64) , ][*@(0.0.255) public][*@(64) _][*^`:`:Pte^@(64) Pte][*@(64) < +][* Ctrl][*@(64) >_]&] +[s0; &] +[s0; &] +[s0; (Derivation from Pte allows Ctrl to be pointed to by Ptr&] +[s0; &] +[s0; This the base class of GUI widgets hierarchy (that is why U`+`+ +widgets are also named `"Ctrls`").&] +[s0; &] +[s0;%- enum_[* PlacementConstants]&] +[s2;b17;a17; Constants used in logical coordinates.&] +[s7;i1120;a17;:`:`:Ctrl`:`:CENTER: [%-*C@3 CENTER]-|Center alignment.&] +[s7;i1120;a17;:`:`:Ctrl`:`:LEFT: [%-*C@3 LEFT]-|Left alignment.&] +[s7;i1120;a17;:`:`:Ctrl`:`:RIGHT: [%-*C@3 RIGHT]-|Right alignment.&] +[s7;i1120;a17;:`:`:Ctrl`:`:TOP: [%-*C@3 TOP]-|Equal to LEFT (better +name for vertical coordinate).&] +[s7;i1120;a17;:`:`:Ctrl`:`:BOTTOM: [%-*C@3 BOTTOM]-|Equal to RIGHT (better +name for vertical coordinate)&] +[s7;i1120;a17;:`:`:Ctrl`:`:SIZE: [%-*C@3 SIZE]-|Size alignment.&] +[s7;i1120;a17;:`:`:Ctrl`:`:MINSIZE: [%-*C@3 MINSIZE]-|Value is determined +using GetMinSize.&] +[s7;i1120;a17;:`:`:Ctrl`:`:MAXSIZE: [%-*C@3 MAXSIZE]-|Value is determined +using GetMaxSize.&] +[s7;i1120;a17;:`:`:Ctrl`:`:STDSIZE: [%-*C@3 STDSIZE]-|Value is determined +using Get&] +[s0; &] +[s0;%- class_[* Ctrl`::Logc]&] +[s2;b17;a17; &] +[s2;b17;a17; This nested class serves as either vertical or horizontal +part of logical position.&] +[s0; &] +[s0;l352;:`:`:Ctrl`:`:Logc`:`:Logc`(int`,int`,int`):%- [* Logc](int_[*@3 al], +int_[*@3 a], int_[*@3 b])&] +[s2;l352;b17;a17; Constructor.&] +[s7;l352;i1120;a17; [%-*C@3 al]-|Alignment type. Determines what other +parameters mean. &] +[s7;l352;i1120;a17; [%-*C@3 a]-|First value.&] +[s7;l352;i1120;a17; [%-*C@3 b]-|Second value.&] +[s0; &] +[s0;l352;:`:`:Ctrl`:`:Logc`:`:Logc`(`):%- [* Logc]()&] +[s2;l352;b17;a17; Default constructor. Sets Logc to the empty state.&] +[s0; &] +[s5;%- [*@(64) static ][*@(0.0.255) int][*@(64) _][* LSGN][*@(64) (][*^`:`:dword^@(64) dword][*@(64) _ +][*@3 d][*@(64) )]&] +[s7;l352;i1120;a17; [%-*C@3 q]-|Logc to compare with.&] +[s7;l352;i1120;a17; [*/ Return value]-|True when equal.&] +[s0; &] +[s5;%- [*@(0.0.255) bool][*@(64) _][* operator!`=][*@(64) (][*^`:`:Ctrl`:`:Logc^@(64) Logc][*@(64) _ +][*@3 q][*@(64) )_][*@(0.0.255) const]&] +[s7;l352;i1120;a17; [%-*C@3 q]-|Logc to compare with.&] +[s7;l352;i1120;a17; [*/ Return value]-|True when not equal.&] +[s0; &] +[s5;%- [*@(0.0.255) int][*@(64) _][* GetAlign][*@(64) ()_][*@(0.0.255) const]&] +[s7;l352;i1120;a17; [*/ Return value]-|Alignment type.&] +[s0; &] +[s5;%- [*@(0.0.255) int][*@(64) _][* GetA][*@(64) ()_][*@(0.0.255) const]&] +[s7;l352;i1120;a17; [*/ Return value]-|First value.&] +[s0; &] +[s5;%- [*@(0.0.255) int][*@(64) _][* GetB][*@(64) ()_][*@(0.0.255) const]&] +[s7;l352;i1120;a17; [*/ Return value]-|Second value.&] +[s0; &] +[s5;%- [*@(0.0.255) void][*@(64) _][* SetAlign][*@(64) (][*@(0.0.255) int][*@(64) _][*@3 align][*@(64) ) +]&] +[s2;l352;b17;a17;%- Sets alignment type.&] +[s7;l352;i1120;a17; [%-*C@3 align]-|Alignment type.&] +[s0; &] +[s5;%- [*@(0.0.255) void][*@(64) _][* SetA][*@(64) (][*@(0.0.255) int][*@(64) _][*@3 a][*@(64) )]&] +[s2;l352;b17;a17; Sets first value.&] +[s7;l352;i1120;a17; [%-*C@3 a]-|Value.&] +[s0; &] +[s5;%- [*@(0.0.255) void][*@(64) _][* SetB][*@(64) (][*@(0.0.255) int][*@(64) _][*@3 b][*@(64) )]&] +[s2;l352;b17;a17; Sets second value.&] +[s7;l352;i1120;a17; [%-*C@3 b]-|Value.&] +[s0; &] +[s5;%- [*@(0.0.255) bool][*@(64) _][* IsEmpty][*@(64) ()_][*@(0.0.255) const]&] +[s7;l352;i1120;a17; [*/ Return value]-|True if Logc is empty.&] +[s0; &] +[s0; &] +[s0; &] +[s5;:`:`:Ctrl`:`:LogPos`:`:struct:%- [*@(0.0.255) struct][*@(64) _][* LogPos]&] +[s2;b17;a17; &] +[s2;b17;a17; This nested class combines two Logc value into complete +logical position.&] +[s0; &] +[s0;l352;:`:`:Ctrl`:`:LogPos`:`:LogPos`(`:`:Ctrl`:`:Logc`,`:`:Ctrl`:`:Logc`):%- [* LogP +os](Logc_[*@3 x], Logc_[*@3 y])&] +[s2;l352;b17;a17; Constructor.&] +[s7;l352;i1120;a17; [%-*C@3 x]-|Horizontal Logc.&] +[s7;l352;i1120;a17; [%-*C@3 y]-|Vertical Logc.&] +[s0; &] +[s0;l352;:`:`:Ctrl`:`:LogPos`:`:LogPos`(`):%- [* LogPos]()&] +[s2;l352;b17;a17; Default constructor. Sets both Logc empty.&] +[s0; &] +[s5;%- [*@(0.0.255) bool][*@(64) _][* operator`=`=][*@(64) (][*^`:`:Ctrl`:`:LogPos^@(64) LogPos +][*@(64) _][*@3 b][*@(64) )_][*@(0.0.255) const]&] +[s7;l352;i1120;a17; [%-*C@3 b]-|LogPos to compare with.&] +[s7;l352;i1120;a17; [*/ Return value]-|True when equal.&] +[s0; &] +[s5;%- [*@(0.0.255) bool][*@(64) _][* operator!`=][*@(64) (][*^`:`:Ctrl`:`:LogPos^@(64) LogPos][*@(64) _ +][*@3 b][*@(64) )_][*@(0.0.255) const]&] +[s7;l352;i1120;a17; [%-*C@3 b]-|LogPos to compare with.&] +[s7;l352;i1120;a17; [*/ Return value]-|True when equal.&] +[s0; &] +[s5;%- [*^`:`:Ctrl`:`:Logc^@(64) Logc][*@(64) _][* x]&] +[s2;l352;b17;a17; Horizontal Logc.&] +[s0; &] +[s5;%- [*^`:`:Ctrl`:`:Logc^@(64) Logc][*@(64) _][* y]&] +[s2;l352;b17;a17; Vertical Logc.&] +[s2;l352;b17;a17; &] +[s0; &] +[s0;%- enum_[* StateReason]&] +[s2;b17;a17; Arguments of State virtual method.&] +[s7;i1120;a17;:`:`:Ctrl`:`:FOCUS: [%-*C@3 FOCUS]-|Ctrl got/lost focus.&] +[s7;i1120;a17;:`:`:Ctrl`:`:ACTIVATE: [%-*C@3 ACTIVATE]-|Ctrl was activated.&] +[s7;i1120;a17;:`:`:Ctrl`:`:DEACTIVATE: [%-*C@3 DEACTIVATE]-|Ctrl was +deactivated.&] +[s7;i1120;a17;:`:`:Ctrl`:`:SHOW: [%-*C@3 SHOW]-|Ctrl visibility changed.&] +[s7;i1120;a17;:`:`:Ctrl`:`:ENABLE: [%-*C@3 ENABLE]-|Ctrl was enabled/disable.&] +[s7;i1120;a17;:`:`:Ctrl`:`:EDITABLE: [%-*C@3 EDITABLE]-|Ctrl editable +status changed.&] +[s7;i1120;a17;:`:`:Ctrl`:`:OPEN: [%-*C@3 OPEN]-|Ctrl was open (its top`-level +Ctrl was open on screen).&] +[s7;i1120;a17;:`:`:Ctrl`:`:CLOSE: [%-*C@3 CLOSE]-|Ctrl was closed (its +top`-level Ctrl was closed).&] +[s0; &] +[s0;%- enum_[* MouseEvents]&] +[s2;b17;a17; Constants that make up [*/ event] argument of [*/ MouseEvent] +and [*/ FrameMouseEvent] virtual methods. Value is combination +of button and action bit fields.&] +[s2;b17;a17; &] +[s0;l160; [* Field masks]&] +[s7;i1120;a17;:`:`:Ctrl`:`:BUTTON: [%-*C@3 BUTTON]-|Mask for button +field.&] +[s7;i1120;a17;:`:`:Ctrl`:`:ACTION: [%-*C@3 ACTION]-|Mask for action +field. &] +[s0; &] +[s0;l160; [* Actions]&] +[s7;i1120;a17;:`:`:Ctrl`:`:MOUSEENTER: [%-*C@3 MOUSEENTER]-|Mouse entered +Ctrl.&] +[s7;i1120;a17;:`:`:Ctrl`:`:MOUSEMOVE: [%-*C@3 MOUSEMOVE]-|Mouse moved +over Ctrl.&] +[s7;i1120;a17;:`:`:Ctrl`:`:MOUSELEAVE: [%-*C@3 MOUSELEAVE]-|Mouse left +Ctrl.&] +[s7;i1120;a17;:`:`:Ctrl`:`:CURSORIMAGE: [%-*C@3 CURSORIMAGE]-|Cursor +image has to be determined (method should respond with image).&] +[s7;i1120;a17;:`:`:Ctrl`:`:MOUSEWHEEL: [%-*C@3 MOUSEWHEEL]-|Mouse wheel +rotated.&] +[s7;i1120;a17;:`:`:Ctrl`:`:DOWN: [%-*C@3 DOWN]-|Mouse button was pressed.&] +[s7;i1120;a17;:`:`:Ctrl`:`:UP: [%-*C@3 UP]-|Mouse button was released.&] +[s7;i1120;a17;:`:`:Ctrl`:`:DOUBLE: [%-*C@3 DOUBLE]-|Mouse button was +double`-clicked.&] +[s7;i1120;a17;:`:`:Ctrl`:`:REPEAT: [%-*C@3 REPEAT]-|When mouse button +is pressed for a while, U`+`+ imitates keyboard autorepeat sending +this message.&] +[s0;l160; [* Buttons] &] +[s7;i1120;a17; [%-*C@3 LEFT]-|Left button. (This constant is not defined +in MouseEvents, instead LEFT from Placements Constants is used).&] +[s7;i1120;a17; [%-*C@3 RIGHT]-|Left button. (This constant is not defined +in MouseEvents, instead LEFT from Placements Constants is used).&] +[s0;l160; [* Combinations]&] +[s7;i1120;a17;:`:`:Ctrl`:`:LEFTDOWN: [%-*C@3 LEFTDOWN]-|Left button +pressed.&] +[s7;i1120;a17;:`:`:Ctrl`:`:LEFTDOUBLE: [%-*C@3 LEFTDOUBLE]-|Left button +double pressed.&] +[s7;i1120;a17;:`:`:Ctrl`:`:LEFTREPEAT: [%-*C@3 LEFTREPEAT]-|Left button +autorepeat.&] +[s7;i1120;a17;:`:`:Ctrl`:`:LEFTUP: [%-*C@3 LEFTUP]-|Left button released.&] +[s7;i1120;a17;:`:`:Ctrl`:`:RIGHTDOWN: [%-*C@3 RIGHTDOWN]-|Right button +pressed.&] +[s7;i1120;a17;:`:`:Ctrl`:`:RIGHTDOUBLE: [%-*C@3 RIGHTDOUBLE]-|Right +button double pressed.&] +[s7;i1120;a17;:`:`:Ctrl`:`:RIGHTREPEAT: [%-*C@3 RIGHTREPEAT]-|Right +button autorepeat.&] +[s7;i1120;a17;:`:`:Ctrl`:`:RIGHTUP: [%-*C@3 RIGHTUP]-|Right button released.&] +[s0; &] +[s0;%- enum_`{_[*@3 NOBACKPAINT], [*@3 FULLBACKPAINT], [*@3 TRANSPARENTBACKPAINT], +[*@3 EXCLUDEPAINT]_`}&] +[s2;b17;a17; These constants are parameters of BackPaint method. +They determine back`-plane drawing style.&] +[s7;i1120;a17;:`:`:Ctrl`:`:NOBACKPAINT: [%-*C@3 NOBACKPAINT]-|No backpaint +is used.&] +[s7;i1120;a17;:`:`:Ctrl`:`:FULLBACKPAINT: [%-*C@3 FULLBACKPAINT]-|Whole +area of Ctrl is backpainted.&] +[s7;i1120;a17;:`:`:Ctrl`:`:TRANSPARENTBACKPAINT: [%-*C@3 TRANSPARENTBACKPAINT]-|Only +transparent child Ctrls are backpainted.&] +[s7;i1120;a17;:`:`:Ctrl`:`:EXCLUDEPAINT: [%-*C@3 EXCLUDEPAINT]-|Ctrl +is not painted. This is special case for specific system related +situations (like OLE control painted by regular Windows routine).&] +[s0; &] +[s5;%- [*@(64) typedef_][*@(0.0.255) bool][*@(64) _(`*][* MouseHook][*@(64) )(Ctrl_`*ctrl, +][*@(0.0.255) bool][*@(64) _inframe, ][*@(0.0.255) int][*@(64) _event, +Point_p, ][*@(0.0.255) int][*@(64) _zdelta, dword_keyflags)]&] +[s2;b17;a17; Type for hooking mouse events across all Ctrls.&] +[s0; &] +[s5;%- [*@(64) typedef_][*@(0.0.255) bool][*@(64) _(`*][* KeyHook][*@(64) )(Ctrl_`*ctrl, +dword_key, ][*@(0.0.255) int][*@(64) _count)]&] +[s2;b17;a17; Type for hooking keyboard events across all Ctrls.&] +[s0; &] +[s5;%- [*@(64) typedef_][*@(0.0.255) bool][*@(64) _(`*][* StateHook][*@(64) )(Ctrl_`*ctrl, +][*@(0.0.255) int][*@(64) _reason)]&] +[s2;b17;a17; Type for hooking state changes across all Ctrls.&] +[s0; &] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:PosLeft`(int`,int`):%- [@(0.0.255) static] [_^`:`:Ctrl`:`:Logc^ Logc]_[* P +osLeft]([@(0.0.255) int]_[*@3 pos], [@(0.0.255) int]_[*@3 size])&] +[s2;b17;a17; Creates left (or top) aligned logical coordinate (Logc).&] +[s7;i1120;a17; [%-*C@3 pos]-|Distance between left margin and left margin +of parent`'s view.&] +[s7;i1120;a17; [%-*C@3 size]-|Size.&] +[s7;i1120;a17; [*/ Return value]-|Logical coordinate.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:PosRight`(int`,int`):%- [@(0.0.255) static] [_^`:`:Ctrl`:`:Logc^ Logc]_[* P +osRight]([@(0.0.255) int]_[*@3 pos], [@(0.0.255) int]_[*@3 size])&] +[s2;b17;a17; Creates right (or bottom) aligned logical coordinate +(Logc).&] +[s7;i1120;a17; [%-*C@3 pos]-|Distance between right margin and right +margin of parent`'s view.&] +[s7;i1120;a17; [%-*C@3 size]-|Size.&] +[s7;i1120;a17; [*/ Return value]-|Logical coordinate.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:PosTop`(int`,int`):%- [@(0.0.255) static] [_^`:`:Ctrl`:`:Logc^ Logc]_[* Po +sTop]([@(0.0.255) int]_[*@3 pos], [@(0.0.255) int]_[*@3 size])&] +[s2;b17;a17; Equal to PosLeft(pos, size).&] +[s7;i1120;a17; [%-*C@3 pos]-|Distance between top margin and top margin +of parent`'s view.&] +[s7;i1120;a17; [%-*C@3 size]-|Size.&] +[s7;i1120;a17; [*/ Return value]-|Logical coordinate.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:PosBottom`(int`,int`):%- [@(0.0.255) static] [_^`:`:Ctrl`:`:Logc^ Logc]_ +[* PosBottom]([@(0.0.255) int]_[*@3 pos], [@(0.0.255) int]_[*@3 size])&] +[s2;b17;a17; Equal to PosRight(pos, size).&] +[s7;i1120;a17; [%-*C@3 pos]-|Distance between bottom margin and bottom +margin of parent`'s view.&] +[s7;i1120;a17; [%-*C@3 size]-|Size.&] +[s7;i1120;a17; [*/ Return value]-|Logical coordinate.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:PosSize`(int`,int`):%- [@(0.0.255) static] [_^`:`:Ctrl`:`:Logc^ Logc]_[* P +osSize]([@(0.0.255) int]_[*@3 lpos], [@(0.0.255) int]_[*@3 rpos])&] +[s2;b17;a17; Creates logical coordinate where distances between margins +and parent`'s view margins are fixed and size of Ctrl is variable +(depends of parent`'s view size).&] +[s7;i1120;a17; [%-*C@3 lpos]-|Distance between left/top margin and left/top +margin of parent`'s view.&] +[s7;i1120;a17; [%-*C@3 rpos]-|Distance between right/bottom margin and +right/bottom margin of parent`'s view.&] +[s7;i1120;a17; [*/ Return value]-|Logical coordinate.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:PosCenter`(int`,int`):%- [@(0.0.255) static] [_^`:`:Ctrl`:`:Logc^ Logc]_ +[* PosCenter]([@(0.0.255) int]_[*@3 size], [@(0.0.255) int]_[*@3 offset])&] +[s2;b17;a17; Creates centered logical coordinate, where Ctrl is placed +in specified distance from center of parent`'s view. &] +[s7;i1120;a17; [%-*C@3 size]-|Size.&] +[s7;i1120;a17; [%-*C@3 offset]-|Offset from center.&] +[s7;i1120;a17; [*/ Return value]-|Logical coordinate.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:PosCenter`(int`):%- [@(0.0.255) static] [_^`:`:Ctrl`:`:Logc^ Logc]_[* PosC +enter]([@(0.0.255) int]_[*@3 size])&] +[s2;b17;a17; Equal to PosCenter(size, 0).&] +[s7;i1120;a17; [%-*C@3 size]-|Size.&] +[s7;i1120;a17; [*/ Return value]-|Logical coordinate.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetTopCtrls`(`):%- [@(0.0.255) static] [_^`:`:Vector^ Vector][@(0.0.255) < +]Ctrl_`*>_[* GetTopCtrls]()&] +[s2;b17;a17; Returns all opened top`-level Ctrls of process. Top`-level +Ctrls are those without parent (GetParent() `=`= NULL) `- TopWindow +Ctrls and pop`-up Ctrls.&] +[s7;i1120;a17; [*/ Return value]-|Vector of all top Ctrls.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetTopWindows`(`):%- [@(0.0.255) static] [_^`:`:Vector^ Vector][@(0.0.255) < +]Ctrl_`*>_[* GetTopWindows]()&] +[s2;b17;a17; Returns all opened TopWindows (that is, instances of +TopWindow class or classes derived from TopWindow) of process. +The difference between GetTopWindows and GetTopCtrls is that +GetTopCtrls returns pop`-ups too. &] +[s7;i1120;a17; [*/ Return value]-|Vector of all TopWindows.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:CloseTopCtrls`(`):%- [@(0.0.255) static] [@(0.0.255) void]_[* CloseTopCtrl +s]()&] +[s2;b17;a17; Closes all top`-level Ctrls.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:InstallMouseHook`(`:`:Ctrl`:`:MouseHook`):%- [@(0.0.255) static] +[@(0.0.255) void]_[* InstallMouseHook]([_^`:`:Ctrl`:`:MouseHook^ MouseHook]_[*@3 hook])&] +[s2;b17;a17; Installs mouse hook `- a routine that receives all mouse +input of application before it gets processed by Ctrls. You can +install more mouse hooks. Mouse hook routine should return true +to indicate the end of processing (and event propagation).&] +[s7;i1120;a17; [%-*C@3 hook]-|Pointer to hook routine.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:DeinstallMouseHook`(`:`:Ctrl`:`:MouseHook`):%- [@(0.0.255) static] +[@(0.0.255) void]_[* DeinstallMouseHook]([_^`:`:Ctrl`:`:MouseHook^ MouseHook]_[*@3 hook]) +&] +[s2;b17;a17; Uninstalls previously installed mouse hook.&] +[s7;i1120;a17; [%-*C@3 hook]-|Pointer to hook routine.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:InstallKeyHook`(`:`:Ctrl`:`:KeyHook`):%- [@(0.0.255) static] +[@(0.0.255) void]_[* InstallKeyHook]([_^`:`:Ctrl`:`:KeyHook^ KeyHook]_[*@3 hook])&] +[s2;b17;a17; Installs keyboard hook `- a routine that receives all +keyboard input of application before it gets processed by Ctrls. +You can install more than one keyboard hooks. Keyboard hook routine +should return true to indicate the end of processing (and event +propagation).&] +[s7;i1120;a17; [%-*C@3 hook]-|Pointer to hook routine.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:DeinstallKeyHook`(`:`:Ctrl`:`:KeyHook`):%- [@(0.0.255) static] +[@(0.0.255) void]_[* DeinstallKeyHook]([_^`:`:Ctrl`:`:KeyHook^ KeyHook]_[*@3 hook])&] +[s2;b17;a17; Uninstalls previously installed keyboard hook.&] +[s7;i1120;a17; [%-*C@3 hook]-|Pointer to hook routine.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:InstallStateHook`(`:`:Ctrl`:`:StateHook`):%- [@(0.0.255) static] +[@(0.0.255) void]_[* InstallStateHook]([_^`:`:Ctrl`:`:StateHook^ StateHook]_[*@3 hook])&] +[s2;b17;a17; Installs state hook `- a routine that receives all state +changes of any Ctrls.&] +[s7;i1120;a17; [%-*C@3 hook]-|Pointer to hook routine.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:DeinstallStateHook`(`:`:Ctrl`:`:StateHook`):%- [@(0.0.255) static] +[@(0.0.255) void]_[* DeinstallStateHook]([_^`:`:Ctrl`:`:StateHook^ StateHook]_[*@3 hook]) +&] +[s2;b17;a17; Deinstalls previously installed state hook.&] +[s7;i1120;a17; [%-*C@3 hook]-|Pointer to hook routine.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Paint`(`:`:Draw`&`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* Paint]([_^`:`:Draw^ D +raw][@(0.0.255) `&]_[*@3 draw])&] +[s2;b17;a17; This method is called when Ctrl`'s view area is about +to be repainted.&] +[s7;i1120;a17; [%-*C@3 draw]-|Target of draw operations.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:CancelMode`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* CancelMode]()&] +[s2;b17;a17; This method is called by U`+`+ core in situations when +internal state of Ctrl that represents ongoing user action is +about to be cleared to default. Typical example of such action +is state of Button that is pushed by mouse click `- if the pushed +state is internally recorded in Button, it should by cleared +by this method. Examples of situations when this method is called +by framework is removing Ctrl from its parent or releasing mouse +capture.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Activate`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* Activate]()&] +[s2;b17;a17; This method is called when Ctrl is top`-level and is +activated `- it or some of its child Ctrls receives keyboard +focus (activation usually has other signs as bringing window +foreground or changing its caption).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Deactivate`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* Deactivate]()&] +[s2;b17;a17; This method is called when Ctrl is top`-level and is +deactivated `- focus has gone outside of Ctrl and its child Ctrls.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:FrameMouseEvent`(int`,`:`:Point`,int`,`:`:dword`):%- [@(0.0.255) virtu +al] [_^`:`:Image^ Image]_[* FrameMouseEvent]([@(0.0.255) int]_[*@3 event], +[_^`:`:Point^ Point]_[*@3 p], [@(0.0.255) int]_[*@3 zdelta], [_^`:`:dword^ dword]_[*@3 keyfla +gs])&] +[s2;b17;a17; This method is called when mouse event happens in frame +area of Ctrl not containing any child Ctrls. Default implementation +does nothing and returns Image`::Arrow().&] +[s7;i1120;a17; [%-*C@3 event]-|Type of event define by [^topic`:`/`/CtrlCore`/src`/Ctrl`$en`-us`#`:`:Ctrl`:`:enum MouseEvents `{ BUTTON`, ACTION`, MOUSEENTER`, MOUSEMOVE`, MOUSELEAVE`, CURSORIMAGE`, MOUSEWHEEL`, DOWN`, UP`, DOUBLE`, REPEAT`, LEFTDOWN`, LEFTDOUBLE`, LEFTREPEAT`, LEFTUP`, RIGHTDOWN`, RIGHTDOUBLE`, RIGHTREPEAT`, RIGHTUP `}^ M +ouseEvents] enum.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in frame coordinates.&] +[s7;i1120;a17; [%-*C@3 zdelta]-|Mouse wheel rotation delta (if event +is MOUSEWHEEL).&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s7;i1120;a17; [*/ Return value]-|If event is MOUSEIMAGE, method should +return Image to be displayed as mouse cursor.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:MouseEvent`(int`,`:`:Point`,int`,`:`:dword`):%- [@(0.0.255) virtual] +[_^`:`:Image^ Image]_[* MouseEvent]([@(0.0.255) int]_[*@3 event], [_^`:`:Point^ Point]_[*@3 p +], [@(0.0.255) int]_[*@3 zdelta], [_^`:`:dword^ dword]_[*@3 keyflags])&] +[s2;b17;a17; This method is called when mouse event happens in view +area of Ctrl not containing any child Ctrls. Default implementation +calls specific mouse event methods based on event parameter.&] +[s7;i1120;a17; [%-*C@3 event]-|Type of event define by [^topic`:`/`/CtrlCore`/src`/Ctrl`$en`-us`#`:`:Ctrl`:`:enum MouseEvents `{ BUTTON`, ACTION`, MOUSEENTER`, MOUSEMOVE`, MOUSELEAVE`, CURSORIMAGE`, MOUSEWHEEL`, DOWN`, UP`, DOUBLE`, REPEAT`, LEFTDOWN`, LEFTDOUBLE`, LEFTREPEAT`, LEFTUP`, RIGHTDOWN`, RIGHTDOUBLE`, RIGHTREPEAT`, RIGHTUP `}^ M +ouseEvents] enum.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 zdelta]-|Mouse wheel rotation delta (if event +is MOUSEWHEEL).&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s7;i1120;a17; [*/ Return value]-|If event is MOUSEIMAGE, method should +return Image to be displayed as mouse cursor.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:MouseEnter`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* MouseEnter]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyf +lags])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse cursor enters the view area of Ctrl.&] +[s7;i1120;a17; [%-*C@3 p]-|Point of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:MouseMove`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* MouseMove]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyfl +ags])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse cursor hovers above view area of Ctrl.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LeftDown`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* LeftDown]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyfla +gs])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse left button is pressed.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LeftDouble`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* LeftDouble]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyf +lags])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse left button is double`-clicked.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LeftTriple`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* LeftTriple]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyf +lags])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse left button is triple`-clicked.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LeftDrag`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* LeftDrag]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyfla +gs])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when user moves the mouse while holding left button by more than +GUI`_DragDistance pixels. [%-*@3 p] is the starting point of drag, +not the current mouse position.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LeftHold`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* LeftHold]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyfla +gs])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when user holds the mouse left button down for a while.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LeftRepeat`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* LeftRepeat]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyf +lags])&] +[s2;b17;a17; This method is repeatedly called by default implementation +of MouseEvent when mouse left button is pressed for some time, +imitating keyboard autorepeat behaviour.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LeftUp`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* LeftUp]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyflags +])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse left button is released.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RightDown`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* RightDown]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyfl +ags])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse right button is pressed.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RightDouble`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* RightDouble]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 key +flags])&] +[s2;b17;a17; This method is repeatedly called by default implementation +of MouseEvent when mouse right button is pressed for some time, +imitating keyboard autorepeat behaviour.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RightTriple`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* RightTriple]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 key +flags])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse right button is triple`-clicked.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RightDrag`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* RightDrag]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyfl +ags])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when user moves the mouse while holding right button by more +than GUI`_DragDistance pixels. [%-*@3 p] is the starting point +of drag, not the current mouse position.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RightHold`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* RightHold]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyfl +ags])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when user holds the mouse right button down for a while.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RightRepeat`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* RightRepeat]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 key +flags])&] +[s2;b17;a17; This method is repeatedly called by default implementation +of MouseEvent when mouse right button is pressed for some time, +imitating keyboard autorepeat behaviour.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RightUp`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* RightUp]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 keyflag +s])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse left button is released.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:MouseWheel`(`:`:Point`,int`,`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* MouseWheel]([_^`:`:Point^ Point]_[*@3 p], [@(0.0.255) int]_[*@3 zdelta], + [_^`:`:dword^ dword]_[*@3 keyflags])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse wheel is rotated.&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 zdelta]-|Amount of rotation.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:MouseLeave`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* MouseLeave]()&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when mouse cursor leaves view area of Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:CursorImage`(`:`:Point`,`:`:dword`):%- [@(0.0.255) virtual] +[_^`:`:Image^ Image]_[* CursorImage]([_^`:`:Point^ Point]_[*@3 p], [_^`:`:dword^ dword]_[*@3 k +eyflags])&] +[s2;b17;a17; This method is called by default implementation of MouseEvent +when the shape of mouse cursor is to be determined..&] +[s7;i1120;a17; [%-*C@3 p]-|Position of mouse cursor in view coordinates.&] +[s7;i1120;a17; [%-*C@3 keyflags]-|Combination of key flags for Shift, +Ctrl and Alt keys.&] +[s7;i1120;a17; [*/ Return value]-|Image of new cursor. Default implementation +returns Image`::Arrow().&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Key`(`:`:dword`,int`):%- [@(0.0.255) virtual] [@(0.0.255) bool]_[* Key]([_^`:`:dword^ d +word]_[*@3 key], [@(0.0.255) int]_[*@3 count])&] +[s2;b17;a17; This method provides keyboard input. When keyboard event +occurs and some of U`+`+ application Ctrls has input focus, its +Key method is called. If Key method returns true, processing +of key event is finished. If it returns false, U`+`+ calls Key +method of parent Ctrl and it repeats until either true is returned +or Ctrl has no parent. If such top`-level Ctrl is reached, U`+`+ +calls its HotKey method. Default implementation is void and returns +false.&] +[s7;i1120;a17; [%-*C@3 key]-|Key identifier. If it is less than 65536, +it indicates character code, otherwise it is key`-code. Key`-code +is combination of basic key codes and further flags indicating +state of shift keys and push/release events.&] +[s7;i1120;a17; [%-*C@3 count]-|Accumulated autorepeat count.&] +[s7;i1120;a17; [*/ Return value]-|Method should return true if further +propagation is not desirable (in most cases this indicates that +Ctrl accepted the key).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HotKey`(`:`:dword`):%- [@(0.0.255) virtual] [@(0.0.255) bool]_[* HotKey]([_^`:`:dword^ d +word]_[*@3 key])&] +[s2;b17;a17; This method is called when no Ctrl accepts key event +using Key method. Default implementation calls HotKey method +child Ctrls. If some child Ctrl returns true, method returns +true, otherwise it returns false.&] +[s7;i1120;a17; [%-*C@3 key]-|Key indentifier.&] +[s7;i1120;a17; [*/ Return value]-|Method should return true to stop +further distribution of key event via HotKey methods.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GotFocus`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* GotFocus]()&] +[s2;b17;a17; This method is called when Ctrl receives input focus. +Default implementation is void.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LostFocus`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* LostFocus]()&] +[s2;b17;a17; This method is called when Ctrl loses input focus. Default +implementation is void.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ChildMouseEvent`(`:`:Ctrl`*`,int`,`:`:Point`,int`,`:`:dword`):%- [@(0.0.255) v +irtual] [@(0.0.255) void]_[* ChildMouseEvent]([_^`:`:Ctrl^ Ctrl]_`*[*@3 child], +[@(0.0.255) int]_[*@3 event], [_^`:`:Point^ Point]_[*@3 p], [@(0.0.255) int]_[*@3 zdelta], +[_^`:`:dword^ dword]_[*@3 keyflags])&] +[s2;b17;a17; This method is invoked before the mouse [%-*@3 event] +is routed to the [%-*@3 child]. Parameters of the event are the +same as those in MouseEvent method. Default implementation calls +the parent`'s ChildMouseEvent method.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ChildGotFocus`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* ChildGotFoc +us]()&] +[s2;b17;a17; This method is invoked when any of child Ctrls receives +input focus.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ChildLostFocus`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* ChildLostF +ocus]()&] +[s2;b17;a17; This method is invoked when any of child Ctrls loses +input focus.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetAccessKeys`(`)const:%- [@(0.0.255) virtual] [_^`:`:dword^ dword]_[* Get +AccessKeys]()_[@(0.0.255) const]&] +[s2;b17;a17; Ctrl should use this method to signal presence of access +keys. Access keys are keyboard keys that can be used to access +or activate dialog functions when pressed together with Alt key. +They can be defined by application designer (usually using `& +or `\b in labels), or they are automatically synthesized using +[* AssignAccessKeys] method. If Ctrl (of one of Ctrls in its child +tree) has some access keys and those keys are letters (in range +`'A`' `- `'Z`'), they should be returned as bit value using AccessKeyBit +function. Other access keys should be indicated by bit 0 (that +means, by binary or of 1 to result). Default implementation returns +0.&] +[s7;i1120;a17; [*/ Return value]-|Bit set of access keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:AssignAccessKeys`(`:`:dword`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* AssignAccessKeys]([_^`:`:dword^ dword]_[*@3 used])&] +[s2;b17;a17; This method gives a Ctrl chance to synthesize its letter +access keys.&] +[s7;i1120;a17; [%-*C@3 used]-|Set of letter access keys that are already +used and should not be chosen by Ctrl as its access keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ChildAdded`(`:`:Ctrl`*`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* Chil +dAdded]([_^`:`:Ctrl^ Ctrl]_`*[*@3 child])&] +[s2;b17;a17; This method is invoked when child is added to Ctrl.&] +[s7;i1120;a17; [%-*C@3 child]-|Pointer to child added.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ChildRemoved`(`:`:Ctrl`*`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* ChildRemoved]([_^`:`:Ctrl^ Ctrl]_`*[*@3 child])&] +[s2;b17;a17; This method is invoked when child is removed from Ctrl.&] +[s7;i1120;a17; [%-*C@3 child]-|Pointer to child removed.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ParentChange`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* ParentChange +]()&] +[s2;b17;a17; This method is called when Ctrl is added or removed +from parent.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:State`(int`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* State]([@(0.0.255) i +nt]_[*@3 reason])&] +[s2;b17;a17; This method is used to notify Ctrls about special state`-change +events that are not covered by virtual methods. Method is called +for entire child tree of Ctrl whose state has changed.&] +[s7;i1120;a17; [%-*C@3 reason]-|Code of event. Standard reasons are +enumerated by StateReason enum.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Layout`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* Layout]()&] +[s2;b17;a17; This method is invoked when layout of Ctrl has to be +refreshed. This is usually either before window is displayed +or when the Ctrl is resized.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetMinSize`(`)const:%- [@(0.0.255) virtual] [_^`:`:Size^ Size]_[* GetMinSi +ze]()_[@(0.0.255) const]&] +[s2;b17;a17; This method should return minimal size of Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Minimal size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetStdSize`(`)const:%- [@(0.0.255) virtual] [_^`:`:Size^ Size]_[* GetStdSi +ze]()_[@(0.0.255) const]&] +[s2;b17;a17; This method should return maximal size of Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Maximal size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsShowEnabled`(`)const:%- [@(0.0.255) virtual] [@(0.0.255) bool]_[* IsShow +Enabled]()_[@(0.0.255) const]&] +[s2;b17;a17; This method indicates whether Ctrl should be painted +as enabled. Default implementation returns IsEnabled() `&`& (!parent +`|`| parent`->IsShowEnabled()), however TopWindow overloads this +function so that owner of modal dialogs while being disabled +during modal dialog lifetime are displayed with enabled Ctrls.&] +[s7;i1120;a17; [*/ Return value]-|true if Ctrl should be painted as +enabled.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:OverPaint`(`)const:%- [@(0.0.255) virtual] [@(0.0.255) int]_[* OverPaint]( +)_[@(0.0.255) const]&] +[s2;b17;a17; This method can returns non`-zero number that represents +paint extension margin of view area `- Ctrl can paint inside +this margin despite that fact that it does not belong to view. +This is useful to represent some specific skinning effect (like +glare around the button). Default implementation returns zero.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetOpaqueRect`(`):%- [@(0.0.255) virtual] [_^`:`:Rect^ Rect]_[* GetOpaqueR +ect]()&] +[s2;b17;a17; Returns the rectangle of view area that is opaque (is +completely filled when painting the widget). The default implementation +returns the whole view area if Transparent flag is set, empty +rectangle otherwise. Paint routine uses this information to optimize.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetVoidRect`(`):%- [@(0.0.255) virtual] [_^`:`:Rect^ Rect]_[* GetVoidRect]( +)&] +[s2;b17;a17; Returns the rectangle of view area that is fully transparent +(nothing is painted in that rectangle). Paint routine uses this +information to optimize.&] +[s0;:`:`:Ctrl`:`:GetTransparentFrameRects`(`):%- virtual Vector_[* GetTransparent +FrameRects]()&] +[s2;b17;a17; For transparent Ctrl returns set of frame areas that +should be painted as transparent.&] +[s7;i1120;a17; [*/ Return value]-|Vector of transparent frame areas.&] +[s0;:`:`:Ctrl`:`:GetOpaqueFrameRects`(`):%- virtual Vector_[* GetOpaqueFrameRects +]()&] +[s2;b17;a17; For transparent Ctrl returns set of frame areas that +should be painted as opaque (means that painting Ctrls `"under`" +is not needed.).&] +[s7;i1120;a17; [*/ Return value]-|Vector of opaque frame areas.&] +[s0;:`:`:Ctrl`:`:GetTransparentViewRects`(`):%- virtual Vector_[* GetTransparentV +iewRects]()&] +[s2;b17;a17; For transparent Ctrl is transparent, returns set of +view areas that should be painted as transparent.&] +[s7;i1120;a17; [*/ Return value]-|Vector of transparent view areas. +&] +[s0;:`:`:Ctrl`:`:GetOpaqueViewRects`(`):%- virtual Vector_[* GetOpaqueViewRects]( +)&] +[s2;b17;a17; For transparent Ctrl returns set of view areas that +should be painted as opaque.&] +[s7;i1120;a17; [*/ Return value]-|Vector of opaque view areas.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Close`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* Close]()&] +[s2;b17;a17; Closes top`-level Ctrl. If Ctrl is not top`-level, has +no effect. If it is and is open in host GUI (either as pop`-up +or as [^topic`:`/`/CtrlCore`/src`/TopWindow`$en`-us`#`:`:TopWindow`:`:class^ TopWin +dow]), it should close it. Default implementation closes. TopWindow +overrides this method to break modal loop instead of closing +if modal loop is performed for it.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsOcxChild`(`):%- [@(0.0.255) virtual] [@(0.0.255) bool]_[* IsOcxChild]()&] +[s2;b17;a17; Used for Ocx control implementation.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetData`(const `:`:Value`&`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* SetData]([@(0.0.255) const]_[_^`:`:Value^ Value][@(0.0.255) `&]_[*@3 dat +a])&] +[s2;b17;a17; Sets the new value to the object. Default implementation +is void.&] +[s7;i1120;a17; [*C@3 data]-|New value.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetData`(`)const:%- [@(0.0.255) virtual] [_^`:`:Value^ Value]_[* GetData]( +)_[@(0.0.255) const]&] +[s2;b17;a17; Gets current value of the object. Default implementation +returns Value() `- void value.&] +[s7;i1120;a17; [*/ Return value]-|Value of object.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetModify`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* SetModify]()&] +[s2;b17;a17; Sets modification flag.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ClearModify`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* ClearModify]( +)&] +[s2;b17;a17; Clears modification flag. Default implementation is +empty.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsModified`(`)const:%- [@(0.0.255) virtual] [@(0.0.255) bool]_[* IsModifie +d]()_[@(0.0.255) const]&] +[s2;b17;a17; Queries modification flag. Default implementation returns +false.&] +[s7;i1120;a17; [*/ Return value]-|Modification flag.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Accept`(`):%- [@(0.0.255) virtual] [@(0.0.255) bool]_[* Accept]()&] +[s2;b17;a17; This virtual method is called when value of Ctrl is +about to be accepted. Default implementation calls Accept for +all child Ctrls and returns false if any of child Ctrls returns +false, true otherwise.&] +[s2;b17;a17; Typical use is when user pressed OK button. If any Ctrl +of dialog returns false, OK is canceled.&] +[s2;b17;a17; Typical implementation of this method should test whether +current state of Ctrl (its edited value) matches requirements. +If it does, it should finish editing, accept edited value and +return true. Otherwise it should return false, &] +[s7;i1120;a17; [*/ Return value]-|Ctrl should return true if it successfully +finished editing, false otherwise.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Reject`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* Reject]()&] +[s2;b17;a17; This virtual method is called when Ctrl should abort +editing, discarding edited value. Default implementation calls +Reject for all child Ctrls.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Serialize`(`:`:Stream`&`):%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* Serialize]([_^`:`:Stream^ Stream][@(0.0.255) `&]_[*@3 s])&] +[s2;b17;a17; Serialization method. Should serialize the value of +Ctrl in a way that is suitable for dialog backup and optional +restore (e.g. when user presses Cancel button).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:AddChild`(`:`:Ctrl`*`):%- [@(0.0.255) void]_[* AddChild]([_^`:`:Ctrl^ Ctrl +]_`*[*@3 child])&] +[s2;b17;a17; Adds a child Ctrl as last one.&] +[s7;i1120;a17; [%-*C@3 child]-|Pointer to child Ctrl at the end of child +list. Note that U`+`+ never takes ownership of Ctrls `- never +calls delete for [@3 child. ]That allows using non`-heap based +Ctrls. &] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:AddChild`(`:`:Ctrl`*`,`:`:Ctrl`*`):%- [@(0.0.255) void]_[* AddChild]([_^`:`:Ctrl^ C +trl]_`*[*@3 child], [_^`:`:Ctrl^ Ctrl]_`*[*@3 insafter])&] +[s2;b17;a17; Inserts child Ctrl after another Ctrl that is already +child.&] +[s7;i1120;a17; [%-*C@3 child]-|Pointer to child Ctrl.&] +[s7;i1120;a17; [%-*C@3 insafter]-|Ctrl that will be before inserted +Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:AddChildBefore`(`:`:Ctrl`*`,`:`:Ctrl`*`):%- [@(0.0.255) void]_[* AddChil +dBefore]([_^`:`:Ctrl^ Ctrl]_`*[*@3 child], [_^`:`:Ctrl^ Ctrl]_`*[*@3 insbefore])&] +[s2;b17;a17; Inserts child Ctrl before another Ctrl that is already +child.&] +[s7;i1120;a17; [%-*C@3 child]-|Pointer to child Ctrl.&] +[s7;i1120;a17; [%-*C@3 insbefore]-|Ctrl that will be after inserted +Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RemoveChild`(`:`:Ctrl`*`):%- [@(0.0.255) void]_[* RemoveChild]([_^`:`:Ctrl^ C +trl]_`*[*@3 child])&] +[s2;b17;a17; Removes Ctrl from child list. Ctrl is never deleted.&] +[s7;i1120;a17; [%-*C@3 child]-|Child to be removed.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetParent`(`)const:%- [_^`:`:Ctrl^ Ctrl]_`*[* GetParent]()_[@(0.0.255) con +st]&] +[s2;b17;a17; Returns parent of Ctrl or NULL if Ctrl is topmost.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to parent Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetLastChild`(`)const:%- [_^`:`:Ctrl^ Ctrl]_`*[* GetLastChild]()_[@(0.0.255) c +onst]&] +[s2;b17;a17; Returns last child.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to last child or NULL if Ctrl +has no children.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetFirstChild`(`)const:%- [_^`:`:Ctrl^ Ctrl]_`*[* GetFirstChild]()_[@(0.0.255) c +onst]&] +[s2;b17;a17; Returns first child.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to first child or NULL if +Ctrl has no children.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetPrev`(`)const:%- [_^`:`:Ctrl^ Ctrl]_`*[* GetPrev]()_[@(0.0.255) const]&] +[s2;b17;a17; Returns child that is before this Ctrl in child list +or NULL if Ctrl is first or not in list.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to previous child or NULL.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetNext`(`)const:%- [_^`:`:Ctrl^ Ctrl]_`*[* GetNext]()_[@(0.0.255) const]&] +[s2;b17;a17; Returns next child that is after this Ctrl in child +list or NULL if Ctrl is last or not in list.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to next child or NULL.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsChild`(`)const:%- [@(0.0.255) bool]_[* IsChild]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|True if Ctrl has parent.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ChildFromPoint`(`:`:Point`&`)const:%- [_^`:`:Ctrl^ Ctrl]_`*[* ChildFromP +oint]([_^`:`:Point^ Point][@(0.0.255) `&]_[*@3 pt])_[@(0.0.255) const]&] +[s2;b17;a17; Checks whether opened top`-level Ctrl is foreground.&] +[s7;i1120;a17; [*/ Return value]-|True if Ctrl is foreground.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetForeground`(`):%- [@(0.0.255) void]_[* SetForeground]()&] +[s2;b17;a17; Asks platform to put top`-level Ctrl to foreground.&] +[s5;K%- [*@(0.0.255) const][*@(64) _][*^`:`:Ctrl^@(64) Ctrl][*@(64) _`*][* GetTopCtrl][*@(64) ()_ +][*@(0.0.255) const]&] +[s2;b17;a17; Gets the top`-level Ctrl, that is Ctrl that has this +Ctrl in child tree and has no parent.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to top`-level Ctrl. Can return +this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetTopCtrl`(`):%- [_^`:`:Ctrl^ Ctrl]_`*[* GetTopCtrl]()&] +[s2;b17;a17; Gets the top`-level Ctrl, that is Ctrl that has this +Ctrl in child tree and has no parent.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to top`-level Ctrl. Can return +this.&] +[s5;K%- [*@(0.0.255) const][*@(64) _][*^`:`:Ctrl^@(64) Ctrl][*@(64) _`*][* GetOwner][*@(64) ()_][*@(0.0.255) c +onst]&] +[s2;b17;a17; Returns owner of top`-level Ctrl. Example of owned window +is dialog launched from main application window. Owner is another +top`-level Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to owner top`-level Ctrl or +NULL is window is not owned.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetOwner`(`):%- [_^`:`:Ctrl^ Ctrl]_`*[* GetOwner]()&] +[s2;b17;a17; Returns owner of top`-level Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to owner top`-level Ctrl or +NULL is window is not owned.&] +[s5;K%- [*@(0.0.255) const][*@(64) _][*^`:`:Ctrl^@(64) Ctrl][*@(64) _`*][* GetTopCtrlOwner][*@(64) ( +)_][*@(0.0.255) const]&] +[s2;b17;a17; Equivalent to GetTopCtrl()`->GetOwner() call.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to owner of top`-level Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetTopCtrlOwner`(`):%- [_^`:`:Ctrl^ Ctrl]_`*[* GetTopCtrlOwner]()&] +[s2;b17;a17; Equivalent to GetTopCtrl()`->GetOwner() call.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to owner of top`-level Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetOwnerCtrl`(`):%- [_^`:`:Ctrl^ Ctrl]_`*[* GetOwnerCtrl]()&] +[s5;K:`:`:Ctrl`:`:GetOwnerCtrl`(`)const:%- [*@(0.0.255) const][*@(64) _][*^`:`:Ctrl^@(64) C +trl][*@(64) _`*][* GetOwnerCtrl][*@(64) ()_][*@(0.0.255) const]&] +[s2;b17;a17; Returns the owner Ctrl. Unlike GetOwner, it returns +actual widget that was used as `"owner`" parameter in Open or +PopUp calls.&] +[s5;K%- [*@(0.0.255) const][*@(64) _][*^`:`:TopWindow^@(64) TopWindow][*@(64) _`*][* GetTopWind +ow][*@(64) ()_][*@(0.0.255) const]&] +[s2;b17;a17; TopWindow that contains this Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to TopWindow.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetTopWindow`(`):%- [_^`:`:TopWindow^ TopWindow]_`*[* GetTopWindow]()&] +[s2;b17;a17; TopWindow that contains this Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to TopWindow.&] +[s5;K%- [*@(0.0.255) const][*@(64) _][*^`:`:TopWindow^@(64) TopWindow][*@(64) _`*][* GetMainWin +dow][*@(64) ()_][*@(0.0.255) const]&] +[s2;b17;a17; Returns main window (one with no owner) that directly +or indirectly owns this Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to main window.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetMainWindow`(`):%- [_^`:`:TopWindow^ TopWindow]_`*[* GetMainWindow]()&] +[s2;b17;a17; Returns main window (one with no owner) that directly +or indirectly owns this Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to main window.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFrame`(int`,`:`:CtrlFrame`&`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* S +etFrame]([@(0.0.255) int]_[*@3 i], [_^`:`:CtrlFrame^ CtrlFrame][@(0.0.255) `&]_[*@3 frm])&] +[s2;b17;a17; Sets Frame at given position. If there is no such position +yet, required number of NullFrame frames is added. Only reference +to frame is stored, that means that frame must exists during +the time it is used in Ctrl. Also, some frames can also be used +for multiple Ctrls.&] +[s7;i1120;a17; [%-*C@3 i]-|Position. First frame with i `=`= 0 is outermost.&] +[s7;i1120;a17; [%-*C@3 frm]-|Reference to frame.&] +[s7;i1120;a17; [*/ Return value]-|Returns `*this to allow chaining of +method calls.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFrame`(`:`:CtrlFrame`&`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* SetFra +me]([_^`:`:CtrlFrame^ CtrlFrame][@(0.0.255) `&]_[*@3 frm])&] +[s2;b17;a17; Sets frame at position 0.&] +[s7;i1120;a17; [%-*C@3 frm]-|Reference to frame.&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:AddFrame`(`:`:CtrlFrame`&`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* AddFra +me]([_^`:`:CtrlFrame^ CtrlFrame][@(0.0.255) `&]_[*@3 frm])&] +[s2;b17;a17; Adds frame at inner`-most position.&] +[s7;i1120;a17; [%-*C@3 frm]-|Reference to frame.&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetFrame`(int`)const:%- [@(0.0.255) const]_[_^`:`:CtrlFrame^ CtrlFrame][@(0.0.255) `& +]_[* GetFrame]([@(0.0.255) int]_[*@3 i]_`=_[@3 0])_[@(0.0.255) const]&] +[s2;b17;a17; Returns reference to frame at given position.&] +[s7;i1120;a17; [%-*C@3 i]-|Position.&] +[s7;i1120;a17; [*/ Return value]-|Reference to frame.&] +[s5;K%- [*^`:`:CtrlFrame^@(64) CtrlFrame][*@(64) `&_][* GetFrame][*@(64) (][*@(0.0.255) int][*@(64) _ +][*@3 i][*@(64) _`=_][*@3 0][*@(64) )]&] +[s2;b17;a17; Returns reference to frame at given position.&] +[s7;i1120;a17; [%-*C@3 i]-|Position.&] +[s7;i1120;a17; [*/ Return value]-|Reference to frame.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RemoveFrame`(int`):%- [@(0.0.255) void]_[* RemoveFrame]([@(0.0.255) int]_[*@3 i +])&] +[s2;b17;a17; Removes frame at given position.&] +[s7;i1120;a17; [%-*C@3 i]-|Index of frame.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RemoveFrame`(`:`:CtrlFrame`&`):%- [@(0.0.255) void]_[* RemoveFrame]([_^`:`:CtrlFrame^ C +trlFrame][@(0.0.255) `&]_[*@3 frm])&] +[s2;b17;a17; Removes first frame equal to [@3 frm]. Equality means +here that pointers to both frames are the same (it is same instance).&] +[s7;i1120;a17; [%-*C@3 frm]-|Frame to remove.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:InsertFrame`(int`,`:`:CtrlFrame`&`):%- [@(0.0.255) void]_[* InsertFrame]( +[@(0.0.255) int]_[*@3 i], [_^`:`:CtrlFrame^ CtrlFrame][@(0.0.255) `&]_[*@3 frm])&] +[s2;b17;a17; Inserts frame at given position.&] +[s7;i1120;a17; [%-*C@3 i]-|Position.&] +[s7;i1120;a17; [%-*C@3 frm]-|Reference to frame.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:FindFrame`(`:`:CtrlFrame`&`):%- [@(0.0.255) int]_[* FindFrame]([_^`:`:CtrlFrame^ C +trlFrame][@(0.0.255) `&]_[*@3 frm])&] +[s2;b17;a17; Finds first frame equal to [@3 frm]. Equality means here +that pointers to both frames are the same (it is same instance).&] +[s7;i1120;a17; [%-*C@3 frm]-|Frame to find.&] +[s7;i1120;a17; [*/ Return value]-|Index of frame or negative value if +frame is not found.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetFrameCount`(`)const:%- [@(0.0.255) int]_[* GetFrameCount]()_[@(0.0.255) c +onst]&] +[s2;b17;a17; Returns count of frames in Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Count of frames.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ClearFrames`(`):%- [@(0.0.255) void]_[* ClearFrames]()&] +[s2;b17;a17; Removes all frames from Ctrl. Frame at position 0 then +added and set to NullFrame.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsOpen`(`)const:%- [@(0.0.255) bool]_[* IsOpen]()_[@(0.0.255) const]&] +[s2;b17;a17; Checks whether top`-level Ctrl of this Ctrl is open.&] +[s7;i1120;a17; [*/ Return value]-|true if open.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Shutdown`(`):%- [@(0.0.255) void]_[* Shutdown]()&] +[s2;b17;a17; Sets internal flag indicating that Ctrl is being destructed. +This is rarely used to solve some destruction order problems.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsShutdown`(`)const:%- [@(0.0.255) bool]_[* IsShutdown]()_[@(0.0.255) cons +t]&] +[s2;b17;a17; Checks whether internal shutdown flag is set.&] +[s7;i1120;a17; [*/ Return value]-|True if in shutdown mode.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetPos`(`:`:Ctrl`:`:LogPos`,bool`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_ +[* SetPos]([_^`:`:Ctrl`:`:LogPos^ LogPos]_[*@3 p], [@(0.0.255) bool]_[*@3 inframe])&] +[s2;b17;a17; Sets [^topic`:`/`/CtrlCore`/src`/LogPos`$en`-us^ logical +position] of Ctrl. If Ctrl is top`-level, logical position must +be of left`-top type.&] +[s7;i1120;a17; [%-*C@3 p]-|Logical position.&] +[s7;i1120;a17; [%-*C@3 inframe]-|If true, Ctrl is placed into [^topic`:`/`/CtrlCore`/src`/AboutFrames`$en`-us^ f +rame area] instead of view area&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetPos`(`:`:Ctrl`:`:LogPos`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* SetPo +s]([_^`:`:Ctrl`:`:LogPos^ LogPos]_[*@3 p])&] +[s2;b17;a17; Sets logical position of Ctrl in view area.&] +[s7;i1120;a17; [%-*C@3 p]-|Logical position.&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetPos`(`:`:Ctrl`:`:Logc`,`:`:Ctrl`:`:Logc`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `& +]_[* SetPos]([_^`:`:Ctrl`:`:Logc^ Logc]_[*@3 x], [_^`:`:Ctrl`:`:Logc^ Logc]_[*@3 y])&] +[s2;b17;a17; Sets logical position by individual coordinates (in +view area).&] +[s7;i1120;a17; [%-*C@3 x]-|Horizontal logical position.&] +[s7;i1120;a17; [%-*C@3 y]-|Vertical logical postion.&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetPosX`(`:`:Ctrl`:`:Logc`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* SetPos +X]([_^`:`:Ctrl`:`:Logc^ Logc]_[*@3 x])&] +[s2;b17;a17; Sets horizontal logical position only (in view area).&] +[s7;i1120;a17; [%-*C@3 x]-|Horizontal logical position.&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetPosY`(`:`:Ctrl`:`:Logc`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* SetPos +Y]([_^`:`:Ctrl`:`:Logc^ Logc]_[*@3 y])&] +[s2;b17;a17; Sets vertical logical position only (in view area).&] +[s7;i1120;a17; [%-*C@3 y]-|Vertical logical position.&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetRect`(const `:`:Rect`&`):%- [@(0.0.255) void]_[* SetRect]([@(0.0.255) c +onst]_[_^`:`:Rect^ Rect][@(0.0.255) `&]_[*@3 r])&] +[s2;b17;a17; Sets left`-top logical position (in view area).&] +[s7;i1120;a17; [%-*C@3 r]-|Rectangle determines left`-top position.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetRect`(int`,int`,int`,int`):%- [@(0.0.255) void]_[* SetRect]([@(0.0.255) i +nt]_[*@3 x], [@(0.0.255) int]_[*@3 y], [@(0.0.255) int]_[*@3 cx], [@(0.0.255) int]_[*@3 cy])&] +[s2;b17;a17; Sets left`-top logical position (in view area).&] +[s7;i1120;a17; [%-*C@3 x]-|Distance between parent rectangle left`-edge +and Ctrl.&] +[s7;i1120;a17; [%-*C@3 y]-|Distance between parent rectangle top`-edge +and Ctrl.&] +[s7;i1120;a17; [%-*C@3 cx]-|Horizontal size.&] +[s7;i1120;a17; [%-*C@3 cy]-|Vertical size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetRectX`(int`,int`):%- [@(0.0.255) void]_[* SetRectX]([@(0.0.255) int]_[*@3 x +], [@(0.0.255) int]_[*@3 cx])&] +[s2;b17;a17; Sets left horizontal logical position (in view area).&] +[s7;i1120;a17; [%-*C@3 x]-|Distance between parent rectangle left`-edge +and Ctrl.&] +[s7;i1120;a17; [%-*C@3 cx]-|Horizontal size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetRectY`(int`,int`):%- [@(0.0.255) void]_[* SetRectY]([@(0.0.255) int]_[*@3 y +], [@(0.0.255) int]_[*@3 cy])&] +[s2;b17;a17; Sets top vertical logical position (in view area).&] +[s7;i1120;a17; [%-*C@3 y]-|Distance between parent rectangle top`-edge +and Ctrl.&] +[s7;i1120;a17; [%-*C@3 cy]-|Vertical size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFramePos`(`:`:Ctrl`:`:LogPos`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* S +etFramePos]([_^`:`:Ctrl`:`:LogPos^ LogPos]_[*@3 p])&] +[s2;b17;a17; Sets logical position of Ctrl in frame area.&] +[s7;i1120;a17; [%-*C@3 p]-|Logical position.&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFramePos`(`:`:Ctrl`:`:Logc`,`:`:Ctrl`:`:Logc`):%- [_^`:`:Ctrl^ Ctrl +][@(0.0.255) `&]_[* SetFramePos]([_^`:`:Ctrl`:`:Logc^ Logc]_[*@3 x], +[_^`:`:Ctrl`:`:Logc^ Logc]_[*@3 y])&] +[s2;b17;a17; Sets logical position by individual coordinates (in +frame area).&] +[s7;i1120;a17; [%-*C@3 x]-|Horizontal logical position.&] +[s7;i1120;a17; [%-*C@3 y]-|Vertical logical postion.&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFramePosX`(`:`:Ctrl`:`:Logc`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* S +etFramePosX]([_^`:`:Ctrl`:`:Logc^ Logc]_[*@3 x])&] +[s2;b17;a17; Sets horizontal logical position only (in frame area).&] +[s7;i1120;a17; [%-*C@3 x]-|Horizontal logical position.&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFramePosY`(`:`:Ctrl`:`:Logc`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* S +etFramePosY]([_^`:`:Ctrl`:`:Logc^ Logc]_[*@3 y])&] +[s2;b17;a17; Sets vertical logical position only (in frame area).&] +[s7;i1120;a17; [%-*C@3 y]-|Vertical logical position.&] +[s7;i1120;a17; [*/ Return value]-|`*this.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFrameRect`(const `:`:Rect`&`):%- [@(0.0.255) void]_[* SetFrameRect]([@(0.0.255) c +onst]_[_^`:`:Rect^ Rect][@(0.0.255) `&]_[*@3 r])&] +[s2;b17;a17; Sets left`-top logical position (in frame area).&] +[s7;i1120;a17; [%-*C@3 r]-|Rectangle determines left`-top position.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFrameRect`(int`,int`,int`,int`):%- [@(0.0.255) void]_[* SetFrameRect]( +[@(0.0.255) int]_[*@3 x], [@(0.0.255) int]_[*@3 y], [@(0.0.255) int]_[*@3 cx], +[@(0.0.255) int]_[*@3 cy])&] +[s2;b17;a17; Sets left`-top logical position (in frame area).&] +[s7;i1120;a17; [%-*C@3 x]-|Distance between parent rectangle left`-edge +and Ctrl.&] +[s7;i1120;a17; [%-*C@3 y]-|Distance between parent rectangle top`-edge +and Ctrl.&] +[s7;i1120;a17; [%-*C@3 cx]-|Horizontal size.&] +[s7;i1120;a17; [%-*C@3 cy]-|Vertical size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFrameRectX`(int`,int`):%- [@(0.0.255) void]_[* SetFrameRectX]([@(0.0.255) i +nt]_[*@3 x], [@(0.0.255) int]_[*@3 cx])&] +[s2;b17;a17; Sets left horizontal logical position (in frame area).&] +[s7;i1120;a17; [%-*C@3 x]-|Distance between parent rectangle left`-edge +and Ctrl.&] +[s7;i1120;a17; [%-*C@3 cx]-|Horizontal size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFrameRectY`(int`,int`):%- [@(0.0.255) void]_[* SetFrameRectY]([@(0.0.255) i +nt]_[*@3 y], [@(0.0.255) int]_[*@3 cy])&] +[s2;b17;a17; Sets top vertical logical position (in frame area).&] +[s7;i1120;a17; [%-*C@3 y]-|Distance between parent rectangle top`-edge +and Ctrl.&] +[s7;i1120;a17; [%-*C@3 cy]-|Vertical size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:InFrame`(`)const:%- [@(0.0.255) bool]_[* InFrame]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|true when Ctrl has position in frame +area.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:InView`(`)const:%- [@(0.0.255) bool]_[* InView]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|true when Ctrl has position in view +area.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetPos`(`)const:%- [_^`:`:Ctrl`:`:LogPos^ LogPos]_[* GetPos]()_[@(0.0.255) c +onst]&] +[s7;i1120;a17; [*/ Return value]-|Logical position of Ctrl&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RefreshLayout`(`):%- [@(0.0.255) void]_[* RefreshLayout]()&] +[s2;b17;a17; Recomputes layout for Ctrl. This includes calling FrameLayout +for all frames and calling Layout virtual method.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RefreshParentLayout`(`):%- [@(0.0.255) void]_[* RefreshParentLayout]()&] +[s2;b17;a17; If Ctrl has parent, calls parent`->RefreshLayout().&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LeftPos`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* LeftPos]([@(0.0.255) i +nt]_[*@3 a], [@(0.0.255) int]_[*@3 size]_`=_STDSIZE)&] +[s2;b17;a17; Sets left horizontal position (in view area).&] +[s7;i1120;a17; [%-*C@3 a]-|Distance from left border of parent.&] +[s7;i1120;a17; [%-*C@3 size]-|Horizontal size.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RightPos`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* RightPos]([@(0.0.255) i +nt]_[*@3 a], [@(0.0.255) int]_[*@3 size]_`=_STDSIZE)&] +[s2;b17;a17; Sets right horizontal position (in view area).&] +[s7;i1120;a17; [%-*C@3 a]-|Distance from the right border of parent.&] +[s7;i1120;a17; [%-*C@3 size]-|Horizontal size.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:TopPos`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* TopPos]([@(0.0.255) i +nt]_[*@3 a], [@(0.0.255) int]_[*@3 size]_`=_STDSIZE)&] +[s2;b17;a17; Sets top vertical position (in view area).&] +[s7;i1120;a17; [%-*C@3 a]-|Distance from the top border of parent.&] +[s7;i1120;a17; [%-*C@3 size]-|Vertical size.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:BottomPos`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* BottomPos]([@(0.0.255) i +nt]_[*@3 a], [@(0.0.255) int]_[*@3 size]_`=_STDSIZE)&] +[s2;b17;a17; Sets bottom vertical position (in view area).&] +[s7;i1120;a17; [%-*C@3 a]-|Distance from the bottom border of parent.&] +[s7;i1120;a17; [%-*C@3 size]-|Vertical size.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HSizePos`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* HSizePos]([@(0.0.255) i +nt]_[*@3 a]_`=_[@3 0], [@(0.0.255) int]_[*@3 b]_`=_[@3 0])&] +[s2;b17;a17; Sets horizontal sizing position (in view area).&] +[s7;i1120;a17; [%-*C@3 a]-|Distance from left border of parent.&] +[s7;i1120;a17; [%-*C@3 b]-|Distance from right border of parent.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:VSizePos`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* VSizePos]([@(0.0.255) i +nt]_[*@3 a]_`=_[@3 0], [@(0.0.255) int]_[*@3 b]_`=_[@3 0])&] +[s2;b17;a17; Sets vertical sizing position (in view area).&] +[s7;i1120;a17; [%-*C@3 a]-|Distance form top border of parent.&] +[s7;i1120;a17; [%-*C@3 b]-|Distance from bottom border of parent.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SizePos`(`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* SizePos]()&] +[s2;b17;a17; Same as VSizePos().HSizePos().&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HCenterPos`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* HCenterPos]( +[@(0.0.255) int]_[*@3 size]_`=_STDSIZE, [@(0.0.255) int]_[*@3 delta]_`=_[@3 0])&] +[s2;b17;a17; Horizontal centered position (in view area).&] +[s7;i1120;a17; [%-*C@3 size]-|Horizontal size.&] +[s7;i1120;a17; [%-*C@3 delta]-|Offset from centered position (rarely +used).&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:VCenterPos`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* VCenterPos]( +[@(0.0.255) int]_[*@3 size]_`=_STDSIZE, [@(0.0.255) int]_[*@3 delta]_`=_[@3 0])&] +[s2;b17;a17; Vertical centered position (in view area).&] +[s7;i1120;a17; [%-*C@3 size]-|Vertical size.&] +[s7;i1120;a17; [%-*C@3 delta]-|Offset from centered position (rarely +used).&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LeftPosZ`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* LeftPosZ]([@(0.0.255) i +nt]_[*@3 a], [@(0.0.255) int]_[*@3 size]_`=_STDSIZE)&] +[s2;b17;a17; Sets left horizontal [/ zoomed ]position (in view area). +Distances are recalculated using zoom factor to accommodate size +differences between standard font used during layout design and +actual standard font.&] +[s7;i1120;a17; [%-*C@3 a]-|Distance from the left border of parent.&] +[s7;i1120;a17; [%-*C@3 size]-|Horizontal size.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RightPosZ`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* RightPosZ]([@(0.0.255) i +nt]_[*@3 a], [@(0.0.255) int]_[*@3 size]_`=_STDSIZE)&] +[s2;b17;a17; Sets right horizontal [/ zoomed ]position (in view area). +Distances are recalculated using zoom factor to accommodate size +differences between standard font used during layout design and +actual standard font.&] +[s7;i1120;a17; [%-*C@3 a]-|Distance from the right border of parent.&] +[s7;i1120;a17; [%-*C@3 size]-|Horizontal size.&] +[s2;b17;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:TopPosZ`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* TopPosZ]([@(0.0.255) i +nt]_[*@3 a], [@(0.0.255) int]_[*@3 size]_`=_STDSIZE)&] +[s2;b17;a17; Sets top vertical [/ zoomed ]position (in view area). +Distances are recalculated using zoom factor to accommodate size +differences between standard font used during layout design and +actual standard font.&] +[s7;i1120;a17; [%-*C@3 a]-|Distance from the top border of parent.&] +[s7;i1120;a17; [%-*C@3 size]-|Vertical size.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:BottomPosZ`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* BottomPosZ]( +[@(0.0.255) int]_[*@3 a], [@(0.0.255) int]_[*@3 size]_`=_STDSIZE)&] +[s2;b17;a17; Sets bottom vertical [/ zoomed ]position (in view area). +Distances are recalculated using zoom factor to accommodate size +differences between standard font used during layout design and +actual standard font.&] +[s7;i1120;a17; [%-*C@3 a]-|Distance from the bottom border of parent.&] +[s7;i1120;a17; [%-*C@3 size]-|Vertical size.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HSizePosZ`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* HSizePosZ]([@(0.0.255) i +nt]_[*@3 a]_`=_[@3 0], [@(0.0.255) int]_[*@3 b]_`=_[@3 0])&] +[s2;b17;a17; Sets vertical [/ zoomed ]sizing position (in view area). +Distances are recalculated using zoom factor to accommodate size +differences between standard font used during layout design and +actual standard font.&] +[s7;i1120;a17; [%-*C@3 a]-|Distance form top border of parent.&] +[s7;i1120;a17; [%-*C@3 b]-|Distance from bottom border of parent.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:VSizePosZ`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* VSizePosZ]([@(0.0.255) i +nt]_[*@3 a]_`=_[@3 0], [@(0.0.255) int]_[*@3 b]_`=_[@3 0])&] +[s2;b17;a17; Sets vertical [/ zoomed ]sizing position (in view area). +Distances are recalculated using zoom factor to accommodate size +differences between standard font used during layout design and +actual standard font.&] +[s7;i1120;a17; [%-*C@3 a]-|Distance form top border of parent.&] +[s7;i1120;a17; [%-*C@3 b]-|Distance from bottom border of parent.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HCenterPosZ`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* HCenterPos +Z]([@(0.0.255) int]_[*@3 size]_`=_STDSIZE, [@(0.0.255) int]_[*@3 delta]_`=_[@3 0])&] +[s2;b17;a17; Horizontal centered [/ zoomed ]position (in view area). +Distances are recalculated using zoom factor to accommodate size +differences between standard font used during layout design and +actual standard font.&] +[s7;i1120;a17; [%-*C@3 size]-|Horizontal size.&] +[s7;i1120;a17; [%-*C@3 delta]-|Offset from centered position (rarely +used).&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:VCenterPosZ`(int`,int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* VCenterPos +Z]([@(0.0.255) int]_[*@3 size]_`=_STDSIZE, [@(0.0.255) int]_[*@3 delta]_`=_[@3 0])&] +[s2;b17;a17; Vertical centered [/ zoomed] position (in view area). +Distances are recalculated using zoom factor to accommodate size +differences between standard font used during layout design and +actual standard font.&] +[s7;i1120;a17; [%-*C@3 size]-|Vertical size.&] +[s7;i1120;a17; [%-*C@3 delta]-|Offset from centered position (rarely +used).&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetRect`(`)const:%- [_^`:`:Rect^ Rect]_[* GetRect]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|Returns current position in parent. +It is either position in view or frame coordinates.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetScreenRect`(`)const:%- [_^`:`:Rect^ Rect]_[* GetScreenRect]()_[@(0.0.255) c +onst]&] +[s7;i1120;a17; [*/ Return value]-|Returns current position in absolute +screen coordinates.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetView`(`)const:%- [_^`:`:Rect^ Rect]_[* GetView]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|Returns position of view rectangle +in frame coordinates.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetScreenView`(`)const:%- [_^`:`:Rect^ Rect]_[* GetScreenView]()_[@(0.0.255) c +onst]&] +[s7;i1120;a17; [*/ Return value]-|Returns position of view rectangle +in absolute screen coordinates.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetSize`(`)const:%- [_^`:`:Size^ Size]_[* GetSize]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|Returns size of view rectangle of +Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetVisibleScreenRect`(`)const:%- [_^`:`:Rect^ Rect]_[* GetVisibleScreenR +ect]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|Returns current position in parent +intersected with either parent`'s visible screen rectangle for +frame Ctrl (as obtained using GetVisibleScreenRect) or parent`'s +screen view rectangle for view Ctrl (obtained using GetVisibleScreenView). +This method is useful when rectangle of Ctrl exceeds it`'s parent +area `- in this case this method returns part of Ctrl that is +not clipped out by parent`'s are limits.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetVisibleScreenView`(`)const:%- [_^`:`:Rect^ Rect]_[* GetVisibleScreenV +iew]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|Returns current position of view area +intersected with either parent`'s visible screen rectangle for +frame Ctrl (as obtained using GetVisibleScreenRect) or parent`'s +screen view rectangle for view Ctrl (obtained using GetVisibleScreenView). +This method is useful when rectangle of Ctrl exceeds it`'s parent +area `- in this case this method returns part of Ctrl view that +is not clipped out by parent`'s are limits.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:AddFrameSize`(int`,int`)const:%- [_^`:`:Size^ Size]_[* AddFrameSize]([@(0.0.255) i +nt]_[*@3 cx], [@(0.0.255) int]_[*@3 cy])_[@(0.0.255) const]&] +[s2;b17;a17; Computes size of Ctrl for given size of view and actual +set of frames.&] +[s7;i1120;a17; [%-*C@3 cx]-|Width.&] +[s7;i1120;a17; [%-*C@3 cy]-|Height.&] +[s7;i1120;a17; [*/ Return value]-|Size of Ctrl that would have requested +view size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:AddFrameSize`(`:`:Size`)const:%- [_^`:`:Size^ Size]_[* AddFrameSize]([_^`:`:Size^ S +ize]_[*@3 sz])_[@(0.0.255) const]&] +[s2;b17;a17; Same as AddFrameSize(sz.cx, sz.cy).&] +[s7;i1120;a17; [%-*C@3 sz]-|Size.&] +[s7;i1120;a17; [*/ Return value]-|Size of Ctrl that would have requested +view size.&] +[s5;K%- [*@(0.0.255) void][*@(64) _][* Refresh][*@(64) (][*@(0.0.255) const][*@(64) _][*^`:`:Rect^@(64) R +ect][*@(64) `&_][*@3 area][*@(64) )]&] +[s2;b17;a17; Marks requested rectangle of view area for repainting. +Actual repaint is deferred for performance reasons.&] +[s7;i1120;a17; [%-*C@3 r]-|Rectangle in view.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Refresh`(int`,int`,int`,int`):%- [@(0.0.255) void]_[* Refresh]([@(0.0.255) i +nt]_[*@3 x], [@(0.0.255) int]_[*@3 y], [@(0.0.255) int]_[*@3 cx], [@(0.0.255) int]_[*@3 cy])&] +[s2;b17;a17; Marks requested rectangle of view area for repainting. +Actual repaint is deferred for performance reasons.&] +[s7;i1120;a17; [%-*C@3 x]-|Left position of rectangle.&] +[s7;i1120;a17; [%-*C@3 y]-|Top position of rectangle.&] +[s7;i1120;a17; [%-*C@3 cx]-|Width.&] +[s7;i1120;a17; [%-*C@3 cy]-|Height.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Refresh`(`):%- [@(0.0.255) void]_[* Refresh]()&] +[s2;b17;a17; Marks whole view area for repainting.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsFullRefresh`(`)const:%- [@(0.0.255) bool]_[* IsFullRefresh]()_[@(0.0.255) c +onst]&] +[s7;i1120;a17; [*/ Return value]-|true when whole view area is marked +for repainting but was not repainted yet.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RefreshFrame`(const `:`:Rect`&`):%- [@(0.0.255) void]_[* RefreshFrame]([@(0.0.255) c +onst]_[_^`:`:Rect^ Rect][@(0.0.255) `&]_[*@3 r])&] +[s2;b17;a17; Marks requested rectangle of frame area for repainting. +Actual repainting is deferred for performance reasons.&] +[s7;i1120;a17; [%-*C@3 r]-|Area to repaint.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RefreshFrame`(int`,int`,int`,int`):%- [@(0.0.255) void]_[* RefreshFrame]( +[@(0.0.255) int]_[*@3 x], [@(0.0.255) int]_[*@3 y], [@(0.0.255) int]_[*@3 cx], +[@(0.0.255) int]_[*@3 cy])&] +[s2;b17;a17; Marks requested rectangle of frame area for repainting. +Actual repaint is deferred for performance reasons.&] +[s7;i1120;a17; [%-*C@3 x]-|Left position of rectangle.&] +[s7;i1120;a17; [%-*C@3 y]-|Top position of rectangle.&] +[s7;i1120;a17; [%-*C@3 cx]-|Width.&] +[s7;i1120;a17; [%-*C@3 cy]-|Height.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RefreshFrame`(`):%- [@(0.0.255) void]_[* RefreshFrame]()&] +[s2;b17;a17; Marks whole Ctrl area for repainting.&] +[s5;K%- [*@(0.0.255) void][*@(64) _][* ScrollView][*@(64) (][*@(0.0.255) const][*@(64) _][*^`:`:Rect^@(64) R +ect][*@(64) `&_][*@3 `_r][*@(64) , ][*@(0.0.255) int][*@(64) _][*@3 dx][*@(64) , +][*@(0.0.255) int][*@(64) _][*@3 dy][*@(64) )]&] +[s2;b17;a17; Marks requested view rectangle for repainting, indicating +that part of this repaint can be done by scrolling current content +of rectangle. Note that actual scroll is deferred to repaint +and that U`+`+ is still allowed to solve the situation by repainting +rather than scrolling.&] +[s7;i1120;a17; [%-*C@3 r]-|Area for repainting.&] +[s7;i1120;a17; [%-*C@3 dx]-|Horizontal scroll.&] +[s7;i1120;a17; [%-*C@3 dy]-|Vertical scroll.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ScrollView`(int`,int`,int`,int`,int`,int`):%- [@(0.0.255) void]_[* Scrol +lView]([@(0.0.255) int]_[*@3 x], [@(0.0.255) int]_[*@3 y], [@(0.0.255) int]_[*@3 cx], +[@(0.0.255) int]_[*@3 cy], [@(0.0.255) int]_[*@3 dx], [@(0.0.255) int]_[*@3 dy])&] +[s2;b17;a17; Marks requested view rectangle for repainting, indicating +that part of this repaint can be done by scrolling current content +of rectangle. Note that actual scroll is deferred to repaint +and that U`+`+ is still allowed to solve the situation by repainting +rather than scrolling.&] +[s7;i1120;a17; [%-*C@3 r]-|Area for repainting.&] +[s7;i1120;a17; [%-*C@3 x]-|Left position of rectangle.&] +[s7;i1120;a17; [%-*C@3 y]-|Top position of rectangle.&] +[s7;i1120;a17; [%-*C@3 cx]-|Width.&] +[s7;i1120;a17; [%-*C@3 cy]-|Height.&] +[s7;i1120;a17; [%-*C@3 dx]-|Horizontal scroll.&] +[s7;i1120;a17; [%-*C@3 dy]-|Vertical scroll.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ScrollView`(int`,int`):%- [@(0.0.255) void]_[* ScrollView]([@(0.0.255) int +]_[*@3 dx], [@(0.0.255) int]_[*@3 dy])&] +[s2;b17;a17; Marks while view area for repainting, indicating that +part of this repaint can be done by scrolling current content +of rectangle. Note that actual scroll is deferred to repaint +and that U`+`+ is still allowed to solve the situation by repainting +rather than scrolling.&] +[s7;i1120;a17; [%-*C@3 dx]-|Horizontal scroll.&] +[s7;i1120;a17; [%-*C@3 dy]-|Vertical scroll.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ScrollView`(const `:`:Rect`&`,`:`:Size`):%- [@(0.0.255) void]_[* ScrollV +iew]([@(0.0.255) const]_[_^`:`:Rect^ Rect][@(0.0.255) `&]_[*@3 r], [_^`:`:Size^ Size]_[*@3 de +lta])&] +[s2;b17;a17; Same as ScrollView(r, delta.cx, delta.cy).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ScrollView`(`:`:Size`):%- [@(0.0.255) void]_[* ScrollView]([_^`:`:Size^ Si +ze]_[*@3 delta])&] +[s2;b17;a17; Same as ScrollView(delta.cx, delta.cy).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Sync`(`):%- [@(0.0.255) void]_[* Sync]()&] +[s2;b17;a17; Forces immediate repainting of areas marked using Refresh, +RefreshFrame or ScrollView methods.&] +[s5;K%- [*@(0.0.255) void][*@(64) _][* Sync][*@(64) (][*@(0.0.255) const][*@(64) _][*^`:`:Rect^@(64) R +ect][*@(64) `&_][*@3 sr][*@(64) )]&] +[s2;b17;a17; Forces immediate repainting of areas marked using Refresh, +RefreshFrame or ScrollView methods, limited with intersection +of given rectangle.&] +[s7;i1120;a17; [%-*C@3 r]-|Rectangle.&] +[s5;K:`:`:Ctrl`:`:OverrideCursor`(const`:`:Image`&`):%- [*^`:`:Image^@(64) Image][*@(64) _ +][* OverrideCursor][*@(64) (][*@(0.0.255) const][*@(64) _][*^`:`:Image^@(64) Image][*@(64) `& +_][*@3 m][*@(64) )]&] +[s2;b17;a17; Overrides mouse cursor to [%-*@3 m]. To end the override, +call it again with the Image returned by the override call.&] +[s5;K%- [*@(0.0.255) void][*@(64) _][* DrawCtrl][*@(64) (][*^`:`:Draw^@(64) Draw][*@(64) `&_][*@3 w +][*@(64) , ][*@(0.0.255) int][*@(64) _][*@3 x][*@(64) , ][*@(0.0.255) int][*@(64) _][*@3 y][*@(64) ) +]&] +[s2;b17;a17; Draws Ctrl at specified position. This is intended for +utility purposes like taking screen`-shots. This version Draws +Ctrl [/ without] background (supplied by parent).&] +[s7;i1120;a17; [%-*C@3 w]-|Target Draw.&] +[s7;i1120;a17; [%-*C@3 x, ][*C@3 y]-|Position.&] +[s5;K%- [*@(0.0.255) void][*@(64) _][* DrawCtrlWithParent][*@(64) (][*^`:`:Draw^@(64) Draw][*@(64) `& +_][*@3 w][*@(64) , ][*@(0.0.255) int][*@(64) _][*@3 x][*@(64) , ][*@(0.0.255) int][*@(64) _][*@3 y][*@(64) ) +]&] +[s2;b17;a17; Draws Ctrl at specified position. This is intended for +utility purposes like taking screen`-shots. This version Draws +Ctrl [/ with] background (supplied by parent).&] +[s7;i1120;a17; [%-*C@3 w]-|Target Draw.&] +[s7;i1120;a17; [%-*C@3 x, ][*C@3 y]-|Position.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HasChild`(`:`:Ctrl`*`)const:%- [@(0.0.255) bool]_[* HasChild]([_^`:`:Ctrl^ C +trl]_`*[*@3 ctrl])_[@(0.0.255) const]&] +[s2;b17;a17; Tests whether Ctrl has specified [/ direct] child.&] +[s7;i1120;a17; [%-*C@3 ctrl]-|Child.&] +[s7;i1120;a17; [*/ Return value]-|true if ctrl is child.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HasChildDeep`(`:`:Ctrl`*`)const:%- [@(0.0.255) bool]_[* HasChildDeep]([_^`:`:Ctrl^ C +trl]_`*[*@3 ctrl])_[@(0.0.255) const]&] +[s2;b17;a17; Tests whether Ctrl has specified ctrl in its child tree +(direct or indirect).&] +[s7;i1120;a17; [%-*C@3 ctrl]-|Child.&] +[s7;i1120;a17; [*/ Return value]-|true if ctrl is in child tree.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IgnoreMouse`(bool`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* IgnoreMouse]([@(0.0.255) b +ool]_[*@3 b]_`=_[@(0.0.255) true])&] +[s2;b17;a17; Sets ignore`-mouse flag. When active, Ctrl is ignored +for mouse input. That is important for static Ctrls that cover +other Ctrls, like LabelBox `- this flag ensures, that mouse input +is not consumed by LabelBox, but is distributed to Ctrls that +lay inside it.&] +[s7;i1120;a17; [%-*C@3 b]-|Value of flag.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:NoIgnoreMouse`(`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* NoIgnoreMouse]() +&] +[s2;b17;a17; Same as IgnoreMouse(false).&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HasMouse`(`)const:%- [@(0.0.255) bool]_[* HasMouse]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|true when Ctrl is target for mouse +events.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HasMouseInFrame`(const `:`:Rect`&`):%- [@(0.0.255) bool]_[* HasMouseInFr +ame]([@(0.0.255) const]_[_^`:`:Rect^ Rect][@(0.0.255) `&]_[*@3 r])&] +[s7;i1120;a17; [%-*C@3 r]-|rectangle in frame area.&] +[s7;i1120;a17; [*/ Return value]-|true when Ctrl is target for mouse +events and mouse pointer is inside specified frame area rectangle.&] +[s5;K%- [*@(0.0.255) bool][*@(64) _][* HasMouseIn][*@(64) (][*@(0.0.255) const][*@(64) _][*^`:`:Rect^@(64) R +ect][*@(64) `&_][*@3 r][*@(64) )]&] +[s7;i1120;a17; [%-*C@3 r]-|rectangle in view area.&] +[s7;i1120;a17; [*/ Return value]-|true when Ctrl is target for mouse +events and mouse pointer is inside specified view area rectangle.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetMouseCtrl`(`):%- [@(0.0.255) static] [_^`:`:Ctrl^ Ctrl]_`*[* GetMouseCt +rl]()&] +[s7;i1120;a17; [*/ Return value]-|Returns current target for mouse events.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IgnoreMouseClick`(`):%- [@(0.0.255) static] [@(0.0.255) void]_[* IgnoreMou +seClick]()&] +[s2;b17;a17; Forces framework to ignore all mouse events till next +button`-up event. This is good tool to solve some corner cases, +like popup window closed by button click when mouse pointer is +over its owner as well (TopWindow`::Close calls this function).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IgnoreMouseUp`(`):%- [@(0.0.255) static] [@(0.0.255) void]_[* IgnoreMouseU +p]()&] +[s2;b17;a17; Invokes IgnoreMouseClick if some of mouse buttons is +pressed.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetCapture`(`):%- [@(0.0.255) bool]_[* SetCapture]()&] +[s2;b17;a17; Sets mouse capture for Ctrl. This method should be called +in MouseLeft or MouseRight methods only. Ctrl will receive all +mouse input until ReleaseCapture is called or mouse button is +released.&] +[s7;i1120;a17; [*/ Return value]-|True when SetCapture was successful +(usually you can ignore this return value).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ReleaseCapture`(`):%- [@(0.0.255) bool]_[* ReleaseCapture]()&] +[s2;b17;a17; Release Ctrl`'s mouse capture.&] +[s7;i1120;a17; [*/ Return value]-|True when mouse capture was released.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HasCapture`(`)const:%- [@(0.0.255) bool]_[* HasCapture]()_[@(0.0.255) cons +t]&] +[s7;i1120;a17; [*/ Return value]-|True if Ctrl has mouse capture.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ReleaseCtrlCapture`(`):%- [@(0.0.255) static] [@(0.0.255) bool]_[* Release +CtrlCapture]()&] +[s2;b17;a17; If any of application`'s Ctrls has mouse capture, it +is released.&] +[s7;i1120;a17; [*/ Return value]-|True if mouse capture was released.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetFocus`(`):%- [@(0.0.255) bool]_[* SetFocus]()&] +[s2;b17;a17; Sets keyboard input focus to the Ctrl. Ctrl is first +to receive keyboard events via Key method as long as it has keyboard +input focus. When Ctrl denies keyboard event (by returning false +from Key method), it is passed to its parent`'s Key method and +so on.&] +[s7;i1120;a17; [*/ Return value]-|True if setting focus was successful.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HasFocus`(`)const:%- [@(0.0.255) bool]_[* HasFocus]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|True if Ctrl has keyboard input focus.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HasFocusDeep`(`)const:%- [@(0.0.255) bool]_[* HasFocusDeep]()_[@(0.0.255) c +onst]&] +[s7;i1120;a17; [*/ Return value]-|True if Ctrl or any of its descendants +has focus or is equal to GetOwnerCtrl of any active popup.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:WantFocus`(bool`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* WantFocus]([@(0.0.255) b +ool]_[*@3 ft]_`=_[@(0.0.255) true])&] +[s2;b17;a17; Indicates whether Ctrl wants focus to be passed to it +by U`+`+, e.g. when navigating through the dialog using Tab (or +Shift`+Tab) key.&] +[s7;i1120;a17; [%-*C@3 ft]-|true to indicate that Ctrl wants focus.&] +[s7;i1120;a17; [*/ Return value]-|Same Ctrl for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:NoWantFocus`(`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* NoWantFocus]()&] +[s7;i1120;a17; [*/ Return value]-|Same Ctrl for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsWantFocus`(`)const:%- [@(0.0.255) bool]_[* IsWantFocus]()_[@(0.0.255) co +nst]&] +[s2;b17;a17;%- Checks whether Ctrl has WantFocus acti.&] +[s7;i1120;a17; [*/ Return value]-|true, when Ctrl wants focus.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:InitFocus`(bool`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* InitFocus]([@(0.0.255) b +ool]_[*@3 ft]_`=_[@(0.0.255) true])&] +[s2;b17;a17; Indicates that Ctrl is eligible to obtain focus upon +opening of dialog or in other similar situations.&] +[s7;i1120;a17; [%-*C@3 ft]-|true to indicate Ctrl is eligible.&] +[s7;i1120;a17; [*/ Return value]-|Same Ctrl for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:NoInitFocus`(`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* NoInitFocus]()&] +[s2;b17;a17; Same as InitFocus(false).&] +[s7;i1120;a17; [*/ Return value]-|Same Ctrl for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsInitFocus`(`):%- [@(0.0.255) bool]_[* IsInitFocus]()&] +[s7;i1120;a17; [*/ Return value]-|true when Ctrl wants init focus.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetWantFocus`(`):%- [@(0.0.255) bool]_[* SetWantFocus]()&] +[s2;b17;a17; If Ctrl wants focus (WantFocus(true) was called for +it), set focus to Ctrl, otherwise nothing happens.&] +[s7;i1120;a17; [*/ Return value]-|true if focus was set.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetFocusChild`(`)const:%- [_^`:`:Ctrl^ Ctrl]_`*[* GetFocusChild]()_[@(0.0.255) c +onst]&] +[s2;b17;a17; If any immediate child of Ctrl has focus, returns pointer +to it.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to child with focus or NULL +if no such exists.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetFocusChildDeep`(`)const:%- [_^`:`:Ctrl^ Ctrl]_`*[* GetFocusChildDeep]( +)_[@(0.0.255) const]&] +[s2;b17;a17; If any child of Ctrl`'s child tree has focus, returns +pointer to it.&] +[s7;i1120;a17; [*/ Return value]-|&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:CancelModeDeep`(`):%- [@(0.0.255) void]_[* CancelModeDeep]()&] +[s2;b17;a17; Calls CancelMode virtual method for Ctrl and all of +its descendants.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetCaret`(int`,int`,int`,int`):%- [@(0.0.255) void]_[* SetCaret]([@(0.0.255) i +nt]_[*@3 x], [@(0.0.255) int]_[*@3 y], [@(0.0.255) int]_[*@3 cx], [@(0.0.255) int]_[*@3 cy])&] +[s2;b17;a17; Place caret rectangle block at given position in view +area. Caret rectangle is full flashing box and usually indicates +place where text is to entered. Ctrl can have just one caret. +Only Ctrl with focus has its caret displayed (also means that +you do not need to remove caret when Ctrl goes out of focus).&] +[s7;i1120;a17; [%-*C@3 x]-|X position.&] +[s7;i1120;a17; [%-*C@3 y]-|Y position.&] +[s7;i1120;a17; [%-*C@3 cx]-|Horizontal size.&] +[s7;i1120;a17; [%-*C@3 cy]-|Vertical size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetCaret`(const `:`:Rect`&`):%- [@(0.0.255) void]_[* SetCaret]([@(0.0.255) c +onst]_[_^`:`:Rect^ Rect][@(0.0.255) `&]_[*@3 r])&] +[s2;b17;a17; Place caret rectangle block at given position in view +area. Caret rectangle is full flashing box and usually indicates +place where text is to entered. Ctrl can have just one caret. +Only Ctrl with focus has its caret displayed (also means that +you do not need to remove caret when Ctrl goes out of focus).&] +[s7;i1120;a17; [%-*C@3 r]-|Caret block rectangle.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:KillCaret`(`):%- [@(0.0.255) void]_[* KillCaret]()&] +[s2;b17;a17; Removes caret from Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetFocusCtrl`(`):%- [@(0.0.255) static] [_^`:`:Ctrl^ Ctrl]_`*[* GetFocusCt +rl]()&] +[s7;i1120;a17; [*/ Return value]-|Ctrl that has focus or NULL if no +Ctrl of application has it.&] +[s5;K%- [*@(64) static ][*@(0.0.255) bool][*@(64) _][* IterateFocusForward][*@(64) (][*^`:`:Ctrl^@(64) C +trl][*@(64) _`*][*@3 ctrl][*@(64) , ][*^`:`:Ctrl^@(64) Ctrl][*@(64) _`*][*@3 top][*@(64) , +][*@(0.0.255) bool][*@(64) _][*@3 noframe][*@(64) _`=_false, ][*@(0.0.255) bool][*@(64) _][*@3 i +nit][*@(64) _`=_false)]&] +[s2;b17;a17; Tries to move focus to next `"appropriate`" Ctrl, like +when Tab key is pressed in the dialog. Appropriate Ctrl needs +to have WantFocus flag, be visible and enabled.&] +[s7;i1120;a17; [%-*C@3 ctrl]-|Ctrl with focus.&] +[s7;i1120;a17; [%-*C@3 top]-|Top Ctrl `- function cycles only between +this Ctrl subtree.&] +[s7;i1120;a17; [%-*C@3 noframe]-|Indicates that frame Ctrls are to be +excluded.&] +[s7;i1120;a17; [*/ Return value]-|true when focus was successfully moved.&] +[s5;K%- [*@(64) static ][*@(0.0.255) bool][*@(64) _][* IterateFocusBackward][*@(64) (][*^`:`:Ctrl^@(64) C +trl][*@(64) _`*][*@3 ctrl][*@(64) , ][*^`:`:Ctrl^@(64) Ctrl][*@(64) _`*][*@3 top][*@(64) , +][*@(0.0.255) bool][*@(64) _][*@3 noframe][*@(64) _`=_false)]&] +[s2;b17;a17; Tries to move focus to previous appropriate Ctrl, like +when Tab key is pressed in the dialog. `"Appropriate`" Ctrl needs +to have WantFocus flag, be visible and enabled.&] +[s7;i1120;a17; [%-*C@3 ctrl]-|Ctrl with focus.&] +[s7;i1120;a17; [%-*C@3 top]-|Top Ctrl `- function cycles only between +this Ctrl subtree.&] +[s7;i1120;a17; [%-*C@3 noframe]-|Indicates that frame Ctrls are to be +excluded.&] +[s7;i1120;a17; [*C@3 init]-|Ctrl must have InitFocus flag.&] +[s7;i1120;a17; [*/ Return value]-|true when focus was successfully moved.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:AccessKeyBit`(`:`:byte`):%- [@(0.0.255) static] [_^`:`:dword^ dword]_[* Ac +cessKeyBit]([_^`:`:byte^ byte]_[*@3 accesskey])&] +[s2;b17;a17; Returns bit`-mask for specified access`-key.&] +[s7;i1120;a17; [%-*C@3 accesskey]-|Access`-key. It should be plain ASCII +value of access`-key.&] +[s7;i1120;a17; [*/ Return value]-|Access`-key bitmask. Note that only +`'A`' `- `'Z`' have distinct bit`-masks as those are only access`-keys +distributed automatically.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetAccessKeysDeep`(`)const:%- [_^`:`:dword^ dword]_[* GetAccessKeysDeep]( +)_[@(0.0.255) const]&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetAccessKeysDeep`(`)const:%- [_^`:`:dword^ dword]_[* GetAccessKeysDeep]( +)_[@(0.0.255) const]&] +[s2;b17;a17; Returns binary or of Ctrl`'s GetAccessKey method results +with the result of calling GetAccessKeyDeep for all children. +In other words, returns key coverage for the whole Ctrl tree.&] +[s7;i1120;a17; [*/ Return value]-|Access`-keys used by Ctrl and its +descendants.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:DistributeAccessKeys`(`):%- [@(0.0.255) void]_[* DistributeAccessKeys]() +&] +[s2;b17;a17; Triggers automatic distribution of access keys. This +is implemented as gathering all already used access keys using +GetAccessKeys method and then using AssignAccessKeys method with +this value to distribute rest of keys (in other words, it is +equivalent of AssignAccessKeys(GetAccessKeys())).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:RefreshAccessKeys`(`):%- [@(0.0.255) void]_[* RefreshAccessKeys]()&] +[s2;b17;a17; Invokes Refresh for this Ctrl or any descendant with +any access`-key assigned.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:VisibleAccessKeys`(`):%- [@(0.0.255) bool]_[* VisibleAccessKeys]()&] +[s7;i1120;a17; [*/ Return value]-|True if according to current access`-key +model there should be visible graphical representation (usually +underline) of access`-keys.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Show`(bool`):%- [@(0.0.255) void]_[* Show]([@(0.0.255) bool]_[*@3 show]_`=_[@(0.0.255) t +rue])&] +[s2;b17;a17; Sets visibility flag for Ctrl.&] +[s7;i1120;a17; [%-*C@3 show]-|true indicates that Ctrl should be visible.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Hide`(`):%- [@(0.0.255) void]_[* Hide]()&] +[s2;b17;a17; Same as Show(false).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsShown`(`)const:%- [@(0.0.255) bool]_[* IsShown]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|visibility flag for Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsVisible`(`)const:%- [@(0.0.255) bool]_[* IsVisible]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|true if Ctrl is currently visible +on the screen. Ctrl is visible if it has visibility flag set, +its parent is visible and its top`-level Ctrl is open.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Enable`(bool`):%- [@(0.0.255) void]_[* Enable]([@(0.0.255) bool]_[*@3 enable +]_`=_[@(0.0.255) true])&] +[s2;b17;a17; Enables or disables Ctrl.&] +[s7;i1120;a17; [%-*C@3 enable]-|true indicates that Ctrl should be enabled.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Disable`(`):%- [@(0.0.255) void]_[* Disable]()&] +[s2;b17;a17; Same as Enable(false).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsEnabled`(`)const:%- [@(0.0.255) bool]_[* IsEnabled]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|true if Ctrl is enabled.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetEditable`(bool`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* SetEditable]([@(0.0.255) b +ool]_[*@3 editable]_`=_[@(0.0.255) true])&] +[s2;b17;a17; Sets editable or read`-only mode of Ctrl. Specific Ctrls +can check this flag using IsEditable method and behave accordingly.&] +[s7;i1120;a17; [%-*C@3 editable]-|true indicates that Ctrl is editable.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetReadOnly`(`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* SetReadOnly]()&] +[s2;b17;a17; Same as SetEditable(false).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsEditable`(`)const:%- [@(0.0.255) bool]_[* IsEditable]()_[@(0.0.255) cons +t]&] +[s7;i1120;a17; [*/ Return value]-|true if Ctrl is editable.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsReadOnly`(`)const:%- [@(0.0.255) bool]_[* IsReadOnly]()_[@(0.0.255) cons +t]&] +[s2;b17;a17; Same as !IsEditable().&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ResetModify`(`):%- [@(0.0.255) void]_[* ResetModify]()&] +[s2;b17;a17; Resets modify flag.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsModifySet`(`)const:%- [@(0.0.255) bool]_[* IsModifySet]()_[@(0.0.255) co +nst]&] +[s7;i1120;a17; [*/ Return value]-|true if modify flag is set.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:UpdateRefresh`(`):%- [@(0.0.255) void]_[* UpdateRefresh]()&] +[s2;b17;a17; Calls both Update and Refresh methods.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Update`(`):%- [@(0.0.255) void]_[* Update]()&] +[s2;b17;a17; Same as SetModify().&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Action`(`):%- [@(0.0.255) void]_[* Action]()&] +[s2;b17;a17; Invokes default Ctrl callback `- WhenAction.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:UpdateAction`(`):%- [@(0.0.255) void]_[* UpdateAction]()&] +[s2;b17;a17; Calls Update and then Action.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:UpdateActionRefresh`(`):%- [@(0.0.255) void]_[* UpdateActionRefresh]()&] +[s2;b17;a17; Calls Update, then Action, then Refresh. Typically called +after user changes values of Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:BackPaint`(int`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* BackPaint]([@(0.0.255) i +nt]_[*@3 bp]_`=_FULLBACKPAINT)&] +[s2;b17;a17; Activates back`-paint mode for Ctrl.&] +[s7;i1120;a17; [%-*C@3 bp]-|Back`-paint mode.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:TransparentBackPaint`(`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* Transpare +ntBackPaint]()&] +[s7;i1120;a17; [*/ Return value]-|BackPaint(TRANSPARENTBACKPAINT).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:NoBackPaint`(`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* NoBackPaint]()&] +[s7;i1120;a17; [*/ Return value]-|BackPaint(NOBACKPAINT).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetBackPaint`(`):%- [@(0.0.255) int]_[* GetBackPaint]()&] +[s7;i1120;a17; [*/ Return value]-|Current back`-paint mode of Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Transparent`(bool`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* Transparent]([@(0.0.255) b +ool]_[*@3 bp]_`=_[@(0.0.255) true])&] +[s2;b17;a17; Sets transparency flag of Ctrl. If transparency flag +is disabled, U`+`+ can paint Ctrl in more effective way.&] +[s7;i1120;a17; [%-*C@3 bp]-|Transparency flag.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:NoTransparent`(`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* NoTransparent]() +&] +[s7;i1120;a17; [*/ Return value]-|Transparent(false).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsTransparent`(`)const:%- [@(0.0.255) bool]_[* IsTransparent]()_[@(0.0.255) c +onst]&] +[s7;i1120;a17; [*/ Return value]-|Value of transparency flag.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ActiveX`(bool`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* ActiveX]([@(0.0.255) b +ool]_[*@3 ax]_`=_[@(0.0.255) true])&] +[s2;b17;a17; Special flag used for ActiveX Ctrls implementation.&] +[s0; Windows specific.&] +[s7;i1120;a17; [%-*C@3 ax]-|true `- Ctrl is ActiveX control&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:NoActiveX`(`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* NoActiveX]()&] +[s7;i1120;a17; [*/ Return value]-|ActiveX(false).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsActiveX`(`)const:%- [@(0.0.255) bool]_[* IsActiveX]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|Value of ActiveX flag.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Info`(const char`*`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* Info]([@(0.0.255) c +onst]_[@(0.0.255) char]_`*[*@3 txt])&] +[s2;b17;a17; Sets Tip text of Ctrl. This text is displayed as tooltip +of Ctrl.&] +[s7;i1120;a17; [%-*C@3 txt]-|Text.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HelpLine`(const char`*`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* HelpLine]( +[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 txt])&] +[s2;b17;a17; Sets help topic link for Ctrl.&] +[s7;i1120;a17; [%-*C@3 txt]-|Link.&] +[s7;i1120;a17; [*/ Return value]-|`*this for method chaining.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetTip`(`)const:%- [_^`:`:String^ String]_[* GetTip]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|Current Tip text.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetHelpLine`(`)const:%- [_^`:`:String^ String]_[* GetHelpLine]()_[@(0.0.255) c +onst]&] +[s7;i1120;a17; [*/ Return value]-|Current HelpTopic link.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:operator`<`<`(`:`:Ctrl`&`):%- [_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[* operato +r<<]([_^`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[*@3 ctrl])&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Add`(`:`:Ctrl`&`):%- [@(0.0.255) void]_[* Add]([_^`:`:Ctrl^ Ctrl][@(0.0.255) `& +]_[*@3 ctrl])&] +[s2;b17;a17; Adds ctrl as the last child.&] +[s7;i1120;a17; [%-*C@3 ctrl]-|Ctrl to add.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Remove`(`):%- [@(0.0.255) void]_[* Remove]()&] +[s2;b17;a17; Removes Ctrl from its parent.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:operator`<`<`=`(const `:`:Value`&`):%- [@(0.0.255) const]_[_^`:`:Value^ V +alue][@(0.0.255) `&]_[* operator<<`=]([@(0.0.255) const]_[_^`:`:Value^ Value][@(0.0.255) `& +]_[*@3 v])&] +[s2;b17;a17; Same as SetData(v).&] +[s7;i1120;a17; [%-*C@3 v]-|New Value of Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Reference to v.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:operator`<`<`=`(`:`:Callback`):%- [_^`:`:Callback^ Callback]_[* operator +<<`=]([_^`:`:Callback^ Callback]_[*@3 action])&] +[s2;b17;a17; Same as WhenAction `= action;&] +[s7;i1120;a17; [%-*C@3 action]-|Callback that is invoked when user changes +value of Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|The value of callback, so that it +can be assigned to several Ctrls in one statement.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:operator`<`<`(`:`:Callback`):%- [_^`:`:Callback^ Callback][@(0.0.255) `& +]_[* operator<<]([_^`:`:Callback^ Callback]_[*@3 action])&] +[s2;b17;a17; Same as WhenAction << action;&] +[s7;i1120;a17; [%-*C@3 action]-|Callback that is to be added to callbacks +that are invoked when user changes value of Ctrl.&] +[s7;i1120;a17; [*/ Return value]-|Reference to WhenAction.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetTimeCallback`(int`,`:`:Callback`,int`):%- [@(0.0.255) void]_[* SetTim +eCallback]([@(0.0.255) int]_[*@3 delay`_ms], [_^`:`:Callback^ Callback]_[*@3 cb], +[@(0.0.255) int]_[*@3 id]_`=_[@3 0])&] +[s2;b17;a17; Puts delayed callback to the timer queue. As an identifier +of callback, which is void `* in timer queue, [* this] `+ [* id] +is used. When Ctrl is destroyed, all callbacks with [* id] in range +0 ... sizeof(Ctrl) are removed from timer callback queue `- this +ensures that no dangling callbacks are left there.&] +[s7;i1120;a17; [%-*C@3 delay`_ms]-|Delay of callback in ms. If this +is 0, callback is called immediately after all pending input +GUI events are processed.&] +[s7;i1120;a17; [%-*C@3 cb]-|Callback. Should be callback to Ctrl`'s +method.&] +[s7;i1120;a17; [%-*C@3 id]-|id. Should be in range 0..80. U`+`+ defines +compile`-time protocol for distributing these ids. If Ctrl wants +to use non`-zero time callback [* id], it should define it using&] +[s7;i1120;a17; -|[@(0.0.255) enum] [@(0.0.255) `{ ]TIMEID`_PERIODIC `= +[/ baseclass]`::TIMEID`_COUNT,&] +[s7;i1120;a17; -| TIMEID`_COUNT[@(0.0.255) `};]&] +[s7;i1120;a17; -|Using zero as [* id] is OK as long as you do not intend +to remove time callbacks using [* KillTimeCallback.]&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:KillTimeCallback`(int`):%- [@(0.0.255) void]_[* KillTimeCallback]([@(0.0.255) i +nt]_[*@3 id]_`=_[@3 0])&] +[s2;b17;a17; Removes time callback associated with Ctrl.&] +[s7;i1120;a17; [%-*C@3 id]-|Id of callback.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ExistsTimeCallback`(int`)const:%- [@(0.0.255) bool]_[* ExistsTimeCallbac +k]([@(0.0.255) int]_[*@3 id]_`=_[@3 0])_[@(0.0.255) const]&] +[s2;b17;a17; Tests whether Ctrl has associated callback in timer +queue.&] +[s7;i1120;a17; [%-*C@3 id]-|Id of callback.&] +[s7;i1120;a17; [*/ Return value]-|true when id is found in timer queue.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetActiveCtrl`(`):%- [@(0.0.255) static] [_^`:`:Ctrl^ Ctrl]_`*[* GetActive +Ctrl]()&] +[s2;b17;a17; Returns pointer to active Ctrl. Active Ctrl is top`-level +Ctrl of Ctrl with keyboard focus.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to active Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetActiveWindow`(`):%- [@(0.0.255) static] [_^`:`:Ctrl^ Ctrl]_`*[* GetActi +veWindow]()&] +[s2;b17;a17; Returns pointer to active TopWindow that is either active +or owns active Ctrl. Difference between GetActiveWindow and GetActiveCtrl +is that GetActiveCtrl can return pop`-up Ctrl, while GetActiveWindow +returns always TopWindow `- if active Ctrl is pop`-up, owner +of pop`-up is returned.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to active window.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetVisibleChild`(`:`:Ctrl`*`,`:`:Point`,bool`):%- [@(0.0.255) static] +[_^`:`:Ctrl^ Ctrl]_`*[* GetVisibleChild]([_^`:`:Ctrl^ Ctrl]_`*[*@3 ctrl], +[_^`:`:Point^ Point]_[*@3 p], [@(0.0.255) bool]_[*@3 pointinframe])&] +[s2;b17;a17; Finds deepest descendant of Ctrl that is visible and +contains given point. If not such Ctrl exists, returns this.&] +[s7;i1120;a17; [%-*C@3 ctrl]-|Parent ctrl.&] +[s7;i1120;a17; [%-*C@3 p]-|Point.&] +[s7;i1120;a17; [%-*C@3 pointinframe]-|Determines whether point is in +view or frame coordinates.&] +[s7;i1120;a17; [*/ Return value]-|Pointer to Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:PopUpHWND`(HWND`,bool`,bool`,bool`,bool`):%- [@(0.0.255) void]_[* PopUpH +WND](HWND_[*@3 hwnd], [@(0.0.255) bool]_[*@3 savebits]_`=_[@(0.0.255) true], +[@(0.0.255) bool]_[*@3 activate]_`=_[@(0.0.255) true], [@(0.0.255) bool]_[*@3 dropshadow]_`= +_[@(0.0.255) false], [@(0.0.255) bool]_[*@3 topmost]_`=_[@(0.0.255) false])&] +[s2;b17;a17; Opens top`-level Ctrl as pop`-up window.&] +[s6; [2 Win32 specific.]&] +[s7;i1120;a17; [%-*C@3 hwnd]-|Win32 handle of owner window.&] +[s7;i1120;a17; [%-*C@3 savebits]-|Indicates that system should try to +preserve background bits.&] +[s7;i1120;a17; [%-*C@3 activate]-|Pop`-up should be activated.&] +[s7;i1120;a17; [%-*C@3 dropshadow]-|Pop`-up should have drop`-shadow +(if supported).&] +[s7;i1120;a17; [%-*C@3 topmost]-|Pop`-up should be top`-most window.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:PopUp`(`:`:Ctrl`*`,bool`,bool`,bool`,bool`):%- [@(0.0.255) void]_[* PopU +p]([_^`:`:Ctrl^ Ctrl]_`*[*@3 owner]_`=_NULL, [@(0.0.255) bool]_[*@3 savebits]_`=_[@(0.0.255) t +rue], [@(0.0.255) bool]_[*@3 activate]_`=_[@(0.0.255) true], [@(0.0.255) bool]_[*@3 dropsha +dow]_`=_[@(0.0.255) false], [@(0.0.255) bool]_[*@3 topmost]_`=_[@(0.0.255) false])&] +[s2;b17;a17; Opens top`-level Ctrl as pop`-up window.&] +[s7;i1120;a17; [%-*C@3 owner]-|Owner.&] +[s7;i1120;a17; [%-*C@3 savebits]-|Indicates that system should try to +preserve background bits.&] +[s7;i1120;a17; [%-*C@3 activate]-|Pop`-up should be activated.&] +[s7;i1120;a17; [%-*C@3 dropshadow]-|Pop`-up should have drop`-shadow +(if supported).&] +[s7;i1120;a17; [%-*C@3 topmost]-|Pop`-up should be top`-most window.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetAlpha`(`:`:byte`):%- [@(0.0.255) void]_[* SetAlpha]([_^`:`:byte^ byte]_ +[*@3 alpha])&] +[s2;b17;a17; Sets top`-level Ctrl alpha blending if supported by +system. Ctrl must be open.&] +[s7;i1120;a17; [%-*C@3 alpha]-|Value of alpha.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsWaitingEvent`(`):%- [@(0.0.255) static] [@(0.0.255) bool]_[* IsWaitingEv +ent]()&] +[s7;i1120;a17; [*/ Return value]-|True when there is waiting unprocessed +event in input queue.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ProcessEvent`(bool`*`):%- [@(0.0.255) static] [@(0.0.255) bool]_[* Process +Event]([@(0.0.255) bool]_`*[*@3 quit]_`=_NULL)&] +[s2;b17;a17; Processes single event from input queue. When there +is no pending event, returns immediately. (Processing event involves +usually involves dispatching it via virtual methods to proper +Ctrls).&] +[s7;i1120;a17; [%-*C@3 quit]-|Assigned true when WM`_QUIT message is +intercepted (Win32 specific).&] +[s7;i1120;a17; [*/ Return value]-|True indicates that event was processed, +false that queue was empty.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:ProcessEvents`(bool`*`):%- [@(0.0.255) static] [@(0.0.255) bool]_[* Proces +sEvents]([@(0.0.255) bool]_`*[*@3 quit]_`=_NULL)&] +[s2;b17;a17; Processes all events from input queue. When there is +no pending event, returns immediately. (Processing event involves +usually involves dispatching it via virtual methods to proper +Ctrls).&] +[s7;i1120;a17; [%-*C@3 quit]-|Assigned true when WM`_QUIT message is +intercepted (Win32 specific).&] +[s7;i1120;a17; [*/ Return value]-|True indicates that one or more events +were processed, false that queue was empty.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:IsPopUp`(`)const:%- [@(0.0.255) bool]_[* IsPopUp]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|True if Ctrl is pop`-up window.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:EventLoop`(`:`:Ctrl`*`):%- [@(0.0.255) static] [@(0.0.255) void]_[* EventL +oop]([_^`:`:Ctrl^ Ctrl]_`*[*@3 loopctrl]_`=_NULL)&] +[s2;b17;a17; Executes event`-loop. If [*@3 loopctrl ]is not NULL, it +must be opened top`-level Ctrl and loop is executed until EndLoop +method for [*@3 loopctrl ]is invoked. If [*@3 loopctrl] is NULL, +loop is executed as long as any top`-level Ctrl exists or application +is terminated by OS specific `"shutdown`" event.&] +[s7;i1120;a17; [%-*C@3 loopctrl]-|Looping Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetLoopLevel`(`):%- [@(0.0.255) static] [@(0.0.255) int]_[* GetLoopLevel]( +)&] +[s7;i1120;a17; [*/ Return value]-|Level of even`-loop (even`-loops a +reentrant).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetLoopCtrl`(`):%- [@(0.0.255) static] [_^`:`:Ctrl^ Ctrl]_`*[* GetLoopCtrl +]()&] +[s7;i1120;a17; [*/ Return value]-|Current looping Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:EndLoop`(`):%- [@(0.0.255) void]_[* EndLoop]()&] +[s2;b17;a17; Terminates loop for looping Ctrl. Note that this terminates +only loop for looping Ctrl. If there is another loop above such +loop, nothing is terminated until this additional loop is active.&] +[s5;K%- [*@(0.0.255) void][*@(64) _][* EndLoop][*@(64) (][*@(0.0.255) int][*@(64) _][*@3 code][*@(64) ) +]&] +[s2;b17;a17; Same as EndLoop(), but also defines loop exit code.&] +[s7;i1120;a17; [%-*C@3 code]-|Loop exit code.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:InLoop`(`)const:%- [@(0.0.255) bool]_[* InLoop]()_[@(0.0.255) const]&] +[s7;i1120;a17; [*/ Return value]-|true if Ctrl is looping Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetExitCode`(`)const:%- [@(0.0.255) int]_[* GetExitCode]()_[@(0.0.255) con +st]&] +[s7;i1120;a17; [*/ Return value]-|Exit code of last loop performed with +this Ctrl.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetMinSize`(`:`:Size`):%- [@(0.0.255) void]_[* SetMinSize]([_^`:`:Size^ Si +ze]_[*@3 sz])&] +[s2;b17;a17; This method does nothing. It is a interface placeholder +to get Layout templates working `- in derived classes this can +be statically overloaded to receive minimal size of layout.&] +[s7;i1120;a17; [%-*C@3 sz]-|Minimal size of layout.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Csizeinit`(`):%- [@(0.0.255) static] [@(0.0.255) void]_[* Csizeinit]()&] +[s2;b17;a17; Sets zoom factor used to scale layouts (to scale zoomed +positioning methods like LeftPosZ). Horizontal distances are +scaled by sz.cx / bsz.cx, vertical by sz.cy / bsz.cy. If bsz +is Size(0, 0), default base size (based on standard Win32 GUI +font) is used. Note that U`+`+ sets scaling factor automatically +upon startup based on actual standard GUI font size.&] +[s7;i1120;a17; [%-*C@3 sz]-|Numerator of scaling factor.&] +[s7;i1120;a17; [%-*C@3 bsz]-|Denominator of scaling factor.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:HorzLayoutZoom`(int`):%- [@(0.0.255) static] [@(0.0.255) int]_[* HorzLayou +tZoom]([@(0.0.255) int]_[*@3 cx])&] +[s2;b17;a17; Performs horizontal scaling by actual scaling factor.&] +[s7;i1120;a17; [%-*C@3 cx]-|Distance to scale.&] +[s7;i1120;a17; [*/ Return value]-|Scaled distance.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:VertLayoutZoom`(int`):%- [@(0.0.255) static] [@(0.0.255) int]_[* VertLayou +tZoom]([@(0.0.255) int]_[*@3 cy])&] +[s2;b17;a17; Performs vertical scaling by actual scaling factor.&] +[s7;i1120;a17; [%-*C@3 cy]-|Distance to scale.&] +[s7;i1120;a17; [*/ Return value]-|Scaled distance.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LayoutZoom`(int`,int`):%- [@(0.0.255) static] [_^`:`:Size^ Size]_[* Layout +Zoom]([@(0.0.255) int]_[*@3 cx], [@(0.0.255) int]_[*@3 cy])&] +[s2;b17;a17; Performs scaling by actual scaling factor.&] +[s7;i1120;a17; [%-*C@3 cx]-|Horizontal distance.&] +[s7;i1120;a17; [%-*C@3 cy]-|Vertical distance.&] +[s7;i1120;a17; [*/ Return value]-|Scaled size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:LayoutZoom`(`:`:Size`):%- [@(0.0.255) static] [_^`:`:Size^ Size]_[* Layout +Zoom]([_^`:`:Size^ Size]_[*@3 sz])&] +[s2;b17;a17; Performs scaling by actual scaling factor.&] +[s7;i1120;a17; [%-*C@3 sz]-|Size to scale.&] +[s7;i1120;a17; [*/ Return value]-|Scaled size.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:NoLayoutZoom`(`):%- [@(0.0.255) static] [@(0.0.255) void]_[* NoLayoutZoom]( +)&] +[s2;b17;a17; Sets scaling factor to (1, 1). Same as SetZoomSize(Size(1, +1), Size(1, 1)).&] +[s5;K:`:`:Ctrl`:`:GetWorkArea`(`):%- [*^`:`:Rect^@(64) Rect][*@(64) _][* GetWorkArea][*@(64) ( +)]&] +[s2;b17;a17; Returns OS specific working area for the widget `- this +is rectangle in screen coordinates where application top`-level +windows can be placed `- the size of screen minus the size of +any border entities like the task`-bar. If widget is not associated +with the open window, returns the size of primary work area.&] +[s7;i1120;a17; [*/ Return value]-|Work area rectangle.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetVirtualWorkArea`(`):%- [@(0.0.255) static] [_^`:`:Rect^ Rect]_[* GetVir +tualWorkArea]()&] +[s2;b17;a17; Returns the total size of all displays minus any border +entities.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetVirtualScreenArea`(`):%- [@(0.0.255) static] [_^`:`:Rect^ Rect]_[* GetV +irtualScreenArea]()&] +[s2;b17;a17; Returns the total size of all displays.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetPrimaryWorkArea`(`):%- [@(0.0.255) static] [_^`:`:Rect^ Rect]_[* GetPri +maryWorkArea]()&] +[s2;b17;a17; Returns the size of primary work area `- primary screen +in Windows is the display with start menu.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetPrimaryScreenArea`(`):%- [@(0.0.255) static] [_^`:`:Rect^ Rect]_[* GetP +rimaryScreenArea]()&] +[s2;b17;a17; Returns the size of primary screen `- primary screen +in Windows is the display with start menu.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetKbdDelay`(`):%- [@(0.0.255) static] [@(0.0.255) int]_[* GetKbdDelay]()&] +[s2;b17;a17; Returns delay of keyboard before autorepeat starts when +key is pressed.&] +[s7;i1120;a17; [*/ Return value]-|Time in ms.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetKbdSpeed`(`):%- [@(0.0.255) static] [@(0.0.255) int]_[* GetKbdSpeed]()&] +[s2;b17;a17; Returns speed of autorepeat.&] +[s7;i1120;a17; [*/ Return value]-|Speed of autorepeat.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetDefaultWindowRect`(`):%- [@(0.0.255) static] [_^`:`:Rect^ Rect]_[* GetD +efaultWindowRect]()&] +[s2;b17;a17; Returns OS suggested rectangle of newly open window.&] +[s7;i1120;a17; [*/ Return value]-|Default window rectangle.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GetAppName`(`):%- [@(0.0.255) static] [_^`:`:String^ String]_[* GetAppName +]()&] +[s7;i1120;a17; [*/ Return value]-|Name of application. Used by U`+`+ +in several places like Prompts.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:SetAppName`(const `:`:String`&`):%- [@(0.0.255) static] +[@(0.0.255) void]_[* SetAppName]([@(0.0.255) const]_[_^`:`:String^ String][@(0.0.255) `&]_[*@3 a +ppname])&] +[s7;i1120;a17; [%-*C@3 appname]-|Adjusts application name.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Name`(`)const:%- [_^`:`:String^ String]_[* Name]()_[@(0.0.255) const]&] +[s2;b17;a17; Dumps diagnostic informations to standard log.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:Dump`(`:`:Stream`&`)const:%- [@(0.0.255) virtual] +[@(0.0.255) void]_[* Dump]([_^`:`:Stream^ Stream][@(0.0.255) `&]_[*@3 s])_[@(0.0.255) const]&] +[s2;b17;a17;%- Dumps diagnostic informations to specified output +stream.&] +[s7;i1120;a17; [%-*C@3 s]-|Stream.&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:InitWin32`(HINSTANCE`):%- [@(0.0.255) static] [@(0.0.255) void]_[* InitWin +32](HINSTANCE_[*@3 hinst])&] +[s2;b17;a17; Flushes all drawing operations to screen (what it EXACTLY +does is platform specific).&] +[s3;%- &] +[s4;%- &] +[s5;:`:`:Ctrl`:`:GuiSleep`(int`):%- [@(0.0.255) static] [@(0.0.255) void]_[* GuiSleep]([@(0.0.255) i +nt]_[*@3 ms])&] +[s2;b17;a17; Sleeps (while allowing other applications or threads +to run) for at least [*@3 ms] milliseconds or until new input event +is available.&] +[s7;i1120;a17; [%-*@3 ms]-|Time to sleep.&] +[s0; ] \ No newline at end of file diff --git a/olddraw/CtrlCore/src.tpp/Frame$en-us.tpp b/olddraw/CtrlCore/src.tpp/Frame$en-us.tpp new file mode 100644 index 000000000..0b93c2cea --- /dev/null +++ b/olddraw/CtrlCore/src.tpp/Frame$en-us.tpp @@ -0,0 +1,324 @@ +topic "Frame"; +[2 $$0,0#00000000000000000000000000000000:Default] +[i448;a25;kKO9;*@(64)2 $$1,0#37138531426314131252341829483380:class] +[l288;2 $$2,0#27521748481378242620020725143825:desc] +[a83;*R6 $$3,0#31310162474203024125188417583966:caption] +[l288;i1121;b17;O9;~~~.1408;2 $$4,0#10431211400427159095818037425705:param] +[i448;a25;kKO9;*@(64)2 $$5,0#37138531426314131252341829483370:item] +[*+117 $$6,6#14700283458701402223321329925657:header] +[{_}%EN-US +[s3; Frame&] +[s0; [^topic`:`/`/CtrlCore`/srcdoc`/AboutFrames`$en`-us^ Frames] are +objects derived from CtrlFrame class that form appearance and +functionality of area between outer Ctrl border and its view.&] +[s0; &] +[s0; &] +[s5;K%- [@(0.0.255) class]_[@0 CtrlFrame]&] +[s2; Interface definition of frame classes.&] +[s0;3 &] +[s0;:`:`:CtrlFrame`:`:CtrlFrame`(`):%- `~[* CtrlFrame]()&] +[s2; Empty virtual destructor.&] +[s0;3 &] +[s5;K%- virtual [@(0.0.255) void]_[@0 FrameLayout]([^`:`:Rect^ Rect]`&_[@3 r])_`=_[@3 0]&] +[s2; Frame reacts to this method by defining its own layout (if needed) +and reducing the size of Ctrl view rectangle.&] +[s4; [%-*C@3 r]-|Reference to current Ctrl rectangle. When Ctrl recomputes +its layout, it starts with Rect equivalent to its external size +(GetRect().Size()). Then it calls FrameLayout of all its frames +(starting with frame 0) and resulting Rect is the size of Ctrl`'s +view.&] +[s0;3 &] +[s5;K%- virtual [@(0.0.255) void]_[@0 FrameAddSize]([^`:`:Size^ Size]`&_[@3 sz])_`=_[@3 0]&] +[s2; Adds size of the frame to the current external size of Ctrl. +This is used to compute the external size of Ctrl for given size +of view.&] +[s4; [%-*C@3 sz]-|Reference to actual size of Ctrl.&] +[s0;3 &] +[s5;K%- virtual [@(0.0.255) void]_[@0 FramePaint]([^`:`:Draw^ Draw]`&_[@3 w], +[@(0.0.255) const]_[^`:`:Rect^ Rect]`&_[@3 r])&] +[s2; Paint the frame. Default implementation is empty.&] +[s4; [%-*C@3 w]-|Draw.&] +[s4; [%-*C@3 r]-|Outer rectangle of the frame (this is the same rectangle +as was given in last FrameLayout).&] +[s0;3 &] +[s5;K%- virtual [@(0.0.255) void]_[@0 FrameAdd]([^`:`:Ctrl^ Ctrl]`&_[@3 parent])&] +[s2; Called when frame is added to the Ctrl. Frame can use it to +add its subctrls to the parent. Default implementation is empty.&] +[s4; [%-*C@3 parent]-|Parent Ctrl.&] +[s0;3 &] +[s5;K%- virtual [@(0.0.255) void]_[@0 FrameRemove]()&] +[s2; Called when frame is removed from the Ctrl. Frame can use it +to remove subctrls from its parent. Default implementation is +empty. &] +[s0; &] +[s5;K:`:`:CtrlFrame`:`:OverPaint`(`)const:%- virtual [@(0.0.255) int]_[@0 OverPaint]()_[@(0.0.255) c +onst]&] +[s2; This method can returns non`-zero number that represents paint +extension margin of Ctrl rectangle `- frame can paint over this +margin despite that fact that it does not belong to the Ctrl +rectangle. This is useful to represent some specific skinning +effect (like glare around the EditField). Default implementation +returns zero. &] +[s0; &] +[s0; &] +[s0; &] +[s0; Standard static frames&] +[s0; U`+`+ defines several standard static frames. Those frames are +mostly used to define (or alter) appearance of border of Ctrls. +All of them are obtained as a reference to single global instance +by single global function and can be assigned to unlimited number +of Ctrls.&] +[s0; Appearance of some of them can be altered by current OS look`&feel.&] +[s0; &] +[ {{3967:1202:1908:2923h1;@(204) [s0; Function] +:: [s0; altered by look`&feel] +:: [s0; Appearance] +:: [s0; Comment] +::@2 [s0; CtrlFrame`&_[* NullFrame]()] +:: [s0; No.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø‡œíÐÁ‰€ ®€ÀÀþ­ ±ØÁ«ŒÁ—·†®ÁÖœ‹€€ïžÙŸåÒɥɒ˥—Ê®•äܪ¹Ôò©äÎÒÉ¥’Ë¥— +¤Ê®•ܪ¹Ôöò©äÒÉ¥’†Ë¥»Ë€€š•üâõ +] +:: [s0; [1 Default Frame for Ctrl.]] +:: [s0; CtrlFrame`&_[* InsetFrame]()] +:: [s0; No.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø¯œíÑÁ€ ¸”ÄÁûïÀŽ´¼Ø­˜ÐƒêÚ†¢Ä™Í¤Ü¹ðþ¹‚œ€€Ù·õž×µÖæÊËœ»Ê¿Û٩ΰ• +—’©”̥䪨¥Ó©™ÊÉÔòʦҲ•’©…”̥䪥ÓÊ©™ÊÉÔÊÖŽÙ©íᗵ׬šýá··üÒŒ€€üÛ…û½€È½ +] +:: [s0; ] +:: [s0; CtrlFrame`&_[* OutsetFrame]()] +:: [s0; No.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø¯œíÒ±ƒÀœÅÁ뿃÷ŽÀà‚Ü‚’½¬àºàé »ùíšô“¯½öߨ€€¼áŒ±¬ýû®Ñ÷ûØÙé¶«•¬Ô² +âÒÉÊ¥«•¬ŠÔ²ÒÉÊ¥««•¬Ô²ÒÉʬ¥«•¬Ô²ÒÛéáÊ×ù¢¦”ך‹µýË€´€Ðü»•·Ï +] +:: [s0; ] +:: [s0; CtrlFrame`&_[* ButtonFrame]()] +:: [s0; No.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø¯œíѱ€°œ„ÁᅢºÂ   ²â¤÷Ê€”ð²…„žŸÓ¤Ÿì·óff€ðšë¦ÕÔÕ÷¥ãŽí댲ØéçŸÿ² +¯•’©”Ì¥äЪ¥Ó©™ÊÉäÔʦҲ•’‹©”̥䪥”Ó©™ÊÉÔÊ”¶Øé¹ŸÄ÷“¥šìý•€€ ôƒõ᳿ +] +:: [s0; ] +:: [s0; CtrlFrame`&_[* ThinInsetFrame]()] +:: [s0; No.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø§œíÐÁ€°È€„Áÿ’ðÀ°ƒÁØ ©‡â¢áÓ„ø°—‘ŠðÙñƒ€€¬žóìÛÿ̹¥—«Í¿Í¥²£•ÊÔªÓ©Ì +¥²•ÊÔªÓµ©Ì¥²•ÊÔÔªÓ©Ì¥²•ÑÊÔªÓ©Ì¥“²µÊß¿þû¢ë•€€ º‰¶Öûå +] +:: [s0; ] +:: [s0; CtrlFrame`&_[* ThinOutsetFrame]()] +:: [s0; No.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø§œíб€Àˆ€„Áÿ’ðÀÙ ¬¼‡ÀʛϨþ®Ó†Þ³ãº‡€€óüæÞéǾ©ô¹•ÊÔªÓµ©Ì¥²•ÊÔ +ÔªÓ©Ì¥²•ÑÊԪө̥Ʋ•ÊÔªÓ©ºÌ¥²•ʦ«½Ç¥ÌÕ‚€Ë€èü°ùÅ +] +:: [s0; ] +:: [s0; CtrlFrame`&_[* BlackFrame]()] +:: [s0; No.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø§œíÐÑ€°ª”ÀÀü«Ä‚ɼ€…æ‹ß»ïšÓÐõÜ‹À€€þóëûÉÒ»¦—Ê®•äܪ¹Ôò©äÎÒÉ¥’Ë¥— +¤Ê®•ܪ¹Ôöò©äÒÉ¥’¤Ë¥—ʧ—Æ¡µ÷‰€€¢†Éꙣ +] +:: [s0; ] +:: [s0; CtrlFrame`&_[* FieldFrame]()] +:: [s0; Yes.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø§œíÐÁ€°º€ÀÀÇøÀŒ¢ú°À²ÌÂú³Âëל‚Žñ瞀€ð›ã·¼¶²üéݦɗʮ•ܪ¹ìÔò©äÒÉ¥ +É’Ë¥—Ê®•äܪ¹Ôò©äÎÒÉ¥’Ë¥— Êß®íåí’Ѐ€Ä“£±Û† +] +:: [s0; [1 Good for borders of all Ctrls that display somthing, like EditField +or ArrayCtrl.]] +:: [s0; CtrlFrame`&_[* TopSeparatorFrame]()] +:: [s0; Yes.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø‡œíÐщ€¡ìÀÁþ‘®”Ÿ×ÈÂÝ„ÁŽÚÁ„áá¹ç±‰Þè߀º€€ëÞò¤òøöé¦ëìÒ߸ꪮ¹ä’Ë +Ѹä’Ë®ÅÓã’Ë®¹”ŒË®¹äÒ´®£Ý»„€€›–Žë¾…ˆ +] +:: [s0; ] +:: [s0; CtrlFrame`&_[* BottomSeparatorFrame]()] +:: [s0; Yes.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø‡œíÐщ€¡ìÀÁþ‘®”Ÿ×ÈÂÝ„ÁŽÚÁ„áá¹ç±‰Þè߀Ѐ€ëþÖÓñµÉ¥—ÜŠÆ¥¡—Üò©š—Ü +ÆòÉ¥èÜòÉö¥—¢ñéÞ¥í·¼©œÝšÉ¢º»„€€›–“¸…ˆ +] +:: [s0; ] +:: [s0; CtrlFrame`&_[* LeftSeparatorFrame]()] +:: [s0; Yes.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø§œíÐÁ‰À°¨”…°ÿ’êàŸ‡Ú˜„ªá„п–ö™¼˜è Š²Þ纀ÀïúÕªêËŽû–¬Ù²ç”Æ’¥Ë–Ò +ŠØ²äÉÒšËá–¬ÙÊãÉ’£¥ü¥€€øèšƒäㄘ +] +:: [s0; ] +:: [s0; CtrlFrame`&_[* RightSeparatorFrame]()] +:: [s0; Yes.] +:: [s0; +@@image:612&237 +€ƒâ€¦€€€ƒÚÿ€€€€ø§œíÐщ€°Ì˜†Àþ‘ì°ˆ‡ë¬ÂÀ£Œ£Öá߅߄Ϻ¼¸„·æµ€š€àµ÷è¿ñ§¶£ª¬Ù²äÒ©‡¥Ë–¬¥ +ݱäÉ’¥´–¼¬Ù²”Æ’¥àËßÙ‚€€‡š¶›Ã„˜ +] +:: [s0; ]}}&] +[s0;3 &] +[s0;3 &] +[s0; Simple Ctrl frame templates&] +[s0;3 &] +[s0;3 &] +[s5;K%- template_<[@(0.0.255) class]_[@3 T]>__[@(0.0.255) class]_[@0 FrameCtrl]_:_[@(0.0.255) pu +blic]_[@3 T], [@(0.0.255) public]_[^`:`:CtrlFrame^ CtrlFrame]&] +[s0;%- class_[* FrameCtrl]&] +[s2; &] +[s2; This is the base class of simple Ctrl frames `- frames that +place single Ctrl at some edge of parent Ctrl.&] +[s2; &] +[s2; This class basically overloads FrameAdd and FrameRemove virtual +methods of [^topic`:`/`/CtrlCore`/src`/Frame`$en`-us`#`:`:CtrlFrame`:`:class CtrlFrame^ C +trlFrame] so that they add/remove `'this`' from parent`'s children`-list.&] +[s2; &] +[s4; [%-*C@4 T]-|Ctrl type.&] +[s0; &] +[s0;%- [%%/ Derived from][%% ]T, [^topic`:`/`/CtrlCore`/src`/Frame`$en`-us`#`:`:CtrlFrame`:`:class CtrlFrame^@(0.0.255) C +trlFrame]&] +[s0;3 &] +[s0; &] +[s0; &] +[s0;%- template_&] +[s5;K%- template_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) class]_[@0 FrameLR]_:_[@(0.0.255) publ +ic]_[^`:`:FrameCtrl^ FrameCtrl]<[@4 T]>_&] +[s2; &] +[s2; This class extends CtrlFrame class with width attribute and +serves as base class to classes placing Ctrl at the left or right +size of parent Ctrl frame. Width is initialized to 0. 0 as width +indicates that width is equal to the height.&] +[s2; &] +[s4; [%-*C@4 T]-|Ctrl type.&] +[s0; &] +[s0;%- [%%/ Derived from][%% ][^topic`:`/`/CtrlCore`/src`/Frame`$en`-us`#`:`:FrameCtrl`:`:template ` class FrameCtrl^ F +rameCtrl] &] +[s0;3 &] +[s0;:`:`:FrameLR`:`:FrameLR`(`):%- FrameLR`&_[* Width](int_[*@3 `_cx])&] +[s2; Sets the new width.&] +[s4; [%-*C@3 `_cx]-|Width.&] +[s4; [*/ Return value]-|`*this.&] +[s0;3 &] +[s5;K%- [@(0.0.255) int]_[@0 GetWidth]()_[@(0.0.255) const]&] +[s4; [*/ Return value]-|Current width.&] +[s0; &] +[s0;3 &] +[s0;3 &] +[s0;3 &] +[s5;K%- template_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) class]_[@0 FrameLeft]_:_[@(0.0.255) pu +blic]_[^`:`:FrameLR^ FrameLR]<[@4 T]>_&] +[s0;%- class_[* FrameLeft]&] +[s2; &] +[s2; This class places Ctrl to the parent`'s left side as frame.&] +[s0; &] +[s4; [%-*C@4 T]-|Ctrl type.&] +[s0; &] +[s0;%- [%%/ Derived from][%% ][^topic`:`/`/CtrlCore`/src`/Frame`$en`-us`#`:`:FrameLR`:`:template ` class FrameLR^ F +rameLR] &] +[s0;3 &] +[s0;3 &] +[s0;3 &] +[s5;K%- template_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) class]_[@0 FrameRight]_:_[@(0.0.255) p +ublic]_[^`:`:FrameLR^ FrameLR]<[@4 T]>_&] +[s0;%- class_[* FrameRight]&] +[s2; &] +[s2; This class places Ctrl to the parent`'s right side as frame.&] +[s0; [%-*C@4 T]-|Ctrl type.&] +[s0;%- [%%/ Derived from][%% ][^topic`:`/`/CtrlCore`/src`/Frame`$en`-us`#`:`:FrameLR`:`:template ` class FrameLR^ F +rameLR] &] +[s0; &] +[s0; &] +[s0;3 &] +[s5;K%- [@(0.0.255) template]_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) class]_[@0 FrameTB]_:_[@(0.0.255) p +ublic]_[^`:`:FrameCtrl^ FrameCtrl]<[@4 T]>_&] +[s0;%- class_[* FrameTB]&] +[s2; &] +[s2; This class extends CtrlFrame class with height attribute and +serves as base class to classes placing Ctrl as the top or bottom +side of parent Ctrl frame. Height is initialized to 0. 0 as height +indicates that height is equal to the width.&] +[s2; &] +[s0; [%-*C@4 T]-|Ctrl type.&] +[s0;%- [%%/ Derived from][%% ][^topic`:`/`/CtrlCore`/src`/Frame`$en`-us`#`:`:FrameCtrl`:`:template ` class FrameCtrl^ F +rameCtrl] &] +[s0;3 &] +[s5;K%- [^`:`:FrameTB^ FrameTB]`&_[@0 Height]([@(0.0.255) int]_[@3 `_cy])&] +[s2; Sets the new height.&] +[s4; [%-*C@3 `_cy]-|Height.&] +[s4; [*/ Return value]-|`*this.&] +[s0; &] +[s5;K%- [@(0.0.255) int]_[@0 GetHeight]()_[@(0.0.255) const]&] +[s4; [*/ Return value]-|Current height.&] +[s0; &] +[s0; &] +[s0; &] +[s0;3 &] +[s5;K%- template_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) class]_[@0 FrameTop]_:_[@(0.0.255) pub +lic]_[^`:`:FrameTB^ FrameTB]<[@4 T]>_&] +[s0;%- class_[* FrameTop]&] +[s2; &] +[s2; This class places Ctrl to the parent`'s top side as frame.&] +[s0; [%-*C@4 T]-|Ctrl type.&] +[s0;%- [%%/ Derived from][%% ][^topic`:`/`/CtrlCore`/src`/Frame`$en`-us`#`:`:FrameTB`:`:template ` class FrameTB^ F +rameTB] &] +[s0; &] +[s0; &] +[s0;3 &] +[s5;K%- template_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) class]_[@0 FrameBottom]_:_[@(0.0.255) p +ublic]_[^`:`:FrameTB^ FrameTB]<[@4 T]>_&] +[s0;%- class_[* FrameBottom]&] +[s2; &] +[s2; This class places Ctrl to the parent`'s bottom side as frame.&] +[s0; [%-*C@4 T]-|Ctrl type.&] +[s0;%- [%%/ Derived from][%% ][^topic`:`/`/CtrlCore`/src`/Frame`$en`-us`#`:`:FrameTB`:`:template ` class FrameTB^ F +rameTB] &] +[s0; &] +[s0; &] +[s0; Frame utility functions&] +[s0; Following functions are intended as helpers to for implementation +of FrameLayout method of CtrlFrame, placing some Ctrl to the +side of parent Ctrl. They adjust given Rect (parameter of FrameLayout) +and also alter position of given Ctrl.&] +[s0;3 &] +[s5;K%- [@(0.0.255) void]_[@0 LayoutFrameLeft]([^`:`:Rect^ Rect]`&_[@3 r], +[^`:`:Ctrl^ Ctrl]_`*[@3 ctrl], [@(0.0.255) int]_[@3 cx])&] +[s2; Places ctrl at the left side of parent Ctrl.&] +[s4; [%-*C@3 r]-|Current parent Ctrl rect.&] +[s4; [%-*C@3 ctrl]-|Ctrl to be placed.&] +[s4; [%-*C@3 cx]-|Required width.&] +[s0;3 &] +[s5;K%- [@(0.0.255) void]_[@0 LayoutFrameRight]([^`:`:Rect^ Rect]`&_[@3 r], +[^`:`:Ctrl^ Ctrl]_`*[@3 ctrl], [@(0.0.255) int]_[@3 cx])&] +[s2; Places ctrl at the right side of parent Ctrl.&] +[s4; [%-*C@3 r]-|Current parent Ctrl rect.&] +[s4; [%-*C@3 ctrl]-|Ctrl to be placed.&] +[s4; [%-*C@3 cx]-|Required width.&] +[s0;3 &] +[s5;K%- [@(0.0.255) void]_[@0 LayoutFrameTop]([^`:`:Rect^ Rect]`&_[@3 r], +[^`:`:Ctrl^ Ctrl]_`*[@3 ctrl], [@(0.0.255) int]_[@3 cy])&] +[s2; Places ctrl at the top side of parent Ctrl.&] +[s4; [%-*C@3 r]-|Current parent Ctrl rect.&] +[s4; [%-*C@3 ctrl]-|Ctrl to be placed.&] +[s4; [%-*C@3 cy]-|Required height.&] +[s0;3 &] +[s5;K%- [@(0.0.255) void]_[@0 LayoutFrameBottom]([^`:`:Rect^ Rect]`&_[@3 r], +[^`:`:Ctrl^ Ctrl]_`*[@3 ctrl], [@(0.0.255) int]_[@3 cy])&] +[s2; Places ctrl at the bottom side of parent Ctrl.&] +[s4; [%-*C@3 r]-|Current parent Ctrl rect.&] +[s4; [%-*C@3 ctrl]-|Ctrl to be placed.&] +[s4; [%-*C@3 cy]-|Required height.&] +[s0; ] \ No newline at end of file diff --git a/olddraw/CtrlCore/src.tpp/Layout$en-us.tpp b/olddraw/CtrlCore/src.tpp/Layout$en-us.tpp new file mode 100644 index 000000000..310fa5b49 --- /dev/null +++ b/olddraw/CtrlCore/src.tpp/Layout$en-us.tpp @@ -0,0 +1,75 @@ +topic "Layout functions";[2 $$0,0#00000000000000000000000000000000:Default] +[i448;a25;kKO9;*@(64)2 $$1,0#37138531426314131252341829483380:class] +[l288;2 $$2,0#27521748481378242620020725143825:desc] +[a83;*R6 $$3,0#31310162474203024125188417583966:caption] +[l288;i1121;b17;O9;~~~.1408;2 $$4,0#10431211400427159095818037425705:param] +[i448;a25;kKO9;*@(64)2 $$5,0#37138531426314131252341829483370:item] +[*+117 $$6,6#14700283458701402223321329925657:header] +[{_}%EN-US +[s3;%- Layout functions&] +[s0; &] +[s0; &] +[s5;K:`:`:InitLayout`(`:`:Ctrl`&`,L`&`):%- template_<[@(0.0.255) class]_[@4 L]>__[@(0.0.255) v +oid]_[@0 InitLayout]([^`:`:Ctrl^ Ctrl]`&_[@3 ctrl], [^L^ L]`&_[@3 layout])&] +[s2; Assigns layout parameters to member Ctrl variables of [@3 layout], +and adds them to the specified [*@3 ctrl].&] +[s4; [*C@4 L]-|Class (or structure) with Ctrl variables. Ctrl variables +must have public access.&] +[s4; [%-*C@3 ctrl]-|Parent Ctrl.&] +[s4; [%-*C@3 layout]-|[*C@4 L] instance.&] +[s0; &] +[s5;K:`:`:CtrlLayout`(T`&`):%- template_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) void]_[@0 Ct +rlLayout]([^T^ T]`&_[@3 ctrl])&] +[s2; Assigns layout parameters to member variables. Required layout +must be one of base classes of T.&] +[s4; [*C@4 T]-|Parent Ctrl type.&] +[s4; [%-*C@3 ctrl]-|Parent Ctrl.&] +[s0; &] +[s5;K:`:`:CtrlLayout`(T`&`,const char`*`):%- template_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) v +oid]_[@0 CtrlLayout]([^T^ T]`&_[@3 ctrl], [@(0.0.255) const]_[@(0.0.255) char]_`*[@3 title])&] +[s2; Calls CtrlLayout and then calls Title method of [*@3 ctrl ](assigning +a caption text to the TopWindow).&] +[s4; [*C@4 T]-|Parent Ctrl type.&] +[s4; [%-*C@3 ctrl]-|Parent Ctrl.&] +[s4; [%-*C@3 title]-|Window title.&] +[s0; &] +[s5;K:`:`:CtrlLayoutOK`(T`&`,const char`*`):%- template_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) v +oid]_[@0 CtrlLayoutOK]([^T^ T]`&_[@3 ctrl], [@(0.0.255) const]_[@(0.0.255) char]_`*[@3 title]) +&] +[s2; Calls CtrlLayout and then assigns Acceptor(IDOK) to the [/ ok] +member Ctrl variable and makes it the default button (activated +by Enter).&] +[s4; [*C@4 T]-|Parent Ctrl type.&] +[s4; [%-*C@3 ctrl]-|Parent Ctrl.&] +[s4; [%-*C@3 title]-|Window title.&] +[s0; &] +[s5;K:`:`:CtrlLayoutCancel`(T`&`,const char`*`):%- template_<[@(0.0.255) class]_[@4 T]>__ +[@(0.0.255) void]_[@0 CtrlLayoutCancel]([^T^ T]`&_[@3 ctrl], [@(0.0.255) const]_[@(0.0.255) c +har]_`*[@3 title])&] +[s2; Calls CtrlLayout and then assigns Rejector(IDCANCEL) to the +[/ cancel] member Ctrl variable and makes it the default cancel +button (activated by Esc).&] +[s4; [*C@4 T]-|Parent Ctrl type.&] +[s4; [%-*C@3 ctrl]-|Parent Ctrl.&] +[s4; [%-*C@3 title]-|Window title.&] +[s0; &] +[s5;K:`:`:CtrlLayoutOKCancel`(T`&`,const char`*`):%- template_<[@(0.0.255) class]_[@4 T]> +__[@(0.0.255) void]_[@0 CtrlLayoutOKCancel]([^T^ T]`&_[@3 ctrl], [@(0.0.255) const]_[@(0.0.255) c +har]_`*[@3 title])&] +[s2; Calls CtrlLayoutOK and then assigns Rejector(IDCANCEL) to the +[/ cancel] member Ctrl variable and makes it the default cancel +button (activated by Esc).&] +[s4; [*C@4 T]-|Parent Ctrl type.&] +[s4; [%-*C@3 ctrl]-|Parent Ctrl.&] +[s4; [%-*C@3 title]-|Window title.&] +[s0; &] +[s5;K:`:`:CtrlLayoutExit`(T`&`,const char`*`):%- template_<[@(0.0.255) class]_[@4 T]>__[@(0.0.255) v +oid]_[@0 CtrlLayoutExit]([^T^ T]`&_[@3 ctrl], [@(0.0.255) const]_[@(0.0.255) char]_`*[@3 titl +e])&] +[s2; Calls CtrlLayoutOK and then assigns Acceptor(IDEXIT) to the +[/ exit] member Ctrl variable and makes it the default button (activated +by Enter).&] +[s4; [*C@4 T]-|Parent Ctrl type.&] +[s4; [%-*C@3 ctrl]-|Parent Ctrl.&] +[s4; [%-*C@3 title]-|Window title.&] +[s0; ] \ No newline at end of file diff --git a/olddraw/CtrlCore/src.tpp/RectTracker$en-us.tpp b/olddraw/CtrlCore/src.tpp/RectTracker$en-us.tpp new file mode 100644 index 000000000..30d92beb5 --- /dev/null +++ b/olddraw/CtrlCore/src.tpp/RectTracker$en-us.tpp @@ -0,0 +1,9 @@ +TITLE("RectTracker") +COMPRESSED +120,156,213,89,107,115,218,56,20,253,43,154,233,99,72,150,178,178,108,99,99,186,157,116,211,180,205,52,109,58,148,221,253,192,64,16,70,9,222,24,203,35,139,36,164,211,254,246,189,242,11,155,24,226,134,180,51,219,204,128,172,199,185,247,28,93,93,95,209,1,65,79,159,226,38,126,130,239,249,231,188,97,231,116,225,203,225,192,51,12,187,75,137,217,189,252,112,218,233,238,31,52,218,198,158,66,209,0,69,183,52,221,54,117,205,32,109,248,208,116,141,152,68,55,52,155,116,12,91,215,109,236,184,62,141,162,225,192,39,182,221,85,139,72,147,60,33,150,73,52,203,176,13,91,211,45,155,192,90,130,49,193,22,49,53,67,183,137,233,76,89,228,14,7,212,214,187,251,189,54,44,210,149,37,0,199,90,155,24,150,65,176,142,137,1,166,52,219,54,52,203,180,245,78,187,237,184,52,148,30,15,82,91,158,166,17,173,59,209,172,46,248,252,253,251,247,150,102,224,196,3,3,192,52,108,128,171,26,244,97,131,88,154,217,193,29,211,214,108,172,3,184,105,97,211,9, +169,160,243,205,212,205,123,169,91,216,241,36,3,136,253,223,52,205,130,37,237,102,251,137,102,88,64,212,214,13,211,182,48,24,39,132,232,58,209,116,210,233,16,179,109,90,206,140,209,41,19,195,193,215,179,111,207,142,62,189,248,235,11,26,68,90,247,131,51,134,191,30,115,101,95,80,247,146,9,245,24,11,235,140,84,243,132,187,212,63,225,60,28,161,193,51,140,95,96,60,26,29,52,112,11,183,136,105,238,161,116,11,178,17,116,182,106,31,96,84,128,45,206,113,138,179,86,88,225,98,226,123,110,21,24,202,189,24,62,31,14,34,210,45,34,35,47,66,52,113,4,201,25,149,72,176,80,176,136,5,113,139,71,158,218,57,47,184,64,115,62,165,62,242,1,165,133,142,37,114,105,80,152,128,104,48,253,157,11,232,137,188,91,6,95,174,164,193,133,207,16,244,249,94,192,16,141,80,228,197,61,9,14,15,153,160,106,101,75,185,132,187,72,125,153,213,122,70,203,192,117,64,143,140,154,234,59,164,190,63,129,25,218,40,222,121,148,63,103,164,147,238,151,195,226,34, +133,155,206,87,205,242,212,87,43,189,148,193,76,170,254,12,4,114,83,116,148,182,217,20,49,234,206,144,244,230,12,84,99,104,10,141,32,2,58,48,62,3,230,172,6,173,47,76,30,46,68,196,197,241,156,94,176,113,195,133,213,82,13,36,207,207,199,123,14,90,247,62,93,62,170,138,13,52,126,158,83,0,181,202,240,249,164,198,138,245,42,12,149,229,124,198,89,73,179,120,245,8,149,65,138,150,116,52,207,251,247,50,213,192,120,20,11,51,231,139,136,33,55,118,4,209,48,100,112,122,3,23,4,91,8,21,84,106,74,28,82,247,203,245,209,11,190,64,108,141,27,177,118,170,181,155,62,41,222,93,97,70,153,129,17,42,77,40,82,142,110,183,113,246,2,111,14,49,30,31,5,126,190,58,13,117,88,210,155,199,101,153,224,253,12,150,244,102,23,150,170,167,16,243,241,227,174,33,159,194,62,56,214,227,252,80,74,13,235,145,46,182,8,50,225,139,96,170,130,122,149,253,174,103,158,202,18,51,149,17,35,120,99,151,71,33,133,6,92,34,118,227,50,54,173,161, +218,161,239,133,143,45,153,194,252,121,122,185,91,228,114,193,114,88,18,164,134,4,255,120,83,57,27,55,188,64,238,200,59,6,218,74,28,108,84,30,138,96,11,167,107,133,170,14,131,84,198,203,187,29,205,104,200,226,151,97,84,243,229,192,125,46,146,68,144,52,119,127,31,40,152,13,169,32,30,27,161,242,148,218,123,169,86,109,224,221,240,206,17,20,8,112,20,36,156,17,24,190,16,234,160,236,213,16,225,51,149,146,137,32,141,121,116,205,197,116,188,191,163,12,41,230,131,98,94,57,48,138,221,88,13,142,247,11,26,133,91,52,10,19,195,74,165,186,65,240,134,70,51,54,133,16,216,141,114,2,179,98,92,246,109,26,143,102,238,213,9,77,238,123,187,59,21,163,108,242,41,82,131,63,224,210,107,245,194,85,213,228,99,164,134,28,236,65,233,33,146,44,28,159,205,163,66,132,252,81,28,55,240,221,24,121,237,74,239,138,74,22,229,65,66,51,31,106,144,255,192,88,216,83,147,199,141,9,231,254,142,236,115,180,173,236,149,161,74,250,147,187,236,222,114,225, +2,181,85,70,144,28,93,130,149,248,84,112,225,93,120,1,148,17,241,109,160,6,219,158,74,30,73,86,172,26,129,230,174,175,196,24,103,67,150,172,54,57,66,105,99,195,107,112,91,213,32,178,170,129,79,254,5,240,26,10,188,99,178,250,244,173,189,138,139,156,96,77,197,89,235,49,185,16,65,154,194,23,66,168,75,223,221,12,94,195,165,184,121,183,52,105,170,195,216,220,112,34,183,120,27,195,253,188,170,100,181,29,77,244,3,39,91,222,148,206,244,235,147,227,119,159,198,103,189,227,119,239,251,63,134,179,172,194,249,243,180,223,63,253,152,111,205,103,38,206,185,152,103,151,40,117,101,46,28,160,108,143,146,219,120,138,182,159,248,168,174,226,165,174,229,16,69,33,115,189,243,101,90,143,178,233,69,124,49,119,185,8,152,40,213,238,234,130,59,97,10,58,185,198,78,157,212,31,248,66,95,191,18,27,91,14,177,77,236,24,186,161,191,84,191,230,188,210,48,124,206,180,238,65,131,96,184,70,171,80,81,102,51,138,224,209,208,113,238,118,47,243,110,116,152,152, +130,231,3,146,244,164,154,156,28,189,237,231,179,210,190,254,233,231,188,171,207,195,241,11,159,157,203,148,74,107,125,114,21,192,225,209,167,254,81,47,239,61,81,203,149,34,181,22,39,187,148,247,254,201,165,228,243,237,62,172,217,171,166,145,123,0,42,154,166,138,159,150,214,33,123,53,128,214,122,123,197,157,156,243,43,184,88,220,213,181,26,169,146,91,181,52,113,208,223,187,51,144,218,103,27,101,169,132,88,39,19,3,212,247,96,195,238,148,253,248,246,109,21,210,197,36,72,81,192,174,127,60,235,189,231,226,246,4,234,185,164,242,104,150,63,86,105,239,222,188,144,102,189,12,238,65,181,199,13,126,88,102,91,62,112,157,123,243,176,117,126,145,96,69,202,43,164,183,75,149,158,102,80,37,220,242,64,170,223,31,97,105,41,227,1,231,102,241,25,184,196,73,140,70,80,114,115,240,160,52,10,30,151,47,106,10,175,52,35,246,173,244,70,204,126,227,108,149,222,151,42,88,242,145,154,177,242,55,19,242,17,99,37,131,251,127,196,202,242,215,196,202,21,136,226,185, +143,16,41,203,36,10,102,44,206,30,191,48,84,214,187,146,95,0,164,240,75,149,109,245,255,15,172,95,234,97,21,220,233,225,115,211,15,90,20,238,43,21,229,233,161,170,175,196,194,133,34,181,96,165,25,211,185,242,128,15,21,140,42,81,10,114,164,88,74,211,69,4,55,74,216,32,52,21,244,90,237,142,170,73,92,14,23,103,168,245,37,67,209,18,166,206,139,90,192,215,240,63,201,155,238,64, diff --git a/olddraw/CtrlCore/src.tpp/TopWindow$en-us.tpp b/olddraw/CtrlCore/src.tpp/TopWindow$en-us.tpp new file mode 100644 index 000000000..d38568f4d --- /dev/null +++ b/olddraw/CtrlCore/src.tpp/TopWindow$en-us.tpp @@ -0,0 +1,19 @@ +TITLE("TopWindow") +COMPRESSED +120,156,229,28,107,83,219,72,242,175,76,177,143,179,89,27,252,4,7,246,170,146,5,54,71,37,132,173,144,92,238,142,194,145,44,143,177,22,89,227,211,72,60,114,92,126,251,117,247,60,36,89,50,24,108,216,92,109,62,196,88,154,233,233,119,247,116,207,248,180,197,190,255,190,81,107,124,215,184,231,223,206,62,31,185,73,16,159,157,250,157,78,111,215,109,117,119,47,222,28,191,216,93,127,89,217,234,84,17,74,19,160,180,183,155,237,94,183,221,236,180,182,224,191,102,187,217,234,182,218,157,102,175,245,162,211,107,183,123,141,29,47,112,165,60,59,13,90,189,222,46,78,106,193,164,214,118,183,213,220,238,244,58,189,102,123,187,215,130,185,173,70,163,213,216,110,117,155,157,118,175,213,221,25,114,233,157,157,186,189,246,238,250,251,45,152,212,198,149,0,120,163,185,213,234,108,119,90,141,118,163,213,129,165,154,189,94,167,185,221,237,181,95,108,109,237,120,238,52,246,69,168,215,242,155,205,86,115,119,208,220,222,5,156,191,126,253,186,209,236,52,20,6,29,0,214, +108,116,0,213,38,60,107,116,90,219,205,238,139,198,139,110,175,217,107,180,1,120,119,187,209,221,153,186,145,59,153,79,122,247,94,210,183,27,59,126,204,1,196,250,79,205,230,54,76,217,170,109,125,215,236,108,3,161,189,118,167,219,219,110,192,226,173,86,171,221,110,53,219,173,23,47,90,221,173,238,246,206,152,187,67,30,157,157,254,231,243,127,127,56,120,87,255,120,194,78,101,123,151,125,16,211,79,126,56,20,87,63,158,157,202,198,46,195,143,238,238,155,190,179,227,236,236,197,81,208,103,167,63,52,26,245,70,163,223,127,89,105,108,52,54,90,221,110,149,105,214,155,55,236,115,250,247,203,70,10,51,59,98,39,59,38,133,52,77,6,129,239,149,129,98,184,252,25,226,211,82,104,53,118,251,177,152,250,30,160,182,233,108,226,219,61,17,113,103,83,70,158,250,234,124,207,67,167,158,72,231,59,131,61,126,18,174,64,198,38,0,223,231,145,127,201,135,108,20,9,224,31,60,96,197,213,26,102,181,148,14,22,241,105,196,37,15,99,201,0,5,167,30,240,75,30, +48,120,199,167,28,254,11,99,118,165,6,138,17,27,11,25,179,227,147,26,75,100,226,6,193,13,27,114,79,68,110,12,203,94,249,241,152,105,101,170,1,19,133,228,155,95,132,152,108,2,240,24,104,97,131,36,142,69,40,25,143,189,141,60,46,135,147,169,136,98,23,86,26,185,94,12,88,176,80,196,156,249,128,208,216,53,203,59,245,136,123,48,232,60,224,172,226,74,88,121,228,135,176,238,224,134,41,110,236,156,240,248,61,12,97,110,56,52,143,94,235,71,19,30,143,197,80,86,217,80,112,137,208,129,62,47,72,134,28,6,223,40,170,94,127,60,100,114,202,61,127,228,123,134,44,31,241,173,88,162,226,177,239,93,176,129,136,64,217,216,72,68,192,58,233,127,241,195,243,106,141,253,158,0,140,120,12,0,35,238,42,188,1,127,103,205,19,97,28,137,32,224,67,103,13,113,253,232,252,228,252,52,67,255,167,49,15,51,2,129,121,2,88,207,135,53,230,19,148,1,242,153,188,10,243,64,30,60,66,118,111,68,27,241,6,242,202,7,193,137,171,16,80,170,248,35, +68,33,34,214,1,97,213,13,246,97,140,243,249,216,189,244,69,18,129,124,66,248,198,220,64,1,1,192,239,196,30,129,100,64,142,250,235,196,139,56,224,163,89,182,145,183,157,29,212,58,139,42,126,121,207,127,7,14,59,21,167,186,99,204,137,93,250,81,12,250,97,21,48,99,19,151,194,31,90,189,180,246,0,134,165,224,216,87,149,170,49,15,34,193,64,84,88,17,139,46,121,20,8,176,251,33,50,97,202,35,16,200,4,160,40,101,3,6,42,249,49,203,147,43,151,152,194,64,219,145,25,18,152,17,4,56,247,23,215,187,72,166,26,244,12,189,75,145,180,135,70,176,56,69,254,100,26,240,9,202,0,190,102,21,66,10,173,80,49,27,128,118,93,72,54,17,67,152,26,8,49,69,250,50,182,156,128,194,250,160,23,135,25,77,248,5,231,128,132,201,66,15,247,247,94,189,219,59,120,107,236,167,102,88,39,181,4,104,116,197,12,3,21,58,70,64,87,190,228,53,230,207,135,250,207,131,19,50,75,240,71,254,121,168,132,194,175,1,99,180,68,99,164,111,221,27, +145,196,7,240,184,154,89,247,149,231,241,169,93,23,0,85,9,255,80,132,92,173,168,108,41,142,18,64,33,63,248,248,77,21,95,105,80,92,73,15,56,124,136,76,209,60,177,38,15,204,201,48,206,24,23,121,170,33,115,234,200,243,24,37,227,185,72,43,170,138,140,193,181,177,129,210,15,48,11,114,116,64,75,78,99,16,136,244,64,219,188,49,159,85,31,80,2,227,253,201,109,131,198,33,180,62,69,68,102,190,166,58,133,79,211,32,129,126,65,233,80,86,113,60,61,107,198,51,248,225,165,184,64,199,128,206,132,102,105,143,107,253,54,122,184,43,235,98,166,137,68,124,153,206,87,82,193,129,11,38,187,145,89,187,82,0,243,58,59,199,84,22,177,12,197,192,18,211,56,129,32,230,6,254,23,46,201,153,162,247,196,8,4,36,160,177,226,87,151,188,62,106,19,184,230,68,130,247,101,167,143,138,157,118,41,240,93,248,53,6,249,78,156,31,157,106,63,197,226,108,134,100,208,182,16,93,46,250,201,16,158,162,179,113,207,57,226,103,141,112,131,125,148,124,148,4, +74,18,214,168,17,209,61,55,244,32,182,234,72,184,4,255,180,155,43,97,160,126,35,239,99,29,102,9,5,58,200,238,10,196,129,38,240,201,52,190,169,89,83,26,3,49,203,72,31,173,55,197,189,196,165,2,14,37,51,219,224,103,210,199,206,95,63,31,238,31,252,227,240,131,165,253,112,148,143,162,96,240,33,178,29,35,36,249,202,138,228,252,78,109,73,35,91,78,101,242,1,47,9,157,202,64,136,0,53,5,190,156,97,232,92,1,208,87,211,233,17,122,39,12,165,4,216,60,56,179,233,75,205,248,127,180,13,162,136,188,175,78,91,64,182,228,113,61,49,228,36,157,206,174,145,202,250,158,98,94,253,246,32,55,226,78,249,33,141,165,242,203,248,224,101,165,152,198,196,200,231,228,113,92,2,94,170,179,224,237,208,249,161,72,21,10,148,132,209,200,177,31,232,81,144,155,130,177,129,246,138,9,135,4,45,78,34,8,137,35,55,0,247,165,124,188,76,188,49,249,120,229,237,181,19,207,141,36,59,152,129,171,71,232,48,132,120,232,24,56,43,131,195,125,202,64, +13,64,28,191,160,52,112,196,250,38,152,48,45,116,233,6,9,135,49,31,0,0,198,193,89,124,174,48,16,43,110,161,215,134,37,77,84,172,82,174,163,3,194,82,94,198,38,4,43,147,179,130,41,103,228,123,229,15,207,121,156,147,176,26,88,46,225,24,61,235,157,34,88,133,254,207,229,203,39,17,93,188,130,117,65,103,39,37,46,248,213,16,55,3,210,196,218,169,144,62,69,212,76,26,103,115,18,126,237,113,62,196,221,140,188,136,209,158,1,180,156,186,30,168,224,1,189,66,86,192,174,26,57,6,226,142,97,69,72,115,88,5,54,40,128,0,69,63,189,12,236,68,120,117,14,81,249,228,163,144,119,20,157,51,110,166,87,238,158,223,107,139,48,203,19,55,106,58,76,42,101,173,233,63,36,24,130,14,19,74,182,232,240,30,226,230,142,184,148,24,187,200,73,22,135,23,173,204,32,181,2,14,42,223,36,150,102,225,163,25,151,245,207,255,127,236,83,134,255,7,178,47,235,246,190,33,246,217,124,161,95,44,66,49,231,199,133,108,56,83,250,162,154,80,217,244, +54,75,157,90,173,108,191,123,63,239,95,86,154,173,94,53,83,128,114,254,10,193,183,153,102,249,46,196,102,8,81,19,246,243,207,240,202,216,58,96,76,209,11,226,180,218,141,200,236,171,116,227,3,89,2,110,141,94,169,141,138,14,224,144,231,166,34,66,226,202,164,51,65,94,207,121,247,56,201,57,235,152,69,172,72,110,243,61,199,51,9,142,221,33,34,139,92,137,140,236,187,63,129,144,230,251,167,111,64,72,22,185,18,33,217,119,127,2,33,153,178,102,105,137,1,146,169,116,159,136,89,24,176,97,192,51,181,85,140,12,88,130,53,219,220,103,64,88,161,123,140,117,220,251,113,158,197,87,213,130,109,33,88,151,125,125,105,138,67,207,75,132,42,32,47,74,133,201,124,13,53,143,197,117,145,196,29,16,56,242,195,19,44,236,148,27,47,190,234,179,220,128,172,13,202,47,37,54,136,68,97,130,48,241,67,127,130,101,19,152,77,219,150,43,93,14,34,97,208,83,234,104,128,110,169,189,161,170,37,190,182,56,205,150,215,112,19,154,214,235,168,215,224,14,2,78, +133,75,207,13,81,113,129,127,19,119,8,201,9,44,28,240,8,51,27,93,196,196,245,202,108,19,72,0,219,204,162,42,204,42,75,48,246,120,154,21,184,101,233,223,62,189,219,239,51,252,191,148,157,164,172,227,171,112,88,228,42,2,180,59,40,202,193,84,139,35,117,76,224,246,64,143,218,45,6,36,15,3,187,157,83,207,76,35,167,140,3,233,170,245,91,178,55,179,76,30,208,146,166,112,18,223,4,243,180,108,8,187,188,97,159,209,71,41,99,156,207,50,55,61,175,108,138,68,179,237,195,129,139,19,111,32,215,111,79,236,196,7,24,91,70,23,138,4,169,242,117,142,170,153,138,54,240,5,212,61,199,26,53,162,82,77,171,222,158,8,101,60,159,96,126,29,99,91,114,184,16,229,79,236,239,14,174,151,20,51,191,158,35,232,7,8,212,192,168,223,206,167,250,9,164,56,67,251,61,114,92,20,181,21,56,157,57,73,216,103,103,125,214,245,204,115,59,105,136,114,173,15,242,195,108,19,37,87,109,82,49,119,158,167,177,94,38,245,179,232,216,223,125,124,251,182, +150,122,30,172,6,101,0,173,130,33,115,137,202,184,83,254,111,140,55,16,136,189,36,138,176,91,128,205,159,75,110,137,30,233,38,25,142,166,104,133,129,110,26,9,15,146,187,37,17,61,114,253,249,200,102,28,191,72,226,69,25,83,158,58,55,168,72,127,87,49,97,78,161,187,205,220,233,148,26,134,185,170,22,85,136,45,190,7,215,220,75,98,158,237,200,98,236,207,116,131,102,187,18,24,183,49,185,212,113,28,139,152,72,52,196,242,17,118,174,101,236,70,212,44,82,77,202,65,146,47,24,82,187,18,91,188,37,250,102,209,173,223,98,255,151,10,213,88,59,133,231,129,239,169,118,184,230,44,22,19,135,190,196,124,2,243,93,63,224,166,213,103,150,38,196,137,214,26,19,97,112,147,18,225,252,5,179,145,192,205,104,138,100,149,180,80,130,155,18,103,77,38,0,208,89,115,234,36,188,106,110,197,59,252,243,123,46,233,156,3,236,21,208,98,82,182,46,37,126,219,74,41,73,74,245,30,10,70,85,144,101,213,231,69,78,235,79,25,98,254,196,15,220,8,173,19, +112,83,154,64,210,207,217,50,166,147,118,139,37,31,141,123,62,42,232,39,197,195,30,26,219,227,55,185,243,30,139,244,140,236,204,59,68,96,108,9,41,205,116,91,208,13,233,86,246,241,27,106,109,224,129,37,185,136,26,153,233,48,79,152,99,12,186,197,147,151,216,92,82,85,203,246,177,228,170,217,75,145,172,123,198,143,34,91,207,157,67,58,123,140,235,166,173,67,233,6,106,17,135,202,71,163,236,33,159,162,59,53,224,179,91,146,25,47,167,97,212,111,247,5,155,130,23,162,243,9,246,228,22,198,103,53,98,153,0,117,228,94,63,41,149,26,252,31,76,229,49,30,161,114,167,79,68,228,111,137,61,57,72,39,250,34,220,113,10,181,228,148,242,119,55,46,221,162,62,150,244,98,90,155,195,190,152,197,30,74,35,136,153,84,183,60,141,189,187,61,155,139,241,19,3,119,5,40,106,139,88,57,138,6,238,242,40,30,91,161,174,24,71,72,186,181,222,84,82,197,169,102,52,103,21,37,119,76,99,126,21,94,34,139,118,176,88,65,215,203,190,42,214,133,50,43, +168,106,170,42,8,209,185,56,106,122,143,232,213,85,225,16,40,229,226,120,228,44,127,156,15,54,10,52,151,18,46,157,175,19,136,26,27,249,145,212,39,238,242,243,139,39,76,135,220,190,174,169,25,212,155,198,157,136,194,7,107,72,120,146,136,42,45,33,191,42,208,65,71,14,50,4,8,136,53,115,8,96,238,57,100,251,172,146,132,1,68,176,220,185,11,111,236,134,231,92,230,160,79,184,27,82,78,90,213,152,227,132,90,230,184,29,102,205,54,111,45,46,201,205,217,62,216,222,0,2,1,110,108,112,143,131,204,7,177,208,34,149,106,153,235,33,81,170,194,54,206,24,187,192,219,103,170,37,124,240,227,178,74,66,246,96,58,153,80,193,23,211,66,159,78,226,8,50,247,62,211,127,204,81,85,231,115,156,91,166,168,173,244,30,19,68,252,50,63,60,25,64,96,184,248,249,92,5,151,71,51,41,59,98,236,166,59,255,124,85,64,46,207,24,249,88,150,148,248,221,28,45,51,142,55,39,117,245,110,70,244,234,97,158,127,175,121,156,99,225,195,253,244,158,46,20, +88,118,220,89,59,126,112,213,20,2,18,238,16,31,151,146,12,114,217,8,109,230,236,209,192,112,136,59,96,78,126,22,93,105,246,120,245,88,36,193,16,107,233,84,99,39,4,176,214,145,200,242,178,206,192,132,43,240,16,146,63,91,115,229,157,40,114,167,176,159,48,67,42,42,23,91,129,18,222,23,252,103,145,122,184,74,253,29,63,87,195,35,147,44,253,34,174,87,174,66,197,238,21,133,7,215,102,82,0,245,122,158,190,196,207,175,47,38,183,125,94,94,152,157,205,183,197,139,127,9,49,121,18,191,82,218,210,52,171,97,255,221,176,198,48,102,211,106,203,40,112,207,37,221,169,144,201,20,47,64,169,10,43,85,153,205,182,103,195,26,118,70,179,43,131,234,70,70,184,248,245,91,242,82,69,94,23,188,148,25,242,124,94,106,22,169,71,122,41,12,120,86,186,40,192,85,29,216,114,189,139,243,72,36,153,86,232,67,51,192,223,32,195,166,203,110,125,102,255,156,147,5,78,163,236,187,188,46,219,185,230,238,93,16,160,74,39,82,223,179,194,215,25,133,31,88, +196,211,155,36,41,8,26,45,51,131,212,166,229,100,79,4,34,250,21,79,185,150,40,174,194,174,126,107,193,60,71,38,149,114,79,189,45,176,112,78,54,85,20,220,61,141,48,115,24,81,111,220,82,94,45,192,225,249,124,200,243,106,5,121,54,152,211,204,128,85,121,204,35,247,34,87,193,198,61,189,27,153,115,150,126,152,222,33,21,119,123,198,35,188,113,9,170,9,206,205,244,78,102,207,236,204,119,135,148,197,91,3,126,22,191,88,198,211,130,103,76,7,61,159,111,44,34,182,132,119,76,129,149,249,199,98,153,29,190,28,129,92,205,141,154,157,199,107,44,193,121,34,117,181,135,45,220,27,42,97,210,237,64,42,171,219,158,174,49,236,82,169,20,233,70,125,208,148,47,65,181,133,114,167,74,209,136,172,62,221,133,24,234,131,69,140,196,190,243,40,157,202,161,117,143,83,204,104,15,77,91,101,104,125,39,240,112,170,148,111,248,141,220,247,37,108,145,7,137,250,193,131,2,199,246,85,123,82,98,159,210,142,163,11,116,4,129,93,0,136,13,0,136,21,201,224, +166,150,205,251,236,237,37,58,110,169,39,56,117,156,193,42,192,120,193,46,66,113,21,162,60,156,181,177,136,213,43,103,173,74,147,32,198,138,17,157,223,83,215,92,76,83,117,198,173,169,194,161,46,131,13,13,178,113,238,138,247,131,252,69,99,183,68,254,32,25,167,66,226,161,175,19,247,156,227,173,200,244,118,119,58,60,101,244,58,195,121,41,79,105,254,103,61,57,29,149,59,254,154,242,157,174,34,75,230,195,172,124,247,220,94,254,181,191,55,224,75,136,0,55,234,134,180,182,74,29,48,88,101,166,89,80,154,22,227,185,85,68,245,185,252,254,91,55,58,231,121,222,60,48,177,35,38,246,25,125,204,73,232,238,224,169,179,22,32,6,206,90,9,119,55,216,97,108,126,18,32,101,44,223,0,77,195,187,208,174,188,96,18,226,178,55,38,135,55,212,14,15,134,129,114,23,184,237,123,171,227,247,3,244,178,246,116,154,74,135,42,253,236,224,26,155,63,154,216,156,27,93,144,197,0,24,136,39,35,16,46,8,4,89,154,23,143,156,145,79,89,125,209,34,85,191, +61,193,191,105,98,217,200,20,161,250,45,105,97,126,228,147,28,175,213,215,166,127,67,21,193,75,207,69,165,239,167,119,173,251,76,125,206,81,106,153,97,251,67,130,121,196,39,179,61,234,98,115,50,115,207,220,28,125,154,26,164,103,110,115,31,146,3,42,104,123,13,242,209,43,142,185,128,31,226,11,117,188,6,173,201,252,180,136,84,63,164,97,239,255,129,77,57,107,170,159,5,242,86,191,45,128,58,96,16,192,39,9,24,150,109,30,214,210,38,93,77,55,194,74,109,76,210,113,78,100,101,217,219,12,63,232,92,144,186,11,139,11,227,207,103,224,113,31,204,133,179,68,208,221,112,58,202,67,64,51,104,104,172,245,41,38,253,203,46,195,251,76,55,253,146,205,117,214,75,124,103,26,139,247,208,208,162,4,239,43,220,7,222,249,90,190,0,115,190,158,45,180,214,62,47,95,138,157,253,15,42,215,166,43, + diff --git a/olddraw/CtrlCore/srcdoc.tpp/AboutFrames$en-us.tpp b/olddraw/CtrlCore/srcdoc.tpp/AboutFrames$en-us.tpp new file mode 100644 index 000000000..098de3c76 --- /dev/null +++ b/olddraw/CtrlCore/srcdoc.tpp/AboutFrames$en-us.tpp @@ -0,0 +1,1186 @@ +TITLE("About Frames") +COMPRESSED +120,156,172,188,137,115,226,89,126,39,248,175,40,162,189,222, +234,118,185,34,165,188,171,98,34,108,183,103,118,28,225,245, +78,184,61,49,177,209,209,177,157,157,165,238,206,117,117,102, +109,102,86,87,219,51,118,32,129,64,18,18,32,113,131,196, +141,0,33,113,8,113,8,4,226,144,184,239,251,70,2,113, +95,226,22,247,254,80,102,85,103,87,183,103,236,8,235,224, +120,239,123,191,247,126,63,62,223,239,123,252,120,97,238,143, +254,232,222,199,247,190,119,239,127,241,243,233,95,46,254,252, +217,87,95,188,253,201,143,191,88,120,242,228,179,23,143,239, +61,248,236,217,252,227,207,254,175,167,159,253,243,63,255,243, +39,79,159,46,124,6,72,154,7,36,205,223,123,112,127,126, +97,126,254,193,189,123,15,22,30,207,63,124,122,239,233,195, +39,243,79,238,221,127,252,96,225,225,227,123,15,63,253,242, +217,235,103,191,250,201,143,159,61,185,255,217,15,254,246,17, +192,181,240,241,195,239,221,159,191,63,127,111,254,209,194,3, +128,234,222,253,123,11,15,230,23,30,206,63,121,242,96,254, +241,195,39,247,159,62,122,244,233,243,103,95,190,125,241,234, +229,79,126,252,179,25,31,192,117,31,224,186,247,248,201,163, +7,243,0,207,131,135,11,247,31,63,124,0,240,62,120,48, +63,15,188,158,127,248,248,209,227,199,159,190,125,241,246,139, +69,128,103,254,209,227,207,158,61,88,248,236,135,0,227,131, +143,31,125,15,48,110,225,49,192,249,96,225,193,163,7,247, +159,44,220,159,127,178,176,240,232,233,253,7,79,31,0,86, +207,47,124,250,226,237,34,96,227,207,0,150,25,27,192,245, +16,80,247,224,225,131,249,251,64,48,30,60,126,120,31,160, +122,12,60,63,184,247,116,126,1,208,249,228,222,195,135,128, +186,197,223,124,19,161,89,112,0,182,71,128,178,133,199,15, +103,196,79,30,60,153,191,255,248,201,194,131,133,71,11,128, +250,123,143,1,15,103,186,31,126,250,249,226,155,231,0,219, +253,133,249,207,222,2,6,125,246,195,63,123,248,217,60,192, +252,248,227,199,223,91,184,247,244,222,194,163,199,79,1,125, +128,169,128,183,247,159,62,157,191,255,4,208,247,96,254,225, +189,249,251,159,62,127,245,249,204,195,133,135,247,238,207,20, +62,1,134,224,17,32,248,46,30,15,31,205,3,230,46,220, +127,2,104,124,60,127,255,62,240,248,240,193,147,199,159,190, +89,156,13,194,219,87,175,127,242,227,31,252,217,71,247,62, +185,247,201,194,195,135,223,7,184,159,2,220,79,238,63,184, +127,255,193,163,167,15,230,239,221,7,148,0,34,30,204,98, +245,232,30,48,138,243,15,23,158,124,250,179,103,111,0,141, +111,31,204,130,250,195,63,153,159,127,60,27,249,217,36,2, +194,126,255,201,195,251,128,242,71,192,3,48,162,128,135,247, +129,216,44,60,125,240,228,254,253,39,247,62,125,254,197,179, +55,111,62,8,208,15,102,94,206,207,127,60,63,255,189,199, +179,184,62,188,191,240,224,233,44,58,247,23,128,0,47,60, +122,248,116,30,136,240,195,71,15,238,45,124,250,122,241,255, +251,234,197,235,197,95,45,190,4,66,252,2,80,254,217,55, +163,243,126,14,206,154,102,226,22,62,158,95,0,102,225,195, +71,143,238,205,226,245,16,152,10,11,247,31,2,1,191,55, +255,228,1,96,16,240,11,12,240,219,247,211,240,110,106,204, +166,197,252,253,143,231,239,127,239,233,194,131,251,128,29,79, +31,60,0,66,0,240,207,63,157,159,159,191,247,4,248,5, +252,2,2,115,55,49,230,129,217,251,126,50,205,63,248,120, +254,193,247,30,3,179,22,24,159,167,15,102,74,159,222,159, +197,109,1,136,250,194,163,123,15,129,240,47,188,227,90,152, +5,123,225,143,128,112,207,47,60,153,253,207,2,62,255,240, +227,121,96,246,3,118,205,63,124,8,248,122,31,136,240,194, +19,192,223,135,64,200,239,223,205,232,249,199,79,62,253,155, +197,175,223,252,229,179,183,139,239,103,201,15,126,248,71,119, +65,127,244,241,252,163,239,221,155,113,63,124,242,20,24,181, +249,7,179,136,221,127,240,224,233,194,211,251,247,31,46,60, +125,120,255,209,61,32,114,111,222,173,220,25,235,108,249,220, +45,189,247,34,30,127,60,255,24,88,71,128,119,15,31,2, +254,222,49,1,190,62,158,159,153,177,240,228,233,163,153,223, +239,69,252,244,79,191,120,241,114,102,3,48,25,62,123,55, +254,63,248,118,2,60,1,22,200,147,39,143,238,221,127,10, +196,1,112,255,222,67,96,106,3,75,255,9,48,176,192,184, +46,0,243,126,182,246,159,255,253,179,95,44,254,244,79,223, +47,204,255,254,255,252,211,255,246,31,255,230,79,255,235,143, +230,126,252,6,88,102,127,254,179,87,95,189,157,251,79,192, +192,44,190,249,227,159,252,248,205,189,207,230,222,63,253,199, +103,207,127,57,247,95,127,250,39,63,253,147,185,31,190,125, +253,197,220,71,95,191,248,252,23,139,111,191,63,247,203,103, +111,230,94,189,92,156,123,245,122,238,87,175,94,47,206,253, +252,142,249,147,247,66,230,158,1,77,175,126,246,255,46,62, +127,251,102,238,243,197,215,47,126,189,248,57,64,242,234,87, +119,82,238,104,230,238,38,229,220,219,95,62,123,59,247,243, +87,175,127,53,247,236,203,47,23,129,185,241,242,249,226,220, +179,151,0,245,87,47,159,207,174,60,207,190,120,241,246,31, +230,94,253,124,38,242,217,220,207,22,223,126,189,184,248,114, +14,176,119,241,245,59,147,126,246,234,53,160,225,142,231,5, +160,237,215,47,22,191,254,228,119,157,248,208,166,25,45,96, +203,140,122,113,230,219,204,143,25,219,139,151,159,47,254,230, +147,119,18,103,109,207,190,248,250,217,63,188,121,231,214,220, +215,47,222,254,242,29,197,220,189,247,138,230,94,188,153,251, +234,205,87,207,190,248,226,31,128,103,64,226,219,87,115,95, +190,126,245,235,23,159,47,2,14,63,127,5,44,115,192,233, +111,140,3,204,159,73,254,100,238,175,222,189,152,251,252,21, +96,208,203,87,111,231,94,46,190,227,253,229,179,95,207,252, +254,135,223,103,254,248,189,17,247,230,158,63,123,9,4,96, +238,205,226,219,25,199,223,124,245,197,187,72,126,244,125,32, +236,192,56,44,254,230,217,175,190,252,98,241,227,185,31,189, +5,248,159,255,45,16,252,185,159,205,4,222,221,65,238,188, +250,128,103,238,217,123,239,238,125,250,65,180,128,139,231,159, +254,143,191,123,245,229,127,3,188,125,245,245,28,224,249,203, +207,190,109,255,64,238,115,192,137,223,118,204,222,125,242,195, +87,95,188,122,253,209,143,254,250,237,15,255,225,217,203,239, +255,182,19,16,241,201,159,127,254,249,71,119,68,63,122,241, +143,139,255,229,213,155,143,190,255,29,130,31,45,190,157,201, +253,232,222,199,115,192,31,112,245,188,123,248,14,209,223,126, +245,242,163,111,155,126,103,136,255,195,220,159,253,217,139,95, +1,51,252,211,71,143,22,254,24,88,0,171,224,18,8,2, +2,129,150,71,83,224,17,116,11,219,169,198,135,118,127,168, +77,129,221,168,68,32,89,192,83,101,147,14,145,235,91,235, +209,17,230,230,16,177,197,88,229,138,204,101,20,8,99,116, +195,184,1,183,172,20,59,28,179,19,4,149,15,102,73,200, +98,21,163,156,140,57,46,166,249,82,153,172,170,57,34,59, +116,209,51,153,35,4,190,144,175,251,87,148,246,184,74,219, +203,105,15,52,161,253,250,209,89,106,71,149,79,10,136,218, +93,162,213,100,17,76,174,201,100,21,76,149,23,186,118,228, +74,48,120,53,121,166,175,241,18,201,54,255,220,172,129,91, +138,55,110,239,229,214,186,106,133,116,200,184,220,142,120,66, +244,234,182,221,121,5,63,24,249,21,13,150,30,125,196,166, +104,189,120,173,117,183,55,49,246,120,167,212,99,41,234,66, +159,17,84,52,190,173,56,231,198,151,216,190,46,163,143,206, +55,118,46,43,14,162,77,18,215,147,192,50,221,214,132,16, +109,215,171,88,194,94,76,60,188,132,81,39,43,146,178,150, +124,25,55,128,45,245,13,210,222,153,90,81,18,25,35,83, +68,206,161,98,66,73,137,203,124,237,70,209,163,246,182,232, +16,245,237,4,179,195,187,205,169,193,171,27,40,209,90,178, +131,6,181,86,174,167,155,108,56,247,182,189,156,56,23,76, +8,198,177,252,202,138,32,76,21,251,208,141,252,25,15,26, +23,69,142,87,122,206,75,112,224,168,80,63,130,4,147,212, +48,57,189,164,175,226,28,93,99,159,0,101,49,247,26,184, +115,174,234,32,207,218,199,186,195,195,205,91,247,37,118,221, +85,180,111,168,81,244,238,50,220,188,106,148,197,55,43,59, +160,160,235,202,18,219,114,128,105,168,46,194,148,52,59,119, +194,87,237,100,204,221,241,69,176,61,181,50,33,79,140,55, +84,4,245,105,215,18,13,183,59,224,173,92,154,188,213,9, +49,28,227,148,114,159,175,151,217,244,37,92,175,81,102,43, +120,29,140,191,195,227,21,46,210,76,12,33,97,69,195,48, +219,230,53,135,89,113,24,41,168,2,234,184,79,95,198,181, +74,180,86,172,166,188,222,190,52,47,111,51,111,32,83,184, +112,205,20,79,79,93,89,147,112,79,169,135,41,203,133,44, +170,34,23,219,42,4,38,11,178,19,14,211,96,48,109,232, +58,117,233,33,42,87,118,16,206,74,191,175,5,181,125,182, +233,161,125,66,40,38,189,154,243,212,114,178,113,121,194,38, +105,107,220,107,122,195,86,186,189,170,174,56,78,141,195,173, +21,84,254,166,176,114,51,74,67,215,53,251,210,192,105,22, +51,168,76,73,188,41,181,200,217,202,73,109,254,1,79,119, +62,221,46,130,54,143,26,214,113,246,186,42,87,56,133,8, +154,41,195,132,178,47,111,150,200,35,7,41,36,181,107,124, +40,104,136,161,169,178,151,147,60,173,87,209,10,83,10,181, +74,159,61,182,228,91,129,102,18,207,84,39,105,129,10,170, +199,15,173,169,130,240,88,213,75,147,173,251,87,165,254,182, +120,79,97,73,19,202,33,34,49,20,61,189,86,164,77,49, +135,174,37,226,94,211,66,233,20,228,228,214,228,169,119,97, +134,162,105,205,80,106,136,55,73,174,10,197,96,78,214,78, +53,135,163,212,141,188,232,58,10,131,215,185,35,68,13,163, +44,64,221,240,1,210,174,30,55,192,242,233,72,120,83,213, +244,16,237,29,229,192,218,17,233,58,205,222,110,139,77,202, +183,98,203,187,174,90,235,180,220,20,157,6,4,114,108,148, +44,88,103,41,55,211,1,82,22,46,102,75,203,65,234,122, +11,205,10,109,94,212,67,185,148,187,58,130,187,157,147,198, +222,228,250,124,111,69,72,25,136,216,181,240,86,213,11,119, +36,55,175,249,133,252,36,132,70,145,79,186,209,32,146,140, +237,117,211,180,252,200,50,202,140,183,122,67,164,38,212,19, +115,66,67,100,189,222,111,169,45,157,75,121,43,11,85,154, +224,57,80,91,51,8,85,111,247,188,98,97,43,158,12,179, +2,249,181,145,234,72,105,195,203,179,101,251,176,208,56,175, +20,42,218,186,46,100,232,136,142,108,254,224,41,26,29,17, +138,69,19,92,231,164,20,247,237,202,164,131,84,99,207,40, +172,241,210,209,240,21,36,190,177,170,232,98,93,75,177,139, +156,1,159,156,244,121,121,169,90,144,234,7,85,169,112,241, +118,243,220,50,57,138,215,14,196,213,186,0,83,106,178,149, +144,157,138,45,80,174,96,165,252,3,182,45,218,220,174,34, +5,228,141,129,187,232,91,74,50,83,252,193,165,114,13,173, +149,209,64,248,140,5,143,36,105,221,62,45,34,172,200,109, +198,122,202,101,6,89,173,141,234,32,182,188,232,234,116,208, +180,103,60,245,171,252,48,117,58,160,20,4,212,209,186,198, +70,178,102,19,23,222,205,93,93,156,200,174,197,4,229,152, +210,26,212,44,143,173,194,233,152,16,32,148,70,26,69,177, +61,89,214,100,248,123,204,228,145,204,127,129,28,168,221,195, +91,10,181,64,140,66,153,66,251,168,116,227,175,169,115,83, +38,59,115,5,178,42,76,83,120,17,11,165,228,50,185,67, +24,243,194,165,171,67,41,161,174,246,48,147,51,236,147,5, +177,56,174,130,104,7,189,236,211,120,55,122,124,51,242,48, +124,39,80,250,224,160,182,68,49,97,88,170,188,180,130,42, +46,119,210,43,250,124,230,70,230,71,46,5,2,217,184,218, +55,174,113,57,196,186,132,134,55,64,135,140,122,164,177,177, +102,88,11,28,16,211,236,100,80,102,55,177,109,212,242,161, +249,88,139,17,40,170,230,83,153,160,73,98,244,10,252,80, +44,145,25,172,108,155,132,72,188,43,21,62,149,148,174,77, +84,120,58,28,225,99,54,75,169,50,200,88,23,171,227,66, +181,105,178,47,131,109,136,110,226,242,64,187,198,189,138,187, +109,60,77,27,26,9,198,137,193,137,97,153,125,233,169,55, +89,20,181,166,185,95,58,220,170,18,146,200,1,236,54,148, +57,72,247,219,12,190,124,112,66,198,211,132,201,75,161,224, +250,150,13,97,131,29,106,84,18,220,202,146,106,171,231,88, +254,149,185,126,177,212,41,90,11,13,97,101,243,194,139,238, +107,142,91,25,241,141,64,81,196,226,14,235,91,228,171,156, +169,183,7,145,156,172,81,53,7,84,70,65,92,130,97,124, +26,55,216,136,221,237,40,200,96,172,139,125,128,206,197,107, +4,151,149,131,86,118,215,225,59,76,90,118,120,120,14,19, +185,55,2,130,36,178,39,218,103,164,147,253,102,191,71,103, +54,139,18,48,52,162,38,95,85,55,47,20,121,129,163,22, +28,106,29,112,86,26,115,226,213,217,45,34,131,242,232,60, +210,202,196,228,89,227,244,168,189,93,58,100,15,146,188,137, +187,151,158,164,122,222,150,91,231,61,35,28,146,182,156,234, +118,54,59,136,187,87,14,74,13,88,64,182,71,115,40,229, +30,132,56,181,105,68,69,200,215,150,245,246,173,160,124,202, +57,79,198,74,225,65,6,66,15,107,108,151,251,190,222,117, +102,231,132,203,79,82,206,28,53,66,174,110,35,7,41,210, +170,79,124,129,118,11,3,203,3,170,36,42,174,45,37,227, +28,50,173,126,174,102,154,116,46,7,62,50,118,200,119,91, +70,72,31,58,244,237,164,105,202,9,148,4,61,15,143,55, +97,61,142,204,160,48,16,76,188,44,30,14,94,43,221,50, +33,144,177,82,238,128,157,236,140,139,107,163,27,52,25,94, +221,223,92,217,39,69,92,206,227,90,170,218,195,156,171,146, +235,123,86,168,37,237,204,95,75,202,123,99,220,104,191,236, +183,213,141,218,11,254,46,87,222,232,113,97,59,114,143,235, +162,224,118,81,51,198,52,59,143,192,48,246,67,133,13,240, +102,26,170,217,111,200,32,75,54,74,109,217,193,194,151,228, +142,112,47,27,235,225,185,254,118,167,124,221,42,153,32,221, +142,189,131,179,55,44,215,142,109,73,70,21,44,156,222,164, +175,198,92,249,69,144,206,138,6,212,92,36,132,155,175,177, +9,187,248,83,225,46,69,201,153,200,215,185,103,155,166,66, +194,41,135,65,117,71,6,133,29,126,206,85,202,189,244,155, +53,249,113,114,9,164,141,245,237,196,224,81,54,189,214,237, +120,171,70,68,86,46,180,97,202,33,171,106,199,183,27,195, +43,237,240,110,64,187,3,171,150,77,234,93,135,122,122,62, +42,108,249,193,92,232,234,240,128,64,81,19,176,214,193,109, +134,156,109,71,229,50,9,111,223,113,109,160,133,245,219,192, +93,9,165,27,193,233,122,130,137,169,15,56,12,103,6,66, +125,112,133,91,155,134,184,42,196,242,217,5,203,85,19,196, +33,232,29,52,232,116,144,197,155,53,121,167,136,28,138,246, +96,165,108,149,191,19,224,161,157,235,231,161,126,133,219,59, +155,132,114,121,104,67,227,29,132,37,54,134,6,187,75,94, +26,68,240,158,104,125,5,158,183,91,109,45,105,58,165,182, +98,116,42,61,12,8,94,111,31,76,54,86,108,68,103,88, +187,6,1,209,43,38,60,201,130,72,134,57,232,155,61,5, +47,134,130,40,131,241,51,200,166,92,197,138,116,100,29,118, +193,11,143,101,218,12,94,224,232,16,83,179,219,170,88,94, +51,40,91,65,56,214,156,219,138,82,65,230,110,236,148,235, +36,124,199,83,133,51,53,67,34,211,215,166,13,150,68,148, +131,186,174,126,133,35,11,242,190,6,131,12,147,67,233,173, +115,79,70,181,149,223,44,25,201,98,194,114,21,73,95,109, +31,80,77,83,234,70,49,209,111,133,39,220,65,229,180,33, +222,207,182,182,225,226,136,151,76,138,39,148,230,146,157,132, +129,163,207,151,21,188,189,250,250,49,61,104,37,64,57,123, +23,225,224,249,200,53,36,220,120,14,150,58,141,166,128,73, +43,136,113,189,242,161,9,132,221,90,206,203,131,123,49,67, +167,166,223,0,110,8,125,109,81,162,63,244,145,243,187,241, +203,173,225,81,181,100,27,156,221,226,42,16,92,229,4,115, +24,145,196,36,249,241,33,25,155,194,157,100,236,229,156,31, +152,120,82,14,210,68,241,32,235,169,147,124,215,238,77,141, +201,44,203,112,223,115,123,219,217,185,16,82,236,225,227,65, +101,23,201,60,24,240,208,88,46,213,224,144,236,226,4,253, +235,64,237,28,87,11,94,240,251,189,102,106,88,54,226,203, +249,177,98,26,103,122,88,176,51,39,229,198,200,202,210,153, +22,52,194,183,119,78,177,173,169,41,194,145,118,141,213,160, +30,34,149,245,214,74,198,201,146,25,169,4,124,191,31,63, +75,52,34,122,79,160,33,17,212,163,165,100,137,154,116,186, +244,157,176,135,72,128,102,216,167,105,105,66,120,197,60,84, +133,218,107,209,161,99,180,157,113,45,171,42,214,229,114,227, +20,138,76,115,15,67,165,201,244,184,40,210,82,121,189,92, +200,65,30,123,200,2,222,217,152,130,164,232,212,224,8,175, +210,220,135,35,58,106,151,55,122,70,10,108,210,69,141,32, +89,115,9,221,59,82,221,76,9,106,34,95,107,8,198,221, +208,53,22,33,31,105,103,91,82,45,225,70,124,179,236,195, +143,245,124,235,214,238,141,150,189,161,172,51,40,145,58,149, +190,39,182,230,208,212,177,218,223,11,242,39,172,16,202,195, +136,165,72,91,166,181,171,233,134,33,95,8,94,235,170,62, +176,35,113,218,217,81,194,249,137,173,148,178,108,57,186,37, +199,227,78,226,213,96,195,25,55,110,47,21,212,22,21,71, +29,183,247,32,88,237,86,51,40,69,133,45,71,217,238,225, +142,118,235,0,26,88,178,21,116,106,57,77,206,218,145,85, +150,55,206,146,163,150,105,106,160,120,92,91,133,101,139,22, +185,19,150,134,173,14,117,206,120,80,57,145,243,52,245,13, +49,9,110,204,172,159,89,212,12,206,57,117,43,157,162,69, +213,94,56,54,25,246,154,225,12,209,185,125,74,181,180,205, +66,200,32,179,93,60,227,168,189,76,181,168,187,86,76,108, +170,9,215,122,132,23,110,172,67,139,142,45,74,113,37,102, +70,118,218,250,67,57,180,189,236,55,147,236,97,146,5,137, +109,235,185,166,113,82,116,229,233,173,73,204,200,246,169,89, +24,79,123,152,158,85,38,87,173,49,92,12,182,88,248,125, +117,116,119,147,96,5,132,108,37,185,186,78,218,107,22,174, +170,7,2,64,139,187,228,217,218,96,115,129,126,54,86,141, +42,123,206,76,131,6,11,239,164,171,85,244,180,137,105,20, +89,202,172,64,194,227,133,75,41,29,239,144,101,26,92,161, +189,199,76,192,112,19,138,34,1,132,41,160,109,51,30,217, +214,139,129,46,54,11,143,160,3,93,85,98,18,159,159,170, +80,56,10,64,112,123,238,114,140,103,47,8,198,45,38,222, +48,0,232,54,174,48,222,97,100,144,160,83,234,94,6,224, +105,76,125,179,54,77,9,88,231,166,1,11,111,180,148,143, +89,51,247,111,108,215,81,252,161,20,240,199,163,23,22,19, +199,170,1,82,210,46,12,195,102,33,155,53,104,239,22,116, +231,158,196,46,27,80,183,57,160,116,134,186,146,135,123,170, +27,208,253,204,58,59,190,186,55,26,226,44,200,8,16,207, +13,198,196,181,124,90,92,161,144,90,150,208,204,206,246,216, +182,4,92,116,213,87,86,120,24,228,228,110,19,174,236,132, +61,252,121,216,237,34,142,196,90,249,13,117,61,201,97,101, +194,75,105,146,90,207,137,30,35,125,154,196,129,74,147,181, +38,72,99,72,125,63,116,156,25,81,229,212,212,133,42,170, +178,107,234,93,117,152,138,87,82,70,116,87,172,49,81,70, +82,121,226,128,69,189,36,91,252,103,140,164,97,74,212,50, +217,220,17,146,13,225,161,41,223,64,183,247,72,238,255,126, +245,213,29,194,125,254,203,103,47,127,177,248,45,232,253,234, +205,139,151,191,152,251,241,15,230,0,136,120,7,93,127,50, +247,171,197,183,191,124,245,249,239,193,214,119,0,243,61,213, +71,127,245,242,205,55,47,191,11,54,255,0,142,252,215,0, +200,196,216,142,201,31,3,0,50,162,88,174,226,153,161,117, +169,198,231,239,142,116,248,101,13,156,47,162,45,175,31,52, +101,171,221,117,27,188,70,231,210,140,133,88,121,56,192,251, +234,199,65,150,186,236,59,182,224,109,86,210,113,30,206,150, +201,58,201,38,222,22,137,158,217,125,62,173,24,199,232,208, +4,42,137,106,75,5,215,123,142,57,28,82,243,44,79,137, +228,115,30,216,69,79,238,206,162,207,82,57,178,165,98,56, +232,169,134,87,253,148,50,43,82,212,194,157,204,145,128,89, +56,138,209,226,198,172,111,219,222,61,57,193,9,92,52,120, +204,209,218,219,106,83,58,88,129,243,250,122,208,133,199,121, +232,29,140,67,233,139,87,93,131,113,205,188,102,8,21,168, +250,139,150,165,85,128,52,237,233,109,54,90,167,92,82,29, +120,45,184,77,91,222,98,186,132,196,177,150,190,50,15,143, +121,247,249,39,158,72,120,237,2,206,165,172,158,87,8,235, +131,201,109,16,84,183,224,118,200,201,209,105,90,113,229,184, +130,244,2,80,185,198,193,152,226,163,215,182,33,19,154,188, +148,101,106,141,161,177,43,39,24,214,198,141,138,34,106,50, +147,59,27,52,173,118,143,149,214,238,130,174,183,117,78,143, +92,154,8,19,113,232,130,30,209,54,81,26,106,120,232,72, +75,8,173,91,180,55,145,152,21,164,67,27,19,138,198,178, +176,136,51,142,241,12,247,32,173,77,97,224,152,253,250,133, +87,238,212,75,105,91,145,142,1,37,184,133,226,83,254,253, +227,32,166,126,162,141,243,67,55,23,249,218,38,244,38,16, +42,104,143,208,167,181,220,237,152,118,123,208,52,65,245,100, +40,125,220,222,65,28,160,40,238,158,126,213,208,163,151,188, +235,124,211,169,18,220,27,215,54,212,4,205,233,32,90,41, +180,165,224,171,92,140,120,53,123,154,36,14,47,28,130,145, +82,30,203,41,107,39,136,94,118,155,183,158,60,97,171,175, +87,79,217,70,124,252,154,14,57,247,22,50,94,97,115,80, +64,92,8,203,203,242,161,122,127,187,16,223,223,241,19,182, +55,138,171,215,92,122,237,108,5,127,158,174,81,247,0,111, +12,222,200,102,54,33,61,62,90,45,138,13,240,42,203,168, +67,136,196,110,45,18,185,36,208,48,67,12,73,251,134,184, +155,97,229,243,224,37,247,161,101,40,151,103,124,122,60,246, +22,219,231,21,176,113,223,22,115,249,26,218,164,192,148,2, +8,54,152,98,114,66,220,233,245,228,252,132,150,92,218,113, +176,184,17,106,86,38,201,15,160,53,255,230,230,176,15,54, +57,168,209,136,181,232,66,43,163,90,240,105,151,62,218,166, +55,15,137,121,147,39,35,247,172,110,109,43,64,136,128,102, +47,80,222,155,250,114,52,104,128,209,97,47,179,147,188,208, +242,42,56,225,220,77,152,144,138,20,55,140,66,146,171,82, +232,149,205,82,29,101,131,147,186,87,166,25,73,206,131,36, +43,68,140,59,100,240,86,3,114,2,174,205,186,144,231,48, +7,181,114,125,197,52,212,163,116,138,244,196,170,61,44,49, +6,240,179,46,124,207,52,12,100,210,251,59,199,30,146,97, +149,82,11,28,28,198,229,149,234,192,185,29,165,141,214,135, +180,243,115,152,3,85,242,184,178,107,249,129,102,80,230,164, +144,169,226,248,50,220,83,173,113,18,194,192,73,114,124,216, +208,52,89,173,11,229,190,169,149,69,228,237,100,4,199,118, +14,101,12,7,9,129,91,2,22,134,195,105,241,158,140,37, +188,93,181,5,79,253,225,72,125,58,73,173,197,48,120,26, +117,188,173,26,180,174,138,199,81,117,218,128,37,92,233,216, +54,222,113,95,134,194,110,77,123,98,100,170,54,101,133,142, +148,137,131,131,2,26,172,206,243,115,192,141,88,19,74,181, +117,245,14,53,89,239,15,251,181,108,102,83,144,129,237,10, +175,130,138,164,12,76,107,85,87,172,38,73,22,193,12,178, +187,131,17,93,70,150,167,200,209,192,145,64,186,222,178,112, +248,20,230,238,254,110,225,112,154,99,81,58,197,237,0,214, +117,205,138,7,143,143,207,216,9,193,161,215,175,150,5,83, +124,88,242,54,160,142,216,119,211,112,252,197,242,50,130,89, +191,184,12,134,110,211,209,178,74,216,62,107,132,59,1,85, +52,111,27,238,156,29,137,215,76,214,243,129,222,54,212,157, +210,247,108,220,162,133,85,61,73,195,15,161,109,38,187,208, +41,119,161,113,95,148,120,142,84,174,3,104,110,68,190,64, +106,79,175,182,205,120,204,13,148,17,105,234,86,86,7,142, +210,18,124,35,146,44,175,81,82,237,12,62,172,202,112,139, +27,178,109,57,133,18,166,166,90,221,150,218,60,189,221,42, +76,52,83,144,148,87,228,110,33,113,160,85,41,116,146,82, +166,18,148,116,76,226,9,30,13,40,214,250,40,131,9,4, +8,55,82,218,36,237,44,54,129,207,85,219,106,41,255,240, +136,210,30,210,228,189,50,245,92,194,195,110,12,79,111,66, +96,14,174,157,226,34,73,136,149,37,171,42,51,17,238,1, +183,176,16,151,204,161,108,96,18,112,97,160,115,214,88,45, +185,119,201,94,182,114,67,115,112,74,44,28,92,240,35,253, +19,233,244,34,48,194,114,241,155,204,118,33,1,94,85,115, +45,184,156,180,237,67,1,8,146,103,231,92,55,200,60,224, +19,94,64,158,133,240,38,61,63,58,101,47,186,109,91,208, +97,234,40,210,56,88,211,53,98,88,222,136,152,12,158,230, +130,116,91,164,226,216,228,75,174,15,207,10,171,170,177,244, +10,113,32,63,190,40,51,107,98,245,169,238,48,31,50,228, +234,109,74,191,165,77,38,73,17,209,129,223,180,203,80,123, +64,155,87,148,65,132,50,64,228,111,249,59,34,189,190,81, +64,80,196,2,84,67,39,204,112,220,68,92,84,146,27,197, +54,197,184,56,59,101,206,11,213,234,43,153,103,47,230,171, +37,0,4,57,185,205,28,167,79,58,122,1,127,64,36,195, +104,65,131,16,118,112,29,102,67,36,108,199,249,42,127,41, +66,99,72,88,231,89,242,165,217,204,6,151,37,89,183,60, +19,41,195,33,227,147,33,233,68,76,149,19,82,103,39,90, +220,88,225,16,245,207,202,249,10,219,30,78,185,130,14,76, +167,208,41,130,121,212,194,82,102,192,232,30,145,13,251,20, +91,58,233,176,212,88,53,44,203,121,222,1,109,238,160,75, +218,129,111,21,234,78,193,55,132,73,121,222,28,80,176,6, +236,242,57,184,15,70,64,19,8,194,53,146,90,63,10,101, +209,39,45,92,7,234,133,213,162,2,55,230,96,187,153,135, +67,163,253,101,122,148,132,246,85,101,204,156,68,234,91,35, +39,141,212,235,18,172,163,17,150,20,48,10,25,81,198,25, +219,1,123,129,133,101,243,125,25,232,250,101,229,226,236,224, +200,50,138,118,14,200,117,194,16,203,61,223,176,160,15,236, +24,74,195,186,141,196,174,195,224,123,59,0,226,134,196,144, +32,194,113,199,117,44,216,206,182,50,149,147,86,5,186,119, +34,171,156,84,139,45,130,38,37,197,22,216,17,206,106,114, +89,230,237,105,207,133,164,96,109,247,220,69,45,4,129,43, +58,191,158,47,118,19,8,73,10,7,146,177,161,204,82,157, +95,167,131,176,242,176,185,198,59,175,241,48,141,29,47,102, +196,68,113,161,103,186,146,150,86,206,31,17,108,212,72,47, +15,34,135,83,178,75,161,205,231,182,15,142,7,205,94,238, +140,41,202,24,183,84,177,99,251,101,65,146,143,39,149,99, +56,17,146,66,171,175,5,203,66,197,17,184,160,238,14,251, +12,88,111,141,2,247,182,183,212,88,242,38,140,98,199,112, +49,66,15,113,176,77,142,140,226,153,226,42,110,25,119,16, +38,91,132,199,254,186,156,106,22,83,59,246,64,161,36,91, +207,121,29,136,253,172,189,147,243,56,219,215,174,188,132,193, +140,202,79,155,185,11,195,198,185,240,66,199,142,96,247,212, +92,200,185,171,196,182,115,119,79,133,227,154,50,54,158,194, +249,106,184,73,188,10,238,25,161,122,175,194,112,187,10,225, +19,8,16,94,96,133,72,130,209,68,180,27,105,149,34,189, +109,31,166,164,1,110,82,103,160,85,164,197,116,103,93,170, +16,90,60,82,99,86,31,165,131,114,154,82,42,42,235,55, +189,134,60,78,113,129,82,131,24,160,107,60,242,226,16,198, +244,54,14,228,101,201,134,179,106,196,244,130,129,53,33,25, +154,139,173,10,186,40,61,145,13,163,97,26,167,250,128,42, +222,56,193,52,16,48,101,206,50,61,73,83,117,176,75,211, +53,49,209,231,115,175,154,203,32,249,153,210,105,43,216,121, +221,214,122,105,76,77,30,68,235,220,29,115,27,103,60,177, +226,160,250,190,107,90,110,215,116,84,6,235,236,182,95,93, +6,83,133,8,230,128,120,59,62,175,171,225,118,34,58,139, +43,179,169,3,140,208,6,94,129,2,16,18,129,176,145,141, +109,27,17,228,44,204,32,100,123,223,132,183,34,82,133,20, +218,84,23,121,45,40,136,2,0,252,96,99,44,144,32,92, +198,36,75,242,226,82,191,169,174,91,183,237,231,100,136,79, +57,140,48,178,138,252,73,38,116,32,57,23,145,72,135,254, +83,147,77,6,235,143,193,85,126,95,175,137,177,208,29,26, +120,176,116,7,33,43,65,137,207,231,63,93,21,15,116,194, +118,205,60,192,85,242,167,78,203,173,36,7,101,84,1,224, +223,61,232,248,38,104,37,71,130,24,90,144,125,87,92,10, +19,28,85,162,85,241,30,41,188,190,173,92,15,70,233,155, +141,145,238,128,74,198,28,94,187,48,50,211,218,148,135,238, +59,182,112,157,210,85,74,173,27,31,129,252,35,232,121,54, +69,3,17,105,166,152,128,67,89,177,96,76,0,23,25,218, +53,150,18,100,183,105,20,107,130,192,114,168,160,114,19,110, +78,198,254,190,195,37,33,203,47,142,243,231,90,89,254,160, +228,76,133,167,219,226,75,85,155,16,116,28,247,241,222,92, +42,122,164,84,31,158,148,182,39,57,107,12,10,19,30,246, +199,129,94,67,41,204,40,220,46,249,69,185,115,105,236,49, +188,76,42,194,93,18,115,236,254,99,232,126,206,86,198,10, +10,129,154,191,138,19,20,119,213,161,80,43,22,108,118,99, +219,200,34,222,81,91,159,182,125,45,8,143,131,230,236,110, +192,168,81,12,161,179,47,102,151,218,122,102,62,205,65,76, +197,77,186,48,100,215,42,209,248,70,206,114,11,199,195,59, +28,124,211,81,38,51,18,41,57,90,237,206,10,7,184,61, +19,50,208,60,38,248,245,75,200,173,226,58,185,202,78,122, +106,232,1,41,194,50,225,53,144,48,182,31,202,244,41,27, +231,146,253,193,210,85,57,236,34,251,195,205,147,129,209,34, +101,167,124,5,6,145,181,107,238,163,125,180,72,155,75,181, +241,206,148,82,62,145,149,57,80,230,42,218,78,190,123,53, +220,16,13,76,200,84,108,112,19,163,236,93,238,176,125,1, +108,66,126,169,101,47,9,208,4,229,245,166,217,116,52,208, +47,75,74,21,13,169,201,58,91,33,25,249,22,242,30,73, +205,42,2,8,104,74,177,85,131,85,90,121,205,198,188,154, +18,57,80,167,91,103,144,185,184,155,178,108,168,113,45,16, +11,6,166,130,29,93,187,106,72,175,85,89,76,217,238,83, +153,113,171,231,117,178,51,199,111,38,174,123,218,194,218,206, +85,0,190,68,196,30,36,146,250,181,29,147,206,202,79,150, +36,30,53,26,68,164,135,220,112,129,57,220,217,135,13,40, +190,193,134,198,152,119,141,166,3,199,100,69,224,103,221,138, +229,205,14,182,40,69,170,209,27,187,142,233,68,73,205,216, +88,234,101,190,55,110,183,8,74,14,105,146,2,147,15,19, +131,29,100,181,231,5,83,175,140,88,164,177,174,243,195,181, +2,36,148,112,66,101,80,232,165,21,79,221,171,71,150,185, +176,1,87,222,0,183,7,25,46,158,232,70,56,7,75,5, +135,65,237,239,26,212,168,181,18,61,233,132,120,200,16,160, +45,93,133,18,109,204,18,125,39,137,234,136,82,240,115,167, +43,101,153,209,33,102,116,70,164,201,181,9,106,135,17,216, +210,38,61,41,106,223,244,142,163,52,117,31,16,173,243,249, +225,246,115,53,168,125,171,244,32,59,203,124,24,66,130,3, +1,253,152,84,103,249,0,54,166,148,196,244,164,25,210,49, +186,49,72,211,166,182,45,235,193,47,107,220,210,74,12,137, +29,170,253,128,232,85,114,137,78,41,173,164,221,12,100,199, +45,196,128,7,124,64,40,157,224,55,68,213,126,248,5,141, +82,58,93,137,9,125,99,97,226,220,61,35,128,48,44,131, +243,237,14,240,154,171,7,198,199,236,55,40,1,186,21,90, +50,236,40,116,148,103,150,181,14,11,232,211,211,162,211,88, +117,121,48,19,37,67,5,0,133,116,10,185,180,98,199,36, +60,113,82,25,16,186,226,60,222,30,40,84,36,26,101,114, +78,133,151,86,2,200,51,16,248,16,165,206,246,48,87,128, +22,197,32,92,23,172,236,195,152,208,210,202,134,15,121,134, +167,161,212,137,238,216,54,11,101,1,191,78,108,168,91,220, +97,254,140,130,56,225,194,88,3,58,118,56,74,29,21,71, +171,173,212,109,64,197,113,77,91,148,250,62,57,227,203,228, +100,224,75,255,246,104,137,100,172,181,117,72,69,117,76,240, +128,219,235,252,9,187,236,56,115,28,43,181,219,198,222,154, +114,115,51,105,205,15,140,190,115,193,25,203,51,12,105,84, +123,91,231,195,97,196,16,61,101,78,204,113,99,181,119,161, +57,245,215,87,72,120,121,166,223,142,230,137,170,62,139,186, +133,142,76,55,88,3,95,146,99,178,15,180,253,51,19,206, +164,252,14,200,252,155,87,111,23,223,213,156,191,91,136,126, +241,242,237,226,235,159,63,123,190,56,171,236,126,190,248,230, +197,47,94,46,126,62,247,230,213,59,234,23,0,46,125,246, +102,113,86,200,125,243,229,226,243,23,63,127,241,252,155,178, +242,71,95,188,248,251,197,185,223,194,205,187,2,241,171,183, +191,92,124,253,97,45,247,205,93,237,244,125,153,252,251,119, +165,243,23,47,129,198,89,185,27,16,250,14,237,190,171,152, +127,83,231,189,43,43,255,252,213,235,187,178,240,203,175,126, +245,179,223,22,146,191,229,125,243,9,160,249,189,182,153,129, +111,62,158,187,51,231,71,207,95,191,250,226,139,191,120,246, +250,3,107,222,233,158,123,254,234,229,219,103,47,94,206,80, +245,59,173,111,190,250,217,12,58,3,172,255,0,64,240,111, +10,210,95,205,188,5,172,124,231,211,183,182,126,9,8,154, +33,242,47,238,236,251,78,161,253,111,94,125,61,247,245,226, +157,253,207,62,159,21,217,127,47,12,63,127,47,109,238,213, +87,223,22,172,255,48,144,255,243,207,63,127,135,222,255,226, +139,103,207,255,254,223,23,200,207,42,193,152,187,74,240,74, +21,205,140,233,165,26,222,126,180,212,240,104,229,138,117,28, +131,166,165,9,117,110,63,65,183,171,231,233,217,84,89,66, +227,75,28,59,218,212,189,106,141,188,151,176,87,188,94,86, +36,118,140,148,242,134,230,154,172,120,56,45,144,4,155,171, +88,34,15,222,33,16,85,189,163,28,205,189,31,197,98,99, +145,84,221,185,219,170,231,78,221,196,181,54,244,154,210,107, +57,28,187,146,222,40,73,117,150,41,60,159,212,227,65,58, +204,67,35,24,157,130,110,53,5,233,118,19,184,76,146,32, +219,16,202,149,48,32,50,87,50,66,94,99,29,10,19,105, +67,219,251,187,183,238,34,202,217,175,139,138,72,70,20,219, +213,102,198,219,20,140,48,122,206,72,107,92,149,230,238,170, +0,172,40,226,246,45,146,213,72,112,163,185,115,233,88,179, +73,118,93,250,96,215,35,150,65,81,56,159,10,19,59,222, +166,78,253,133,157,84,26,151,80,43,148,237,219,66,9,87, +102,242,234,136,218,160,9,102,142,225,146,78,149,33,54,56, +87,69,242,91,48,165,49,206,113,175,234,38,74,221,180,62, +9,187,180,160,101,136,61,141,72,153,65,90,122,199,150,82, +174,113,247,97,238,139,93,74,99,67,221,69,59,175,65,197, +53,97,70,123,211,47,67,172,32,244,69,130,112,162,94,234, +217,24,26,11,10,21,30,95,82,215,97,235,192,71,253,8, +44,127,69,194,163,194,198,173,85,247,228,230,194,28,218,167, +139,170,193,50,221,125,128,137,123,81,132,33,93,95,69,30, +176,104,196,196,141,84,217,184,38,156,174,152,76,12,114,219, +72,175,16,186,167,168,228,174,72,79,96,202,233,229,210,145, +196,164,38,25,68,114,240,134,138,168,86,75,186,201,240,113, +199,224,201,27,203,30,224,201,200,210,57,58,129,171,169,11, +171,79,134,38,41,215,77,220,39,224,213,240,190,8,15,54, +228,122,84,217,189,99,36,27,229,133,163,250,250,164,187,203, +27,244,83,55,171,67,33,127,201,89,133,131,192,150,101,58, +220,26,64,108,157,226,147,219,72,76,67,148,110,138,144,62, +172,15,126,7,225,67,221,112,86,182,145,196,132,193,7,7, +110,131,129,182,196,23,30,23,219,9,253,70,13,223,29,141, +104,32,147,178,51,197,229,198,144,211,118,145,154,81,211,66, +254,166,5,177,142,34,91,155,253,2,135,125,42,234,174,194, +78,77,99,14,156,193,71,172,173,95,222,94,172,220,96,67, +197,147,86,86,59,117,75,183,196,131,169,152,32,187,245,199, +5,50,221,249,16,55,171,4,103,162,234,254,101,44,52,171, +4,211,77,25,246,172,18,188,76,30,109,238,247,56,246,201, +222,213,134,240,130,87,178,174,168,125,244,181,117,20,116,168, +28,164,198,112,127,163,45,109,251,235,179,10,48,178,118,28, +44,85,228,148,248,85,226,172,189,2,192,45,24,193,70,11, +102,172,94,187,50,11,74,68,214,170,236,50,20,161,140,93, +137,69,215,52,107,168,153,90,97,31,114,13,192,144,79,7, +193,179,194,32,110,95,217,59,201,25,69,219,48,114,29,46, +79,110,78,9,75,16,41,87,69,211,83,11,12,112,78,179, +42,229,214,111,51,96,87,253,108,146,129,213,187,195,179,97, +186,222,48,237,160,132,82,69,138,219,58,21,78,105,25,34, +184,203,9,245,98,212,227,48,149,207,65,145,172,149,77,192, +136,132,160,220,9,162,53,188,195,195,161,39,213,244,230,105, +70,235,0,62,69,104,106,62,234,74,23,46,31,75,243,204, +163,211,142,155,7,227,53,12,36,142,215,91,184,169,208,52, +211,158,187,225,114,215,194,101,98,63,81,203,37,215,150,40, +135,153,126,6,201,73,82,236,149,190,124,234,18,246,98,234, +134,191,206,119,56,143,240,72,69,146,43,57,11,231,33,90, +147,79,218,117,114,246,43,166,253,202,38,241,34,61,214,116, +46,115,20,215,197,160,27,207,82,243,2,202,210,46,0,226, +209,183,214,16,82,117,222,177,92,72,20,4,44,188,108,175, +71,240,252,227,192,217,230,161,244,102,93,222,232,112,93,56, +159,137,117,125,181,175,213,78,14,118,226,208,41,9,57,189, +9,182,212,125,225,78,103,34,72,54,178,21,250,176,190,225, +101,134,177,222,12,175,106,222,34,133,241,156,96,54,29,35, +11,146,37,94,252,122,95,19,243,81,168,241,163,154,21,87, +210,113,96,131,30,98,204,46,44,113,236,203,150,200,202,202, +169,101,210,111,208,150,33,234,14,104,197,153,193,165,148,120, +76,2,123,190,34,216,245,183,149,70,184,241,144,35,197,245, +248,234,198,117,138,74,89,194,43,169,174,201,18,219,129,195, +122,183,182,197,206,252,64,141,169,38,206,28,71,123,117,52, +59,13,198,164,248,125,147,69,162,233,52,17,22,107,127,25, +203,145,75,29,38,117,167,122,68,233,204,80,124,158,90,200, +19,147,8,166,112,20,64,95,178,19,3,187,201,193,55,25, +150,178,141,41,94,236,227,175,107,236,14,223,14,210,184,158, +196,147,6,160,84,31,82,218,165,122,9,137,246,73,112,76, +212,222,230,5,49,131,205,113,81,224,11,241,66,165,176,37, +246,100,58,200,54,141,133,53,72,249,87,96,76,252,156,19, +180,182,147,53,13,100,176,202,141,39,140,246,122,71,197,166, +20,236,80,115,18,65,174,180,140,195,27,52,20,145,61,180, +28,135,131,197,195,108,25,163,116,45,179,115,250,107,159,39, +181,222,82,94,163,201,249,67,203,160,39,239,251,213,125,65, +136,165,236,12,110,67,163,77,135,164,174,8,55,92,12,114, +176,195,3,15,163,91,80,110,207,111,51,181,220,146,179,64, +21,182,179,133,235,154,186,150,77,38,123,7,62,56,89,113, +158,201,195,59,114,247,129,173,114,132,77,78,171,147,113,135, +35,115,94,168,165,187,161,73,135,54,5,33,157,222,125,74, +76,168,28,160,26,170,62,104,80,238,92,109,174,108,8,33, +55,69,116,122,237,74,42,114,165,161,24,179,95,74,132,250, +119,42,97,170,112,153,226,10,162,194,12,77,252,82,42,39, +202,112,135,210,90,242,186,110,57,115,49,98,97,73,83,85, +212,215,188,166,242,32,111,27,28,12,116,24,35,178,13,106, +24,56,2,172,241,242,162,101,13,181,236,2,249,198,208,202, +217,43,117,87,87,16,91,168,132,30,222,88,222,144,161,249, +170,80,153,120,176,206,13,233,196,73,165,247,186,30,37,101, +96,186,110,129,18,179,27,196,78,98,185,133,241,107,110,92, +235,226,235,181,245,176,194,237,63,68,117,146,107,185,229,115, +68,98,173,70,21,238,174,13,200,26,21,154,79,245,171,111, +67,70,117,59,222,190,41,218,235,2,210,150,179,83,180,194, +58,10,250,114,88,189,42,8,69,8,52,92,121,111,89,57, +208,177,247,13,21,219,54,187,152,54,244,189,2,38,219,235, +57,26,50,49,3,194,114,21,214,73,2,48,222,43,220,90, +71,251,171,43,173,138,178,143,35,142,250,187,145,150,38,178, +191,11,27,20,247,252,49,159,127,9,24,215,237,168,98,165, +138,47,21,19,3,129,64,89,32,149,73,6,97,136,185,17, +74,192,183,19,6,113,39,132,21,105,139,164,242,169,66,41, +14,49,176,70,133,142,119,182,125,110,197,24,168,116,154,155, +40,25,158,216,179,21,36,2,15,2,0,71,186,188,193,245, +186,55,162,221,27,97,171,68,83,31,123,146,35,69,200,235, +56,202,57,135,74,197,56,199,225,157,25,141,234,13,10,36, +30,216,90,25,72,38,200,193,141,0,221,217,217,64,116,252, +238,218,1,101,32,208,210,187,35,132,85,20,54,231,180,104, +146,203,128,18,101,221,236,200,70,84,220,229,28,86,111,150, +170,102,186,158,17,146,39,142,106,50,234,182,219,24,55,93, +85,134,87,19,123,217,57,202,7,171,42,151,240,20,221,145, +197,34,43,109,9,3,134,45,161,58,113,53,132,9,238,184, +58,102,71,239,102,90,102,148,234,122,77,238,102,121,51,37, +10,231,86,145,187,75,171,129,173,45,107,192,160,160,79,86, +151,151,241,187,18,28,193,22,138,32,65,21,124,185,215,224, +198,172,9,156,95,229,80,98,236,181,51,81,176,24,230,5, +65,185,100,38,38,174,14,210,131,4,7,111,162,129,40,90, +177,54,158,105,244,202,58,174,63,105,139,41,15,56,62,149, +24,27,240,118,24,100,163,14,199,192,242,168,208,85,224,78, +135,203,236,172,174,6,228,203,113,68,230,244,106,41,210,216, +75,209,71,121,212,173,166,144,9,186,60,251,132,157,36,232, +50,224,114,209,118,173,98,95,46,158,83,177,120,88,68,69, +20,226,156,116,247,209,187,88,56,125,4,206,159,73,85,93, +39,158,33,217,75,198,123,38,142,222,198,116,11,243,160,14, +87,166,104,56,15,228,113,136,100,82,246,8,144,56,72,178, +77,195,180,252,73,238,113,206,102,189,209,90,105,52,208,234, +21,95,105,119,54,211,250,137,82,7,243,161,149,27,58,218, +176,5,86,187,111,135,86,223,33,125,40,139,110,70,203,19, +211,97,0,37,32,201,214,93,208,142,108,255,184,152,130,174, +15,41,44,83,113,25,115,28,227,222,118,119,123,205,136,180, +215,62,64,12,148,183,107,198,32,184,4,3,13,110,250,240, +65,43,74,62,161,132,46,224,197,29,117,215,144,71,28,152, +66,43,78,50,198,126,156,225,110,69,107,6,84,33,126,54, +30,159,17,91,202,22,254,96,156,26,105,179,227,82,198,71, +145,238,141,247,121,193,3,41,167,130,141,80,205,149,67,203, +17,110,111,53,213,151,92,236,54,210,185,238,113,25,23,246, +65,185,160,22,114,149,42,216,118,111,11,167,235,203,203,148, +50,248,132,50,216,112,83,120,55,183,229,42,169,17,80,197, +165,151,160,126,118,9,86,22,108,142,36,229,72,36,186,217, +200,203,237,213,196,116,43,76,66,251,73,146,43,150,116,216, +136,57,25,136,22,112,159,139,192,5,136,107,135,90,52,206, +153,6,198,209,74,181,141,216,60,245,9,15,198,129,19,204, +161,3,111,209,155,200,104,213,41,128,226,25,222,12,37,133, +16,149,0,16,79,60,221,8,56,130,194,68,61,204,143,19, +14,19,236,73,47,103,91,154,32,100,24,137,10,55,22,141, +162,77,155,85,77,101,27,119,161,102,85,239,220,26,183,37, +163,35,203,241,173,143,55,232,81,157,196,110,113,31,165,58, +139,157,100,219,205,152,189,152,245,80,15,3,107,59,209,131, +227,138,243,38,56,137,173,151,109,147,246,142,61,142,172,102, +139,34,82,80,79,71,22,215,169,7,213,132,154,17,10,15, +97,57,244,142,118,59,29,178,227,226,200,188,24,101,34,4, +82,75,16,15,77,78,229,138,111,213,208,137,86,88,236,157, +182,219,2,236,177,185,191,229,59,41,184,193,26,156,119,90, +14,202,37,118,99,164,115,11,34,243,237,21,198,205,85,219, +8,66,185,98,253,4,101,47,122,185,147,245,97,213,33,196, +165,246,66,187,100,79,228,215,161,215,106,213,229,82,155,216, +153,128,106,17,117,211,237,11,103,91,235,248,245,164,178,92, +12,12,131,85,115,37,80,41,192,173,121,253,205,116,195,192, +44,227,210,186,172,111,247,34,178,223,105,39,46,2,194,213, +192,230,240,200,177,4,197,123,125,70,197,153,4,142,119,159, +211,162,61,89,124,123,163,158,83,24,172,151,200,104,72,138, +82,108,103,241,13,249,13,104,40,106,242,97,248,200,58,176, +158,107,43,5,121,5,178,113,150,114,117,180,90,67,82,172, +221,46,44,91,220,174,157,184,60,140,37,149,237,155,9,84, +171,152,27,79,49,99,74,207,70,77,209,33,219,217,80,84, +199,166,55,32,57,212,148,20,117,209,170,167,221,24,149,137, +110,235,167,201,211,246,222,160,164,115,168,49,103,87,3,209, +185,195,62,69,206,138,152,230,129,207,123,198,84,123,155,76, +181,25,89,220,228,223,36,43,37,78,113,133,33,151,131,218, +102,100,123,111,195,2,60,50,140,117,202,122,113,133,38,95, +201,25,15,28,179,82,173,95,199,156,8,49,234,170,92,46, +122,71,135,177,140,218,5,255,170,165,140,20,186,103,197,100, +134,13,25,52,25,188,177,107,237,128,133,119,170,195,205,99, +47,92,39,36,183,33,102,225,233,224,56,179,166,183,0,253, +22,161,93,48,240,215,1,122,199,116,25,149,84,148,60,92, +196,214,122,18,39,136,238,238,179,213,55,179,146,177,21,96, +111,208,213,94,28,83,109,33,120,153,106,142,151,188,1,188, +101,218,222,189,245,250,238,222,194,207,100,73,249,48,165,66, +81,84,197,173,228,185,41,67,62,178,204,122,201,44,78,195, +3,103,3,244,170,59,247,144,201,186,124,136,199,188,171,100, +167,51,67,97,34,103,158,133,161,153,217,18,43,173,179,10, +114,21,205,42,5,60,202,96,133,6,112,31,52,60,61,102, +192,131,234,20,122,220,176,89,120,48,104,147,187,5,122,129, +199,103,178,118,128,32,120,128,24,104,253,106,146,212,44,220, +233,14,218,42,8,189,208,240,164,98,123,179,26,115,202,140, +164,166,136,28,53,255,178,83,176,179,213,171,49,63,179,90, +169,226,206,116,242,141,158,167,70,62,235,14,228,253,105,210, +183,135,143,42,40,34,21,22,148,201,172,95,228,8,170,24, +109,109,171,139,240,26,55,82,238,195,17,254,64,222,170,96, +186,32,66,174,183,20,85,58,38,214,252,208,40,230,199,39, +102,73,207,49,236,239,228,54,122,173,86,31,118,107,28,163, +250,14,94,146,3,107,6,199,120,197,96,188,227,194,183,38, +122,108,10,63,166,34,115,142,201,86,167,54,134,245,242,24, +84,115,138,242,95,129,44,223,129,242,127,254,230,14,175,206, +192,230,155,197,197,143,191,129,183,119,192,243,243,207,191,217, +111,254,110,163,248,251,109,216,0,172,157,109,15,127,183,149, +252,219,61,217,127,247,234,14,137,190,0,192,238,191,152,20, +0,96,245,226,91,0,241,206,61,7,88,223,2,152,249,197, +12,185,190,135,179,119,138,222,60,7,32,238,243,95,126,7, +204,190,121,251,250,171,231,239,183,214,207,207,125,250,129,130, +159,254,247,111,161,236,175,95,188,126,251,213,179,47,230,126, +253,234,197,231,239,72,255,250,25,224,218,219,143,102,91,162, +127,250,199,115,175,191,255,33,245,159,254,143,215,159,124,177, +248,243,183,115,63,253,147,159,254,135,185,133,123,191,133,196, +63,253,167,255,137,72,0,79,207,54,95,127,52,123,0,100, +190,249,199,239,8,125,243,143,159,60,255,205,191,81,230,127, +121,6,4,232,163,191,124,253,236,107,64,226,215,31,207,82, +11,111,222,206,253,11,86,127,253,201,140,240,110,151,247,59, +7,62,158,123,253,201,219,87,95,126,12,232,155,189,252,207, +139,47,126,241,203,183,31,125,255,227,185,31,253,245,219,255, +227,245,226,226,135,155,200,191,53,227,167,255,244,217,239,230, +28,126,252,131,15,67,246,147,217,238,248,55,115,95,125,249, +110,232,94,2,230,126,113,215,241,219,36,203,44,33,242,249, +226,108,28,223,0,211,229,13,16,142,111,179,42,175,1,227, +158,205,114,27,159,188,63,243,240,230,237,179,215,111,223,124, +56,147,190,37,249,150,105,38,239,249,179,47,190,120,243,161, +29,119,121,155,187,3,6,119,74,129,73,246,203,197,185,119, +167,57,102,137,151,223,74,121,189,248,37,208,188,248,18,208, +50,147,246,211,255,253,253,9,134,111,253,122,63,110,63,249, +144,242,213,151,95,190,122,243,2,152,134,95,190,126,245,124, +17,152,167,63,253,211,111,143,36,188,203,222,124,190,8,24, +123,55,165,223,222,41,190,59,195,243,249,239,122,11,144,1, +6,190,88,252,245,59,162,247,121,173,15,168,102,134,124,124, +151,172,185,75,227,124,13,44,162,55,31,207,216,158,191,250, +213,151,95,189,125,207,246,161,200,187,64,125,216,250,205,137, +140,119,71,40,102,61,207,191,122,253,26,112,226,238,20,195, +55,99,50,59,55,242,226,229,221,89,138,111,220,190,155,90, +63,153,3,218,94,125,253,102,238,203,217,187,89,224,0,99, +102,66,222,143,36,48,134,127,32,3,245,126,165,126,144,97, +122,71,255,123,121,166,247,171,242,174,115,254,59,167,25,102, +249,188,215,239,247,143,220,123,127,113,153,255,95,165,159,254, +77,89,168,248,108,59,201,245,221,118,18,157,12,235,41,211, +127,103,59,9,247,221,118,18,200,58,159,27,227,238,115,229, +209,110,165,28,133,3,159,211,211,222,164,180,24,21,219,216, +108,7,73,114,49,62,116,168,241,241,236,182,171,139,220,43, +22,181,7,35,179,154,107,171,217,157,182,218,50,109,125,208, +76,199,128,251,134,171,34,145,120,133,237,174,220,157,40,249, +36,253,220,81,75,52,148,119,35,249,42,37,208,217,86,38, +106,113,231,137,99,84,131,67,108,74,136,165,91,195,163,235, +233,117,37,83,81,61,205,163,44,65,163,47,123,185,209,173, +169,122,102,108,172,193,137,99,109,222,154,214,75,214,90,107, +149,137,177,197,139,83,249,199,160,115,109,21,193,93,169,174, +122,17,59,86,182,226,4,39,64,155,180,136,1,101,61,76, +41,94,6,171,114,37,236,100,235,152,59,45,45,21,160,244, +112,62,178,227,75,93,216,53,37,245,78,207,78,28,225,36, +142,126,34,79,234,137,162,142,158,168,156,162,202,174,253,144, +179,22,26,41,57,234,35,55,216,215,23,190,170,245,70,39, +47,83,180,160,4,200,226,215,168,64,102,8,123,154,113,224, +61,87,93,152,114,117,60,246,192,56,117,29,17,35,154,116, +64,27,4,193,40,182,118,201,223,230,194,13,156,155,146,204, +226,135,65,150,252,48,120,115,175,64,115,143,205,145,164,98, +211,3,58,15,217,145,58,133,151,28,223,247,123,215,78,54, +83,141,190,38,39,40,28,25,195,155,212,171,125,225,54,232, +250,186,158,112,152,7,186,155,107,16,98,243,66,166,160,95, +79,168,178,99,84,5,165,63,227,130,123,180,210,182,228,216, +116,74,26,247,70,27,178,19,226,233,105,51,106,14,30,75, +193,91,70,213,150,125,246,52,113,100,175,29,181,124,167,166, +58,110,36,26,187,136,236,182,245,56,121,146,85,43,86,182, +215,212,134,90,211,189,204,187,144,221,20,241,138,42,140,204, +192,183,16,177,201,5,97,173,93,83,85,206,183,69,27,22, +119,147,112,153,146,94,177,61,132,161,65,32,86,13,69,129, +132,59,129,49,240,193,151,200,68,9,125,81,88,57,209,234, +1,0,120,10,81,14,70,104,163,49,164,203,246,46,93,92, +23,108,153,22,235,11,143,106,205,188,25,223,196,30,78,176, +237,117,129,205,3,90,242,26,78,92,137,80,92,15,231,11, +211,39,37,7,242,0,20,54,241,65,226,204,214,218,254,94, +188,233,202,145,53,75,49,131,129,218,153,26,18,151,73,49, +55,22,85,84,35,44,240,246,177,57,67,181,168,200,96,141, +161,209,37,168,73,5,164,248,96,9,109,190,108,151,221,234, +92,147,8,181,138,142,113,60,62,182,157,118,246,247,180,132, +74,73,93,152,180,80,227,190,53,212,160,37,163,124,52,5, +29,183,135,170,215,189,250,97,186,39,0,135,173,62,13,61, +183,205,38,48,88,75,232,218,196,100,140,219,132,158,35,77, +55,168,16,238,108,16,205,216,91,124,109,84,67,151,28,253, +115,252,128,82,247,33,215,121,238,155,243,34,130,169,60,241, +72,100,55,83,67,106,239,140,64,223,220,167,185,85,214,253, +182,123,131,142,235,236,104,134,123,245,140,92,56,174,54,107, +117,152,73,133,84,170,171,183,135,206,134,53,180,57,206,114, +170,194,202,197,209,110,164,168,74,139,220,234,196,158,12,19, +46,115,154,43,164,195,81,118,144,69,107,216,236,86,151,154, +108,109,207,242,79,146,204,4,90,67,167,32,93,23,28,22, +149,108,17,41,209,65,193,128,225,94,97,205,6,222,177,66, +142,170,7,92,227,115,52,138,220,221,137,230,240,100,98,55, +93,164,229,167,145,219,234,109,107,56,118,80,187,147,70,172, +67,233,81,202,19,201,137,174,209,62,27,99,73,91,49,155, +17,116,124,150,170,100,135,50,125,87,97,191,141,166,184,254, +92,83,21,242,169,172,65,89,206,213,153,182,139,153,176,103, +73,149,100,212,213,29,145,45,236,15,157,130,119,195,91,120, +212,4,215,62,177,250,98,157,72,116,44,188,101,46,135,122, +215,226,142,61,238,70,64,33,21,152,77,119,118,40,108,132, +3,189,228,184,54,201,208,50,114,233,102,23,223,11,79,50, +168,9,18,187,214,185,8,142,11,43,122,7,194,141,222,140, +86,79,154,106,246,104,83,199,187,142,148,107,105,95,104,221, +194,133,237,82,10,2,245,228,144,1,163,136,220,107,44,60, +230,134,81,148,100,193,235,168,182,31,188,141,67,68,52,229, +164,214,218,102,226,21,93,183,143,88,60,32,224,41,225,212, +52,220,114,110,81,82,103,7,160,182,220,53,217,100,31,108, +102,211,19,6,221,232,50,213,45,215,189,154,72,87,9,103, +120,177,149,108,84,62,153,232,15,92,154,180,23,211,166,215, +61,107,151,82,137,187,126,193,63,216,135,141,41,5,199,24, +150,28,236,201,210,102,56,213,78,58,149,178,76,35,63,173, +125,140,113,83,122,211,154,76,189,172,53,196,227,213,206,37, +171,48,57,20,180,134,155,96,119,185,128,42,237,123,178,13, +149,15,164,118,198,143,54,112,100,184,22,159,226,197,155,186, +60,150,109,42,81,10,58,11,150,116,204,167,131,49,113,35, +7,103,107,83,106,73,214,93,246,9,234,144,116,134,22,181, +142,176,214,87,239,200,194,248,13,89,56,191,137,89,23,90, +243,8,254,49,206,139,93,79,136,147,167,173,9,131,119,217, +247,172,36,210,107,1,159,62,171,94,57,172,117,144,91,37, +236,170,64,77,81,30,76,153,45,123,67,53,220,176,92,27, +214,41,29,55,73,21,7,117,106,131,147,141,218,64,150,223, +175,138,234,122,125,247,6,33,22,52,8,77,157,144,227,46, +162,115,132,86,142,216,89,35,239,141,86,82,121,129,194,114, +50,32,149,14,235,61,236,33,108,12,62,109,120,251,141,248, +96,11,59,246,99,29,155,110,159,16,38,228,94,23,216,16, +27,249,6,186,122,184,116,194,144,158,247,24,235,82,17,43, +173,45,14,236,43,237,219,224,224,150,113,85,167,152,226,132, +160,144,96,170,239,86,45,154,113,156,65,14,72,165,39,87, +233,174,158,135,245,113,175,213,222,241,165,21,134,24,104,21, +251,187,161,76,76,148,62,185,230,159,88,52,155,25,165,119, +109,159,162,167,45,141,33,172,233,202,237,45,8,74,242,4, +202,168,46,50,120,225,231,199,172,188,154,80,36,173,72,26, +0,244,191,33,75,5,8,84,222,30,136,88,169,23,138,234, +150,251,56,100,102,83,217,133,220,186,82,161,104,37,71,49, +220,173,47,97,227,208,147,36,234,245,86,9,214,17,118,29, +242,75,53,126,55,78,66,243,247,114,44,180,32,193,163,136, +164,126,16,127,120,181,143,33,163,221,233,68,193,228,75,9, +207,179,171,142,35,144,226,226,118,223,116,234,46,28,80,14, +196,187,110,195,41,170,146,224,180,184,195,11,198,68,16,38, +212,29,82,114,45,224,144,95,59,53,117,219,206,164,239,37, +156,248,109,82,122,178,34,147,30,12,105,248,144,181,120,171, +114,187,234,94,116,161,201,224,215,138,221,248,154,81,148,220, +194,177,161,76,111,169,206,165,131,2,114,119,225,166,147,86, +97,244,171,10,43,79,189,101,199,52,12,101,20,170,16,85, +70,81,185,102,80,221,191,220,222,11,226,35,229,117,204,228, +152,137,171,196,85,145,157,58,31,33,207,186,208,154,14,186, +95,177,224,101,3,231,128,209,15,113,241,166,224,10,200,166, +116,215,243,226,20,157,178,195,160,76,193,110,58,197,186,121, +126,227,112,173,99,172,121,46,107,3,188,89,209,236,55,46, +229,144,37,159,115,249,34,75,195,238,203,99,189,44,52,210, +203,243,219,82,178,245,34,19,141,9,178,246,152,52,239,18, +103,157,233,77,73,58,22,58,27,13,166,13,48,87,174,51, +178,79,72,88,53,23,194,229,72,59,219,16,68,50,68,169, +225,19,201,169,209,159,84,131,171,192,125,43,73,231,139,206, +81,181,229,171,125,135,129,153,221,119,27,198,92,16,4,34, +184,182,31,155,240,130,203,94,21,179,79,151,187,185,101,7, +52,92,85,235,226,232,82,76,186,22,191,10,31,128,114,103, +251,233,196,241,149,183,100,88,227,224,141,116,138,118,235,102, +150,122,42,234,184,251,254,168,35,118,192,246,153,84,91,216, +64,135,81,38,238,92,194,61,126,132,126,95,145,65,65,68, +8,99,72,97,85,77,96,162,228,122,199,112,48,68,134,6, +34,50,100,98,39,199,3,58,17,100,143,3,186,109,209,249, +18,115,222,46,39,249,229,225,94,225,34,193,39,85,176,188, +110,243,220,116,18,217,225,158,141,67,198,208,48,183,166,143, +130,241,198,224,198,112,148,132,148,156,217,14,61,185,15,115, +226,137,89,92,217,88,87,39,173,89,157,30,140,192,236,50, +16,86,184,241,218,2,34,118,205,179,253,35,254,235,11,188, +25,145,52,111,113,208,55,92,222,245,106,115,121,183,76,93, +49,198,148,129,157,74,68,76,146,203,10,253,221,104,18,181, +127,75,8,194,161,216,224,250,49,166,97,98,196,100,16,218, +176,177,51,75,60,17,101,14,100,35,218,168,42,108,76,167, +35,96,30,44,187,199,90,164,160,174,83,212,75,146,64,139, +123,27,244,116,192,154,66,124,171,215,41,88,251,187,219,158, +213,220,134,49,150,93,93,94,171,242,57,19,213,120,144,203, +215,70,84,56,85,209,103,164,74,81,153,157,197,114,201,176, +172,30,246,128,36,46,163,251,12,136,198,126,230,52,239,50, +42,8,37,214,203,185,41,51,28,88,62,195,121,166,27,43, +55,201,6,117,156,188,186,74,25,176,178,202,242,150,54,217, +103,209,14,165,87,230,110,172,206,89,26,219,93,55,72,197, +77,185,16,199,17,251,249,208,5,37,33,95,58,236,251,70, +173,160,158,210,10,198,115,246,147,67,89,68,226,202,27,229, +185,158,253,148,32,174,166,141,92,75,181,40,198,75,209,87, +177,224,217,77,163,47,228,57,57,69,141,243,90,179,17,35, +231,121,48,9,14,139,165,244,155,16,255,89,48,203,72,95, +113,75,178,35,77,81,159,204,66,171,194,226,118,146,88,31, +12,58,177,168,179,66,154,90,60,250,53,135,5,57,194,41, +118,90,167,89,79,198,178,42,118,240,196,28,111,90,235,218, +59,27,41,139,250,2,222,70,25,53,27,183,100,223,154,135, +147,55,77,46,79,92,173,38,34,116,188,39,115,54,198,18, +193,97,102,232,150,120,212,71,216,12,71,23,94,131,197,247, +236,252,246,49,118,112,129,100,162,66,118,206,201,132,197,55, +11,14,68,20,87,213,73,67,240,78,151,86,157,40,80,221, +157,105,12,55,107,99,170,183,222,47,20,61,44,236,93,222, +105,179,224,190,203,59,153,131,18,179,49,210,41,168,65,100, +115,69,63,189,90,106,215,64,200,216,196,84,120,183,123,4, +171,172,202,103,121,39,132,219,158,88,135,94,31,70,192,244, +37,98,167,70,173,141,45,41,250,222,150,53,199,218,66,170, +253,197,98,96,123,136,179,213,131,149,82,125,205,172,117,79, +161,244,177,167,131,186,108,242,156,45,198,129,114,32,76,239, +111,135,32,198,83,226,222,116,8,182,241,12,59,212,164,103, +201,198,64,29,242,203,50,129,13,86,20,160,182,153,97,125, +224,16,88,65,49,75,246,176,162,197,29,200,70,37,182,156, +73,129,220,154,55,199,208,29,16,93,152,231,215,10,83,179, +228,106,64,116,208,214,10,91,109,48,252,196,139,54,198,59, +133,44,158,19,232,34,232,161,94,211,41,40,28,11,199,69, +240,144,227,141,90,116,89,193,68,129,31,118,130,230,98,163, +103,58,60,51,37,157,237,101,77,191,88,80,139,142,6,55, +102,240,217,165,91,77,72,231,156,163,243,54,33,185,218,81, +27,57,83,109,155,64,9,248,224,61,145,122,43,112,5,119, +214,242,3,93,161,225,184,30,216,145,197,205,181,45,145,122, +15,184,252,48,51,196,36,106,80,190,164,26,189,230,59,198, +78,248,12,191,65,145,165,208,100,11,192,238,59,32,51,27, +222,12,211,168,112,15,218,43,235,69,241,88,237,46,138,3, +30,218,86,59,119,4,8,176,242,213,5,204,30,30,146,60, +226,248,50,3,122,32,163,145,224,104,237,112,137,219,241,193, +197,148,114,143,176,76,241,145,193,87,3,102,121,223,100,220, +188,108,7,113,29,81,192,179,135,47,237,169,131,117,49,32, +160,209,189,186,179,167,127,1,216,99,106,27,215,211,128,210, +204,32,83,17,3,173,98,181,184,70,0,90,245,194,80,190, +56,72,9,128,166,164,88,45,66,198,228,219,184,119,221,219, +3,161,186,0,80,16,52,201,91,88,113,115,35,153,226,148, +241,24,64,196,77,102,112,69,173,79,171,33,253,204,11,248, +52,175,56,68,0,6,155,134,109,163,217,207,103,86,100,81, +240,29,63,75,168,150,41,73,44,202,218,80,141,219,195,123, +213,145,46,185,160,43,240,248,9,38,160,96,197,136,76,204, +142,41,136,61,96,114,113,197,139,28,11,116,167,162,65,187, +135,35,82,44,190,153,2,234,25,78,226,106,47,135,50,153, +137,192,55,92,41,142,189,221,58,179,61,180,221,136,60,61, +139,49,238,234,83,209,9,46,69,206,38,130,46,51,235,43, +105,130,58,64,90,186,146,245,36,27,228,11,90,108,228,138, +212,189,71,150,10,72,188,41,216,13,119,72,99,12,176,138, +247,77,39,35,188,209,101,24,246,119,140,27,249,140,207,167, +82,152,198,120,226,230,38,133,51,108,121,199,120,229,224,116, +183,199,105,141,172,184,58,103,76,232,237,5,198,75,29,202, +24,36,135,28,232,178,211,208,86,125,169,253,157,44,212,95, +189,124,247,253,7,51,72,252,197,226,111,190,217,132,241,53, +0,152,191,221,237,240,230,195,47,7,184,203,75,60,123,254, +238,128,255,226,47,159,253,250,197,12,168,2,0,254,110,223, +198,226,39,191,248,228,131,205,27,175,94,207,253,231,197,103, +159,47,190,158,161,235,143,223,99,252,217,14,141,119,40,127, +150,235,122,243,234,131,45,28,51,233,175,190,139,144,191,61, +89,241,249,172,235,197,140,232,195,236,194,79,238,50,24,223, +52,252,237,226,175,94,253,250,219,51,22,111,230,62,250,160, +21,176,247,93,242,2,128,198,191,126,191,55,229,245,172,231, +221,94,18,0,250,127,179,189,229,247,14,109,204,210,62,63, +249,159,228,198,22,230,62,253,38,73,246,65,210,232,47,190, +122,251,246,213,203,185,223,124,7,99,255,219,51,102,191,249, +228,67,67,190,155,127,154,127,52,251,255,0,220,255,110,138, +109,254,209,191,127,138,237,95,45,243,223,37,197,6,232,188, +115,242,119,19,109,179,73,55,107,253,209,95,191,253,63,159, +253,98,241,229,219,103,127,40,225,246,47,56,250,209,93,182, +234,143,231,190,124,54,203,230,124,199,142,119,141,119,223,250, +240,155,127,173,204,119,83,236,163,223,27,184,111,218,255,160, +152,223,77,229,44,252,62,247,95,3,65,152,125,223,196,189, +187,17,254,228,239,94,125,249,193,187,191,121,245,223,158,189, +124,251,159,94,61,255,234,205,31,148,255,62,215,248,187,201, +29,224,233,147,119,63,127,176,239,27,83,222,45,133,133,239, +100,149,190,221,212,244,174,247,223,245,251,45,18,99,55,250, +46,159,180,25,215,201,242,204,208,114,103,196,225,26,110,151, +133,43,35,60,83,203,93,94,135,244,225,203,92,61,68,186, +226,93,177,158,86,135,81,121,49,209,14,43,199,141,61,117, +153,35,247,37,227,118,162,179,237,115,174,71,85,157,100,110, +84,171,237,141,13,197,246,70,91,123,176,74,40,153,131,93, +9,89,75,247,31,23,56,156,230,89,158,234,32,75,200,14, +239,105,220,123,178,172,81,165,34,145,211,64,101,143,236,162, +140,41,123,121,170,191,221,246,103,101,87,77,103,185,25,163, +145,236,206,44,38,238,228,141,87,114,123,44,88,196,178,122, +4,165,8,165,82,132,199,120,153,239,54,237,108,218,110,213, +175,244,37,201,71,230,1,216,188,114,89,223,245,11,175,6, +140,11,197,206,78,52,223,72,67,57,165,154,214,32,102,185, +172,209,107,9,87,180,68,105,110,114,79,99,186,74,133,58, +236,28,93,30,19,162,244,122,120,111,235,150,201,244,41,167, +240,163,94,192,179,178,106,2,160,9,201,49,190,238,181,19, +42,110,180,183,225,150,105,234,210,91,216,254,89,75,226,66, +71,243,60,232,246,168,121,93,61,132,21,28,74,40,138,118, +105,220,150,76,101,160,35,158,38,159,40,50,246,43,218,35, +188,116,42,234,186,119,37,97,52,104,79,131,88,22,66,225, +41,28,152,160,8,89,245,230,181,157,67,68,164,73,55,106, +59,75,103,52,222,54,215,175,57,175,47,237,64,202,218,52, +217,116,78,179,247,59,123,9,1,30,98,223,171,19,244,240, +160,207,203,22,119,245,132,76,180,222,208,30,41,175,32,198, +118,70,116,123,228,226,33,207,229,155,250,27,217,201,129,133, +158,212,174,136,163,176,186,54,112,49,132,6,223,165,149,146, +203,68,42,69,35,223,113,56,198,55,152,70,176,157,208,187, +143,27,110,223,24,108,139,140,153,18,95,188,126,53,216,162, +88,217,129,177,221,187,63,116,147,172,109,39,162,184,13,219, +54,243,92,88,203,169,185,224,56,218,78,38,251,185,188,244, +4,233,86,84,197,25,139,72,122,174,219,78,46,79,214,27, +156,243,244,206,134,162,162,174,26,120,197,149,28,73,44,56, +90,45,137,109,85,17,119,224,92,23,93,106,71,112,228,210, +158,198,125,96,242,16,9,0,0,233,223,88,76,160,54,127, +234,56,181,171,17,5,175,230,124,99,186,162,222,22,240,214, +195,218,52,55,187,70,205,166,80,250,104,221,163,177,38,102, +121,37,3,86,59,242,92,64,214,249,199,20,218,137,74,212, +110,157,199,134,195,122,117,137,153,150,5,164,226,104,107,21, +225,214,211,144,35,86,181,50,192,65,59,146,100,219,236,111, +166,185,144,174,118,87,104,215,53,156,183,146,93,195,33,42, +202,58,240,187,149,77,44,112,7,87,152,252,211,97,206,215, +205,243,251,68,240,32,166,70,12,71,35,126,76,66,76,168, +86,124,9,245,82,250,208,14,155,132,173,56,38,134,69,0, +117,224,142,217,190,166,48,31,170,140,93,133,11,133,35,84, +168,153,34,246,11,135,230,122,146,67,105,167,195,200,193,185, +125,201,120,2,207,16,146,23,155,241,48,92,99,72,238,157, +233,104,120,191,150,14,91,111,187,111,136,250,195,146,106,208, +171,104,77,245,233,141,37,166,26,83,53,209,97,219,75,52, +149,55,17,161,146,174,34,60,171,77,175,144,152,155,91,249, +77,152,118,74,242,233,228,216,8,105,221,119,162,172,86,58, +70,137,87,115,120,56,172,165,154,70,239,44,173,212,154,240, +17,241,61,245,106,72,216,28,112,213,120,44,59,200,53,104, +194,107,132,160,162,122,173,255,255,59,57,147,223,68,178,59, +142,255,43,45,37,167,81,38,125,200,109,20,229,144,81,142, +185,68,115,27,117,203,61,147,78,50,202,36,61,234,246,40, +57,26,48,139,89,12,102,43,48,155,1,155,213,44,54,59, +184,176,89,140,141,141,217,87,179,217,24,179,239,187,139,45, +96,119,119,102,34,69,26,205,237,189,250,253,222,247,87,85, +122,135,170,175,62,239,135,168,34,115,51,141,9,125,4,51, +241,163,172,203,92,79,67,114,225,29,189,154,138,53,55,14, +56,179,155,75,244,116,14,1,96,147,35,4,155,250,29,83, +6,188,153,239,121,205,35,55,102,109,80,172,250,214,139,178, +117,7,77,223,119,229,148,86,94,154,117,149,8,29,152,193, +225,173,67,124,201,179,17,56,37,151,226,225,58,77,212,109, +224,46,176,69,245,157,156,45,78,101,114,162,152,53,92,3, +51,138,89,236,168,101,139,128,110,15,83,67,97,162,225,112, +59,191,211,98,176,74,86,104,58,86,89,134,214,182,191,109, +129,178,99,220,120,61,203,24,213,197,242,145,43,152,132,153, +5,74,37,81,126,121,186,23,235,244,93,213,123,243,172,155, +192,14,38,121,186,51,18,218,226,106,161,29,223,176,20,59, +228,142,236,225,29,82,214,127,226,38,111,37,209,200,157,146, +212,66,222,15,23,31,246,199,176,110,0,169,106,53,119,118, +55,66,137,0,27,154,220,65,237,172,5,61,158,181,232,139, +31,186,94,67,30,190,15,134,109,60,201,109,69,212,171,89, +107,131,161,136,85,85,246,163,88,157,63,55,155,242,196,251, +80,248,166,186,39,5,112,116,118,60,110,192,149,21,21,96, +216,219,73,35,192,242,124,230,228,150,235,146,34,82,237,35, +100,174,195,14,235,205,133,153,12,151,244,199,154,99,70,38, +112,99,107,244,149,144,63,212,179,70,197,254,177,43,228,175, +158,131,128,44,120,175,182,104,44,107,222,160,30,78,77,34, +176,64,70,158,25,4,84,69,17,186,202,45,217,204,110,148, +81,102,227,80,97,169,37,214,36,51,144,134,224,186,36,155, +118,21,60,253,113,2,244,50,176,4,5,219,124,147,61,180, +99,125,76,12,53,73,49,185,151,88,147,60,207,50,195,145, +116,123,190,203,11,144,113,230,60,165,26,47,94,64,184,235, +84,101,155,27,144,231,216,208,116,150,159,160,206,152,195,250, +176,126,182,133,151,67,212,168,237,17,107,138,208,46,187,1, +202,102,24,151,245,59,236,144,95,105,117,240,169,45,155,92, +28,98,149,11,137,78,33,222,211,187,11,246,211,108,65,21, +52,155,6,168,96,50,225,46,39,136,215,232,209,157,197,152, +51,245,5,114,180,124,131,133,219,185,86,17,197,233,115,210, +5,198,160,223,218,34,5,17,221,81,174,137,193,200,162,14, +0,11,153,163,69,249,206,169,38,167,163,183,124,116,137,107, +207,85,11,192,7,227,212,160,58,19,70,211,108,110,164,238, +6,58,20,175,130,195,21,149,111,43,104,135,108,217,222,66, +199,41,145,244,168,200,17,186,103,160,139,205,124,99,179,151, +179,87,208,173,27,22,44,151,56,182,135,215,96,162,35,23, +4,42,109,145,173,50,42,178,95,32,82,55,174,242,150,245, +82,158,216,80,59,117,84,225,65,183,190,217,79,161,26,113, +59,205,211,47,98,139,45,115,130,109,86,218,130,164,248,129, +226,172,29,190,144,158,55,211,122,154,20,178,165,113,243,251, +208,169,207,141,54,184,198,35,37,51,176,97,80,66,78,34, +227,98,45,130,160,183,0,2,217,159,79,179,140,66,30,85, +168,118,110,1,249,242,246,208,201,221,154,135,165,115,181,103, +36,185,32,166,213,245,99,175,44,50,28,77,39,86,163,41, +16,85,135,68,172,114,243,138,151,216,2,187,154,246,125,251, +92,149,198,247,8,133,193,142,25,13,109,28,215,241,209,245, +94,207,107,6,183,148,230,130,168,128,203,42,36,119,138,118, +144,157,51,138,102,116,54,62,28,239,82,214,175,188,53,136, +138,96,58,168,157,234,134,205,169,159,192,224,240,10,152,4, +28,113,239,32,149,135,25,219,132,61,189,9,37,96,94,73, +78,89,234,97,3,143,221,219,176,183,111,241,25,3,237,138, +195,134,30,186,84,95,104,46,36,244,14,33,210,205,225,54, +37,56,206,15,207,137,36,174,0,68,139,28,208,26,214,192, +6,192,3,191,75,82,23,170,241,90,178,243,33,126,87,193, +192,11,186,163,93,185,237,50,210,184,212,213,85,106,142,132, +58,46,87,244,93,87,223,190,201,53,249,116,128,151,98,232, +136,213,166,54,135,85,227,153,193,30,108,215,64,117,223,4, +21,135,220,176,204,190,43,214,147,25,155,221,76,204,42,78, +83,230,67,130,236,24,81,101,76,1,67,26,113,123,192,103, +231,225,183,50,161,144,134,117,146,28,83,210,250,186,50,115, +127,165,167,170,114,67,108,173,80,49,108,73,146,163,52,61, +107,217,200,2,23,202,90,162,172,222,167,73,96,93,158,190, +206,28,101,76,83,91,8,119,71,186,225,158,220,158,104,207, +114,150,48,34,35,61,2,82,44,205,186,183,140,42,70,29, +180,141,6,3,153,196,108,136,102,12,59,227,108,39,192,56, +96,223,202,154,227,10,199,51,74,34,53,185,221,99,207,131, +111,167,149,38,186,194,92,193,189,218,72,134,157,176,178,92, +91,47,226,242,176,218,148,58,47,70,207,106,92,18,175,198, +31,19,89,100,5,219,67,201,55,175,234,155,28,103,240,62, +53,127,136,76,121,112,5,198,14,153,16,231,230,38,1,65, +96,238,201,85,49,184,181,47,1,204,126,28,141,35,57,101, +83,189,34,66,155,122,88,187,81,147,49,107,246,22,94,201, +164,227,179,45,49,165,149,195,72,75,24,120,186,170,20,59, +78,147,161,237,74,49,173,163,235,74,137,180,242,58,74,242, +50,163,29,31,42,162,151,105,103,49,6,249,246,140,12,106, +97,90,101,82,50,178,211,209,135,137,250,148,115,41,244,10, +175,98,231,144,127,122,178,70,108,52,109,77,72,110,10,132, +34,71,12,215,173,147,216,243,158,67,249,66,249,200,230,53, +50,17,1,237,96,27,126,82,172,184,253,49,77,113,80,84, +77,134,202,209,65,21,186,47,224,57,114,15,20,238,38,194, +21,95,226,16,103,101,222,40,220,57,28,197,56,65,149,83, +209,145,178,43,168,91,248,209,35,81,197,94,184,243,136,187, +204,93,64,50,231,192,224,92,107,231,58,221,87,239,132,67, +164,170,92,87,118,166,155,69,20,108,234,81,17,141,189,89, +55,63,209,35,139,81,192,201,75,170,133,253,203,155,92,213, +27,172,122,39,136,104,237,161,110,234,170,122,121,177,190,120, +101,165,110,234,238,130,5,41,135,217,108,3,90,138,57,154, +217,159,151,239,85,202,221,18,211,122,81,216,84,249,252,195, +170,13,115,202,71,31,23,216,182,136,143,43,145,236,227,105, +128,226,204,124,224,86,117,50,170,94,160,121,236,73,44,161, +38,13,38,73,159,29,142,114,151,195,11,199,89,232,110,115, +79,123,101,165,147,99,100,186,100,46,80,204,242,21,71,91, +28,18,205,172,53,24,89,69,247,26,57,236,238,58,116,219, +3,112,90,177,187,120,160,168,82,216,89,180,94,96,186,39, +66,5,162,0,29,11,170,25,17,133,157,15,220,98,203,117, +254,105,52,64,155,120,243,114,210,157,15,94,187,128,119,170, +237,148,57,103,172,80,170,107,234,237,27,184,174,70,159,170, +248,60,82,114,0,210,184,94,54,140,186,47,50,221,179,54, +31,170,5,233,189,161,208,119,24,251,188,8,170,103,132,225, +93,202,73,211,213,68,183,124,90,154,97,183,1,135,48,137, +163,84,162,77,49,167,82,212,248,26,255,50,112,70,210,186, +88,187,106,65,192,203,59,169,78,98,18,107,217,120,40,21, +4,47,33,64,156,209,21,25,30,110,244,138,174,151,236,83, +17,29,222,109,169,39,98,79,180,83,153,230,66,179,217,108, +104,140,23,76,62,41,42,78,214,154,254,30,22,1,76,53, +87,165,139,245,3,65,191,224,0,122,234,91,7,51,5,175, +26,229,67,228,9,103,223,10,34,107,132,56,130,118,6,122, +236,209,93,49,156,236,32,114,108,150,29,210,148,134,38,64, +188,9,118,230,162,140,206,225,80,225,4,222,116,132,157,86, +195,224,52,6,80,161,217,6,212,40,220,82,55,204,138,249, +236,70,147,217,48,198,252,167,187,251,220,187,92,22,75,227, +250,187,205,253,233,192,43,203,0,61,65,208,114,188,235,135, +96,4,68,11,118,199,144,58,137,102,70,130,167,64,58,154, +219,115,92,15,56,103,32,156,92,110,149,88,31,48,45,142, +166,61,89,161,169,75,204,9,170,94,121,8,221,197,41,190, +27,63,216,132,244,209,188,71,19,246,201,185,195,8,84,108, +108,130,241,176,87,69,90,188,240,8,143,153,30,66,26,199, +158,56,62,86,66,248,72,87,25,123,184,95,36,178,184,156, +100,179,195,148,21,175,124,125,219,240,97,17,144,45,62,20, +218,203,2,84,59,163,7,33,229,214,129,198,218,215,159,96, +246,48,38,54,52,243,105,130,16,72,203,156,92,50,16,252, +201,28,226,55,134,112,212,17,255,0,189,225,245,249,146,87, +30,17,20,38,206,43,4,138,177,140,52,178,124,96,172,119, +142,167,133,34,66,232,110,15,8,58,18,129,241,89,83,31, +145,46,166,82,128,229,226,245,225,254,234,98,1,187,89,235, +151,48,123,18,31,216,242,108,6,65,153,166,104,224,214,135, +18,174,59,194,66,243,33,126,4,33,4,93,106,136,229,57, +234,13,168,21,130,142,59,88,6,35,184,145,214,15,202,206, +250,18,174,102,161,31,38,86,78,183,103,139,203,139,97,136, +88,9,44,35,90,193,241,97,198,208,205,74,45,143,137,2, +167,85,153,61,95,232,235,207,250,46,119,170,151,83,72,151, +233,91,60,169,12,216,6,27,69,149,68,250,184,76,96,181, +54,230,215,200,74,64,6,202,128,135,54,147,243,176,183,148, +39,80,226,146,226,89,25,68,69,144,203,199,105,64,61,210, +64,123,14,66,227,253,120,184,233,233,151,154,59,219,72,161, +216,183,120,128,3,153,65,15,105,211,56,84,148,56,216,14, +55,247,197,139,32,121,93,120,230,153,53,153,203,59,83,46, +84,91,150,110,56,174,106,129,215,197,32,88,183,92,54,149, +89,123,143,59,190,108,105,135,231,118,158,178,88,158,111,142, +13,41,149,147,200,140,98,215,58,237,83,182,30,159,110,240, +215,212,73,116,249,8,101,40,209,103,151,65,86,71,75,214, +173,73,174,188,132,235,251,109,144,234,235,16,164,178,148,121, +55,49,245,119,175,197,204,211,233,36,223,33,197,36,68,102, +100,63,150,73,240,66,253,148,132,10,89,148,42,241,140,118, +63,4,166,140,186,103,228,21,6,89,19,216,117,40,186,78, +155,195,42,158,163,53,219,143,185,137,63,46,207,24,125,254, +104,33,45,219,100,190,250,234,219,215,75,131,233,95,111,222, +254,253,217,87,111,86,255,182,236,22,249,246,245,95,191,255, +246,213,219,71,158,99,229,211,71,134,234,201,116,90,30,81, +122,247,129,191,250,136,162,188,103,75,254,252,212,131,242,237, +55,143,46,209,163,214,199,70,160,143,206,211,71,36,234,215, +207,254,240,132,107,60,221,195,255,113,193,254,7,248,248,224, +109,189,250,246,221,211,153,165,239,87,191,121,236,24,186,250, +122,33,245,106,117,33,246,229,39,47,87,223,124,247,205,215, +43,159,173,60,95,121,190,212,248,252,205,219,215,43,207,223, +189,253,122,229,249,99,229,149,95,190,254,231,202,167,223,191, +91,249,197,34,231,179,39,63,233,245,95,86,151,147,15,50, +207,86,126,251,132,132,125,177,242,187,247,112,216,199,188,151, +255,29,190,248,213,207,43,247,167,165,37,243,83,234,61,38, +190,252,193,248,231,86,252,226,205,119,63,165,222,34,237,229, +199,209,7,171,240,103,148,251,253,155,213,213,55,255,248,41, +21,159,50,95,254,112,242,226,203,79,158,61,123,241,222,240, +124,207,220,253,168,61,236,50,180,216,192,175,255,253,205,187, +71,76,232,7,27,229,55,207,94,252,7,193,119,84,109, \ No newline at end of file diff --git a/olddraw/CtrlCore/srcdoc.tpp/LogPos$en-us.tpp b/olddraw/CtrlCore/srcdoc.tpp/LogPos$en-us.tpp new file mode 100644 index 000000000..078859668 --- /dev/null +++ b/olddraw/CtrlCore/srcdoc.tpp/LogPos$en-us.tpp @@ -0,0 +1,85 @@ +TITLE("Logical positions") +COMPRESSED +120,156,149,85,219,110,219,70,16,253,149,69,228,22,182,43, +11,59,123,33,119,197,151,20,78,158,26,36,65,210,246,193, +130,96,211,212,74,90,132,34,85,146,138,47,69,243,237,61, +67,202,142,29,181,72,107,193,162,77,242,204,185,204,12,57, +83,226,232,72,142,229,72,126,231,103,250,42,44,243,93,217, +205,103,165,114,46,139,169,52,89,78,105,246,206,103,95,190, +124,153,120,175,50,46,69,40,69,210,104,82,68,70,74,163, +82,178,94,122,235,200,73,157,26,101,83,105,167,219,188,201, +55,243,89,238,116,118,250,33,1,74,141,237,72,147,38,73, +137,50,184,75,106,169,12,41,75,206,25,74,173,211,62,73, +166,69,190,237,98,93,205,103,215,140,3,74,3,37,83,151, +24,2,198,88,165,83,107,128,53,134,8,127,147,77,147,52, +157,118,177,43,3,48,148,164,89,110,84,118,206,42,205,56, +25,65,157,74,1,53,202,36,70,59,165,201,41,149,120,109, +188,129,108,82,211,216,5,136,188,6,134,113,12,179,32,52, +214,144,70,30,38,181,26,183,165,56,26,233,73,129,213,73, +107,65,24,110,31,66,226,124,24,151,128,78,165,150,239,118, +198,145,78,157,50,42,81,16,32,83,152,100,118,59,93,132, +182,0,78,43,202,58,72,202,206,95,218,140,0,78,199,233, +72,73,47,85,146,122,16,66,44,12,107,239,73,59,16,26, +178,146,244,180,168,23,108,82,89,169,51,96,28,186,144,160, +112,31,137,77,8,122,149,118,96,76,73,107,124,91,227,210, +105,27,184,15,93,221,204,103,167,47,143,229,68,78,148,181, +39,172,215,3,238,180,209,218,36,222,144,212,96,65,13,195, +113,37,18,157,36,171,220,244,58,111,65,217,25,14,246,156, +59,207,83,132,216,181,179,26,204,9,190,208,81,216,211,72, +70,121,227,180,118,114,90,148,121,219,62,137,231,148,45,18, +141,137,70,41,167,106,181,50,158,163,209,10,241,170,196,122, +66,190,54,49,82,77,155,240,199,46,54,97,19,42,4,28, +49,24,217,67,115,246,67,8,45,195,16,170,49,41,140,161, +77,18,201,105,89,204,130,210,22,113,75,114,6,138,240,65, +131,187,253,28,246,179,209,207,5,233,49,233,145,87,70,67, +137,55,6,1,160,0,121,34,146,14,31,56,67,44,253,100, +16,36,244,38,6,250,1,110,198,100,70,41,6,24,125,242, +134,233,189,230,248,20,210,87,137,180,104,131,26,224,138,67, +87,71,136,157,148,227,223,19,198,219,49,97,17,160,144,172, +133,109,141,160,149,131,117,139,228,117,63,220,148,186,233,219, +112,211,190,202,187,176,159,150,211,243,163,97,204,40,25,83, +50,146,140,183,206,163,125,100,56,62,109,140,87,94,107,171, +188,213,137,68,140,237,176,199,12,230,93,234,247,240,177,72, +58,166,20,107,5,171,214,194,124,15,131,241,148,88,138,114, +62,225,16,246,69,174,206,202,88,177,14,204,69,54,140,194, +233,249,79,68,41,23,114,216,22,231,18,169,61,178,64,4, +210,98,204,241,36,112,232,51,218,172,176,3,252,40,40,62, +229,171,112,117,182,223,211,63,47,255,250,225,245,219,179,223, +62,138,89,171,50,241,166,94,197,34,47,197,182,110,35,47, +127,251,227,124,214,218,76,188,47,243,162,31,4,81,47,197, +121,215,148,173,184,137,221,58,86,34,118,173,64,95,249,82, +108,197,34,116,161,217,64,227,66,92,223,137,242,219,106,147, +3,2,145,151,245,141,216,212,77,16,69,189,217,150,225,86, +108,31,185,154,80,230,93,252,28,68,87,63,112,48,55,206, +23,93,94,173,202,48,17,191,174,3,160,184,38,150,245,174, +17,221,221,54,180,172,113,93,55,241,190,174,58,80,29,168, +152,14,166,34,86,57,123,39,51,49,59,21,101,88,118,115, +113,117,38,224,8,182,90,81,96,219,198,7,208,175,254,96, +53,182,16,81,128,184,169,55,125,1,17,22,171,192,228,123, +173,143,50,69,94,45,158,42,106,227,125,152,28,138,224,211, +189,136,255,78,123,93,119,235,129,155,41,154,184,90,15,42, +218,39,50,62,64,198,33,217,112,239,252,59,108,223,136,238, +89,158,43,248,202,201,148,204,245,15,206,10,232,8,205,255, +244,54,128,254,37,55,241,123,104,186,190,208,65,123,251,105, +224,71,215,231,188,68,137,7,192,235,188,88,139,46,110,194, +179,81,42,214,232,16,168,121,140,203,252,174,222,117,226,120, +215,238,242,178,188,19,121,43,134,181,99,103,69,19,242,94, +111,221,240,217,120,31,171,213,201,88,108,227,109,120,202,141, +59,129,221,175,8,11,193,16,96,174,119,29,111,4,102,106, +33,80,226,112,47,246,26,127,174,208,79,120,142,109,187,195, +212,175,243,126,169,250,53,0,146,183,224,145,40,62,234,189, +175,107,196,183,234,119,65,108,155,250,186,12,27,209,175,5, +238,233,107,228,219,109,9,194,94,126,145,87,98,215,242,186, +12,203,188,136,203,101,232,243,232,27,92,15,59,196,184,74, +112,55,22,121,195,154,3,131,22,188,30,123,86,188,62,227, +170,130,214,155,117,168,246,255,65,197,254,50,139,25,196,223, +172,239,30,32,7,173,175,194,224,234,58,244,38,194,98,34, +46,112,20,203,188,192,107,242,240,121,210,176,5,22,205,239, +124,49,123,169,197,213,139,119,191,92,158,243,204,148,151,175, +111,99,119,249,33,116,205,221,213,139,57,43,109,118,85,223, +239,71,27,189,231,222,38,72,63,226,120,236,253,88,144,62, +225,193,28,236,47,135,245,239,9,118,45,27,122,134,126,104, +212,197,144,249,131,179,103,109,89,12,105,241,229,175,143,178, +77,232,214,245,98,120,106,138,11,209,238,150,203,120,43,142, +203,248,41,136,55,216,223,247,117,123,33,66,87,76,38,147, +147,158,68,102,90,204,255,6,214,199,18,85, \ No newline at end of file diff --git a/olddraw/CtrlCore/srcdoc.tpp/TimerAndModalTrap$en-us.tpp b/olddraw/CtrlCore/srcdoc.tpp/TimerAndModalTrap$en-us.tpp new file mode 100644 index 000000000..87b5338a1 --- /dev/null +++ b/olddraw/CtrlCore/srcdoc.tpp/TimerAndModalTrap$en-us.tpp @@ -0,0 +1,190 @@ +TITLE("About modal loops and periodic timer events") +COMPRESSED +120,156,197,88,107,115,227,182,21,253,43,104,189,237,218,27, +217,37,248,16,73,169,211,137,227,36,141,39,217,199,196,155, +233,7,143,39,130,72,200,66,76,18,44,9,90,171,73,147, +223,222,115,1,80,15,123,147,166,51,233,116,119,118,37,81, +184,175,115,207,125,64,183,33,123,241,34,152,4,39,193,127, +248,51,251,92,174,196,80,153,187,219,42,204,178,185,74,131, +120,46,120,58,127,155,207,127,254,249,231,139,60,15,231,164, +138,67,21,15,226,136,135,156,199,65,16,135,41,79,242,32, +79,50,158,5,81,26,135,73,26,36,179,86,116,162,190,187, +21,89,52,127,245,237,20,82,225,36,57,137,120,196,3,62, +13,99,156,10,162,32,140,121,152,240,44,139,121,154,100,81, +62,157,206,10,209,26,165,155,187,219,37,201,65,42,130,84, +144,102,211,152,67,38,78,194,40,77,98,200,198,49,231,120, +207,147,116,154,166,51,163,76,37,239,110,21,57,189,228,211, +116,46,226,144,156,190,34,111,227,201,244,4,94,134,41,84, +196,97,60,141,163,44,140,120,22,134,211,60,138,243,24,238, +243,112,166,140,132,179,75,136,145,40,137,37,48,28,39,49, +143,128,75,156,38,17,142,165,120,141,131,156,135,176,158,5, +73,2,195,242,195,8,22,225,68,114,83,152,11,211,132,78, +103,113,198,163,52,11,227,112,26,194,129,32,69,176,100,61, +153,149,178,47,32,23,133,124,110,224,210,252,234,211,100,206, +33,156,78,210,147,48,200,131,112,154,230,48,8,103,17,120, +148,231,60,202,96,48,230,73,192,163,89,161,75,4,187,12, +147,32,154,67,38,67,54,166,80,108,161,73,166,28,254,134, +81,6,139,41,143,34,252,159,196,89,58,235,37,229,195,232, +238,238,246,213,167,167,193,69,112,17,38,201,25,249,155,67, +60,139,226,40,138,167,121,204,131,8,86,160,35,38,184,166, +1,50,202,147,48,155,45,69,15,147,38,38,108,175,136,1, +196,38,192,31,101,73,4,203,83,252,135,204,34,188,8,200, +132,121,156,69,81,22,204,138,74,244,253,1,60,175,40,68, +206,39,156,159,164,132,106,18,133,113,78,208,68,33,224,13, +167,73,206,129,111,50,141,131,112,214,201,127,14,170,147,181, +108,0,176,2,65,230,99,114,60,25,225,139,35,99,56,225, +33,232,152,76,167,1,161,149,128,19,97,148,0,238,128,103, +49,60,194,95,36,216,120,62,90,122,88,94,240,104,194,163, +147,60,140,35,120,146,199,49,0,128,2,158,115,206,131,12, +127,17,25,96,177,204,224,158,91,135,180,226,241,132,199,39, +41,136,140,60,229,49,153,207,35,130,47,4,250,225,52,72, +144,134,208,137,135,4,122,248,2,176,243,48,163,127,103,36, +159,76,56,10,2,30,242,36,65,216,17,128,14,51,132,158, +0,249,200,146,156,167,217,236,141,220,244,159,11,35,61,91, +94,93,189,112,52,227,211,9,159,158,4,36,159,100,57,210, +199,99,130,47,138,227,60,204,163,40,9,243,36,154,6,128, +177,119,245,76,194,84,83,182,30,119,74,210,9,79,81,94, +8,53,73,16,188,21,67,224,41,39,87,194,44,159,18,8, +94,201,226,188,82,13,249,1,94,204,29,21,94,93,125,194, +121,74,138,50,84,75,150,77,131,40,7,22,128,32,72,64, +115,116,132,12,121,70,154,67,212,0,181,132,226,65,220,203, +197,185,175,215,31,191,255,233,79,95,188,57,255,238,134,221, +246,225,156,93,46,245,96,88,173,75,81,177,74,235,182,103, +162,41,89,43,59,165,75,85,48,163,106,217,49,249,8,70, +244,127,190,187,237,131,57,243,47,215,13,51,107,133,227,157, +81,69,37,217,70,50,211,109,153,209,76,126,104,43,161,26, +182,89,11,195,112,98,211,233,230,158,109,148,89,59,137,86, +201,66,50,189,98,84,83,179,3,173,233,156,157,168,166,168, +134,82,178,191,94,153,174,250,70,45,255,226,95,47,214,127, +243,71,252,139,229,57,251,230,237,219,119,108,198,218,97,89, +193,219,247,186,253,135,106,74,189,97,139,31,253,49,247,205, +204,127,58,255,151,217,182,178,148,43,39,120,245,205,229,205, +205,155,203,215,95,204,119,223,211,243,211,179,253,231,71,173, +74,182,226,251,71,139,159,230,199,142,248,23,18,92,204,102, +78,126,60,251,227,78,207,141,52,239,129,229,149,168,170,37, +50,114,186,56,167,158,49,97,239,191,186,190,249,236,242,234, +235,211,21,63,59,176,225,223,88,235,94,51,57,241,92,239, +187,78,215,173,121,251,245,233,226,143,173,125,251,135,197,31, +159,235,241,47,127,255,238,122,241,253,229,187,119,139,239,95, +95,94,191,121,174,204,57,127,241,237,208,156,62,209,177,207, +251,251,53,37,90,3,86,73,201,53,148,100,131,103,163,35, +108,169,63,176,123,105,122,166,91,217,200,146,233,71,48,136, +72,229,222,220,131,26,19,214,107,134,79,91,188,234,134,109, +245,192,122,3,34,177,110,104,26,5,178,16,39,65,16,151, +204,158,161,22,244,208,21,178,103,167,27,151,223,53,20,86, +178,63,187,128,63,240,162,175,232,24,190,104,172,47,29,26, +175,106,204,5,123,75,36,27,186,30,174,174,172,153,2,100, +120,96,186,177,252,163,163,240,86,246,19,86,139,102,203,52, +30,116,196,104,201,68,213,73,81,110,201,173,226,1,65,44, +37,44,48,101,200,113,27,50,148,45,94,226,96,35,109,84, +132,6,168,95,84,26,182,160,166,134,134,234,226,24,185,239, +122,10,77,60,45,46,170,33,32,10,191,182,84,31,205,253, +156,81,11,174,151,248,206,154,130,213,7,41,81,153,35,58, +80,109,125,39,249,137,45,78,38,122,27,222,74,202,138,173, +144,9,251,61,210,205,30,149,220,180,26,96,140,186,22,47, +123,68,3,145,101,165,93,104,148,133,90,90,211,23,236,178, +48,3,244,111,39,174,86,23,47,215,18,137,89,74,1,65, +86,41,164,192,231,219,166,175,208,221,14,73,42,84,214,111, +123,244,94,155,95,184,253,195,208,219,156,162,7,172,165,67, +138,78,218,118,194,64,87,100,212,98,66,16,84,0,24,222, +0,68,35,30,36,67,11,41,36,220,169,160,233,24,14,210, +112,88,74,172,84,125,43,76,129,220,49,240,210,160,95,146, +194,213,128,40,32,10,83,157,128,57,229,168,209,203,198,102, +200,225,90,136,6,49,52,144,25,236,87,165,37,31,209,192, +39,167,134,135,232,158,189,67,121,192,201,202,2,221,73,51, +116,205,30,234,213,208,20,180,67,65,99,85,57,80,149,121, +146,255,27,237,142,34,208,98,77,108,215,150,147,96,79,219, +130,150,194,202,99,232,43,210,177,101,75,48,240,97,36,181, +23,213,132,146,205,211,151,186,163,22,216,41,131,84,9,214, +15,117,45,144,16,159,11,66,19,10,225,136,37,48,252,20, +136,196,53,99,101,12,101,223,18,90,138,98,205,218,181,232, +45,123,215,178,106,109,116,40,95,232,92,74,156,236,16,116, +137,170,48,194,131,227,12,168,190,31,228,113,124,10,139,210, +252,45,62,126,209,208,32,0,229,52,21,240,107,84,162,59, +96,103,216,21,187,189,244,78,221,45,110,253,247,139,187,39, +42,84,131,35,196,114,155,4,12,152,7,178,109,189,229,200, +19,82,86,126,84,231,236,72,41,91,220,30,116,229,103,70, +64,76,79,69,26,124,35,65,236,96,112,93,230,191,50,129, +166,249,204,130,88,17,128,163,199,51,204,17,215,25,29,73, +126,155,250,221,76,27,109,224,153,133,229,208,248,138,63,179, +189,235,199,214,34,213,72,37,182,32,4,117,98,133,39,251, +145,79,64,252,206,190,224,211,104,255,87,161,17,141,43,182, +143,3,52,14,139,37,77,3,244,56,182,86,247,246,244,158, +211,255,123,191,127,35,220,99,36,191,2,123,255,127,193,253, +247,74,209,47,177,152,134,215,90,117,165,159,70,190,155,186, +73,7,65,12,8,227,27,154,106,86,170,193,106,142,230,89, +96,38,163,219,29,247,199,55,122,51,25,231,244,90,144,226, +94,213,45,173,25,207,4,169,88,5,108,213,237,96,108,223, +4,164,237,47,180,212,9,53,122,116,62,92,109,160,162,82, +15,178,218,238,102,56,219,232,161,42,109,43,240,59,135,35, +215,110,57,177,163,12,75,163,143,193,99,130,65,187,241,120, +244,174,225,30,180,240,162,19,253,26,221,22,111,157,50,90, +124,168,235,179,211,163,73,54,161,40,252,138,227,199,173,221, +5,42,116,104,90,39,236,74,0,246,203,66,12,187,13,198, +45,29,122,191,42,61,181,238,219,88,41,151,195,253,189,236, +38,110,234,29,251,49,244,118,198,51,171,248,121,0,104,220, +170,174,101,169,48,65,232,148,93,106,0,159,52,248,68,123, +60,65,69,66,141,238,106,32,47,154,70,111,201,151,197,203, +47,133,161,7,7,202,100,215,233,14,187,3,22,173,11,118, +77,115,71,161,233,238,194,5,186,99,128,186,41,228,129,183, +142,99,154,24,96,221,144,31,214,56,134,153,54,217,237,133, +165,110,22,47,13,43,105,99,163,20,238,150,184,113,110,187, +58,179,33,181,148,92,101,206,158,12,229,175,176,117,60,18, +76,150,54,189,194,246,227,96,60,200,68,169,86,43,217,73, +90,40,47,11,172,60,118,16,238,70,114,87,15,149,147,249, +40,249,14,2,234,220,46,75,167,31,41,34,218,90,241,178, +56,119,139,146,176,87,49,199,173,53,166,110,103,247,8,67, +43,151,231,218,4,0,222,15,8,109,130,133,74,97,24,34, +217,180,224,141,83,185,116,191,36,161,86,95,127,118,148,4, +231,64,165,106,101,215,30,226,143,173,128,122,40,214,150,225, +207,246,16,218,140,78,119,235,141,147,119,123,36,108,145,205, +51,135,56,134,167,20,228,60,8,130,2,4,244,248,30,178, +224,72,71,107,245,118,41,209,242,58,172,114,59,164,203,161, +115,196,133,240,40,68,199,159,241,208,213,230,184,203,120,124, +232,218,228,187,236,184,188,59,44,106,12,7,23,218,146,28, +70,245,16,93,151,114,11,224,118,140,41,68,43,150,10,121, +85,36,72,131,101,23,129,235,18,253,208,217,93,136,114,227, +214,113,191,130,129,13,26,4,248,108,107,221,220,8,170,204, +45,150,88,191,194,210,246,187,248,228,203,216,206,215,181,174, +44,71,160,18,252,96,98,48,64,160,149,190,229,244,107,27, +215,82,62,185,54,140,107,125,123,16,156,85,247,20,23,44, +251,27,89,85,251,214,96,15,236,141,236,13,172,16,216,225, +222,236,85,23,88,45,125,179,192,215,143,182,132,237,206,122, +224,184,13,218,122,79,248,194,207,3,215,15,56,140,182,80, +60,80,117,122,11,98,9,230,210,190,125,180,120,158,186,205, +25,109,220,246,29,119,19,243,87,37,86,17,250,71,215,71, +31,244,179,133,140,6,168,172,86,19,223,134,93,222,159,81, +87,126,160,57,59,138,186,225,118,56,118,73,187,59,227,103, +236,211,158,112,13,28,90,73,47,2,235,33,117,152,13,46, +22,196,46,98,50,61,213,5,149,158,181,124,88,127,96,40, +90,91,45,140,7,189,193,245,144,238,56,216,204,47,216,215, +184,195,145,84,173,108,116,192,203,14,25,123,243,244,68,179, +83,205,81,149,178,224,46,83,246,62,186,191,199,184,253,141, +168,74,84,135,22,162,13,230,164,6,15,65,167,137,61,96, +119,118,86,168,174,24,106,90,221,233,234,236,132,96,98,37, +10,115,52,13,39,123,130,244,72,215,254,50,163,169,145,162, +221,151,71,3,223,118,133,71,92,61,244,208,31,165,121,226, +46,146,170,30,239,75,232,140,70,209,4,119,207,132,113,61, +254,148,60,247,115,202,30,49,107,186,109,203,114,113,110,175, +103,174,48,253,176,183,44,179,38,233,150,179,252,200,69,139, +212,160,51,208,239,84,31,32,51,182,98,171,221,122,79,191, +18,208,152,241,65,175,113,253,239,13,25,1,228,149,106,30, +220,181,179,71,47,220,111,24,238,103,128,125,60,27,141,59, +144,173,85,186,106,226,214,221,183,178,80,150,205,27,207,212, +173,21,65,159,70,210,233,234,101,127,241,42,97,170,27,138, +209,41,80,66,47,127,192,247,23,236,244,186,22,247,116,89, +21,251,177,99,87,2,71,107,215,207,157,176,118,93,213,53, +153,115,250,93,184,244,106,232,199,4,26,65,189,117,21,69, +37,69,51,56,138,251,54,75,60,63,184,106,147,218,98,188, +57,215,18,23,209,70,245,245,33,14,118,73,117,91,138,179, +129,188,18,79,48,6,69,165,239,237,134,215,233,138,86,22, +16,178,95,17,209,220,35,102,149,218,193,8,166,173,69,181, +90,156,143,33,236,60,62,110,161,227,26,128,48,214,162,117, +85,91,211,143,135,32,68,175,93,3,162,103,55,235,193,216, +142,180,115,153,144,178,120,188,236,47,206,216,107,221,83,91, +83,118,215,100,125,171,77,63,50,140,14,93,81,221,86,106, +217,209,29,89,173,168,137,216,100,1,24,227,146,5,30,141, +148,174,129,97,239,238,30,80,106,105,177,75,144,31,26,214, +237,82,203,222,118,7,18,112,37,100,15,139,131,61,181,160, +221,200,184,149,240,89,167,242,109,39,98,119,255,6,15,61, +167,109, \ No newline at end of file diff --git a/uppsrc/Draw/Cham.cpp b/olddraw/Draw/Cham.cpp similarity index 100% rename from uppsrc/Draw/Cham.cpp rename to olddraw/Draw/Cham.cpp diff --git a/uppsrc/Draw/Cham.h b/olddraw/Draw/Cham.h similarity index 100% rename from uppsrc/Draw/Cham.h rename to olddraw/Draw/Cham.h diff --git a/uppsrc/Draw/ComposeText.cpp b/olddraw/Draw/ComposeText.cpp similarity index 100% rename from uppsrc/Draw/ComposeText.cpp rename to olddraw/Draw/ComposeText.cpp diff --git a/olddraw/Draw/Copying b/olddraw/Draw/Copying new file mode 100644 index 000000000..f135f3633 --- /dev/null +++ b/olddraw/Draw/Copying @@ -0,0 +1,21 @@ +Copyright 1998-2008 The U++ Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of + conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of + conditions and the following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE U++ PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/uppsrc/Draw/Debug.cpp b/olddraw/Draw/Debug.cpp similarity index 100% rename from uppsrc/Draw/Debug.cpp rename to olddraw/Draw/Debug.cpp diff --git a/uppsrc/Draw/Debug.h b/olddraw/Draw/Debug.h similarity index 100% rename from uppsrc/Draw/Debug.h rename to olddraw/Draw/Debug.h diff --git a/uppsrc/Draw/Display.cpp b/olddraw/Draw/Display.cpp similarity index 100% rename from uppsrc/Draw/Display.cpp rename to olddraw/Draw/Display.cpp diff --git a/uppsrc/Draw/Display.h b/olddraw/Draw/Display.h similarity index 100% rename from uppsrc/Draw/Display.h rename to olddraw/Draw/Display.h diff --git a/uppsrc/Draw/Draw.cpp b/olddraw/Draw/Draw.cpp similarity index 100% rename from uppsrc/Draw/Draw.cpp rename to olddraw/Draw/Draw.cpp diff --git a/uppsrc/Draw/Draw.h b/olddraw/Draw/Draw.h similarity index 100% rename from uppsrc/Draw/Draw.h rename to olddraw/Draw/Draw.h diff --git a/uppsrc/Draw/Draw.upp b/olddraw/Draw/Draw.upp similarity index 100% rename from uppsrc/Draw/Draw.upp rename to olddraw/Draw/Draw.upp diff --git a/uppsrc/Draw/DrawData.cpp b/olddraw/Draw/DrawData.cpp similarity index 100% rename from uppsrc/Draw/DrawData.cpp rename to olddraw/Draw/DrawData.cpp diff --git a/uppsrc/Draw/DrawImg.iml b/olddraw/Draw/DrawImg.iml similarity index 100% rename from uppsrc/Draw/DrawImg.iml rename to olddraw/Draw/DrawImg.iml diff --git a/uppsrc/Draw/DrawOpWin32.cpp b/olddraw/Draw/DrawOpWin32.cpp similarity index 100% rename from uppsrc/Draw/DrawOpWin32.cpp rename to olddraw/Draw/DrawOpWin32.cpp diff --git a/uppsrc/Draw/DrawOpX11.cpp b/olddraw/Draw/DrawOpX11.cpp similarity index 100% rename from uppsrc/Draw/DrawOpX11.cpp rename to olddraw/Draw/DrawOpX11.cpp diff --git a/uppsrc/Draw/DrawRasterData.cpp b/olddraw/Draw/DrawRasterData.cpp similarity index 100% rename from uppsrc/Draw/DrawRasterData.cpp rename to olddraw/Draw/DrawRasterData.cpp diff --git a/uppsrc/Draw/DrawText.cpp b/olddraw/Draw/DrawText.cpp similarity index 100% rename from uppsrc/Draw/DrawText.cpp rename to olddraw/Draw/DrawText.cpp diff --git a/uppsrc/Draw/DrawTextUtil.cpp b/olddraw/Draw/DrawTextUtil.cpp similarity index 100% rename from uppsrc/Draw/DrawTextUtil.cpp rename to olddraw/Draw/DrawTextUtil.cpp diff --git a/uppsrc/Draw/DrawTextWin32.cpp b/olddraw/Draw/DrawTextWin32.cpp similarity index 100% rename from uppsrc/Draw/DrawTextWin32.cpp rename to olddraw/Draw/DrawTextWin32.cpp diff --git a/uppsrc/Draw/DrawTextXft.cpp b/olddraw/Draw/DrawTextXft.cpp similarity index 100% rename from uppsrc/Draw/DrawTextXft.cpp rename to olddraw/Draw/DrawTextXft.cpp diff --git a/uppsrc/Draw/DrawUtil.cpp b/olddraw/Draw/DrawUtil.cpp similarity index 100% rename from uppsrc/Draw/DrawUtil.cpp rename to olddraw/Draw/DrawUtil.cpp diff --git a/uppsrc/Draw/DrawWin32.cpp b/olddraw/Draw/DrawWin32.cpp similarity index 100% rename from uppsrc/Draw/DrawWin32.cpp rename to olddraw/Draw/DrawWin32.cpp diff --git a/uppsrc/Draw/DrawWin32.h b/olddraw/Draw/DrawWin32.h similarity index 100% rename from uppsrc/Draw/DrawWin32.h rename to olddraw/Draw/DrawWin32.h diff --git a/uppsrc/Draw/DrawX11.cpp b/olddraw/Draw/DrawX11.cpp similarity index 100% rename from uppsrc/Draw/DrawX11.cpp rename to olddraw/Draw/DrawX11.cpp diff --git a/uppsrc/Draw/Drawing.cpp b/olddraw/Draw/Drawing.cpp similarity index 100% rename from uppsrc/Draw/Drawing.cpp rename to olddraw/Draw/Drawing.cpp diff --git a/uppsrc/Draw/Image.cpp b/olddraw/Draw/Image.cpp similarity index 100% rename from uppsrc/Draw/Image.cpp rename to olddraw/Draw/Image.cpp diff --git a/uppsrc/Draw/Image.h b/olddraw/Draw/Image.h similarity index 100% rename from uppsrc/Draw/Image.h rename to olddraw/Draw/Image.h diff --git a/uppsrc/Draw/ImageBlit.cpp b/olddraw/Draw/ImageBlit.cpp similarity index 100% rename from uppsrc/Draw/ImageBlit.cpp rename to olddraw/Draw/ImageBlit.cpp diff --git a/uppsrc/Draw/ImageChOp.cpp b/olddraw/Draw/ImageChOp.cpp similarity index 100% rename from uppsrc/Draw/ImageChOp.cpp rename to olddraw/Draw/ImageChOp.cpp diff --git a/uppsrc/Draw/ImageDraw.h b/olddraw/Draw/ImageDraw.h similarity index 100% rename from uppsrc/Draw/ImageDraw.h rename to olddraw/Draw/ImageDraw.h diff --git a/uppsrc/Draw/ImageOp.cpp b/olddraw/Draw/ImageOp.cpp similarity index 100% rename from uppsrc/Draw/ImageOp.cpp rename to olddraw/Draw/ImageOp.cpp diff --git a/uppsrc/Draw/ImageOp.h b/olddraw/Draw/ImageOp.h similarity index 100% rename from uppsrc/Draw/ImageOp.h rename to olddraw/Draw/ImageOp.h diff --git a/uppsrc/Draw/ImageScale.cpp b/olddraw/Draw/ImageScale.cpp similarity index 100% rename from uppsrc/Draw/ImageScale.cpp rename to olddraw/Draw/ImageScale.cpp diff --git a/uppsrc/Draw/ImageWin32.cpp b/olddraw/Draw/ImageWin32.cpp similarity index 100% rename from uppsrc/Draw/ImageWin32.cpp rename to olddraw/Draw/ImageWin32.cpp diff --git a/uppsrc/Draw/ImageX11.cpp b/olddraw/Draw/ImageX11.cpp similarity index 100% rename from uppsrc/Draw/ImageX11.cpp rename to olddraw/Draw/ImageX11.cpp diff --git a/uppsrc/Draw/MakeCache.cpp b/olddraw/Draw/MakeCache.cpp similarity index 100% rename from uppsrc/Draw/MakeCache.cpp rename to olddraw/Draw/MakeCache.cpp diff --git a/uppsrc/Draw/MetaFile.cpp b/olddraw/Draw/MetaFile.cpp similarity index 100% rename from uppsrc/Draw/MetaFile.cpp rename to olddraw/Draw/MetaFile.cpp diff --git a/uppsrc/Draw/Mt.cpp b/olddraw/Draw/Mt.cpp similarity index 100% rename from uppsrc/Draw/Mt.cpp rename to olddraw/Draw/Mt.cpp diff --git a/uppsrc/Draw/Palette.cpp b/olddraw/Draw/Palette.cpp similarity index 100% rename from uppsrc/Draw/Palette.cpp rename to olddraw/Draw/Palette.cpp diff --git a/uppsrc/Draw/Raster.cpp b/olddraw/Draw/Raster.cpp similarity index 100% rename from uppsrc/Draw/Raster.cpp rename to olddraw/Draw/Raster.cpp diff --git a/uppsrc/Draw/Raster.h b/olddraw/Draw/Raster.h similarity index 100% rename from uppsrc/Draw/Raster.h rename to olddraw/Draw/Raster.h diff --git a/uppsrc/Draw/RasterEncoder.cpp b/olddraw/Draw/RasterEncoder.cpp similarity index 100% rename from uppsrc/Draw/RasterEncoder.cpp rename to olddraw/Draw/RasterEncoder.cpp diff --git a/uppsrc/Draw/RasterFormat.cpp b/olddraw/Draw/RasterFormat.cpp similarity index 100% rename from uppsrc/Draw/RasterFormat.cpp rename to olddraw/Draw/RasterFormat.cpp diff --git a/uppsrc/Draw/RasterWrite.cpp b/olddraw/Draw/RasterWrite.cpp similarity index 100% rename from uppsrc/Draw/RasterWrite.cpp rename to olddraw/Draw/RasterWrite.cpp diff --git a/uppsrc/Draw/SSettings.cpp b/olddraw/Draw/SSettings.cpp similarity index 100% rename from uppsrc/Draw/SSettings.cpp rename to olddraw/Draw/SSettings.cpp diff --git a/uppsrc/Draw/gdk.dli b/olddraw/Draw/gdk.dli similarity index 100% rename from uppsrc/Draw/gdk.dli rename to olddraw/Draw/gdk.dli diff --git a/uppsrc/Draw/gnome.dli b/olddraw/Draw/gnome.dli similarity index 100% rename from uppsrc/Draw/gnome.dli rename to olddraw/Draw/gnome.dli diff --git a/uppsrc/Draw/gobj.dli b/olddraw/Draw/gobj.dli similarity index 100% rename from uppsrc/Draw/gobj.dli rename to olddraw/Draw/gobj.dli diff --git a/uppsrc/Draw/gpixbuf.dli b/olddraw/Draw/gpixbuf.dli similarity index 100% rename from uppsrc/Draw/gpixbuf.dli rename to olddraw/Draw/gpixbuf.dli diff --git a/uppsrc/Draw/gtk.dli b/olddraw/Draw/gtk.dli similarity index 100% rename from uppsrc/Draw/gtk.dli rename to olddraw/Draw/gtk.dli diff --git a/uppsrc/Draw/iml.h b/olddraw/Draw/iml.h similarity index 100% rename from uppsrc/Draw/iml.h rename to olddraw/Draw/iml.h diff --git a/uppsrc/Draw/iml_header.h b/olddraw/Draw/iml_header.h similarity index 100% rename from uppsrc/Draw/iml_header.h rename to olddraw/Draw/iml_header.h diff --git a/uppsrc/Draw/iml_source.h b/olddraw/Draw/iml_source.h similarity index 100% rename from uppsrc/Draw/iml_source.h rename to olddraw/Draw/iml_source.h diff --git a/uppsrc/Draw/init b/olddraw/Draw/init similarity index 100% rename from uppsrc/Draw/init rename to olddraw/Draw/init diff --git a/uppsrc/Draw/src.tpp/Display$en-us.tpp b/olddraw/Draw/src.tpp/Display$en-us.tpp similarity index 100% rename from uppsrc/Draw/src.tpp/Display$en-us.tpp rename to olddraw/Draw/src.tpp/Display$en-us.tpp diff --git a/uppsrc/Draw/src.tpp/Draw$en-us.tpp b/olddraw/Draw/src.tpp/Draw$en-us.tpp similarity index 100% rename from uppsrc/Draw/src.tpp/Draw$en-us.tpp rename to olddraw/Draw/src.tpp/Draw$en-us.tpp diff --git a/uppsrc/Draw/src.tpp/Font$en-us.tpp b/olddraw/Draw/src.tpp/Font$en-us.tpp similarity index 100% rename from uppsrc/Draw/src.tpp/Font$en-us.tpp rename to olddraw/Draw/src.tpp/Font$en-us.tpp diff --git a/uppsrc/Draw/src.tpp/FontInfo$en-us.tpp b/olddraw/Draw/src.tpp/FontInfo$en-us.tpp similarity index 100% rename from uppsrc/Draw/src.tpp/FontInfo$en-us.tpp rename to olddraw/Draw/src.tpp/FontInfo$en-us.tpp diff --git a/uppsrc/Draw/src.tpp/Image$en-us.tpp b/olddraw/Draw/src.tpp/Image$en-us.tpp similarity index 100% rename from uppsrc/Draw/src.tpp/Image$en-us.tpp rename to olddraw/Draw/src.tpp/Image$en-us.tpp diff --git a/uppsrc/Draw/src.tpp/Iml$en-us.tpp b/olddraw/Draw/src.tpp/Iml$en-us.tpp similarity index 100% rename from uppsrc/Draw/src.tpp/Iml$en-us.tpp rename to olddraw/Draw/src.tpp/Iml$en-us.tpp diff --git a/uppsrc/Draw/srcdoc.tpp/DrawOutput$en-us.tpp b/olddraw/Draw/srcdoc.tpp/DrawOutput$en-us.tpp similarity index 100% rename from uppsrc/Draw/srcdoc.tpp/DrawOutput$en-us.tpp rename to olddraw/Draw/srcdoc.tpp/DrawOutput$en-us.tpp diff --git a/uppsrc/Draw/srcdoc.tpp/DrawTutorial$en-us.tpp b/olddraw/Draw/srcdoc.tpp/DrawTutorial$en-us.tpp similarity index 100% rename from uppsrc/Draw/srcdoc.tpp/DrawTutorial$en-us.tpp rename to olddraw/Draw/srcdoc.tpp/DrawTutorial$en-us.tpp diff --git a/uppsrc/Draw/srcdoc.tpp/ImgTutorial$en-us.tpp b/olddraw/Draw/srcdoc.tpp/ImgTutorial$en-us.tpp similarity index 100% rename from uppsrc/Draw/srcdoc.tpp/ImgTutorial$en-us.tpp rename to olddraw/Draw/srcdoc.tpp/ImgTutorial$en-us.tpp diff --git a/reference/RichTextObject/RichTextObject.upp b/reference/RichTextObject/RichTextObject.upp index f758038f5..553782d29 100644 --- a/reference/RichTextObject/RichTextObject.upp +++ b/reference/RichTextObject/RichTextObject.upp @@ -1,3 +1,5 @@ +description "Demonstrates the use of QTF object in text format\377"; + uses CtrlLib, RichEdit;