summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src/modern_row.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2014-12-14 21:30:16 +0000
committerKirill Volinsky <mataes2007@gmail.com>2014-12-14 21:30:16 +0000
commitc730f12da81f636ecf65aa656a46b9337daaa37a (patch)
tree0b069d59b6366447e0a0d40982ac610fbe86d9a7 /plugins/Clist_modern/src/modern_row.cpp
parent91867c03b57bbf85eae500475683c16da4ec3a9c (diff)
Clist_modern: changed warning lavel to w4
git-svn-id: http://svn.miranda-ng.org/main/trunk@11425 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src/modern_row.cpp')
-rw-r--r--plugins/Clist_modern/src/modern_row.cpp183
1 files changed, 90 insertions, 93 deletions
diff --git a/plugins/Clist_modern/src/modern_row.cpp b/plugins/Clist_modern/src/modern_row.cpp
index cbcb0265ef..b03c891b09 100644
--- a/plugins/Clist_modern/src/modern_row.cpp
+++ b/plugins/Clist_modern/src/modern_row.cpp
@@ -65,27 +65,27 @@ ROWCELL *cppInitModernRow(ROWCELL ** tabAccess)
int seq = 0;
ROWCELL * RowRoot = NULL;
FILE * hFile;
- int i=0;
- if (!db_get_b(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)) return NULL;
+ int i = 0;
+ if (!db_get_b(NULL, "ModernData", "UseAdvancedRowLayout", SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)) return NULL;
tmplbuf = NULL;
- if ( db_get_b(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT) == 1)
- tmplbuf = db_get_sa(NULL,"ModernData","RowTemplate");
+ if (db_get_b(NULL, "ModernData", "UseAdvancedRowLayout", SETTING_ROW_ADVANCEDLAYOUT_DEFAULT) == 1)
+ tmplbuf = db_get_sa(NULL, "ModernData", "RowTemplate");
if (tmplbuf) {
- rowParse(RowRoot, RowRoot, tmplbuf, i, seq,tabAccess);
+ rowParse(RowRoot, RowRoot, tmplbuf, i, seq, tabAccess);
mir_free(tmplbuf);
return RowRoot;
}
if (hFile = fopen("template.txt", "rb"))
{
fsize = _filelength(_fileno(hFile));
- tmplbuf = (char*)malloc(fsize+1);
+ tmplbuf = (char*)malloc(fsize + 1);
memset(tmplbuf, 0, (fsize + 1));
- for (i=0; i < fsize; i++) tmplbuf[i] = getc(hFile);
+ for (i = 0; i < fsize; i++) tmplbuf[i] = getc(hFile);
tmplbuf[i] = 0;
- i=0;
- rowParse(RowRoot, RowRoot, tmplbuf, i, seq,tabAccess);
- db_set_s(NULL,"ModernData","RowTemplate",tmplbuf);
+ i = 0;
+ rowParse(RowRoot, RowRoot, tmplbuf, i, seq, tabAccess);
+ db_set_s(NULL, "ModernData", "RowTemplate", tmplbuf);
free(tmplbuf);
fclose(hFile);
return RowRoot;
@@ -167,7 +167,7 @@ char * rowParserGetNextWord(char *tbuf, int &hbuf)
memset(buf, 0, sizeof(buf));
- while(tbuf[hbuf] != 0)
+ while (tbuf[hbuf] != 0)
{
ch = tbuf[hbuf];
@@ -222,36 +222,36 @@ void rowParserGetParam(ROWCELL* &cell, char *tbuf, int &hbuf)
char * word = rowParserGetNextWord(tbuf, hbuf);
int param = 0;
- if (!_strnicmp(word, "avatar", strlen(word))) param = TC_AVATAR;
- else if (!_strnicmp(word, "text1", strlen(word))) param = TC_TEXT1;
- else if (!_strnicmp(word, "text2", strlen(word))) param = TC_TEXT2;
- else if (!_strnicmp(word, "text3", strlen(word))) param = TC_TEXT3;
- else if (!_strnicmp(word, "status", strlen(word))) param = TC_STATUS;
- else if (!_strnicmp(word, "extra", strlen(word))) param = TC_EXTRA;
- else if (!_strnicmp(word, "extra1", strlen(word))) param = TC_EXTRA1;
- else if (!_strnicmp(word, "extra2", strlen(word))) param = TC_EXTRA2;
- else if (!_strnicmp(word, "extra3", strlen(word))) param = TC_EXTRA3;
- else if (!_strnicmp(word, "extra4", strlen(word))) param = TC_EXTRA4;
- else if (!_strnicmp(word, "extra5", strlen(word))) param = TC_EXTRA5;
- else if (!_strnicmp(word, "extra6", strlen(word))) param = TC_EXTRA6;
- else if (!_strnicmp(word, "extra7", strlen(word))) param = TC_EXTRA7;
- else if (!_strnicmp(word, "extra8", strlen(word))) param = TC_EXTRA8;
- else if (!_strnicmp(word, "extra9", strlen(word))) param = TC_EXTRA9;
- else if (!_strnicmp(word, "time", strlen(word))) param = TC_TIME;
- else if (!_strnicmp(word, "space", strlen(word))) param = TC_SPACE;
- else if (!_strnicmp(word, "fspace", strlen(word))) param = TC_FIXED;
-
- else if (!_strnicmp(word, "left", strlen(word))) param = TC_LEFT;
- else if (!_strnicmp(word, "top", strlen(word))) param = TC_TOP;
- else if (!_strnicmp(word, "vcenter", strlen(word))) param = TC_VCENTER;
- else if (!_strnicmp(word, "hcenter", strlen(word))) param = TC_HCENTER;
- else if (!_strnicmp(word, "right", strlen(word))) param = TC_RIGHT;
- else if (!_strnicmp(word, "bottom", strlen(word))) param = TC_BOTTOM;
-
- else if (!_strnicmp(word, "layer", strlen(word))) cell->layer = TRUE;
-
- else if (!_strnicmp(word, "width", strlen(word))) param = TC_WIDTH;
- else if (!_strnicmp(word, "height", strlen(word))) param = TC_HEIGHT;
+ if (!_strnicmp(word, "avatar", strlen(word))) param = TC_AVATAR;
+ else if (!_strnicmp(word, "text1", strlen(word))) param = TC_TEXT1;
+ else if (!_strnicmp(word, "text2", strlen(word))) param = TC_TEXT2;
+ else if (!_strnicmp(word, "text3", strlen(word))) param = TC_TEXT3;
+ else if (!_strnicmp(word, "status", strlen(word))) param = TC_STATUS;
+ else if (!_strnicmp(word, "extra", strlen(word))) param = TC_EXTRA;
+ else if (!_strnicmp(word, "extra1", strlen(word))) param = TC_EXTRA1;
+ else if (!_strnicmp(word, "extra2", strlen(word))) param = TC_EXTRA2;
+ else if (!_strnicmp(word, "extra3", strlen(word))) param = TC_EXTRA3;
+ else if (!_strnicmp(word, "extra4", strlen(word))) param = TC_EXTRA4;
+ else if (!_strnicmp(word, "extra5", strlen(word))) param = TC_EXTRA5;
+ else if (!_strnicmp(word, "extra6", strlen(word))) param = TC_EXTRA6;
+ else if (!_strnicmp(word, "extra7", strlen(word))) param = TC_EXTRA7;
+ else if (!_strnicmp(word, "extra8", strlen(word))) param = TC_EXTRA8;
+ else if (!_strnicmp(word, "extra9", strlen(word))) param = TC_EXTRA9;
+ else if (!_strnicmp(word, "time", strlen(word))) param = TC_TIME;
+ else if (!_strnicmp(word, "space", strlen(word))) param = TC_SPACE;
+ else if (!_strnicmp(word, "fspace", strlen(word))) param = TC_FIXED;
+
+ else if (!_strnicmp(word, "left", strlen(word))) param = TC_LEFT;
+ else if (!_strnicmp(word, "top", strlen(word))) param = TC_TOP;
+ else if (!_strnicmp(word, "vcenter", strlen(word))) param = TC_VCENTER;
+ else if (!_strnicmp(word, "hcenter", strlen(word))) param = TC_HCENTER;
+ else if (!_strnicmp(word, "right", strlen(word))) param = TC_RIGHT;
+ else if (!_strnicmp(word, "bottom", strlen(word))) param = TC_BOTTOM;
+
+ else if (!_strnicmp(word, "layer", strlen(word))) cell->layer = TRUE;
+
+ else if (!_strnicmp(word, "width", strlen(word))) param = TC_WIDTH;
+ else if (!_strnicmp(word, "height", strlen(word))) param = TC_HEIGHT;
else
{
@@ -259,7 +259,7 @@ void rowParserGetParam(ROWCELL* &cell, char *tbuf, int &hbuf)
return;
}
- if (param>TC_TEXT3 && param != TC_SPACE) cell->hasfixed = 1;
+ if (param > TC_TEXT3 && param != TC_SPACE) cell->hasfixed = 1;
switch (param)
{
@@ -320,17 +320,17 @@ void rowParserGetParam(ROWCELL* &cell, char *tbuf, int &hbuf)
// hbuf - указатель буфера
// sequence - нужно задавать 0, это очередность нахождения
//
-BOOL rowParse(ROWCELL* &cell, ROWCELL* parent, char *tbuf, int &hbuf, int &sequence, ROWCELL** RowTabAccess )
+BOOL rowParse(ROWCELL* &cell, ROWCELL* parent, char *tbuf, int &hbuf, int &sequence, ROWCELL** RowTabAccess)
{
char * word;
word = rowParserGetNextWord(tbuf, hbuf);
int cont;
- if (!_strnicmp(word, "<tr", strlen(word)) || !_strnicmp(word, "<tr>", strlen(word))) cont = TC_ROW;
- else if (!_strnicmp(word, "<tc", strlen(word)) || !_strnicmp(word, "<tc>", strlen(word))) cont = TC_COL;
- else if (!_strnicmp(word, "/>", strlen(word)) ||
- !_strnicmp(word, "</tr>", strlen(word)) ||
- !_strnicmp(word, "</tc>", strlen(word))) return TRUE;
+ if (!_strnicmp(word, "<tr", strlen(word)) || !_strnicmp(word, "<tr>", strlen(word))) cont = TC_ROW;
+ else if (!_strnicmp(word, "<tc", strlen(word)) || !_strnicmp(word, "<tc>", strlen(word))) cont = TC_COL;
+ else if (!_strnicmp(word, "/>", strlen(word)) ||
+ !_strnicmp(word, "</tr>", strlen(word)) ||
+ !_strnicmp(word, "</tc>", strlen(word))) return TRUE;
else return FALSE;
rowAddCell(cell, cont);
@@ -338,7 +338,7 @@ BOOL rowParse(ROWCELL* &cell, ROWCELL* parent, char *tbuf, int &hbuf, int &seque
if (cell->type != 0 && cell->type != TC_SPACE && cell->type != TC_FIXED)
RowTabAccess[sequence++] = cell;
- if (!rowParse(cell->child, cell, tbuf, hbuf, sequence,RowTabAccess))
+ if (!rowParse(cell->child, cell, tbuf, hbuf, sequence, RowTabAccess))
return FALSE;
if (!parent)
@@ -347,7 +347,7 @@ BOOL rowParse(ROWCELL* &cell, ROWCELL* parent, char *tbuf, int &hbuf, int &seque
return TRUE;
}
- if (!rowParse(cell->next, parent, tbuf, hbuf, sequence,RowTabAccess))
+ if (!rowParse(cell->next, parent, tbuf, hbuf, sequence, RowTabAccess))
return FALSE;
parent->sizing |= cell->sizing;
@@ -382,15 +382,15 @@ void rowCalculateMinSize(ROWCELL* cell)
int fullWidth = 0;
if (!cell) return;
- cell->r.left = 0;
- cell->r.top = 0;
+ cell->r.left = 0;
+ cell->r.top = 0;
if (cell->type < TC_TEXT1 || cell->type > TC_TEXT3 && cell->type != TC_SPACE)
- cell->r.right = cell->w;
+ cell->r.right = cell->w;
else
- cell->r.right = 0;
+ cell->r.right = 0;
- cell->r.bottom = cell->h;
+ cell->r.bottom = cell->h;
rowCalculateMinSize(cell->child);
rowCalculateMinSize(cell->next);
@@ -407,15 +407,14 @@ void rowCalculateMinSize(ROWCELL* cell)
{
//w = max(w, curchild->r.right);
wl += curchild->r.right;
- fullWidth = max(fullWidth,max(curchild->full_width,curchild->w));
+ fullWidth = max(fullWidth, max(curchild->full_width, curchild->w));
}
else
{
w += curchild->r.right;
- fullWidth += max(curchild->full_width,curchild->w);
+ fullWidth += max(curchild->full_width, curchild->w);
}
- }
- while (curchild = curchild->next);
+ } while (curchild = curchild->next);
}
if (cell->cont == TC_COL)
@@ -423,7 +422,7 @@ void rowCalculateMinSize(ROWCELL* cell)
while (curchild)
{
w = max(w, curchild->r.right);
- fullWidth = max(fullWidth,max(curchild->full_width,curchild->w));
+ fullWidth = max(fullWidth, max(curchild->full_width, curchild->w));
if (curchild->layer)
{
@@ -437,10 +436,10 @@ void rowCalculateMinSize(ROWCELL* cell)
}
}
- cell->r.right = max(max(w, cell->r.right),wl);
- cell->r.bottom = max(max(h, cell->r.bottom),hl);
- cell->full_width = max(fullWidth,cell->full_width);
- cell->fixed_width = max(cell->fixed_width,cell->r.right);
+ cell->r.right = max(max(w, cell->r.right), wl);
+ cell->r.bottom = max(max(h, cell->r.bottom), hl);
+ cell->full_width = max(fullWidth, cell->full_width);
+ cell->fixed_width = max(cell->fixed_width, cell->r.right);
return;
}
@@ -464,8 +463,7 @@ void rowEqualize(ROWCELL* cell)
{
if (curchild->layer) continue;
curchild->r.bottom = cell->r.bottom;
- }
- while (curchild = curchild->next);
+ } while (curchild = curchild->next);
}
if (cell->cont == TC_COL)
@@ -474,8 +472,7 @@ void rowEqualize(ROWCELL* cell)
{
if (curchild->layer) continue;
curchild->r.right = cell->r.right;
- }
- while (curchild = curchild->next);
+ } while (curchild = curchild->next);
}
@@ -492,7 +489,7 @@ void rowPlacing(pROWCELL cell)
{
if (cell->type == 0) return;
- switch(cell->type)
+ switch (cell->type)
{
case TC_TEXT1:
case TC_TEXT2:
@@ -501,27 +498,27 @@ void rowPlacing(pROWCELL cell)
cell->r.right += cell->r.left;
break;
default:
+ {
+ switch (cell->halign)
{
- switch(cell->halign)
- {
- case TC_LEFT:
- break;
- case TC_HCENTER:
- cell->r.left += (cell->r.right - cell->w)/2;
- break;
- case TC_RIGHT:
- cell->r.left += cell->r.right - cell->w;
- }
- cell->r.right = cell->r.left + cell->w;
+ case TC_LEFT:
+ break;
+ case TC_HCENTER:
+ cell->r.left += (cell->r.right - cell->w) / 2;
+ break;
+ case TC_RIGHT:
+ cell->r.left += cell->r.right - cell->w;
}
+ cell->r.right = cell->r.left + cell->w;
+ }
}
- switch(cell->valign)
+ switch (cell->valign)
{
case TC_TOP:
break;
case TC_VCENTER:
- cell->r.top += (cell->r.bottom - cell->h)/2;
+ cell->r.top += (cell->r.bottom - cell->h) / 2;
break;
case TC_BOTTOM:
cell->r.top += cell->r.bottom - cell->h;
@@ -544,26 +541,26 @@ void rowLayerProc(pROWCELL cell, pROWCELL parent)
}
else
{
- switch(cell->halign)
+ switch (cell->halign)
{
case TC_LEFT:
cell->r.left = parent->r.left;
break;
case TC_HCENTER:
- cell->r.left = parent->r.left + (parent->r.right - cell->r.right)/2;
+ cell->r.left = parent->r.left + (parent->r.right - cell->r.right) / 2;
break;
case TC_RIGHT:
cell->r.left = parent->r.left + parent->r.right - cell->r.right;
}
}
- switch(cell->valign)
+ switch (cell->valign)
{
case TC_TOP:
cell->r.top = parent->r.top;
break;
case TC_VCENTER:
- cell->r.top = parent->r.top + (parent->r.bottom - cell->r.bottom)/2;
+ cell->r.top = parent->r.top + (parent->r.bottom - cell->r.bottom) / 2;
break;
case TC_BOTTOM:
cell->r.top = parent->r.top + parent->r.bottom - cell->r.bottom;
@@ -623,7 +620,7 @@ void rowPositioning(pROWCELL cell, int &dist)
if (curchild->sizing)
{
- autosized += max(curchild->w,curchild->full_width);
+ autosized += max(curchild->w, curchild->full_width);
r++;
}
else
@@ -637,10 +634,10 @@ void rowPositioning(pROWCELL cell, int &dist)
if (r == 0)
{
- switch(cell->halign)
+ switch (cell->halign)
{
case TC_HCENTER:
- x += (dist - cw)/2;// - 1;
+ x += (dist - cw) / 2;// - 1;
break;
case TC_RIGHT:
x += dist - cw;
@@ -652,7 +649,7 @@ void rowPositioning(pROWCELL cell, int &dist)
curchild = cell->child;
size = 0;
- while(curchild)
+ while (curchild)
{
if (curchild->layer)
{
@@ -704,7 +701,7 @@ void rowPositioning(pROWCELL cell, int &dist)
if (h > size)
{
- switch(cell->valign)
+ switch (cell->valign)
{
case TC_VCENTER:
y += (h - size) / 2;
@@ -716,7 +713,7 @@ void rowPositioning(pROWCELL cell, int &dist)
}
curchild = cell->child;
- while(curchild)
+ while (curchild)
{
if (curchild->layer)
{
@@ -728,7 +725,7 @@ void rowPositioning(pROWCELL cell, int &dist)
curchild->r.top = y;
y += curchild->r.bottom;
- curchild->r.left = cell->r.left;
+ curchild->r.left = cell->r.left;
curchild->r.right = dist;
rowPositioning(curchild, size);