diff options
Diffstat (limited to 'plugins/TrafficCounter/src/TrafficCounter.cpp')
-rw-r--r-- | plugins/TrafficCounter/src/TrafficCounter.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index ef7c33e8ca..3c2c81fa82 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -23,15 +23,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //GLOBAL
/*-------------------------------------------------------------------------------------------------------------------*/
uTCFLAGS unOptions;
-PROTOLIST *ProtoList; // .
-PROTOLIST OverallInfo; // .
+PROTOLIST *ProtoList; // Данные обо всех аккаунтах.
+PROTOLIST OverallInfo; // Суммарные данные по видимым аккаунтам.
int NumberOfAccounts;
HWND TrafficHwnd;
HINSTANCE hInst;
CLIST_INTERFACE *pcli;
-int hLangpack = 0; // .
+int hLangpack = 0; // Поддержка плагинозависимого перевода.
BOOL bPopupExists = FALSE, bVariablesExists = FALSE, bTooltipExists = FALSE;
static wchar_t tszFormat[] =
@@ -51,7 +51,7 @@ wchar_t *TRAFFIC_COUNTER_WINDOW_CLASS = L"TrafficCounterWnd"; WORD notify_send_size = 0;
WORD notify_recv_size = 0;
//
-//
+// Цвет шрифта и фона
COLORREF Traffic_BkColor, Traffic_FontColor;
//notify
@@ -88,12 +88,12 @@ FontIDW TrafficFontID; ColourIDW TrafficBackgroundColorID;
//---------------------------------------------------------------------------------------------
-// ToolTip
+// Для ToolTip
//---------------------------------------------------------------------------------------------
BOOL TooltipShowing;
POINT TooltipPosition;
-//
+// Вспомогательные переменные чтобы заставить работать ключевой цвет
BOOL UseKeyColor;
COLORREF KeyColor;
@@ -129,7 +129,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) extern "C" int __declspec(dllexport) Load(void)
{
- // .
+ // Получаем дескриптор языкового пакета.
mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
@@ -146,13 +146,13 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
- // .
+ // Удаляем шрифт.
if (Traffic_h_font) {
DeleteObject(Traffic_h_font);
Traffic_h_font = nullptr;
}
- // .
+ // Убиваем все рабочие данные.
DestroyProtocolList();
return 0;
}
@@ -164,20 +164,20 @@ int TrafficCounterShutdown(WPARAM, LPARAM) SaveSettings(0);
- // .
+ // Удаляем пункт главного меню.
if (hTrafficMainMenuItem) {
Menu_RemoveItem(hTrafficMainMenuItem);
hTrafficMainMenuItem = nullptr;
}
- // .
+ // Удаляем контекстное меню.
if (TrafficPopupMenu) {
DestroyMenu(TrafficPopupMenu);
TrafficPopupMenu = nullptr;
}
- // .
+ // Разрегистрируем процедуру отрисовки фрейма.
CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)TrafficHwnd, (LPARAM)NULL);
- // .
+ // Удаляем фрейм.
if ((ServiceExists(MS_CLIST_FRAMES_REMOVEFRAME)) && Traffic_FrameID) {
CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)Traffic_FrameID, 0);
Traffic_FrameID = nullptr;
@@ -200,7 +200,7 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) CreateProtocolList();
ModuleLoad(0, 0);
- //
+ // Читаем флаги
unOptions.Flags = db_get_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_WHAT_DRAW, 0x0882);
Stat_SelAcc = db_get_w(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_STAT_ACC_OPT, 0x01);
@@ -214,7 +214,7 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) Traffic_PopupTimeoutDefault = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_TIMEOUT_DEFAULT, 1);
Traffic_PopupTimeoutValue = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_TIMEOUT_VALUE, 5);
- //
+ // Формат счётчика для каждого активного протокола
if (db_get_ws(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_COUNTER_FORMAT, &dbv) == 0) {
if (mir_wstrlen(dbv.ptszVal) > 0)
mir_wstrncpy(Traffic_CounterFormat, dbv.ptszVal, _countof(Traffic_CounterFormat));
@@ -226,7 +226,7 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) mir_wstrcpy(Traffic_CounterFormat, tszFormat);
}
- //
+ // Формат всплывающих подсказок
if (db_get_ws(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOOLTIP_FORMAT, &dbv) == 0) {
if (mir_wstrlen(dbv.ptszVal) > 0)
mir_wstrncpy(Traffic_TooltipFormat, dbv.ptszVal, _countof(Traffic_TooltipFormat));
@@ -240,7 +240,7 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) Traffic_AdditionSpace = db_get_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_ADDITION_SPACE, 0);
- //
+ // Счётчик времени онлайна
OverallInfo.Total.Timer = db_get_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOTAL_ONLINE_TIME, 0);
//register traffic font
@@ -258,7 +258,7 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) TrafficFontID.order = 0;
Font_RegisterW(&TrafficFontID);
- //
+ // Регистрируем цвет фона
TrafficBackgroundColorID.cbSize = sizeof(ColourIDW);
mir_wstrcpy(TrafficBackgroundColorID.group, LPGENW("Traffic counter"));
mir_wstrcpy(TrafficBackgroundColorID.name, LPGENW("Font"));
@@ -269,11 +269,11 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) HookEvent(ME_FONT_RELOAD, UpdateFonts);
- // Variables
+ // Добавляем поддержку плагина Variables
RegisterVariablesTokens();
CreateServiceFunction("TrafficCounter/ShowHide", MenuCommand_TrafficShowHide);
- // /
+ // Регистрируем горячую клавишу для показа/скрытия фрейма
{
HOTKEYDESC hkd = {};
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'T');
@@ -284,17 +284,17 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) Hotkey_Register(&hkd);
}
- // .
+ // Добавляем пункт в главное меню.
if (unOptions.ShowMainMenuItem)
Traffic_AddMainMenuItem();
- // .
+ // Создаём контекстное меню.
if (TrafficPopupMenu = CreatePopupMenu()) {
AppendMenu(TrafficPopupMenu, MF_STRING, POPUPMENU_HIDE, TranslateT("Hide traffic window"));
AppendMenu(TrafficPopupMenu, MF_STRING, POPUPMENU_CLEAR_NOW, TranslateT("Clear the current (Now:) value"));
}
- // Netlib
+ // Регистрируем обработчики событий Netlib
HookEvent(ME_NETLIB_FASTRECV, TrafficRecv);
HookEvent(ME_NETLIB_FASTSEND, TrafficSend);
@@ -308,12 +308,12 @@ void SaveSettings(BYTE OnlyCnt) {
unsigned short int i;
- //
+ // Сохраняем счётчик времени онлайна
db_set_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOTAL_ONLINE_TIME, OverallInfo.Total.Timer);
if (OnlyCnt) return;
- //
+ // Для каждого протокола сохраняем флаги
for (i = 0; i < NumberOfAccounts; i++) {
if (!ProtoList[i].name) continue;
db_set_b(NULL, ProtoList[i].name, SETTINGS_PROTO_FLAGS, ProtoList[i].Flags);
@@ -331,13 +331,13 @@ void SaveSettings(BYTE OnlyCnt) db_set_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_TIMEOUT_DEFAULT, Traffic_PopupTimeoutDefault);
db_set_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_POPUP_TIMEOUT_VALUE, Traffic_PopupTimeoutValue);
//
- //
+ // Формат счётчиков
db_set_ws(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_COUNTER_FORMAT, Traffic_CounterFormat);
db_set_ws(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOOLTIP_FORMAT, Traffic_TooltipFormat);
db_set_b(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_ADDITION_SPACE, Traffic_AdditionSpace);
- //
+ // Сохраняем флаги
db_set_dw(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_WHAT_DRAW, unOptions.Flags);
db_set_w(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_STAT_ACC_OPT, Stat_SelAcc);
}
@@ -414,7 +414,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) int height = rect.bottom - rect.top;
int width = rect.right - rect.left;
- // .
+ // Свой контекст устройства.
HDC hdc = CreateCompatibleDC(hDC);
BITMAPINFO RGB32BitsBITMAPINFO = { 0 };
@@ -453,43 +453,43 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) HFONT old_font = (HFONT)SelectObject(hdc, Traffic_h_font);
- //
+ // Ограничиваем область рисования
rect.top += 2;
rect.left += 3;
rect.bottom -= 2;
rect.right -= 3;
//-------------------
- // Variables, .
+ // Если нет плагина Variables, рисуем упрощённо.
//-------------------
if (!bVariablesExists) {
SummarySession = SummaryTotal = 0;
- //
+ // Для каждого аккаунта
for (int i = 0; i < NumberOfAccounts; i++) {
- // .
+ // Только если разрешено его отображение.
if (ProtoList[i].Visible && ProtoList[i].Enabled) {
int dx = 0;
- // .
+ // Изображаем иконку аккаунта.
if (unOptions.DrawProtoIcon) {
TC_DrawIconEx(hdc, rect.left, rect.top,
Skin_LoadProtoIcon(ProtoList[i].name, CallProtoService(ProtoList[i].name, PS_GETSTATUS, 0, 0)), b, ClistModernPresent);
dx = 19;
}
- //
+ // Изображаем имя аккаунта
if (unOptions.DrawProtoName) {
rect.left += dx;
TC_AlphaText(hdc, ProtoList[i].tszAccountName, &rect, DT_SINGLELINE | DT_LEFT | DT_TOP, ClistModernPresent);
rect.left -= dx;
}
- // .
- // .
+ // Следующие позиции строятся от правого края.
+ // Общее время.
if (unOptions.DrawTotalTimeCounter) {
wchar_t bu[32];
GetDurationFormatM(ProtoList[i].Total.Timer, L"h:mm:ss", bu, 32);
TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
}
- // .
+ // Текущее время.
if (unOptions.DrawCurrentTimeCounter) {
wchar_t bu[32];
@@ -498,7 +498,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
rect.right += 50;
}
- // .
+ // Изображаем общий трафик.
if (unOptions.DrawTotalTraffic) {
wchar_t bu[32];
@@ -510,7 +510,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) if (ProtoList[i].Visible)
SummaryTotal += ProtoList[i].TotalRecvTraffic + ProtoList[i].TotalSentTraffic;
}
- // .
+ // Изображаем текущий трафик.
if (unOptions.DrawCurrentTraffic) {
wchar_t bu[32];
@@ -526,17 +526,17 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) rect.top += Traffic_LineHeight + Traffic_AdditionSpace;
}
}
- // .
+ // Рисуем суммарный трафик выбранных аккаунтов.
if (unOptions.ShowSummary) {
- // .
+ // Изображаем иконку.
int dx = 0;
if (unOptions.DrawProtoIcon) {
TC_DrawIconEx(hdc, rect.left, rect.top,
Skin_LoadIcon(SKINICON_OTHER_MIRANDA), b, ClistModernPresent);
dx = 19;
}
- //
- //
+ // Выводим текст
+ // Изображаем имя
if (unOptions.DrawProtoName) {
wchar_t *bu = mir_a2u("Summary");
@@ -545,14 +545,14 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) rect.left -= dx;
mir_free(bu);
}
- // .
+ // Общее время.
if (unOptions.DrawTotalTimeCounter) {
wchar_t bu[32];
GetDurationFormatM(OverallInfo.Total.Timer, L"h:mm:ss", bu, 32);
TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
}
- // .
+ // Текущее время.
if (unOptions.DrawCurrentTimeCounter) {
wchar_t bu[32];
@@ -561,7 +561,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
rect.right += 50;
}
- // .
+ // Изображаем общий трафик.
if (unOptions.DrawTotalTraffic) {
wchar_t bu[32];
@@ -570,7 +570,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
rect.right += 100;
}
- // .
+ // Изображаем текущий трафик.
if (unOptions.DrawCurrentTraffic) {
wchar_t bu[32];
@@ -581,17 +581,17 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) }
}
rect.top += Traffic_LineHeight + Traffic_AdditionSpace;
- // .
+ // Рисуем всеобщий трафик.
if (unOptions.ShowOverall) {
- // .
+ // Изображаем иконку.
int dx = 0;
if (unOptions.DrawProtoIcon) {
TC_DrawIconEx(hdc, rect.left, rect.top,
Skin_LoadIcon(SKINICON_OTHER_MIRANDA), b, ClistModernPresent);
dx = 19;
}
- //
- //
+ // Выводим текст
+ // Изображаем имя
if (unOptions.DrawProtoName) {
wchar_t *bu = mir_a2u("Overall");
@@ -600,8 +600,8 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) rect.left -= dx;
mir_free(bu);
}
- // .
- // .
+ // Следующие позиции строятся от правого края.
+ // Изображаем общий трафик.
if (unOptions.DrawTotalTraffic) {
wchar_t bu[32];
@@ -610,7 +610,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) TC_AlphaText(hdc, bu, &rect, DT_SINGLELINE | DT_RIGHT | DT_TOP, ClistModernPresent);
rect.right += 100;
}
- // .
+ // Изображаем текущий трафик.
if (unOptions.DrawCurrentTraffic) {
wchar_t bu[32];
@@ -623,16 +623,16 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) }
else {
//-------------
- // Variables - -
+ // Если есть Variables - рисуем по-новому
//-------------
RowItemInfo *ItemsList;
WORD ItemsNumber, RowsNumber;
- // Variables .
+ // Готовим список строк для Variables и иконок.
wchar_t **ExtraText = (wchar_t**)mir_alloc(sizeof(wchar_t*));
HICON *ahIcon = (HICON*)mir_alloc(sizeof(HICON));
RowsNumber = 0;
- // .
+ // Цикл по аккаунтам.
for (int i = 0; i < NumberOfAccounts; i++) {
if (ProtoList[i].Visible && ProtoList[i].Enabled) {
ExtraText = (wchar_t**)mir_realloc(ExtraText, sizeof(wchar_t*) * (RowsNumber + 1));
@@ -642,7 +642,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) ahIcon[RowsNumber++] = Skin_LoadProtoIcon(ProtoList[i].name, CallProtoService(ProtoList[i].name, PS_GETSTATUS, 0, 0));
}
}
- // 2 .
+ // Ещё 2 особых элемента.
if (unOptions.ShowSummary) {
ExtraText = (wchar_t**)mir_realloc(ExtraText, sizeof(wchar_t*) * (RowsNumber + 1));
ahIcon = (HICON*)mir_realloc(ahIcon, sizeof(HICON) * (RowsNumber + 1));
@@ -658,16 +658,16 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) ahIcon[RowsNumber++] = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
}
- //
+ // Рисуем свой счётчик для каждого из выбранных протоколов
for (int i = 0; i < RowsNumber; i++) {
wchar_t *buf = variables_parse(Traffic_CounterFormat, ExtraText[i], NULL);
if (ItemsNumber = GetRowItems(buf, &ItemsList)) {
- // .
+ // Рисуем текст.
for (int dx = 0; dx < ItemsNumber; dx++) {
- // .
+ // Делаем копию прямоугольника для рисования.
memcpy(&rect2, &rect, sizeof(RECT));
rect2.bottom = rect2.top + Traffic_LineHeight;
- // ?
+ // Что за тег?
switch (ItemsList[dx].Alignment) {
case 'I':
TC_DrawIconEx(hdc, ItemsList[dx].Interval, rect2.top, ahIcon[i], b, ClistModernPresent);
@@ -688,7 +688,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) }
}
- // .
+ // Нужно освободить память.
for (; ItemsNumber--;)
mir_free(ItemsList[ItemsNumber].String);
@@ -698,7 +698,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) rect.top += Traffic_LineHeight + Traffic_AdditionSpace;
}
- // .
+ // Удаляем список строк.
for (; RowsNumber--;)
mir_free(ExtraText[RowsNumber]);
mir_free(ExtraText);
@@ -735,7 +735,7 @@ void ProtocolIsOnLine(int num) - 1000 * ProtoList[num].AllStatistics[ProtoList[num].NumberOfRecords - 1].Time;
ProtoList[num].Session.Timer = 0;
- if (online_count == 1) // - .
+ if (online_count == 1) // Хотя бы один аккаунт перешёл в онлайн - готовимся считать суммарное время.
{
OverallInfo.Session.TimeAtStart = CurrentTimeMs - 1000 * OverallInfo.Session.Timer;
OverallInfo.Total.TimeAtStart = CurrentTimeMs - 1000 * OverallInfo.Total.Timer;
@@ -838,13 +838,13 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP NotifyOnSend();
break;
- case TIMER_REDRAW: // .
+ case TIMER_REDRAW: // Перерисовка раз в полсекунды.
{
DWORD CurrentTimeMs;
SYSTEMTIME stNow;
SaveSettings(1);
- // .
+ // Перед подсчётом суммарного трафика обнуляем счётчики.
OverallInfo.CurrentRecvTraffic =
OverallInfo.CurrentSentTraffic =
OverallInfo.TotalRecvTraffic =
@@ -862,11 +862,11 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP Stat_CheckStatistics(i);
- { // .
+ { // Здесь на основании статистики вычисляются значения всех трафиков и времени.
DWORD Sum1, Sum2;
unsigned long int j;
- // .
+ // Значения для текущей сессии.
for (Sum1 = Sum2 = 0, j = ProtoList[i].StartIndex; j < ProtoList[i].NumberOfRecords; j++) {
Sum1 += ProtoList[i].AllStatistics[j].Incoming;
Sum2 += ProtoList[i].AllStatistics[j].Outgoing;
@@ -875,7 +875,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP ProtoList[i].CurrentSentTraffic = Sum2 - ProtoList[i].StartOutgoing;
OverallInfo.CurrentRecvTraffic += ProtoList[i].CurrentRecvTraffic;
OverallInfo.CurrentSentTraffic += ProtoList[i].CurrentSentTraffic;
- // .
+ // Значения для выбранного периода.
ProtoList[i].TotalRecvTraffic =
Stat_GetItemValue(1 << i,
unOptions.PeriodForShow + 1,
@@ -892,7 +892,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP OverallInfo.TotalSentTraffic += ProtoList[i].TotalSentTraffic;
}
}
- // ?
+ // Не пора ли уведомить?
if (unOptions.NotifyBySize && Traffic_Notify_size_value) {
if (!((OverallInfo.CurrentRecvTraffic >> 10) % Traffic_Notify_size_value)
&& notify_recv_size != OverallInfo.CurrentRecvTraffic >> 10)
@@ -903,10 +903,10 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP NotifyOnSend();
}
- // .
+ // Счётчики суммарного времени.
GetLocalTime(&stNow);
- // ?
+ // Не пора ли сбросить общий счётчик?
if ((unOptions.PeriodForShow == 0
&& stNow.wHour == 0
&& stNow.wMinute == 0
@@ -1002,7 +1002,7 @@ void CreateTrafficWindow(HWND hCluiWnd) 0, 0, 0, 0, hCluiWnd, nullptr, hInst, nullptr);
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- //
+ // Готовимся создавать фрейм
memset(&f, 0, sizeof(CLISTFrame));
f.align = alBottom;
f.cbSize = sizeof(CLISTFrame);
@@ -1011,12 +1011,12 @@ void CreateTrafficWindow(HWND hCluiWnd) f.hWnd = TrafficHwnd;
f.TBname = ("Traffic counter");
f.name = ("Traffic counter");
- //
+ // Создаём фрейм
Traffic_FrameID = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&f, 0);
CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)f.hWnd, (LPARAM)TrafficCounter_PaintCallbackProc);
}
- // .
+ // Создаём таймеры.
SetTimer(TrafficHwnd, TIMER_REDRAW, 500, nullptr);
UpdateNotifyTimer();
}
@@ -1113,8 +1113,8 @@ void CreateProtocolList(void) ProtoList[i].StartIndex = ProtoList[i].NumberOfRecords - 1;
ProtoList[i].StartIncoming = ProtoList[i].AllStatistics[ProtoList[i].StartIndex].Incoming;
ProtoList[i].StartOutgoing = ProtoList[i].AllStatistics[ProtoList[i].StartIndex].Outgoing;
- } //
- // .
+ } // цикл по аккаунтам
+ // Начальные значения для суммарной информации.
OverallInfo.Session.Timer = OverallInfo.Total.Timer = 0;
}
@@ -1169,7 +1169,7 @@ int UpdateFonts(WPARAM, LPARAM) TrafficFontHeight = abs(logfont.lfHeight) + 1;
Traffic_BkColor = Colour_GetW(TrafficBackgroundColorID);
- //
+ // Ключевой цвет
UseKeyColor = db_get_b(NULL, "ModernSettings", "UseKeyColor", 1);
KeyColor = db_get_dw(NULL, "ModernSettings", "KeyColor", 0);
@@ -1190,15 +1190,15 @@ unsigned short int TrafficWindowHeight(void) for (int i = 0; i < NumberOfAccounts; i++)
ActProto += ProtoList[i].Visible && ProtoList[i].Enabled;
- // 16 ( ).
+ // Высота строки минимум 16 пикселей (для иконки).
Traffic_LineHeight = TrafficFontHeight > 16 ? TrafficFontHeight : 16;
- // .
+ // Высота фрейма равна количеству строк.
int MaxWndHeight = ActProto * Traffic_LineHeight + Traffic_AdditionSpace * (ActProto - 1) + 4;
return (MaxWndHeight < TrafficFontHeight) ? 0 : MaxWndHeight;
}
-// ProtoList
+// Функция вносит изменения в ProtoList при коммутации аккаунтов
int OnAccountsListChange(WPARAM wParam, LPARAM lParam)
{
PROTOACCOUNT *acc = (PROTOACCOUNT*)lParam;
|