.cosmetics

git-svn-id: svn://ultimatepp.org/upp/trunk@7192 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-04-08 17:36:26 +00:00
parent 9f215fa19e
commit 1c6cc19a40
19 changed files with 53 additions and 30 deletions

View file

@ -798,7 +798,7 @@ int TcpSocket::Get(void *buffer, int count)
int l = (int)(end - ptr);
done = 0;
if(l > 0)
if(l > 0) {
if(l < count) {
memcpy(buffer, ptr, l);
done += l;
@ -809,6 +809,7 @@ int TcpSocket::Get(void *buffer, int count)
ptr += count;
return count;
}
}
int end_time = GetEndTime();
while(done < count && !IsError() && !IsEof()) {
if(!Wait(WAIT_READ, end_time))
@ -864,11 +865,12 @@ String TcpSocket::GetLine(int maxlen)
return String::GetVoid();
int c = Peek(end_time);
if(c < 0) {
if(!IsError())
if(!IsError()) {
if(msecs() > end_time)
SetSockError("GetLine", -1, "timeout");
else
continue;
}
return String::GetVoid();
}
Get();

View file

@ -224,7 +224,7 @@ void Ctrl::DnD(Point p, PasteClip& clip)
Ptr<Ctrl> ctrl = this;
while(ctrl && ctrl->IsEnabled()) {
Rect view = ctrl->GetScreenView();
if(ctrl->IsMouseActive())
if(ctrl->IsMouseActive()) {
if(view.Contains(p)) {
dndpos = p - view.TopLeft();
dndframe = false;
@ -239,6 +239,7 @@ void Ctrl::DnD(Point p, PasteClip& clip)
if(clip.IsAccepted())
break;
}
}
ctrl = ctrl->ChildFromPoint(hp);
}
if(ctrl != dndctrl) {

View file

@ -362,7 +362,7 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) {
bool hasviewctrls = false;
bool viewexcluded = false;
for(q = firstchild; q; q = q->next)
if(q->IsShown())
if(q->IsShown()) {
if(q->InFrame()) {
if(!viewexcluded && IsTransparent() && q->GetRect().Intersects(view)) {
w.Begin();
@ -377,6 +377,7 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) {
}
else
hasviewctrls = true;
}
if(viewexcluded)
w.End();
DOLEVELCHECK;

View file

@ -329,13 +329,14 @@ Image Ctrl::MEvent0(int e, Point p, int zd)
mouseinview = inview;
MouseEventH(inview ? MOUSEENTER : MOUSELEAVE, p, zd, GetMouseFlags() | mm);
}
if(_this)
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();
}

View file

@ -371,11 +371,12 @@ void Ctrl::RemoveFrame(int i) {
int n = frame.GetCount();
Mitor<Frame> m;
if(n > 1)
for(int q = 0; q < n; q++)
for(int q = 0; q < n; q++) {
if(q != i)
m.Add().frame = frame[q].frame;
else
frame[q].frame->FrameRemove();
}
frame = pick(m);
if(frame.GetCount() == 0)
frame.Add().frame = &NullFrame();

View file

@ -1081,9 +1081,8 @@ String RTFParser::ReadBinHex(char& odd) const
: *s >= 'A' && *s <= 'F' ? *s - 'A' + 10
: *s >= 'a' && *s <= 'f' ? *s - 'a' + 10
: 255);
if(w < 16)
if(v >= 16)
{
if(w < 16) {
if(v >= 16) {
t = *s;
v = w;
}
@ -1092,6 +1091,7 @@ String RTFParser::ReadBinHex(char& odd) const
out.Cat(16 * v + w);
v = 255;
}
}
}
odd = (v < 16 ? t : 0);
return out;

View file

@ -747,11 +747,12 @@ void ArrayCtrl::ChildGotFocus()
RefreshRow(cursor);
if(!acceptingrow) {
Point p = FindCellCtrl(GetFocusCtrl());
if(!IsNull(p))
if(!IsNull(p)) {
if(nocursor)
ScrollInto(p.y);
else
SetCursor(p.y);
}
}
Ctrl::ChildGotFocus();
}
@ -834,7 +835,7 @@ Size ArrayCtrl::DoPaint(Draw& w, bool sample) {
Color fg, bg;
Value q;
const Display& d = GetCellInfo(i, jj, hasfocus0, q, fg, bg, st);
if(sample || w.IsPainting(r))
if(sample || w.IsPainting(r)) {
if(cw < 2 * cm || editmode && i == cursor && column[jj].edit)
d.PaintBackground(w, r, q, fg, bg, st);
else {
@ -846,6 +847,7 @@ Size ArrayCtrl::DoPaint(Draw& w, bool sample) {
GetDisplay(i, jj).Paint(w, r, q, fg, bg, st);
w.End();
}
}
x += cw;
if(vertgrid)
w.DrawRect(x - 1, r.top, 1, r.Height(), gridcolor);

View file

@ -123,7 +123,7 @@ void ChHostSkin()
face = String(~face, q);
}
fontname = Font::FindFaceNameIndex(face);
if(fontname == 0)
if(fontname == 0) {
if(ToUpper(face[0]) == 'M')
fontname = Font::COURIER;
else
@ -131,6 +131,7 @@ void ChHostSkin()
fontname = Font::ROMAN;
else
fontname = Font::ARIAL;
}
}
}

View file

@ -226,11 +226,12 @@ void ColorPopUp::Paint(Draw& w)
DrawFilledFrame(w, r, SColorText, color);
r.Inflate(1);
if(colori == 999)
if(colori == 999) {
if(GetMouseLeft())
DrawFrame(w, r, SColorShadow, SColorLight);
else
DrawFrame(w, r, GUI_GlobalStyle() >= GUISTYLE_XP ? SColorText : SColorHighlight);
}
}
return;
}
@ -239,11 +240,12 @@ void ColorPopUp::Paint(Draw& w)
if(i < 18 && scolors)
DrawFrame(w, x + 2, y + 1, 12, 12, Blend(SColorLight, SColorHighlight));
if(i == colori)
if(i == colori) {
if(GetMouseLeft())
DrawFrame(w, x, y - 1, 16, 16, SColorShadow, SColorLight);
else
DrawFrame(w, x, y - 1, 16, 16, GUI_GlobalStyle() >= GUISTYLE_XP ? SColorText : SColorHighlight);
}
i++;
}
y += 16;

View file

@ -855,11 +855,12 @@ void FileSel::SearchLoad()
if(!IsEmpty(basedir) && String(~dir).IsEmpty())
dirup.Disable();
olddir = ~dir;
if(olddir.GetCount() || basedir.GetCount())
if(olddir.GetCount() || basedir.GetCount()) {
if(sortext && mode != SELECTDIR)
SortByExt(list);
else
SortByName(list);
}
Update();
#ifdef GUI_WIN
lazyicons.Start(list, d, WhenIcon);
@ -968,7 +969,7 @@ void FileSel::Finish() {
Exclamation(p + t_(" is directory."));
return;
}
if(asking)
if(asking) {
if(mode == SAVEAS) {
if(!ff.IsEmpty() && !PromptOKCancel(p + t_(" already exists.&Do you want to continue ?")))
return;
@ -979,6 +980,7 @@ void FileSel::Finish() {
nonexist << p;
ne++;
}
}
}
if(ne) {
nonexist << (ne == 1 ? t_(" does not exist.") : t_("&do not exist."));
@ -1196,14 +1198,14 @@ void FileSel::DirUp() {
void FileSel::MkDir() {
if(String(~dir).IsEmpty() && basedir.IsEmpty()) return;
String name, error;
if(EditText(name, t_("New directory"), t_("Name")) && !name.IsEmpty())
if(filesystem->CreateFolder(FilePath(name), error))
{
if(EditText(name, t_("New directory"), t_("Name")) && !name.IsEmpty()) {
if(filesystem->CreateFolder(FilePath(name), error)) {
Load();
list.FindSetCursor(name);
}
else
Exclamation(t_("[A3* Creating directory failed !&&]") + error);
}
}
void FileSel::PlusMinus(const char *title, bool sel) {

View file

@ -282,11 +282,12 @@ void MenuItem::Paint(Draw& w)
bool hl = state != NORMAL;
Size sz = GetSize();
if(hl)
if(hl) {
if(GUI_GlobalStyle() >= GUISTYLE_XP)
ChPaint(w, 0, 0, sz.cx, sz.cy, style->item);
else
w.DrawRect(sz, SColorHighlight);
}
UPP::Image li = licon;
if(li.IsEmpty()) {
switch(type) {

View file

@ -1458,13 +1458,14 @@ bool TreeCtrl::DnDInserti(int ii, PasteClip& d, bool bottom)
int parent = GetParent(itemi);
int childi = GetChildIndex(parent, itemi);
int ins = -1;
if(bottom)
if(bottom) {
if(childi != GetChildCount(parent) - 1 && ii + 1 < line.GetCount())
return DnDInserti(ii + 1, d, false);
else {
childi++;
ins = 1;
}
}
WhenDropInsert(parent, childi, d);
if(d.IsAccepted()) {
DnD(itemi, ins);

View file

@ -2,7 +2,7 @@
#define _CtrlLib_icpp_init_stub
#include "CtrlCore/init"
#include "PdfDraw/init"
#define BLITZ_INDEX__ Fa588a2a7bb40a3ed36760f6c2bef5026
#define BLITZ_INDEX__ F2a95805f3896075b0a556396aabaf515
#include "CtrlLib.icpp"
#undef BLITZ_INDEX__
#endif

View file

@ -14,20 +14,22 @@ DDARasterizer::DDARasterizer()
void DDARasterizer::AHorz(int x, int y, int cx)
{
if(cx)
if(cx) {
if(cx < 0)
PutHorz(x + cx + 1, y, -cx);
else
PutHorz(x, y, cx);
}
}
void DDARasterizer::AVert(int x, int y, int cy)
{
if(cy)
if(cy) {
if(cy < 0)
PutVert(x, y + cy + 1, -cy);
else
PutVert(x, y, cy);
}
}
void DDARasterizer::DoLine(Point p1, Point p2, bool last)

View file

@ -253,7 +253,7 @@ void Font::Serialize(Stream& s) {
name = GetFaceName();
s % name;
}
if(s.IsLoading())
if(s.IsLoading()) {
if(f >= 0)
Face(f);
else {
@ -261,6 +261,7 @@ void Font::Serialize(Stream& s) {
if(IsNull(name))
SetNull();
}
}
}
else {
String name = GetFaceName();

View file

@ -24,7 +24,7 @@ String QtfFormat(Color c)
void LngFmt(String& fmt, dword l, dword lang)
{
if(lang != (dword)l)
if(lang != (dword)l) {
if(l == 0)
fmt << "%-";
else
@ -32,6 +32,7 @@ void LngFmt(String& fmt, dword l, dword lang)
fmt << "%%";
else
fmt << "%" << LNGAsText(l);
}
}
void CharFmt(String& fmt, const RichPara::CharFormat& a, const RichPara::CharFormat& b)

View file

@ -39,12 +39,13 @@ void RichPara::Flush(Draw& draw, const PaintInfo& pi, wchar *text,
int width = z * x - z * x0;
int zy0 = z * y0;
int zx0 = z * x0;
if(!IsNull(f.indexentry) && !IsNull(pi.indexentry))
if(!IsNull(f.indexentry) && !IsNull(pi.indexentry)) {
if(pi.indexentrybg)
draw.DrawRect(zx0, z * y, width, z * (y + linecy) - z * y,
pi.coloroverride ? SColorPaper() : pi.indexentry);
else
draw.DrawRect(zx0, zy0, width, 2, pi.indexentry);
}
if(!IsNull(f.paper) && !highlight)
draw.DrawRect(zx0, z * y, width, z * (y + linecy) - z * y,
pi.coloroverride ? SColorPaper() : f.paper);

View file

@ -13,7 +13,7 @@ void RichTable::InvalidateRefresh(int i, int j)
if(i < format.header)
r_row = -1;
else
if(r_row != i || r_column != j)
if(r_row != i || r_column != j) {
if(r_row == -2 && clayout.sz == GetSize()) {
r_row = i;
r_column = j;
@ -23,6 +23,7 @@ void RichTable::InvalidateRefresh(int i, int j)
}
else
r_row = -1;
}
Invalidate();
}

View file

@ -192,7 +192,7 @@ RichCaret RichTxt::GetCaret(int pos, RichContext rc) const
pos = GetLength();
while(parti < part.GetCount()) {
int l = GetPartLength(parti) + 1;
if(pos < l)
if(pos < l) {
if(IsTable(parti))
return GetTable(parti).GetCaret(pos, rc);
else {
@ -210,6 +210,7 @@ RichCaret RichTxt::GetCaret(int pos, RichContext rc) const
tp.textpage = rc.page;
return tp;
}
}
pos -= l;
rc.py = GetNextPageY(parti++, rc);
}
@ -338,11 +339,12 @@ void RichTxt::GatherValPos(Vector<RichValPos>& f, RichContext rc, int pos, int t
nbefore = pp.before + pp.ruler;
nline = pp.linecy[0];
}
if(p.haspos)
if(p.haspos) {
if(type == LABELS)
Get(parti, rc.styles, true).GatherLabels(f, rc.page, rc.py, pos, nbefore, nline);
else
Get(parti, rc.styles, true).GatherIndexes(f, rc.page, rc.py, pos, nbefore, nline);
}
}
pos += GetPartLength(parti) + 1;
rc.py = GetNextPageY(parti++, rc);