summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-02-26 17:10:22 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-02-26 17:10:22 +0300
commitaef55024d4b3ea568091485c20fce421632115dc (patch)
tree183fce6bd4f87cad9e04a9e34cea36b706364d12 /plugins/Clist_modern
parent07600605510b522c669305feeb0ef3b8d8bfba95 (diff)
bunch of obsolete code removed from Clist_Modern
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/init.cpp1
-rw-r--r--plugins/Clist_modern/src/modern_clcpaint.cpp451
-rw-r--r--plugins/Clist_modern/src/modern_clistopts.cpp3
-rw-r--r--plugins/Clist_modern/src/modern_clui.cpp1
-rw-r--r--plugins/Clist_modern/src/modern_commonprototypes.h46
-rw-r--r--plugins/Clist_modern/src/modern_row.cpp740
-rw-r--r--plugins/Clist_modern/src/modern_row.h8
-rw-r--r--plugins/Clist_modern/src/modern_rowheight_funcs.cpp14
-rw-r--r--plugins/Clist_modern/src/modern_rowtemplateopt.cpp541
-rw-r--r--plugins/Clist_modern/src/modern_static_clui.h2
10 files changed, 17 insertions, 1790 deletions
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp
index 31cd731094..c01c5d7466 100644
--- a/plugins/Clist_modern/src/init.cpp
+++ b/plugins/Clist_modern/src/init.cpp
@@ -102,7 +102,6 @@ int CMPlugin::Unload(void)
XPThemesUnloadModule();
UnloadAvatarOverlayIcon();
- FreeRowCell();
EventArea_UnloadModule();
TRACE("Unloading Clist Modern COMPLETE\r\n");
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp
index a06a0c4b2a..f0c91c8a9c 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.cpp
+++ b/plugins/Clist_modern/src/modern_clcpaint.cpp
@@ -899,457 +899,6 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
minheight = max(minheight, height);
dy += (minheight > height) ? ((minheight - height) >> 1) : 0;
- // Call Placement
- cppCalculateRowItemsPos(gl_RowRoot, free_row_rc.right - free_row_rc.left);
- // Now paint
- while ((gl_RowTabAccess[i] != nullptr || (i < 2 && Drawing->type == CLCIT_GROUP)) && !(i >= 2 && Drawing->type == CLCIT_GROUP)) {
- if (gl_RowTabAccess[i]->r.right - gl_RowTabAccess[i]->r.left > 0 && gl_RowTabAccess[i]->r.bottom - gl_RowTabAccess[i]->r.top > 0) {
- RECT p_rect = gl_RowTabAccess[i]->r;
- OffsetRect(&p_rect, dx, dy);
- if (dat->text_rtl != 0 && gl_RowTabAccess[i]->type != TC_EXTRA /*each extra icon modified separately*/)
- _RTLRect(&p_rect, free_row_rc.right);
-
- SIZE text_size;
- switch (gl_RowTabAccess[i]->type) {
- case TC_TEXT1:
- {
- // paint text 1
- UINT uTextFormat = (dat->text_rtl ? DT_RTLREADING : 0);
- text_size.cx = p_rect.right - p_rect.left;
- text_size.cy = p_rect.bottom - p_rect.top;
- ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), nullptr);
-
- uTextFormat |= (gl_RowTabAccess[i]->valign == TC_VCENTER) ? DT_VCENTER : (gl_RowTabAccess[i]->valign == TC_BOTTOM) ? DT_BOTTOM : 0;
- uTextFormat |= (gl_RowTabAccess[i]->halign == TC_HCENTER) ? DT_CENTER : (gl_RowTabAccess[i]->halign == TC_RIGHT) ? DT_RIGHT : 0;
-
- uTextFormat = uTextFormat | (gl_TrimText ? DT_END_ELLIPSIS : 0) | DT_SINGLELINE;
- if (Drawing->type == CLCIT_CONTACT) {
- if (selected)
- SetTextColor(hdcMem, dat->selTextColour);
- else if (hottrack)
- _SetHotTrackColour(hdcMem, dat);
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, 0, (int)mir_wstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
- if ((dat->bFilterSearch || selected) && dat->szQuickSearch[0] != '\0') {
- int idx = 0;
- if (dat->bFilterSearch) {
- wchar_t *lowered = CharLowerW(NEWWSTR_ALLOCA(Drawing->szText));
- wchar_t *lowered_search = CharLowerW(NEWWSTR_ALLOCA(dat->szQuickSearch));
- wchar_t *p1 = wcsstr(lowered, lowered_search);
- if (p1)
- idx = int(p1 - lowered);
- }
- SetTextColor(hdcMem, dat->quickSearchColour);
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, idx, (int)mir_wstrlen(dat->szQuickSearch), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
- }
-
- SIZE size;
- GetTextSize(&size, hdcMem, p_rect, Drawing->szText, Drawing->ssText.plText, 0, dat->text_resize_smileys ? 0 : Drawing->ssText.iMaxSmileyHeight);
- Drawing->pos_label = p_rect;
- Drawing->pos_label.right = min(Drawing->pos_label.right, Drawing->pos_label.left + size.cx);
- }
- else if (Drawing->type == CLCIT_GROUP) {
- RECT nameRect = p_rect;
- RECT countRect = { 0 };
- RECT count_rc = { 0 };
- SIZE count_size = { 0 };
- int space_width = 0;
- wchar_t *szCounts = Clist_GetGroupCountsText(dat, Drawing);
- // Has to draw the count?
- if (szCounts && mir_wstrlen(szCounts) > 0) {
- // calc width and height
- ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr);
- ske_DrawText(hdcMem, L" ", 1, &count_rc, DT_CALCRECT | DT_NOPREFIX);
- count_size.cx = count_rc.right - count_rc.left;
- space_width = count_size.cx;
- count_rc.right = 0;
- count_rc.left = 0;
- ske_DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &count_rc, DT_CALCRECT);
- count_size.cx += count_rc.right - count_rc.left;
- count_size.cy = count_rc.bottom - count_rc.top;
- }
- // modify text rect
- {
- SIZE grp_size = { 0 };
- int wid = p_rect.right - p_rect.left;
- ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, nullptr);
- GetTextSize(&grp_size, hdcMem, p_rect, Drawing->szText, Drawing->ssText.plText, 0, dat->text_resize_smileys ? 0 : Drawing->ssText.iMaxSmileyHeight);
-
- if (wid - count_size.cx > grp_size.cx) {
- if (dat->row_align_group_mode != 2) { //center or left
- int x = (dat->row_align_group_mode == 1) ? (wid - (grp_size.cx + count_size.cx)) >> 1 : 0;
- nameRect.left += x;
- nameRect.right = nameRect.left + grp_size.cx;
- countRect.left = nameRect.right + space_width;
- countRect.right = countRect.left + count_size.cx - space_width;
- }
- else {
- countRect.right = nameRect.right;
- countRect.left = countRect.right - ((count_size.cx > 0) ? (count_size.cx - space_width) : 0);
- nameRect.right = countRect.left - ((count_size.cx > 0) ? space_width : 0);
- nameRect.left = nameRect.right - grp_size.cx;
- }
- }
- else {
- countRect.right = nameRect.right;
- nameRect.right -= count_size.cx;
- countRect.left = nameRect.right + space_width;
- }
- countRect.bottom = nameRect.bottom;
- countRect.top = nameRect.top;
- }
-
- uTextFormat |= DT_VCENTER;
- ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, nullptr);
- if (selected)
- SetTextColor(hdcMem, dat->selTextColour);
- else if (hottrack)
- _SetHotTrackColour(hdcMem, dat);
- _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_wstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
- if (selected && !dat->bFilterSearch) {
- SetTextColor(hdcMem, dat->quickSearchColour);
- _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, (int)mir_wstrlen(Drawing->szText), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys);
- }
- if (szCounts && mir_wstrlen(szCounts) > 0) {
- ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPCOUNTS : FONTID_CLOSEDGROUPCOUNTS, nullptr);
- if (selected)
- SetTextColor(hdcMem, dat->selTextColour);
- else if (hottrack)
- _SetHotTrackColour(hdcMem, dat);
- ske_DrawText(hdcMem, szCounts, (int)mir_wstrlen(szCounts), &countRect, uTextFormat);
- }
- Drawing->pos_label = nameRect;
- }
- }
- break;
-
- case TC_TEXT2:
- {
- // paint text 2
- //
- // Select font
- UINT uTextFormat = (dat->text_rtl ? DT_RTLREADING : 0);
-
- if (g_plugin.secondLine.bActive && g_plugin.secondLine.iType == TEXT_CONTACT_TIME && pdnce->hTimeZone) {
- // Get contact time
- wchar_t buf[70] = L"";
- mir_free_and_nil(pdnce->szSecondLineText);
-
- TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", buf, _countof(buf), 0);
- pdnce->szSecondLineText = mir_wstrdup(buf);
- }
-
- uTextFormat |= (gl_RowTabAccess[i]->valign == TC_VCENTER) ? DT_VCENTER : (gl_RowTabAccess[i]->valign == TC_BOTTOM) ? DT_BOTTOM : 0;
- uTextFormat |= (gl_RowTabAccess[i]->halign == TC_HCENTER) ? DT_CENTER : (gl_RowTabAccess[i]->halign == TC_RIGHT) ? DT_RIGHT : 0;
-
- text_size.cx = p_rect.right - p_rect.left;
- text_size.cy = p_rect.bottom - p_rect.top;
-
- ChangeToFont(hdcMem, dat, FONTID_SECONDLINE, nullptr);
- uTextFormat = uTextFormat | (gl_TrimText ? DT_END_ELLIPSIS : 0) | DT_SINGLELINE;
- if (Drawing->type == CLCIT_CONTACT)
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szSecondLineText, 0, (int)mir_wstrlen(pdnce->szSecondLineText), pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys);
- }
- break;
-
- case TC_TEXT3:
- {
- //paint text 3
- // Select font
- UINT uTextFormat = (dat->text_rtl ? DT_RTLREADING : 0);
-
- if (g_plugin.thirdLine.bActive && g_plugin.thirdLine.iType == TEXT_CONTACT_TIME && pdnce->hTimeZone) {
- // Get contact time
- wchar_t buf[70] = L"";
- mir_free(pdnce->szThirdLineText);
-
- TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", buf, _countof(buf), 0);
- pdnce->szThirdLineText = mir_wstrdup(buf);
- }
-
- uTextFormat |= (gl_RowTabAccess[i]->valign == TC_VCENTER) ? DT_VCENTER : (gl_RowTabAccess[i]->valign == TC_BOTTOM) ? DT_BOTTOM : 0;
- uTextFormat |= (gl_RowTabAccess[i]->halign == TC_HCENTER) ? DT_CENTER : (gl_RowTabAccess[i]->halign == TC_RIGHT) ? DT_RIGHT : 0;
-
- text_size.cx = p_rect.right - p_rect.left;
- text_size.cy = p_rect.bottom - p_rect.top;
-
- ChangeToFont(hdcMem, dat, FONTID_THIRDLINE, nullptr);
- uTextFormat = uTextFormat | (gl_TrimText ? DT_END_ELLIPSIS : 0) | DT_SINGLELINE;
- if (Drawing->type == CLCIT_CONTACT)
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szThirdLineText, 0, (int)mir_wstrlen(pdnce->szThirdLineText), pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys);
- }
- break;
-
- case TC_STATUS:
- if ((Drawing->type == CLCIT_GROUP && !dat->row_hide_group_icon) || (Drawing->type == CLCIT_CONTACT && Drawing->iImage != -1
- && !(dat->icon_hide_on_avatar && dat->avatars_show && Drawing->avatar_data != nullptr && !Drawing->bImageIsSpecial))) {
- int iImage = -1;
- // Get image
- if (Drawing->type == CLCIT_GROUP) {
- if (!dat->row_hide_group_icon) iImage = Drawing->group->expanded ? IMAGE_GROUPOPEN : IMAGE_GROUPSHUT;
- else iImage = -1;
- }
- else if (Drawing->type == CLCIT_CONTACT)
- iImage = Drawing->iImage;
-
- if (iImage != -1) {
- COLORREF colourFg;
- int mode;
- // Store pos
- Drawing->pos_icon = p_rect;
- if (hottrack) {
- colourFg = dat->hotTextColour;
- mode = ILD_NORMAL;
- }
- else if (Drawing->type == CLCIT_CONTACT && Drawing->flags & CONTACTF_NOTONLIST) {
- colourFg = dat->fontModernInfo[FONTID_NOTONLIST].colour;
- mode = ILD_BLEND50;
- }
- else {
- colourFg = dat->selBkColour;
- mode = ILD_NORMAL;
- }
-
- if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) &&
- Clist_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- mode = ILD_SELECTED;
- }
-
- _DrawStatusIcon(Drawing, dat, iImage, hdcMem, p_rect.left, p_rect.top, 0, 0, CLR_NONE, colourFg, mode);
- }
- }
- break;
-
- case TC_AVATAR:
- {
- BOOL hasAvatar = Drawing->avatar_data != nullptr;
- BYTE blendmode = 255;
- if (hottrack)
- blendmode = 255;
- else if (Drawing->type == CLCIT_CONTACT && Drawing->flags & CONTACTF_NOTONLIST)
- blendmode = 128;
- if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) && Clist_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- blendmode = 128;
- if (!hasAvatar) { // if no avatar then paint icon image
- int iImage = Drawing->iImage;
- if (iImage != -1) {
- COLORREF colourFg;
- int mode;
- // Store pos
- Drawing->pos_icon = p_rect;
- if (hottrack) {
- colourFg = dat->hotTextColour;
- mode = ILD_NORMAL;
- }
- else if (Drawing->type == CLCIT_CONTACT && Drawing->flags & CONTACTF_NOTONLIST) {
- colourFg = dat->fontModernInfo[FONTID_NOTONLIST].colour;
- mode = ILD_BLEND50;
- }
- else {
- colourFg = dat->selBkColour;
- mode = ILD_NORMAL;
- }
-
- if (Drawing->type == CLCIT_CONTACT && dat->bShowIdle && (Drawing->flags & CONTACTF_IDLE) && Clist_GetRealStatus(Drawing, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- mode = ILD_SELECTED;
-
- _DrawStatusIcon(Drawing, dat, iImage, hdcMem, p_rect.left, p_rect.top, 0, 0, CLR_NONE, colourFg, mode);
- }
- }
- else {
- HRGN rgn = nullptr;
- int round_radius = 0;
- int ava_width = p_rect.right - p_rect.left;
- int ava_height = p_rect.bottom - p_rect.top;
- // Store pos
- Drawing->pos_avatar = p_rect;
- HRGN oldrgn = CreateRectRgn(0, 0, 0, 0);
- GetClipRgn(hdcMem, oldrgn);
-
- // Round corners
- if (dat->avatars_round_corners) {
- if (dat->avatars_use_custom_corner_size)
- round_radius = dat->avatars_custom_corner_size;
- else
- round_radius = min(ava_width, ava_height) / 5;
- }
- else round_radius = 0;
-
- if (dat->avatars_draw_border) {
- HBRUSH hBrush = CreateSolidBrush(dat->avatars_border_color);
- HBRUSH hOldBrush = (HBRUSH)SelectObject(hdcMem, hBrush);
- HRGN rgn2;
- rgn = CreateRoundRectRgn(p_rect.left, p_rect.top, p_rect.right + 1, p_rect.bottom + 1, round_radius << 1, round_radius << 1);
- rgn2 = CreateRoundRectRgn(p_rect.left + 1, p_rect.top + 1, p_rect.right, p_rect.bottom, round_radius << 1, round_radius << 1);
- CombineRgn(rgn2, rgn, rgn2, RGN_DIFF);
- // FrameRgn(hdcMem, rgn, hBrush, 1, 1 );
- FillRgn(hdcMem, rgn2, hBrush);
- ske_SetRgnOpaque(hdcMem, rgn2);
- SelectObject(hdcMem, hOldBrush);
- DeleteObject(hBrush);
- DeleteObject(rgn);
- DeleteObject(rgn2);
- }
- if (dat->avatars_round_corners || dat->avatars_draw_border) {
- int k = dat->avatars_draw_border ? 1 : 0;
- rgn = CreateRoundRectRgn(p_rect.left + k, p_rect.top + k, p_rect.right + 1 - k, p_rect.bottom + 1 - k, round_radius * 2, round_radius * 2);
- ExtSelectClipRgn(hdcMem, rgn, RGN_AND);
- }
-
- // Draw avatar
- _DrawContactAvatar(hdcMem, dat, Drawing, &row_rc, selected, hottrack, &p_rect);
-
- // Restore region
- if (dat->avatars_round_corners || dat->avatars_draw_border)
- DeleteObject(rgn);
-
- SelectClipRgn(hdcMem, oldrgn);
- DeleteObject(oldrgn);
-
- // Draw borders
-
- //TODO fix overlays
- // Draw overlay
- if (dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0)
- && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < _countof(g_pAvatarOverlayIcons)) {
- p_rect.top = p_rect.bottom - ICON_HEIGHT;
- p_rect.left = p_rect.right - ICON_HEIGHT;
-
- if (dat->avatars_draw_border) {
- p_rect.top--;
- p_rect.left--;
- }
-
- switch (dat->avatars_overlay_type) {
- case SETTING_AVATAR_OVERLAY_TYPE_NORMAL:
- {
- UINT a = blendmode;
- a = (a << 24);
- ske_ImageList_DrawEx(hAvatarOverlays, g_pAvatarOverlayIcons[GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE].listID,
- hdcMem,
- p_rect.left, p_rect.top, ICON_HEIGHT, ICON_HEIGHT,
- CLR_NONE, CLR_NONE,
- (blendmode == 255) ? ILD_NORMAL : (blendmode == 128) ? ILD_BLEND50 : ILD_BLEND25);
- }
- break;
- case SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL:
- {
- int item = g_clistApi.pfnIconFromStatusMode(Drawing->pce->szProto, Drawing->pce->szProto == nullptr ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact);
- if (item != -1)
- _DrawStatusIcon(Drawing, dat, item, hdcMem,
- p_rect.left, p_rect.top, ICON_HEIGHT, ICON_HEIGHT,
- CLR_NONE, CLR_NONE, (blendmode == 255) ? ILD_NORMAL : (blendmode == 128) ? ILD_BLEND50 : ILD_BLEND25);
- }
- break;
- case SETTING_AVATAR_OVERLAY_TYPE_CONTACT:
- if (Drawing->iImage != -1)
- _DrawStatusIcon(Drawing, dat, Drawing->iImage, hdcMem,
- p_rect.left, p_rect.top, ICON_HEIGHT, ICON_HEIGHT,
- CLR_NONE, CLR_NONE, (blendmode == 255) ? ILD_NORMAL : (blendmode == 128) ? ILD_BLEND50 : ILD_BLEND25);
- break;
- }
- }
- }
- }
- break;
-
- case TC_EXTRA:
- if (Drawing->type == CLCIT_CONTACT &&
- (!Drawing->iSubNumber || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0)) {
- int BlendedInActiveState = dat->dbbBlendInActiveState;
- int BlendValue = dat->dbbBlend25 ? ILD_BLEND25 : ILD_BLEND50;
- int count = 0;
- RECT rc;
- int x = 0;
- for (int iImage = 0; iImage < dat->extraColumnsCount; iImage++) {
- COLORREF colourFg = dat->selBkColour;
- int mode = BlendedInActiveState ? BlendValue : ILD_NORMAL;
- if (Drawing->iExtraImage[iImage] == EMPTY_EXTRA_ICON) {
- if (!dat->bMetaIgnoreEmptyExtra) {
- SetRect(&rc, p_rect.left + x, p_rect.top, p_rect.left + x + ICON_HEIGHT, p_rect.bottom);
- x += dat->extraColumnSpacing;
- if (dat->text_rtl != 0) _RTLRect(&rc, free_row_rc.right);
- Drawing->pos_extra[iImage] = rc;
- count++;
- }
- continue;
- }
-
- if (selected)
- mode = BlendedInActiveState ? ILD_NORMAL : ILD_SELECTED;
- else if (hottrack) {
- mode = BlendedInActiveState ? ILD_NORMAL : ILD_FOCUS;
- colourFg = dat->hotTextColour;
- }
- else if (Drawing->type == CLCIT_CONTACT && (Drawing->flags & CONTACTF_NOTONLIST)) {
- colourFg = dat->fontModernInfo[FONTID_NOTONLIST].colour;
- mode = BlendValue;
- }
-
- SetRect(&rc, p_rect.left + x, p_rect.top, p_rect.left + x + ICON_HEIGHT, p_rect.bottom);
- x += dat->extraColumnSpacing;
- count++;
- if (dat->text_rtl != 0) _RTLRect(&rc, free_row_rc.right);
- Drawing->pos_extra[iImage] = rc;
- if (Drawing->iExtraImage[iImage] != EMPTY_EXTRA_ICON)
- ske_ImageList_DrawEx(dat->himlExtraColumns, Drawing->iExtraImage[iImage], hdcMem,
- rc.left, rc.top, 0, 0, CLR_NONE, colourFg, mode);
- }
- }
- break;
-
- case TC_EXTRA1:
- case TC_EXTRA2:
- case TC_EXTRA3:
- case TC_EXTRA4:
- case TC_EXTRA5:
- case TC_EXTRA6:
- case TC_EXTRA7:
- case TC_EXTRA8:
- case TC_EXTRA9:
- if (Drawing->type == CLCIT_CONTACT && (!Drawing->iSubNumber || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0)) {
- int eNum = gl_RowTabAccess[i]->type - TC_EXTRA1;
- if (eNum < dat->extraColumnsCount) {
- if (Drawing->iExtraImage[eNum] != EMPTY_EXTRA_ICON) {
- COLORREF colourFg = RGB(0, 0, 0);
- int mode = 0;
- int BlendedInActiveState = dat->dbbBlendInActiveState;
- int BlendValue = dat->dbbBlend25 ? ILD_BLEND25 : ILD_BLEND50;
- if (mode2 != -1) mode = mode2;
- else {
- if (selected) mode = BlendedInActiveState ? ILD_NORMAL : ILD_SELECTED;
- else if (hottrack) {
- mode = BlendedInActiveState ? ILD_NORMAL : ILD_FOCUS;
- colourFg = dat->hotTextColour;
- }
- else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST) {
- colourFg = dat->fontModernInfo[FONTID_NOTONLIST].colour;
- mode = BlendValue;
- }
- mode2 = mode;
- }
- if (dat->text_rtl != 0) _RTLRect(&p_rect, free_row_rc.right);
- Drawing->pos_extra[eNum] = p_rect;
- if (Drawing->iExtraImage[eNum] != EMPTY_EXTRA_ICON)
- ske_ImageList_DrawEx(dat->himlExtraColumns, Drawing->iExtraImage[eNum], hdcMem,
- p_rect.left, p_rect.top, 0, 0, CLR_NONE, colourFg, mode);
- }
- }
- }
- break;
-
- case TC_TIME:
- wchar_t szResult[80];
- if (!TimeZone_PrintDateTime(pdnce->hTimeZone, L"t", szResult, _countof(szResult), 0)) {
- // Select font
- ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, nullptr);
- ske_DrawText(hdcMem, szResult, (int)mir_wstrlen(szResult), &p_rect, DT_NOPREFIX | DT_SINGLELINE | (dat->text_rtl ? DT_RTLREADING : 0));
- }
- break;
- }
- }
- i++;
- }
- return;
}
void CLCPaint::_DrawStatusIcon(ClcContact *Drawing, ClcData *dat, int iImage, HDC hdcMem, int x, int y, int cx, int cy, DWORD colorbg, DWORD colorfg, int mode)
diff --git a/plugins/Clist_modern/src/modern_clistopts.cpp b/plugins/Clist_modern/src/modern_clistopts.cpp
index b9b6252dd5..e56c2429d5 100644
--- a/plugins/Clist_modern/src/modern_clistopts.cpp
+++ b/plugins/Clist_modern/src/modern_clistopts.cpp
@@ -901,9 +901,6 @@ struct
static row_opt_items[] =
{
{ LPGEN("Row"), IDD_OPT_ITEM_ROW, DlgProcItemRowOpts },
-#ifdef _DEBUG
- { LPGEN("Row design"), IDD_OPT_ROWTMPL, DlgTmplEditorOpts },
-#endif
{ LPGEN("Avatar"), IDD_OPT_ITEM_AVATAR, DlgProcItemAvatarOpts },
{ LPGEN("Icon"), IDD_OPT_ITEM_ICON, DlgProcItemIconOpts },
{ LPGEN("Contact time"), IDD_OPT_ITEM_CONTACT_TIME, DlgProcItemContactTimeOpts },
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp
index 04db78d534..20d4d4ad94 100644
--- a/plugins/Clist_modern/src/modern_clui.cpp
+++ b/plugins/Clist_modern/src/modern_clui.cpp
@@ -269,7 +269,6 @@ m_hDwmapiDll(nullptr)
// TODO Add Row template loading here.
- RowHeight_InitModernRow();
nLastRequiredHeight = 0;
LoadCLUIFramesModule();
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h
index 1f0a473375..f313232167 100644
--- a/plugins/Clist_modern/src/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/modern_commonprototypes.h
@@ -59,10 +59,10 @@ typedef INT_PTR(*PSYNCCALLBACKPROC)(WPARAM, LPARAM);
/* CLCItems */
-bool CLCItems_IsShowOfflineGroup(ClcGroup *group);
+bool CLCItems_IsShowOfflineGroup(ClcGroup *group);
/* CListMod */
-int CListMod_HideWindow();
+int CListMod_HideWindow();
/* CLUI */
HANDLE RegisterIcolibIconHandle(char *szIcoID, char *szSectionName, char *szDescription, wchar_t *tszDefaultFile, int iDefaultIndex, HINSTANCE hDefaultModule, int iDefaultResource);
@@ -125,7 +125,7 @@ HBITMAP ske_LoadGlyphImage(const wchar_t *szFileName);
HRESULT SkinEngineLoadModule();
void ske_LoadSkinFromDB(void);
int ske_LoadSkinFromIniFile(wchar_t*, BOOL);
-wchar_t* ske_ParseText(wchar_t *stzText);
+wchar_t* ske_ParseText(wchar_t *stzText);
int ske_PrepareImageButDontUpdateIt(RECT *r);
int ske_ReCreateBackImage(BOOL Erase, RECT *w);
int ske_RedrawCompleteWindow();
@@ -143,20 +143,20 @@ int ske_ValidateFrameImageProc(RECT *r);
/* CLUIFrames.c PROXIED */
-int CLUIFrames_ActivateSubContainers(BOOL wParam);
-int CLUIFrames_OnClistResize_mod(WPARAM wParam, LPARAM lParam);
-int CLUIFrames_OnMoving(HWND, RECT *);
-int CLUIFrames_OnShowHide(int mode);
-int CLUIFrames_SetLayeredMode(BOOL fLayeredMode, HWND hwnd);
-int CLUIFrames_SetParentForContainers(HWND parent);
-int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam);
+int CLUIFrames_ActivateSubContainers(BOOL wParam);
+int CLUIFrames_OnClistResize_mod(WPARAM wParam, LPARAM lParam);
+int CLUIFrames_OnMoving(HWND, RECT *);
+int CLUIFrames_OnShowHide(int mode);
+int CLUIFrames_SetLayeredMode(BOOL fLayeredMode, HWND hwnd);
+int CLUIFrames_SetParentForContainers(HWND parent);
+int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam);
-FRAMEWND * FindFrameByItsHWND(HWND FrameHwnd); //cluiframes.c
+FRAMEWND* FindFrameByItsHWND(HWND FrameHwnd); //cluiframes.c
-int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid);
+int DrawTitleBar(HDC hdcMem2, RECT *rect, int Frameid);
-int FindFrameID(HWND FrameHwnd);
-int SetAlpha(BYTE Alpha);
+int FindFrameID(HWND FrameHwnd);
+int SetAlpha(BYTE Alpha);
/* others TODO: move above */
@@ -164,8 +164,6 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam);
void DrawBackGround(HWND hwnd, HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColour, DWORD backgroundBmpUse);
HRESULT BackgroundsLoadModule();
int BackgroundsUnloadModule();
-INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //RowTemplate.c
-BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c
char* GetParamN(char *string, char *buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces); //mod_skin_selector.c
WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim, BOOL SkipSpaces);
DWORD CompareContacts2_getLMTime(MCONTACT u); //contact.c
@@ -180,35 +178,27 @@ int GetContactCachedStatus(MCONTACT hContact);
int GetContactIconC(ClcCacheEntry *cacheEntry); //clistmod.c
int GetStatusForContact(MCONTACT hContact, char *szProto); //clistsettings.c
int InitCustomMenus(void); //clistmenus.c
-int LoadMoveToGroup(); //movetogroup.c
int LoadStatusBarData(); //modern_statusbar.c
-int MenuModulesLoaded(WPARAM wParam, LPARAM lParam); //clistmenu.c
-int MenuModulesShutdown(WPARAM wParam, LPARAM lParam); //clistmenu.c
-int MenuProcessCommand(WPARAM wParam, LPARAM lParam); //clistmenu.c
int OnFrameTitleBarBackgroundChange(WPARAM wParam, LPARAM lParam); //cluiframes.c
int QueueAllFramesUpdating(bool); //cluiframes.c
int RecursiveDeleteMenu(HMENU hMenu); //clistmenus.c
int ModernSkinButtonRedrawAll(); //modern_button.c
int RegisterButtonByParce(char *ObjectName, char *Params); //mod_skin_selector.c
-int RestoreAllContactData(ClcData *dat); //cache_funcs.c
-
int SkinSelector_DeleteMask(MODERNMASK *mm); //mod_skin_selector.c
-int StoreAllContactData(ClcData *dat); //cache_func.c
INT_PTR ToggleHideOffline(WPARAM wParam, LPARAM lParam); //contact.c
INT_PTR SetUseGroups(WPARAM wParam, LPARAM lParam); //contact.c
INT_PTR ToggleSounds(WPARAM wParam, LPARAM lParam); //contact.c
void ClcOptionsChanged(); //clc.c
void Docking_GetMonitorRectFromWindow(HWND hWnd, RECT *rc); //Docking.c
void DrawAvatarImageWithGDIp(HDC hDestDC, int x, int y, DWORD width, DWORD height, HBITMAP hbmp, int x1, int y1, DWORD width1, DWORD height1, DWORD flag, BYTE alpha); //gdiplus.cpp
-void FreeRowCell(); //RowHeight
void InitGdiPlus(); //gdiplus.cpp
void ShutdownGdiPlus(); //gdiplus.cpp
void UnloadAvatarOverlayIcon(); //clc.c
void UnLoadContactListModule(); //clistmod.c
void UpdateAllAvatars(ClcData *dat); //cache_func.c
-void ApplyViewMode(const char *Name, bool onlySelector = false);
-void SaveViewMode(const char *name, const wchar_t *szGroupFilter, const char *szProtoFilter, DWORD statusMask, DWORD stickyStatusMask, unsigned int options, unsigned int stickies, unsigned int operators, unsigned int lmdat);
+void ApplyViewMode(const char *Name, bool onlySelector = false);
+void SaveViewMode(const char *name, const wchar_t *szGroupFilter, const char *szProtoFilter, DWORD statusMask, DWORD stickyStatusMask, unsigned int options, unsigned int stickies, unsigned int operators, unsigned int lmdat);
// cluiframes.c
int ExtraImage_ExtraIDToColumnNum(int extra);
@@ -268,15 +258,11 @@ struct DWM_BLURBEHIND
};
extern HRESULT(WINAPI *g_proc_DWMEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind);
-extern tPaintCallbackProc CLCPaint_PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData);
-
/* SkinEngine.c */
-
BYTE SkinDBGetContactSettingByte(MCONTACT hContact, const char* szSection, const char*szKey, BYTE bDefault);
extern OVERLAYICONINFO g_pAvatarOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1];
extern OVERLAYICONINFO g_pStatusOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1];
-
#endif
diff --git a/plugins/Clist_modern/src/modern_row.cpp b/plugins/Clist_modern/src/modern_row.cpp
deleted file mode 100644
index bd638fffe7..0000000000
--- a/plugins/Clist_modern/src/modern_row.cpp
+++ /dev/null
@@ -1,740 +0,0 @@
-/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (C) 2012-19 Miranda NG team (https://miranda-ng.org),
-Copyright (c) 2000-08 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-Created by Anton Senko aka ZORG , tweaked by Artem Shpynov aka FYR
-*/
-
-#include "stdafx.h"
-
-void rowCalculateMinSize(ROWCELL* cell);
-void rowEqualize(ROWCELL* cell);
-void rowResetEmptyRects(ROWCELL* cell);
-void rowDeleteTree(ROWCELL* cell);
-
-//extern ROWCELL * gl_RowRoot; // Указатель на корневой тэг < contact> в шаблоне
-//ROWOBJECTS RowTA; // Структура, через которую осуществляется доступ к элементам контакта.
-// Формируется при выполнении фу-и RowParce. Неявный параметр фуи rowParserGetParam
-
-
-// Формируется при выполнении фу-и RowParce. Неявный параметр фуи rowParserGetParam
-
-char *tmplbuf; // Буфер для хранения шаблона в текстовом виде
-
-ROWCELL *cppInitModernRow(ROWCELL ** tabAccess)
-{
- int fsize;
- int seq = 0;
- ROWCELL * RowRoot = nullptr;
- FILE * hFile;
- int i = 0;
- if (!db_get_b(0, "ModernData", "UseAdvancedRowLayout", SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)) return nullptr;
- tmplbuf = nullptr;
- if (db_get_b(0, "ModernData", "UseAdvancedRowLayout", SETTING_ROW_ADVANCEDLAYOUT_DEFAULT) == 1)
- tmplbuf = db_get_sa(0, "ModernData", "RowTemplate");
- if (tmplbuf) {
- 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);
- memset(tmplbuf, 0, (fsize + 1));
-
- 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(0, "ModernData", "RowTemplate", tmplbuf);
- free(tmplbuf);
- fclose(hFile);
- return RowRoot;
- }
- return nullptr;
-
-}
-
-void cppDeleteTree(ROWCELL * RowRoot)
-{
- ROWCELL *rc = RowRoot;
- rowDeleteTree(rc);
-}
-
-int cppCalculateRowHeight(ROWCELL *RowRoot)
-{
- if (RowRoot == nullptr)
- return 0;
- RowRoot->h = 0;
- RowRoot->w = 0;
- rowResetEmptyRects(RowRoot);
- rowCalculateMinSize(RowRoot);
- rowEqualize(RowRoot);
- return RowRoot->r.bottom;
-}
-void cppCalculateRowItemsPos(ROWCELL *RowRoot, int width)
-{
- rowSizeWithReposition(RowRoot, width);
-}
-
-// rowAddCell
-// Выделяет необходимое кол-во дин. памяти для структуры ROWCELL
-// и связывает ее с деревом описания контакта
-// link - поле child или next, родительской структуры ROWCELL
-// cont - тип контейнера: строка, столбец или корневой узел
-//
-//
-const ROWCELL * rowAddCell(ROWCELL* &link, int cont)
-{
- link = (ROWCELL*)malloc(sizeof(ROWCELL));
- memset(link, 0, sizeof(ROWCELL));
- link->cont = cont;
- return link;
-}
-
-// rowDeleteTree
-// Освобождает память занятую деревом описания контакта
-// cell - адрес корневого узла дерева описания контакта
-//
-//
-void rowDeleteTree(ROWCELL* cell)
-{
- if (!cell) return;
- if (cell->child)
- rowDeleteTree((ROWCELL*)(cell->child));
- if (cell->next)
- rowDeleteTree((ROWCELL*)(cell->next));
- free(cell);
- cell = nullptr;
- return;
-}
-
-// rowParserGetNextWord
-// Выбирает из потока данных (сейчас файлового) очередное слово.
-// Словом считается последовательность символов, ограниченная знаками: SP, < , >, ;, TAB, CR, LF
-// символы от ; и до конца строки считаются комментарием.
-// NOTE: Данная реализация не совсем подходит для включения ее в ModernCL,
-// а по сему, тут надо будет переделывать
-// tbuf - указатель на буфер содержащий текст шаблона
-// hbuf - указатель буфера
-//
-//
-char * rowParserGetNextWord(char *tbuf, int &hbuf)
-{
- static char buf[256];
- char ch;
-
- int j = -1;
-
- memset(buf, 0, sizeof(buf));
-
- while (tbuf[hbuf] != 0)
- {
- ch = tbuf[hbuf];
-
- // Remark found
- if (ch == ';')
- {
- if (j >= 0) return buf;
-
- while (tbuf[hbuf] != 10 && tbuf[hbuf] != 13) hbuf++;
- }
-
- // Tag-bracers found
- if (!(ch == '>' && j < 0)) //not single '>' found
- {
- if ((ch == '<' || ch == '>') && j >= 0)
- {
- if (ch == '>')
- {
- if (buf[0] == '/' || buf[0] == '<') buf[++j] = ch;
- hbuf++;
- }
- return buf;
- }
-
- if (ch == ' ' || ch == 9 || ch == 10 || ch == 13 || ch == ';' || ch == '>')
- {
- if (ch == '>')
- {
- buf[++j] = ch;
- hbuf++;
- }
-
- if (j >= 0) return buf; // Word is selected
- }
- else
- buf[++j] = ch;
- }
- hbuf++;
- }
- return nullptr;
-}
-
-// rowParserGetParam
-// ищет и интерпретирует слова в шаблоне, заключенные между тэгами
-// cell - указатель на текущий интерпретируемый контейнер шаблона
-// tbuf - указатель на буфер содержащий текст шаблона
-// hbuf - указатель буфера
-//
-//
-void rowParserGetParam(ROWCELL* &cell, char *tbuf, int &hbuf)
-{
- char * word = rowParserGetNextWord(tbuf, hbuf);
- int param = 0;
-
- if (!_strnicmp(word, "avatar", mir_strlen(word))) param = TC_AVATAR;
- else if (!_strnicmp(word, "text1", mir_strlen(word))) param = TC_TEXT1;
- else if (!_strnicmp(word, "text2", mir_strlen(word))) param = TC_TEXT2;
- else if (!_strnicmp(word, "text3", mir_strlen(word))) param = TC_TEXT3;
- else if (!_strnicmp(word, "status", mir_strlen(word))) param = TC_STATUS;
- else if (!_strnicmp(word, "extra", mir_strlen(word))) param = TC_EXTRA;
- else if (!_strnicmp(word, "extra1", mir_strlen(word))) param = TC_EXTRA1;
- else if (!_strnicmp(word, "extra2", mir_strlen(word))) param = TC_EXTRA2;
- else if (!_strnicmp(word, "extra3", mir_strlen(word))) param = TC_EXTRA3;
- else if (!_strnicmp(word, "extra4", mir_strlen(word))) param = TC_EXTRA4;
- else if (!_strnicmp(word, "extra5", mir_strlen(word))) param = TC_EXTRA5;
- else if (!_strnicmp(word, "extra6", mir_strlen(word))) param = TC_EXTRA6;
- else if (!_strnicmp(word, "extra7", mir_strlen(word))) param = TC_EXTRA7;
- else if (!_strnicmp(word, "extra8", mir_strlen(word))) param = TC_EXTRA8;
- else if (!_strnicmp(word, "extra9", mir_strlen(word))) param = TC_EXTRA9;
- else if (!_strnicmp(word, "time", mir_strlen(word))) param = TC_TIME;
- else if (!_strnicmp(word, "space", mir_strlen(word))) param = TC_SPACE;
- else if (!_strnicmp(word, "fspace", mir_strlen(word))) param = TC_FIXED;
-
- else if (!_strnicmp(word, "left", mir_strlen(word))) param = TC_LEFT;
- else if (!_strnicmp(word, "top", mir_strlen(word))) param = TC_TOP;
- else if (!_strnicmp(word, "vcenter", mir_strlen(word))) param = TC_VCENTER;
- else if (!_strnicmp(word, "hcenter", mir_strlen(word))) param = TC_HCENTER;
- else if (!_strnicmp(word, "right", mir_strlen(word))) param = TC_RIGHT;
- else if (!_strnicmp(word, "bottom", mir_strlen(word))) param = TC_BOTTOM;
-
- else if (!_strnicmp(word, "layer", mir_strlen(word))) cell->layer = TRUE;
-
- else if (!_strnicmp(word, "width", mir_strlen(word))) param = TC_WIDTH;
- else if (!_strnicmp(word, "height", mir_strlen(word))) param = TC_HEIGHT;
-
- else
- {
- hbuf -= (int)mir_strlen(word);
- return;
- }
-
- if (param > TC_TEXT3 && param != TC_SPACE) cell->hasfixed = 1;
-
- switch (param)
- {
- case TC_TEXT1:
- case TC_TEXT2:
- case TC_TEXT3:
- case TC_SPACE:
- cell->sizing = 1;
- case TC_STATUS:
- case TC_AVATAR:
- case TC_EXTRA:
- case TC_EXTRA1:
- case TC_EXTRA2:
- case TC_EXTRA3:
- case TC_EXTRA4:
- case TC_EXTRA5:
- case TC_EXTRA6:
- case TC_EXTRA7:
- case TC_EXTRA8:
- case TC_EXTRA9:
- case TC_TIME:
- case TC_FIXED:
-
- cell->type = param;
- break;
-
- case TC_HCENTER:
- case TC_RIGHT:
- cell->halign = param;
- break;
-
- case TC_VCENTER:
- case TC_BOTTOM:
- cell->valign = param;
- break;
-
- case TC_WIDTH:
- word = rowParserGetNextWord(tbuf, hbuf);
- param = atoi(word);
- cell->w = param;
- break;
-
- case TC_HEIGHT:
- word = rowParserGetNextWord(tbuf, hbuf);
- param = atoi(word);
- cell->h = param;
- }
-
- rowParserGetParam(cell, tbuf, hbuf);
- return;
-}
-// rowParse
-// Ищет в шаблоне теги < contact>, < tr> и < tc>, и добавляет соответствующие узлы
-// в дерево описания контакта
-// cell - поле child или next родительского контейнера
-// parent - указатель на родительский контейнер
-// tbuf - указатель на буфер содержащий текст шаблона
-// hbuf - указатель буфера
-// sequence - нужно задавать 0, это очередность нахождения
-//
-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", mir_strlen(word)) || !_strnicmp(word, "<tr>", mir_strlen(word))) cont = TC_ROW;
- else if (!_strnicmp(word, "<tc", mir_strlen(word)) || !_strnicmp(word, "<tc>", mir_strlen(word))) cont = TC_COL;
- else if (!_strnicmp(word, "/>", mir_strlen(word)) ||
- !_strnicmp(word, "</tr>", mir_strlen(word)) ||
- !_strnicmp(word, "</tc>", mir_strlen(word))) return TRUE;
- else return FALSE;
-
- rowAddCell(cell, cont);
- rowParserGetParam(cell, tbuf, hbuf);
- if (cell->type != 0 && cell->type != TC_SPACE && cell->type != TC_FIXED)
- RowTabAccess[sequence++] = cell;
-
- if (!rowParse(cell->child, cell, tbuf, hbuf, sequence, RowTabAccess))
- return FALSE;
-
- if (!parent)
- {
- RowTabAccess[sequence] = nullptr;
- return TRUE;
- }
-
- if (!rowParse(cell->next, parent, tbuf, hbuf, sequence, RowTabAccess))
- return FALSE;
-
- parent->sizing |= cell->sizing;
- parent->hasfixed |= cell->hasfixed;
- return TRUE;
-}
-
-void rowResetEmptyRects(ROWCELL* cell)
-{
- if (!cell) return;
- if (cell->type == 0)
- {
- SetRect(&(cell->r), 0, 0, 0, 0);
- cell->full_width = 0;
- cell->fixed_width = 0;
- }
- rowResetEmptyRects(cell->child);
- rowResetEmptyRects(cell->next);
-}
-
-// rowCalculateMinSize
-// Вычисление минимальных размеров каждого контейнера дерева описания контакта
-// Эта фу-я ВСЕГДА! должна вызываться непосредственно перед rowPositioning
-// cell - указатель на корневой узел дерева описания контакта
-// NOTE: Перед вызывом rowCalculateMinSize необходимо заполнить поля w и h структуры RowTA, для каждого элемента
-//
-void rowCalculateMinSize(ROWCELL* cell)
-{
- ROWCELL* curchild = nullptr;
- int w = 0, h = 0;
- int wl = 0, hl = 0;
- int fullWidth = 0;
- if (!cell) return;
-
- 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;
- else
- cell->r.right = 0;
-
- cell->r.bottom = cell->h;
-
- rowCalculateMinSize(cell->child);
- rowCalculateMinSize(cell->next);
-
- if (!(curchild = cell->child)) return;
-
- if (cell->cont == TC_ROW)
- {
- do
- {
- h = max(h, curchild->r.bottom);
-
- if (curchild->layer)
- {
- //w = max(w, curchild->r.right);
- wl += curchild->r.right;
- fullWidth = max(fullWidth, max(curchild->full_width, curchild->w));
- }
- else
- {
- w += curchild->r.right;
- fullWidth += max(curchild->full_width, curchild->w);
- }
- } while (curchild = curchild->next);
- }
-
- if (cell->cont == TC_COL)
- {
- while (curchild)
- {
- w = max(w, curchild->r.right);
- fullWidth = max(fullWidth, max(curchild->full_width, curchild->w));
-
- if (curchild->layer)
- {
- hl = curchild->r.bottom;
- // h = max(h, curchild->r.bottom);
- }
- else
- h += curchild->r.bottom;
-
- curchild = curchild->next;
- }
- }
-
- 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;
-}
-
-// void rowEqualise(ROWCELL* cell)
-//
-// Уравнивает высоты детей внутри строк, и ширины детей внутри стобцов
-// cell - указатель на корневой узел дерева описания контакта
-//
-void rowEqualize(ROWCELL* cell)
-{
- ROWCELL* curchild = nullptr;
- if (!cell) return;
- rowEqualize(cell->child);
- rowEqualize(cell->next);
-
- if (!(curchild = cell->child)) return;
-
- if (cell->cont == TC_ROW)
- {
- do
- {
- if (curchild->layer) continue;
- curchild->r.bottom = cell->r.bottom;
- } while (curchild = curchild->next);
- }
-
- if (cell->cont == TC_COL)
- {
- do
- {
- if (curchild->layer) continue;
- curchild->r.right = cell->r.right;
- } while (curchild = curchild->next);
- }
-
-
- //rowEqualize(cell->child);
- //rowEqualize(cell->next);
-}
-
-// void rowPlacing(pttCell cell, pttCell parent)
-//
-// Позиционирует элемент строки контакта в его контейнере
-// cell - указатель на плавающий контейнер
-//
-void rowPlacing(pROWCELL cell)
-{
- if (cell->type == 0) return;
-
- switch (cell->type)
- {
- case TC_TEXT1:
- case TC_TEXT2:
- case TC_TEXT3:
- case TC_SPACE:
- cell->r.right += cell->r.left;
- break;
- default:
- {
- 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;
- }
- }
-
- switch (cell->valign)
- {
- case TC_TOP:
- break;
- case TC_VCENTER:
- cell->r.top += (cell->r.bottom - cell->h) / 2;
- break;
- case TC_BOTTOM:
- cell->r.top += cell->r.bottom - cell->h;
- }
- cell->r.bottom = cell->r.top + cell->h;
-}
-
-// void ttTLProc(pROWCELL cell, pROWCELL parent)
-//
-// Позиционирует плавающий контейнер, внутри родительского
-// cell - указатель на плавающий контейнер
-// parent - указатель на родительский контейнер
-//
-void rowLayerProc(pROWCELL cell, pROWCELL parent)
-{
- if (cell->sizing)
- {
- cell->r.left = parent->r.left;
- //cell->r.right += cell->r.left;
- }
- else
- {
- 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;
- break;
- case TC_RIGHT:
- cell->r.left = parent->r.left + parent->r.right - cell->r.right;
- }
- }
-
- 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;
- break;
- case TC_BOTTOM:
- cell->r.top = parent->r.top + parent->r.bottom - cell->r.bottom;
- break;
- }
-}
-
-// void rowPositioning(pROWCELL cell, int &dist)
-//
-// Вычисляет прямоугольники элементов контакта, учитывая выравнивание в контейнере
-// cell - указатель на корневой узел дерева описания контакта
-// dist - новая ширина контакта
-//
-void rowPositioning(pROWCELL cell, int &dist)
-{
- ROWCELL* curchild = nullptr;
-
- int x = cell->r.left;
- int y = cell->r.top;
-
- int h = cell->r.bottom;
- int w = dist;
-
- int r = 0;
- int size = 0;
- int cw = 0;
- int fixedsized = 0;
- int autosized = 0;
- int dummy = 0;
-
- // Коррректировка назначаемой ширины dist
- if (w < cell->r.right && (cell->type < TC_TEXT1 || cell->type > TC_TEXT3 && cell->type != TC_SPACE) || !cell->sizing)
- dist = w = cell->r.right;
-
- cell->r.right = dist;
- dummy = dist;
- if (!(curchild = cell->child))
- {
- rowPlacing(cell);
- return;
- }
-
- // Позиционирование контейнеров в строке
- if (cell->cont == TC_ROW)
- {
- fixedsized = cell->fixed_width;
- while (curchild)
- {
- // Контейнеры layer не должны влиять на позиционирование контейнеров tc
- if (curchild->layer)
- {
- curchild = curchild->next;
- continue;
- }
-
- cw += curchild->r.right;
-
- if (curchild->sizing)
- {
- autosized += max(curchild->w, curchild->full_width);
- r++;
- }
- else
- size += curchild->r.right;
-
- curchild = curchild->next;
- }
-
- w -= size;
- fixedsized -= size;
-
- if (r == 0)
- {
- switch (cell->halign)
- {
- case TC_HCENTER:
- x += (dist - cw) / 2;// - 1;
- break;
- case TC_RIGHT:
- x += dist - cw;
- break;
- }
- }
-
-
- curchild = cell->child;
-
- size = 0;
- while (curchild)
- {
- if (curchild->layer)
- {
- //int dummy = 0;
- rowLayerProc(curchild, cell);
- rowPositioning(curchild, dummy);
- }
- else
- {
- curchild->r.top = cell->r.top;
- curchild->r.left = x;
-
-
- w -= size;
- if (curchild->sizing)
- {
- size = w;
- r--;
- }
- else
- size = curchild->r.right;
-
- rowPositioning(curchild, size);
- x += size;
-
- if (!curchild->sizing)
- size = 0;
- }
-
- curchild = curchild->next;
- }
- }
-
- // Позиционирование контейнеров в столбце
- if (cell->cont == TC_COL)
- {
- while (curchild)
- {
- // Контейнеры layer не должны влиять на позиционирование контейнеров tr
- if (curchild->layer)
- {
- curchild = curchild->next;
- continue;
- }
-
- size += curchild->r.bottom;
- curchild = curchild->next;
- }
-
- if (h > size)
- {
- switch (cell->valign)
- {
- case TC_VCENTER:
- y += (h - size) / 2;
- break;
- case TC_BOTTOM:
- y += (h - size);
- break;
- }
- }
-
- curchild = cell->child;
- while (curchild)
- {
- if (curchild->layer)
- {
- rowLayerProc(curchild, cell);
- rowPositioning(curchild, dummy);
- }
- else
- {
- curchild->r.top = y;
- y += curchild->r.bottom;
-
- curchild->r.left = cell->r.left;
- curchild->r.right = dist;
-
- rowPositioning(curchild, size);
-
- }
-
- curchild = curchild->next;
- }
- }
-
- rowPlacing(cell);
-
-}
-
-// void rowSizeWithReposition(ROWCELL* &root, int width)
-//
-// Производит просчет и позиционирование элементов котакта
-// Перед вызовом необходимо заполнить структуру RowTA
-//
-void rowSizeWithReposition(ROWCELL* &root, int width)
-{
- root->h = 0;
- root->w = 0;
- rowCalculateMinSize(root);
- rowEqualize(root);
- rowPositioning(root, width);
- root->h = root->r.bottom;
- root->w = root->r.right;
-}
-
-#undef _CPPCODE
diff --git a/plugins/Clist_modern/src/modern_row.h b/plugins/Clist_modern/src/modern_row.h
index dead645a89..82797558b7 100644
--- a/plugins/Clist_modern/src/modern_row.h
+++ b/plugins/Clist_modern/src/modern_row.h
@@ -76,12 +76,4 @@ typedef struct tagRowCell
}
ROWCELL, *pROWCELL;
-// Структура для доступа к контейнерам элемента контакта внутри дерева опивания
-#ifndef _CPPCODE
-int cppCalculateRowHeight(ROWCELL *RowRoot);
-void cppCalculateRowItemsPos(ROWCELL *RowRoot, int width);
-ROWCELL *cppInitModernRow(ROWCELL ** tabAccess);
-void cppDeleteTree(ROWCELL * RowRoot);
-#endif
-
#endif // modern_row_h__ \ No newline at end of file
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
index abf02a353d..8adc019b4e 100644
--- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
+++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
@@ -30,17 +30,6 @@ Created by Pescuma, modified by Artem Shpynov
ROWCELL *gl_RowTabAccess[TC_ELEMENTSCOUNT + 1] = {}; // Массив, через который осуществляется доступ к элементам контакта.
ROWCELL *gl_RowRoot;
-void FreeRowCell()
-{
- if (gl_RowRoot)
- cppDeleteTree(gl_RowRoot);
-}
-
-void RowHeight_InitModernRow()
-{
- gl_RowRoot = cppInitModernRow(gl_RowTabAccess);
-}
-
SIZE GetAvatarSize(int imageWidth, int imageHeight, int maxWidth, int maxHeight)
{
float scalefactor = 0;
@@ -263,8 +252,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item)
}
}
- int height = cppCalculateRowHeight(gl_RowRoot);
- height += dat->row_border * 2;
+ int height = dat->row_border * 2;
height = max(height, dat->row_min_heigh);
if (item != -1)
dat->row_heights[item] = height;
diff --git a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
deleted file mode 100644
index 4441199e68..0000000000
--- a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp
+++ /dev/null
@@ -1,541 +0,0 @@
-/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (C) 2012-19 Miranda NG team (https://miranda-ng.org),
-Copyright (c) 2000-08 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "stdafx.h"
-
-void RefreshTree(HWND hwndDlg, HTREEITEM hti);
-static char* rowOptTmplStr;
-static ROWCELL* rowOptTmplRoot;
-static ROWCELL* rowOptTA[100];
-wchar_t *types[] = {
- L"none", L"text1", L"text2", L"text3", L"status",
- L"avatar", L"extra", L"extra1", L"extra2", L"extra3",
- L"extra4", L"extra5", L"extra6", L"extra7", L"extra8",
- L"extra9", L"time", L"space", L"fspace"
-};
-
-RECT da = { 205, 58, 440, 130 }; // Draw area
-
-void rowOptBuildTA(pROWCELL cell, pROWCELL* TA, int* i)
-{
- if (!cell) return;
- TA[(*i)++] = cell;
- rowOptBuildTA(cell->child, TA, i);
- rowOptBuildTA(cell->next, TA, i);
-}
-
-void rowOptShowSettings(HWND hwnd)
-{
- TVITEM tvi;
- pROWCELL cell;
- HTREEITEM node = TreeView_GetSelection(GetDlgItem(hwnd, IDC_ROWTREE));
- int param;
-
- tvi.hItem = node;
- tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
-
- TreeView_GetItem(GetDlgItem(hwnd, IDC_ROWTREE), &tvi);
- cell = (pROWCELL)tvi.lParam;
-
- if (!tvi.hItem) {
- EnableWindow(GetDlgItem(hwnd, IDC_CONTTYPE), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_VALIGN), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_HALIGN), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_CONTWIDTH), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_CONTHEIGHT), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTWIDTH), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTHEIGHT), 0);
- SendDlgItemMessage(hwnd, IDC_SPINCONTWIDTH, UDM_SETPOS, 0, 0);
- SendDlgItemMessage(hwnd, IDC_SPINCONTHEIGHT, UDM_SETPOS, 0, 0);
- EnableWindow(GetDlgItem(hwnd, IDC_CONTLAYER), 0);
- return;
- }
-
- EnableWindow(GetDlgItem(hwnd, IDC_CONTTYPE), 1);
- EnableWindow(GetDlgItem(hwnd, IDC_VALIGN), 1);
- EnableWindow(GetDlgItem(hwnd, IDC_HALIGN), 1);
- EnableWindow(GetDlgItem(hwnd, IDC_CONTLAYER), 1);
-
- if (cell->type != TC_SPACE && cell->type != TC_FIXED) {
- EnableWindow(GetDlgItem(hwnd, IDC_CONTWIDTH), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_CONTHEIGHT), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTWIDTH), 0);
- EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTHEIGHT), 0);
- SendDlgItemMessage(hwnd, IDC_SPINCONTWIDTH, UDM_SETPOS, 0, 0);
- SendDlgItemMessage(hwnd, IDC_SPINCONTHEIGHT, UDM_SETPOS, 0, 0);
- }
- else {
- EnableWindow(GetDlgItem(hwnd, IDC_CONTWIDTH), 1);
- EnableWindow(GetDlgItem(hwnd, IDC_CONTHEIGHT), 1);
- EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTWIDTH), 1);
- EnableWindow(GetDlgItem(hwnd, IDC_SPINCONTHEIGHT), 1);
- SendDlgItemMessage(hwnd, IDC_SPINCONTWIDTH, UDM_SETPOS, 0, MAKELONG(cell->w, 0));
- SendDlgItemMessage(hwnd, IDC_SPINCONTHEIGHT, UDM_SETPOS, 0, MAKELONG(cell->h, 0));
- }
-
- SendDlgItemMessage(hwnd, IDC_CONTTYPE, CB_SETCURSEL, cell->type, 0);
-
- switch (cell->valign) {
- case TC_VCENTER:
- param = 1;
- break;
- case TC_BOTTOM:
- param = 2;
- break;
- default:
- param = 0;
- }
- SendDlgItemMessage(hwnd, IDC_VALIGN, CB_SETCURSEL, param, 0);
-
- switch (cell->halign) {
- case TC_HCENTER:
- param = 1;
- break;
- case TC_RIGHT:
- param = 2;
- break;
- default:
- param = 0;
- }
- SendDlgItemMessage(hwnd, IDC_HALIGN, CB_SETCURSEL, param, 0);
-
- CheckDlgButton(hwnd, IDC_CONTLAYER, cell->layer ? BST_CHECKED : BST_UNCHECKED);
-}
-
-void rowOptGenerateTreeView(pROWCELL cell, HTREEITEM node, HWND hwnd)
-{
- if (!cell) return;
-
- TVINSERTSTRUCT tvis;
- tvis.hParent = node;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.lParam = (LPARAM)cell;
-
- switch (cell->cont) {
- case TC_ROW:
- tvis.item.pszText = L"Line";
- break;
- case TC_COL:
- tvis.item.pszText = L"Column";
- }
-
- tvis.item.iImage = cell->child ? 1 : 2;
- tvis.item.iSelectedImage = cell->child ? 0 : 2;
-
- HTREEITEM pnode = TreeView_InsertItem(hwnd, &tvis);
- rowOptGenerateTreeView(cell->child, pnode, hwnd);
- rowOptGenerateTreeView(cell->next, node, hwnd);
-}
-
-int rowOptFillRowTree(HWND hwnd)
-{
- TreeView_DeleteAllItems(hwnd);
- rowOptGenerateTreeView(rowOptTmplRoot, nullptr, hwnd);
- TreeView_Expand(hwnd, TreeView_GetRoot(hwnd), TVM_EXPAND);
- return 0;
-}
-
-void rowOptAddContainer(HWND htree, HTREEITEM hti)
-{
- TVINSERTSTRUCT tvis;
- TVITEM tviparent;
- ROWCELL *cell = nullptr;
-
- if (!hti) {
- if (TreeView_GetRoot(htree))
- return;
-
- rowAddCell(rowOptTmplRoot, TC_ROW);
- tvis.hParent = nullptr;
- tvis.hInsertAfter = TVI_ROOT;
- tvis.item.pszText = L"Line";
- tvis.item.lParam = (LPARAM)rowOptTmplRoot;
- cell = rowOptTmplRoot;
- }
- else {
- // Get parent item
- tviparent.hItem = hti;
- tviparent.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- TreeView_GetItem(htree, &tviparent);
- cell = (pROWCELL)tviparent.lParam;
-
- if (cell->cont == TC_ROW)
- tvis.item.pszText = L"Column";
- else
- tvis.item.pszText = L"Line";
-
- if (cell->child) {
- cell = cell->child;
-
- while (cell->next)
- cell = cell->next;
-
- rowAddCell(cell->next, ((ROWCELL*)tviparent.lParam)->cont == TC_ROW ? TC_COL : TC_ROW);
- cell = cell->next;
- }
- else {
- rowAddCell(cell->child, ((ROWCELL*)tviparent.lParam)->cont == TC_ROW ? TC_COL : TC_ROW);
- cell = cell->child;
- }
-
- tvis.hInsertAfter = TVI_LAST;
- }
-
- tvis.item.lParam = (LPARAM)cell;
- tvis.hParent = hti;
-
- tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.iImage = 2;
- tvis.item.iSelectedImage = 2;
-
- TreeView_InsertItem(htree, &tvis);
-
- TreeView_Expand(htree, hti, TVM_EXPAND);
-
- // Change icon at parent item
- tviparent.iImage = 1;
- tviparent.iSelectedImage = 0;
- TreeView_SetItem(htree, &tviparent);
-
- int i = 0;
- memset(rowOptTA, 0, sizeof(rowOptTA));
- rowOptBuildTA(rowOptTmplRoot, (pROWCELL*)&rowOptTA, &i);
-}
-
-void rowOptDelContainer(HWND htree, HTREEITEM hti)
-{
- HTREEITEM prev = TreeView_GetPrevSibling(htree, hti);
- HTREEITEM prnt = TreeView_GetParent(htree, hti);
- TVITEM tvi, tvpi;
-
- if (!hti) return;
-
- // Get current tree item
- tvi.hItem = hti;
- tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- TreeView_GetItem(htree, &tvi);
-
- tvpi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
-
- if (prev) {
- tvpi.hItem = prev;
- TreeView_GetItem(htree, &tvpi);
- ((pROWCELL)tvpi.lParam)->next = ((pROWCELL)tvi.lParam)->next;
- }
- else {
- if (prnt) {
- tvpi.hItem = prnt;
- TreeView_GetItem(htree, &tvpi);
- ((pROWCELL)tvpi.lParam)->child = ((pROWCELL)tvi.lParam)->next;
- prev = prnt;
- }
- else {
-
- tvpi.lParam = 0;
- rowOptTmplRoot = (pROWCELL)tvpi.lParam;
- }
-
- }
-
- ((pROWCELL)tvi.lParam)->next = nullptr;
- rowDeleteTree((pROWCELL)tvi.lParam);
-
- {
- int i = 0;
- memset(rowOptTA, 0, sizeof(rowOptTA));
- rowOptBuildTA((pROWCELL)tvpi.lParam, (pROWCELL*)&rowOptTA, &i);
- }
-
- TreeView_DeleteItem(htree, hti);
-
-
- // Change icon at parent item
- if (!prnt || (prnt != prev)) return;
-
- if (TreeView_GetChild(htree, prnt)) {
- tvpi.iImage = 1;
- tvpi.iSelectedImage = 0;
- }
- else {
- tvpi.iImage = 2;
- tvpi.iSelectedImage = 2;
- }
- TreeView_SetItem(htree, &tvpi);
-
-}
-
-void RefreshTree(HWND hwndDlg, HTREEITEM hti)
-{
- HWND htree = GetDlgItem(hwndDlg, IDC_ROWTREE);
- pROWCELL cell;
- TVITEM tvi = { 0 };
- if (hti == nullptr) hti = TreeView_GetRoot(htree);
- while (hti) {
- tvi.hItem = hti;
- tvi.mask = TVIF_HANDLE;
- TreeView_GetItem(htree, &tvi);
- cell = (pROWCELL)tvi.lParam;
- if (cell) {
- wchar_t buf[200] = { 0 };
- if (!cell->child) {
- if (cell->type == 0)
- mir_snwprintf(buf, TranslateT("Empty %s cell"), cell->cont == TC_COL ? TranslateT("column") : TranslateT("line"));
- else
- mir_wstrncpy(buf, TranslateW(types[cell->type]), _countof(buf));
- }
- else {
- if (cell->type == 0)
- mir_wstrncpy(buf, (cell->cont != TC_COL ? TranslateT("columns") : TranslateT("lines")), _countof(buf));
- else
- mir_snwprintf(buf, TranslateT("%s, contain %s"), TranslateW(types[cell->type]), cell->cont != TC_COL ? TranslateT("columns") : TranslateT("lines"));
- }
- if (cell->layer) mir_wstrncat(buf, TranslateT(" layered"), _countof(buf) - mir_wstrlen(buf));
- tvi.mask = TVIF_HANDLE | TVIF_TEXT;
- tvi.pszText = buf;
- TreeView_SetItem(htree, &tvi);
- }
- {
- HTREEITEM child_hti = TreeView_GetChild(htree, hti);
- if (child_hti) RefreshTree(hwndDlg, child_hti);
- }
- hti = TreeView_GetNextSibling(htree, hti);
- }
-
- RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
-}
-
-INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- HWND htree = GetDlgItem(hwndDlg, IDC_ROWTREE);
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
-
- rowOptTmplStr = db_get_sa(0, "ModernData", "RowTemplate", "<TR />");
-
- SendDlgItemMessage(hwndDlg, IDC_SPINCONTWIDTH, UDM_SETRANGE, 0, MAKELONG(999, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPINCONTHEIGHT, UDM_SETRANGE, 0, MAKELONG(999, 0));
-
- for (auto &it : types) {
- int item = SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
- SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_SETITEMDATA, item, 0);
- }
- SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_SETCURSEL, 0, 0);
- {
- wchar_t *h_alignment[] = { L"left", L"hCenter", L"right" };
- for (auto &it : h_alignment) {
- int item = SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
- SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_SETITEMDATA, item, 0);
- }
- SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_SETCURSEL, 0, 0);
-
- wchar_t *v_alignment[] = { L"top", L"vCenter", L"bottom" };
- for (auto &it : v_alignment) {
- int item = SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_ADDSTRING, 0, (LPARAM)TranslateW(it));
- SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_SETITEMDATA, item, 0);
- }
- SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_SETCURSEL, 0, 0);
-
- rowDeleteTree(rowOptTmplRoot);
- rowOptTmplRoot = nullptr;
-
- int hbuf = 0, seq = 0;
- rowParse(rowOptTmplRoot, rowOptTmplRoot, rowOptTmplStr, hbuf, seq, rowOptTA);
- seq = 0;
- memset(rowOptTA, 0, sizeof(rowOptTA));
- rowOptBuildTA(rowOptTmplRoot, (pROWCELL*)&rowOptTA, &seq);
-
- rowOptFillRowTree(htree);
- RefreshTree(hwndDlg, nullptr);
- TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_ROWTREE), TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_ROWTREE)));
- rowOptShowSettings(hwndDlg);
- }
- return TRUE;
-
- case WM_COMMAND:
- {
- HTREEITEM hti = TreeView_GetSelection(htree);
-
- TVITEM tvi = { 0 };
- tvi.hItem = hti;
- tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- TreeView_GetItem(htree, &tvi);
- pROWCELL cell = (pROWCELL)tvi.lParam;
-
- switch (LOWORD(wParam)) {
- case IDC_CONTTYPE:
- if (HIWORD(wParam) == CBN_SELENDOK) {
- int index = SendDlgItemMessage(hwndDlg, IDC_CONTTYPE, CB_GETCURSEL, 0, 0);
- cell->type = index;
- RefreshTree(hwndDlg, nullptr);
- }
-
- case IDC_VALIGN:
- if (HIWORD(wParam) == CBN_SELENDOK) {
- switch (SendDlgItemMessage(hwndDlg, IDC_VALIGN, CB_GETCURSEL, 0, 0)) {
- case 0:
- cell->valign = TC_TOP;
- break;
- case 1:
- cell->valign = TC_VCENTER;
- break;
- case 2:
- cell->valign = TC_BOTTOM;
- break;
- }
- RefreshTree(hwndDlg, nullptr);
- }
-
- case IDC_HALIGN:
- if (HIWORD(wParam) == CBN_SELENDOK) {
- switch (SendDlgItemMessage(hwndDlg, IDC_HALIGN, CB_GETCURSEL, 0, 0)) {
- case 0:
- cell->halign = TC_LEFT;
- break;
- case 1:
- cell->halign = TC_HCENTER;
- break;
- case 2:
- cell->halign = TC_RIGHT;
- break;
- }
- RefreshTree(hwndDlg, nullptr);
- }
- }
-
- if (HIWORD(wParam) == BN_CLICKED) {
- if (lParam == (LPARAM)GetDlgItem(hwndDlg, IDC_ADDCONTAINER)) // Adding new container
- rowOptAddContainer(htree, hti);
-
- else if (lParam == (LPARAM)GetDlgItem(hwndDlg, IDC_DELCONTAINER)) // Deleting container
- rowOptDelContainer(htree, hti);
-
- else if (lParam == (LPARAM)GetDlgItem(hwndDlg, IDC_CONTUP)) // Moving container to up
- RedrawWindow(htree, &da, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
-
- RefreshTree(hwndDlg, nullptr);
- RedrawWindow(GetParent(hwndDlg), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);
- }
- return TRUE;
- }
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_ROWTREE:
- if (((LPNMHDR)lParam)->code == NM_SETCURSOR)
- rowOptShowSettings(hwndDlg);
- if (((LPNMHDR)lParam)->code == NM_CLICK)
- RedrawWindow(hwndDlg, &da, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
- break;
-
- case 0: // Apply or Ok button is pressed
- return FALSE; // Temporary
- }
- return TRUE;
-
- case WM_PAINT:
- if (rowOptTmplRoot) {
- // Drawning row template at properties page
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint(hwndDlg, &ps);
-
- TVITEM curItem;
- curItem.hItem = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_ROWTREE));
- curItem.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- TreeView_GetItem(GetDlgItem(hwndDlg, IDC_ROWTREE), &curItem);
-
- int i = 0;
- while (rowOptTA[i]) {
- switch (rowOptTA[i]->type) {
- case TC_AVATAR:
- rowOptTA[i]->w = 25;
- rowOptTA[i]->h = 30;
- break;
-
- case TC_STATUS:
- case TC_EXTRA1:
- case TC_EXTRA2:
- case TC_EXTRA3:
- case TC_EXTRA4:
- case TC_EXTRA5:
- case TC_EXTRA6:
- case TC_EXTRA7:
- case TC_EXTRA8:
- case TC_EXTRA9:
- rowOptTA[i]->w = 16;
- rowOptTA[i]->h = 16;
- break;
-
- case TC_EXTRA:
- rowOptTA[i]->w = 112;
- rowOptTA[i]->h = 16;
- break;
-
- case TC_TEXT1:
- case TC_TEXT2:
- case TC_TEXT3:
- rowOptTA[i]->w = 200;
- rowOptTA[i]->h = 16;
- break;
-
- case TC_TIME:
- rowOptTA[i]->w = 30;
- rowOptTA[i]->h = 10;
- default:
- rowOptTA[i]->w = 0;
- rowOptTA[i]->h = 0;
- }
- i++;
- }
-
- rowSizeWithReposition(rowOptTmplRoot, da.right - da.left);
-
- i = -1;
- while (rowOptTA[++i]) {
-
- switch (rowOptTA[i]->type) {
- case TC_SPACE:
- case TC_FIXED:
- case 0:
- //if (rowOptTA[i] != (pROWCELL)curItem.lParam)
- continue;
- }
- Rectangle(hdc,
- rowOptTA[i]->r.left + da.left,
- rowOptTA[i]->r.top + da.top,
- rowOptTA[i]->r.right + da.left,
- rowOptTA[i]->r.bottom + da.top);
- }
-
- EndPaint(hwndDlg, &ps);
- return FALSE;
- }
-
- }
- return FALSE;
-}
diff --git a/plugins/Clist_modern/src/modern_static_clui.h b/plugins/Clist_modern/src/modern_static_clui.h
index 98bae390b4..cf0939d7eb 100644
--- a/plugins/Clist_modern/src/modern_static_clui.h
+++ b/plugins/Clist_modern/src/modern_static_clui.h
@@ -83,8 +83,6 @@ int ske_ValidateFrameImageProc(RECT *r);
HWND StatusBar_Create(HWND parent);
-void RowHeight_InitModernRow();
-
int UnhookAll();
/* Module function prototypes */