Some SystemDraw fixes, fixed another reason for key lag in theide

git-svn-id: svn://ultimatepp.org/upp/trunk@1160 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-05-12 07:43:36 +00:00
parent 6118f68704
commit dfe15080d7
11 changed files with 30 additions and 12 deletions

View file

@ -2,7 +2,7 @@
NAMESPACE_UPP
#define LLOG(x) //LOG(x)
#define LLOG(x) // LOG(x)
Ptr<Ctrl> Ctrl::focusCtrl;
Ptr<Ctrl> Ctrl::focusCtrlWnd;

View file

@ -108,6 +108,7 @@ String UDropTarget::Get(const char *fmt) const
void UDropTarget::DnD(POINTL pl, bool drop, DWORD *effect, DWORD keys)
{
LLOG("DnD effect: " << *effect);
dword e = *effect;
*effect = DROPEFFECT_NONE;
if(!ctrl)
@ -119,20 +120,24 @@ void UDropTarget::DnD(POINTL pl, bool drop, DWORD *effect, DWORD keys)
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)
@ -446,12 +451,15 @@ STDMETHODIMP UDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeySta
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

View file

@ -84,8 +84,13 @@ void QtfParser::Picture(int type) {
name.Cat(*term++);
if(type == 0) {
#ifdef PLATFORM_WIN32
#ifdef SYSTEMDRAW
Drawing iw = LoadWMF(GetExeDirFile(name));
if(!iw) iw = LoadWMF(name);
#else
Drawing iw = Drawing::LoadWMF(GetExeDirFile(name));
if(!iw) iw = Drawing::LoadWMF(name);
#endif
if(iw) Par().Cat(PaintRect(DrawingDisplay(), iw), cx, cy, state.value);
#endif
}

View file

@ -38,13 +38,17 @@ Draw& ScreenInfo();
void RtfDocOut::PutPicture(const Drawing& iw, Size sz) {
#ifdef PLATFORM_WIN32
#if SYSTEMDRAW
WinMetaFile wmf = AsWMF(iw);
#else
WinMetaFile wmf = iw.AsWMF();
#endif
HENHMETAFILE hemf = wmf.GetHEMF();
if(!hemf) return;
dword size = GetWinMetaFileBits(hemf, 0, NULL, MM_ANISOTROPIC, ScreenInfo());
dword size = GetWinMetaFileBits(hemf, 0, NULL, MM_ANISOTROPIC, ScreenHDC());
if(size <= 0) return;
StringBuffer b(size);
GetWinMetaFileBits(hemf, size, (byte *) ~b, MM_ANISOTROPIC, ScreenInfo());
GetWinMetaFileBits(hemf, size, (byte *) ~b, MM_ANISOTROPIC, ScreenHDC());
String data = b;
rtf.Cat(Format("\r\n{\\pict\\wmetafile8\\picw%d\\pich%d\\picwgoal%d\\pichgoal%d \r\n",
254 * sz.cx / 60, 254 * sz.cy / 60, Dow(sz.cx), Dow(sz.cy)));

View file

@ -20,7 +20,7 @@ CtrlArray::Item::~Item()
void CtrlArray::Item::Paint(Draw& draw)
{
draw.DrawRect(draw.GetClip(), IsCursor() ? SWhiteGray : SColorFace());
draw.DrawRect(GetSize(), IsCursor() ? SWhiteGray : SColorFace());
}
void CtrlArray::Item::LeftDown(Point pt, dword keyflags)
@ -179,7 +179,7 @@ void CtrlArray::Layout()
void CtrlArray::Paint(Draw& draw)
{
draw.DrawRect(draw.GetClip(), SGray);
draw.DrawRect(GetSize(), SGray);
}
void CtrlArray::RightDown(Point pt, dword keyflags)

View file

@ -1196,7 +1196,7 @@ bool DocCtrl::FlushDirty()
void DocCtrl::Paint(Draw& draw)
{
draw.DrawRect(draw.GetClip(), doc_type -> paper);
draw.DrawRect(GetSize(), doc_type -> paper);
}
void DocCtrl::ToolFileSave(Bar& bar)

View file

@ -54,7 +54,7 @@ FormulaCtrl::FormulaCtrl()
void FormulaCtrl::Paint(Draw& draw)
{
RefCon<Formula> form = ParseFormula(text, font, color);
draw.DrawRect(draw.GetClip(), SWhite);
draw.DrawRect(GetSize(), SWhite);
if(!!form) {
form = new FormulaBox(form, LtBlue, FormulaBox::THICK);
Size client = GetSize();

View file

@ -97,7 +97,7 @@ void ImageBrowseCtrl::Layout()
void ImageBrowseCtrl::Paint(Draw& draw)
{
draw.DrawRect(draw.GetClip(), Color(224, 255, 255));
draw.DrawRect(GetSize(), Color(224, 255, 255));
Size org_size = image.GetSize();
Size out_size = GetZoomSize();
if(org_size.cx <= 0 || org_size.cy <= 0

View file

@ -635,7 +635,7 @@ void OldTreeItem::LayoutItem()
void OldTreeItem::PaintItem(Draw& draw, Point pos) const
{
Rect clip = draw.GetClip();
Rect clip(0, 0, 9999, 9999);
Rect rc = Rect(pos.x - BUTTON_HALF, pos.y, clip.right, pos.y + tree_size.cy) & clip;
if(rc.IsEmpty())
return;
@ -1178,7 +1178,7 @@ void OldTreeCtrl::Paint(Draw& draw)
Rect rc_butt = rc;
rc_butt.left += BUTTON_HALF + 1 + ICONGAP;
Color bg = (IsShowEnabled() ? SWhite : SLtGray);
DrawRectMinusRect(draw, draw.GetClip(), rc_butt, DBG_PAINT(bg, LtGreen));
DrawRectMinusRect(draw, GetSize(), rc_butt, DBG_PAINT(bg, LtGreen));
PaintItem(draw, rc.TopLeft());
}

View file

@ -177,7 +177,7 @@ void RulerCtrl::Paint(Draw& draw)
Size client = GetSize();
int csize = is_vert ? client.cy : client.cx;
int cheight = is_vert ? client.cx : client.cy;
Rect clip = draw.GetClip();
Rect clip = GetSize();
int cy = font.Info().GetHeight();
double pos1 = FromClient(0);
double pos2 = FromClient(csize);

View file

@ -200,9 +200,10 @@ void WorkspaceWork::TouchFile(const String& path)
if(!showtime)
return;
Time tm = GetSysTime();
String n = GetFileName(path);
for(int i = 0; i < filelist.GetCount(); i++) {
FileList::File f = filelist[i];
if(path == SourcePath(GetActivePackage(), f.name))
if(f.name == n && path == SourcePath(GetActivePackage(), f.name))
filelist.Set(i, f.name, f.icon, f.font, f.ink, false, 0,
Null, SColorMark, Null, Null, Null, SColorMark);
}