mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-31 07:12:39 -06:00
CtrlCore: Developing Cocoa support
git-svn-id: svn://ultimatepp.org/upp/trunk@12101 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
fce079d34b
commit
42f716ebe5
9 changed files with 37 additions and 23 deletions
|
|
@ -45,6 +45,7 @@ private:
|
|||
|
||||
void *handle;
|
||||
|
||||
RectCG MakeRectCG(const Rect& r);
|
||||
void ClipCG(const Rect& r);
|
||||
void FlipY(int& y) { y = top - y; }
|
||||
Rect GetClip() const { return clip.GetCount() ? clip.Top() : Rect(-999999, -999999, 999999, 999999); }
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#ifdef PLATFORM_COCOA
|
||||
|
||||
#define LLOG(x) DLOG(x)
|
||||
#define LLOG(x) // DLOG(x)
|
||||
|
||||
int Upp::Ctrl::WndCaretTime;
|
||||
bool Upp::Ctrl::WndCaretVisible;
|
||||
|
|
@ -51,10 +51,6 @@ void Upp::CocoInit(int argc, const char **argv, const char **envptr)
|
|||
|
||||
Font::SetDefaultFont(Arial(12)); // TODO: Read from NSFont!
|
||||
NSFont *sysfont = [NSFont systemFontOfSize:0];
|
||||
DDUMP(Upp::ToString((CFStringRef)[sysfont familyName]));
|
||||
DDUMP(Upp::ToString((CFStringRef)[sysfont displayName]));
|
||||
DDUMP(Upp::ToString((CFStringRef)[sysfont fontName]));
|
||||
DDUMP([sysfont pointSize]);
|
||||
Font::SetFace(0, Upp::ToString((CFStringRef)[sysfont familyName]), Font::TTF);
|
||||
Font::SetDefaultFont(StdFont(fround([sysfont pointSize]))); // TODO: Read from NSFont!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,9 +48,10 @@ void Upp::Ctrl::Create(dword style)
|
|||
|
||||
void Upp::Ctrl::WndDestroy()
|
||||
{
|
||||
DLOG("WndDestroy " << this);
|
||||
if(!top)
|
||||
return;
|
||||
[top->coco->window release];
|
||||
[top->coco->window close];
|
||||
delete top->coco;
|
||||
delete top;
|
||||
top = NULL;
|
||||
|
|
|
|||
|
|
@ -98,11 +98,16 @@ RectCG SystemDraw::Convert(const Rect& r)
|
|||
return Convert(r.left, r.top, r.GetWidth(), r.GetHeight());
|
||||
}
|
||||
|
||||
RectCG SystemDraw::MakeRectCG(const Rect& r)
|
||||
{
|
||||
Size sz = r.GetSize();
|
||||
return RectCG(r.left, top - r.top - sz.cy, sz.cx, sz.cy);
|
||||
}
|
||||
|
||||
void SystemDraw::ClipCG(const Rect& r)
|
||||
{
|
||||
Size sz = r.GetSize();
|
||||
CGContextClipToRect(cgHandle, CGRectMake(r.left, top - r.top - sz.cy, sz.cx, sz.cy));
|
||||
DLOG("ClipCG " << r);
|
||||
CGContextClipToRect(cgHandle, MakeRectCG(r));
|
||||
}
|
||||
|
||||
bool SystemDraw::ClipOp(const Rect& r)
|
||||
|
|
@ -122,9 +127,15 @@ bool SystemDraw::ClipoffOp(const Rect& r)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool SystemDraw::ExcludeClipOp(const Rect& r)
|
||||
bool SystemDraw::ExcludeClipOp(const Rect& r_)
|
||||
{
|
||||
// TODO, perhaps use CGContextClipToRects
|
||||
CGRect cgr[4];
|
||||
Rect r = r_.Offseted(GetOffset());
|
||||
cgr[0] = MakeRectCG(Rect(0, 0, 9999, r.top));
|
||||
cgr[1] = MakeRectCG(Rect(0, r.bottom, 9999, 9999));
|
||||
cgr[2] = MakeRectCG(Rect(0, 0, r.left, 9999));
|
||||
cgr[3] = MakeRectCG(Rect(r.right, 0, 9999, 9999));
|
||||
CGContextClipToRects(cgHandle, cgr, 4);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -149,6 +160,8 @@ Rect SystemDraw::GetPaintRect() const
|
|||
|
||||
void SystemDraw::DrawRectOp(int x, int y, int cx, int cy, Color color)
|
||||
{
|
||||
if(IsNull(color))
|
||||
return;
|
||||
CGRect cgr = Convert(x, y, cx, cy);
|
||||
if(color == InvertColor()) {
|
||||
Set(White());
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ void RenderCharacterSys(FontGlyphConsumer& sw, double x, double y, int ch, Font
|
|||
void SystemDraw::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink,
|
||||
int n, const int *dx)
|
||||
{
|
||||
DLOG("angle " << angle << ", text " << text << ", ink " << ink);
|
||||
// DLOG("angle " << angle << ", text " << text << ", ink " << ink);
|
||||
Set(ink); // needs to be here because rotation saves context...
|
||||
if(angle) {
|
||||
// TODO: Fix this!
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ K_LEFT = kVK_LeftArrow|K_DELTA,
|
|||
K_UP = kVK_UpArrow|K_DELTA,
|
||||
K_RIGHT = kVK_RightArrow|K_DELTA,
|
||||
K_DOWN = kVK_DownArrow|K_DELTA,
|
||||
K_INSERT = 999999999, // kVK_Insert|K_DELTA, // TODO
|
||||
K_INSERT = kVK_Help|K_DELTA, // Code is this for external keyboard..
|
||||
K_DELETE = kVK_ForwardDelete|K_DELTA,
|
||||
|
||||
K_NUMPAD0 = kVK_ANSI_Keypad0|K_DELTA,
|
||||
|
|
@ -106,11 +106,11 @@ K_CTRL_COMMA = kVK_ANSI_Comma|K_DELTA|K_CTRL,
|
|||
K_CTRL_PERIOD = kVK_ANSI_Period|K_DELTA|K_CTRL,
|
||||
K_CTRL_SEMICOLON = kVK_ANSI_Semicolon|K_DELTA|K_CTRL,
|
||||
K_CTRL_EQUAL = kVK_ANSI_Equal|K_DELTA|K_CTRL,
|
||||
K_CTRL_APOSTROPHE,
|
||||
K_CTRL_APOSTROPHE, // TODO
|
||||
|
||||
K_BREAK,
|
||||
K_BREAK, // TODO
|
||||
|
||||
K_PLUS = 999999999,
|
||||
K_PLUS = 999999997,
|
||||
K_MINUS = kVK_ANSI_Minus|K_DELTA,
|
||||
K_COMMA = kVK_ANSI_Comma|K_DELTA,
|
||||
K_PERIOD = kVK_ANSI_Period|K_DELTA,
|
||||
|
|
@ -120,4 +120,4 @@ K_GRAVE = kVK_ANSI_Grave|K_DELTA,
|
|||
K_LBRACKET = kVK_ANSI_LeftBracket|K_DELTA,
|
||||
K_BACKSLASH = kVK_ANSI_Backslash|K_DELTA,
|
||||
K_RBRACKET = kVK_ANSI_RightBracket|K_DELTA,
|
||||
K_QUOTEDBL = 999999999,
|
||||
K_QUOTEDBL = 999999996,
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ library(POSIX !NOGTK !RAINBOW GUI !OSX11) notify;
|
|||
|
||||
library(DRAGONFLY) "Xext Xinerama";
|
||||
|
||||
link(MACOSX) " -framework Foundation -framework Cocoa";
|
||||
|
||||
file
|
||||
Core readonly separator,
|
||||
CtrlCore.h options(BUILDER_OPTION) PCH,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Upp {
|
||||
|
||||
#define LLOG(x) // DLOG(x)
|
||||
#define LLOG(x) DLOG(x)
|
||||
#define LTIMING(x) // TIMING(x)
|
||||
|
||||
bool Ctrl::globalbackpaint;
|
||||
|
|
@ -351,8 +351,12 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) {
|
|||
LTIMING("CtrlPaint");
|
||||
Rect rect = GetRect().GetSize();
|
||||
Rect orect = rect.Inflated(overpaint);
|
||||
DDUMP(Name());
|
||||
DDUMP(orect);
|
||||
DDUMP(clip);
|
||||
if(!IsShown() || orect.IsEmpty() || clip.IsEmpty() || !clip.Intersects(orect))
|
||||
return;
|
||||
DLOG("2");
|
||||
Ctrl *q;
|
||||
Rect view = rect;
|
||||
for(int i = 0; i < frame.GetCount(); i++) {
|
||||
|
|
@ -592,7 +596,7 @@ void Ctrl::UpdateArea0(SystemDraw& draw, const Rect& clip, int backpaint)
|
|||
{
|
||||
GuiLock __;
|
||||
LTIMING("UpdateArea");
|
||||
LLOG("========== UPDATE AREA " << UPP::Name(this) << " ==========");
|
||||
LLOG("========== UPDATE AREA " << UPP::Name(this) << " " << clip << " ==========");
|
||||
ExcludeDHCtrls(draw, GetRect().GetSize(), clip);
|
||||
if(globalbackbuffer) {
|
||||
CtrlPaint(draw, clip);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
sooner:
|
||||
- minimize, maximaze
|
||||
- Open/OpenMain variants
|
||||
- LabelBox is wrong
|
||||
- closing it
|
||||
- initial focus
|
||||
- SerializePlacement
|
||||
- Switch does not seem to work for some reason
|
||||
|
||||
later:
|
||||
DrawDragRect
|
||||
- fullscreen
|
||||
- missing cursors (add to iml, use undocumented cursor)
|
||||
- X11 on option
|
||||
|
|
@ -16,7 +16,6 @@ DrawDragRect
|
|||
- CommonFontInfo GetFontInfoSys(Font font) metrics
|
||||
- ROTATED TEXT
|
||||
- GetGlyphInfoSys metrics
|
||||
- Default gui font (also in GetAllFacesSys)
|
||||
- EndSession ?
|
||||
- Image::Arrow etc...
|
||||
- ignoreclick
|
||||
|
|
@ -46,3 +45,5 @@ done:
|
|||
- implement standard cursors
|
||||
- backspace and delete not working
|
||||
- Enter Up
|
||||
- LabelBox is wrong
|
||||
- Default gui font (also in GetAllFacesSys)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue