Пример #1
0
void TooltipReadData(void)
{
	char fontname[80];
	int fontsize;
	LONG weight, italic;

	GetMyRegStrEx(NULL, "TipFont", fontname, 80, "", gConfigNo);
	if (fontname[0] == 0) 
	{
		HFONT hfont;
		hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
		if(hfont)
		{
			LOGFONT lf;
			GetObject(hfont, sizeof(lf),(LPVOID)&lf);
			strcpy(fontname, lf.lfFaceName);
		}
	}

	fontsize = GetMyRegLongEx(NULL, "TipFontSize", 9, gConfigNo);
	weight = GetMyRegLongEx(NULL, "TipBold", 0, gConfigNo);
	if(weight) weight = FW_BOLD;
	else weight = 0;
	italic = GetMyRegLongEx(NULL, "TipItalic", 0, gConfigNo);

	if(hFonTooltip) DeleteObject(hFonTooltip);
	hFonTooltip = CreateMyFont(fontname, fontsize, weight, italic);
	dwTooltipType = GetMyRegLong(NULL, "BalloonFlg", 0);
	alphaTooltip = (int)(short)GetMyRegLongEx(NULL, "AlphaTip", 0, gConfigNo);
	iTooltipDispTime = (int)(short)GetMyRegLong(NULL, "TipDispTime", 5);
	bTooltipCustomDrawDisable = GetMyRegLong("Tooltip", "TipDisableCustomDraw", TRUE);
	bTooltipUpdateEnable[0] = GetMyRegLong("Tooltip", "Tip1Update", 0);
	bTooltipUpdateEnable[1] = GetMyRegLong("Tooltip", "Tip2Update", 0);
	bTooltipUpdateEnable[2] = GetMyRegLong("Tooltip", "Tip3Update", 0);

	dwTooltipFonCol = GetMyRegLongEx(NULL, "TipFonColor",
		0x80000000 | COLOR_INFOTEXT, gConfigNo);
	dwTooltipBakCol = GetMyRegLongEx(NULL, "TipBakColor",
		0x80000000 | COLOR_INFOBK, gConfigNo);

	bTooltipEnableDoubleBuffering = GetMyRegLong("Tooltip", "TipEnableDoubleBuffering", FALSE);

	nTooltipIcon = GetMyRegLongEx("", "TipIcon", 0, gConfigNo);

	iTooltipDispInterval = (int)(short)GetMyRegLong("Tooltip", "TipDispInterval", 1);
	if (iTooltipDispInterval > 30) iTooltipDispInterval = 30;
	if (iTooltipDispInterval < 1) iTooltipDispInterval = 1;

	iTooltipSizeX = GetMyRegLong("Tooltip", "HTMLTipDispSizeX", 200);
	iTooltipSizeY = GetMyRegLong("Tooltip", "HTMLTipDispSizeY", 200);
}
void CWeekTimePicker::PaintDC(HDC hdc)
{
	if (NULL == m_hFont)
	{
		m_hFont = CreateMyFont(hdc);
	}
	HFONT hOldFont = (HFONT)::SelectObject(hdc, m_hFont);

	CRect rcBar;
	for (int i=0; i<WEEK_LEN; ++i)
	{
		::DrawText(hdc, m_vecWeekDayName[i].GetBuffer(), m_vecWeekDayName[i].GetLength(), &m_vecWeekDayNameRect[i], DT_CENTER|DT_VCENTER|DT_SINGLELINE);
		rcBar = m_vecWeekDayBarRect[i];
		rcBar.InflateRect(1, 1);

		int x = 0;
		int y = 0;
		CRect rcHour;
		TCHAR szHour[4] = {0};
		for (int j=0; j <= 24; ++j)
		{
			x = rcBar.left + j*HOUR_WIDTH;
			y = rcBar.top;
			MoveToEx(hdc, x, y, NULL);
			LineTo(hdc, x, y-5);
			if (j % 2 == 0)
			{
				rcHour.left = x - 8;
				rcHour.right = x + 8;
				rcHour.top = y - 15;
				rcHour.bottom = y - 5;
				_sntprintf_s(szHour, 3, _T("%d"), j);
				::DrawText(hdc, szHour, _tcslen(szHour), &rcHour, DT_CENTER|DT_BOTTOM|DT_SINGLELINE);
			}
		}

		HBRUSH hOldBrush = (HBRUSH)::SelectObject(hdc, (HBRUSH)::GetStockObject(NULL_BRUSH));
		::Rectangle(hdc, rcBar.left, rcBar.top, rcBar.right, rcBar.bottom);
		::SelectObject(hdc, hOldBrush);
		COLORREF oldColor = ::SetTextColor(hdc, RGB(255,255,255));
		UpdateRectArea(hdc, i);
		SetTextColor(hdc, oldColor);
	}

	::SelectObject(hdc, hOldFont);
}
static BOOL M_Win_OnCreate(HWND hwnd, CREATESTRUCT FAR *lpCreateStruct)
{
   RECT WRect;                                               //Размеры рабочей области окна
   GetClientRect(hwnd, &WRect);                              //Получили размеры рабочей области окна
   if(CreateMyFont() < 0) return FALSE;                      //Создание логического фонта
   int sw_x1 = WRect.right / 2 - sw_lx / 2 - 2*sw_lx - 2*sw_dx;
   int sw_x2 = WRect.right / 2 - sw_lx / 2 - sw_lx - sw_dx;
   int sw_x3 = WRect.right / 2 - sw_lx / 2;
   int sw_x4 = WRect.right / 2 + sw_lx / 2 + sw_dx;
   int sw_x5 = WRect.right / 2 + sw_lx / 2 + sw_lx + 2*sw_dx;
#if defined WRITE_YES                                        //Режим записи разрешен
   int ddh2 = (Conf.WriteYes != 1) ? 0 : sw_hb;
   int sw_xx1 = WRect.right / 2 - sw_lx2 / 2 - 2*sw_lx2 - 2*sw_dx;
   int sw_xx2 = WRect.right / 2 - sw_lx2 / 2 - sw_lx2 - sw_dx;
   int sw_xx3 = WRect.right / 2 - sw_lx2 / 2;
   int sw_xx4 = WRect.right / 2 + sw_lx2 / 2 + sw_dx;
   int sw_xx5 = WRect.right / 2 + sw_lx2 / 2 + sw_lx2 + 2*sw_dx;
#else
   #define ddh2 0
#endif
   int sw_y1 = WRect.bottom - sw_hb - sw_d;
   int sw_ls = WRect.right - 2 * sw_xs;                      //Ширина окна дерева
   int sw_hs = WRect.bottom - sw_ys - sw_hb - 3 * sw_d - ddh2;//Высота окна дерева

#if defined WRITE_YES                                        //Режим записи разрешен
   int sw_y2 = WRect.bottom - sw_hb - 2*sw_d - ddh2;
#endif
   hSizeHDD = CreateWindowEx(WS_EX_STATICEDGE, "button", "", //Кнопка размеров диска
                    WS_CHILD | WS_VISIBLE,
                    sw_xs, sw_ys-22, 560, 22, hwnd, HMENU(IDC_SIZE_HDD),
                    MainInst, NULL);
   SendMessage(hSizeHDD, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

   hPrShift = CreateWindow("static", "",                     //Признак выбранной границы
//                    WS_BORDER |                              //Черная рамка толщиной в пиксель
                    SS_RIGHT | WS_CHILD | WS_VISIBLE,
                    sw_xs+sw_ls-200, sw_ys-18, 200, 18, hwnd, HMENU(IDC_PR_SHIFT),
                    MainInst, NULL);
   SendMessage(hPrShift, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

   hwndTree = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, "Tree View", //Окно дерева
                    TVS_HASBUTTONS |
                    TVS_HASLINES |
                    TVS_DISABLEDRAGDROP |
               //   TVS_FULLROWSELECT |
               //   TVS_SINGLEEXPAND |                       //При нажатии CTRL стрелки сдвигают список
               //   TVS_TRACKSELECT |                        //При движении мыши выводит горизонтальную подчеркивающую линию
                    TVS_LINESATROOT |
               //   TVS_CHECKBOXES |                         //Между иконкой и именем появляется ChekBox в котором можно ставить и убирать галочки
                    TVS_SHOWSELALWAYS | WS_VISIBLE | WS_CHILD | WS_BORDER,
                    sw_xs, sw_ys, sw_ls, sw_hs, hwnd, HMENU(IDC_TREEBOX),
                    MainInst, NULL);
   SendMessage(hwndTree, WM_SETFONT, (WPARAM)MyFont_Cur, LPARAM(TRUE));
// TV_SORTCB psort;
// psort.hParent = psort.lpfnCompare = CompareFunc;
// TreeView_SortChildrenCB(hwndTree, &psort, 0);

   hNumSel = CreateWindow("static", "",                      //Число выбранных файлов
//                    WS_BORDER |                              //Черная рамка толщиной в пиксель
                    WS_CHILD | WS_VISIBLE,
                    sw_xs, sw_y1-4, 160, 18, hwnd, HMENU(IDC_NUM_SEL),
                    MainInst, NULL);
   SendMessage(hNumSel, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));
   hSizeSel = CreateWindow("static", "",                     //Суммарный размер выбранных файлов
//                    WS_BORDER |                              //Черная рамка толщиной в пиксель
               //   WS_BORDER | SS_CENTER |                  //Черная рамка толщиной в пиксель
                    WS_CHILD | WS_VISIBLE,
                    sw_xs, sw_y1+12, 160, 18, hwnd, HMENU(IDC_SIZE_SEL),
                    MainInst, NULL);
   SendMessage(hSizeSel, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

   hCopy = CreateWindow("button", (Lan+4)->msg,              //"Копировать файл",
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
                     sw_x1, sw_y1, sw_lx, sw_hb, hwnd, HMENU(IDC_COPY),
                     MainInst, NULL);
   SendMessage(hCopy, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

   hClear = CreateWindow("button", (Lan+123)->msg,           //"Очистить",
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
                     sw_x2, sw_y1, sw_lx, sw_hb, hwnd, HMENU(IDC_CLEAR),
                     MainInst, NULL);
   SendMessage(hClear, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

   hToTxt = CreateWindow("button", (Lan+146)->msg,           //Запись txt
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                     sw_x3, sw_y1, sw_lx, sw_hb, hwnd, HMENU(IDC_TO_TXT),
                     MainInst, NULL);
   SendMessage(hToTxt, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

   hConf = CreateWindow("button", (Lan+5)->msg,              //"Настройка",
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
                     sw_x4, sw_y1, sw_lx, sw_hb, hwnd, HMENU(IDC_CONFIG),
                     MainInst, NULL);
   SendMessage(hConf, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

   hClose = CreateWindow("button", (Lan+6)->msg,             //"Выход"
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
                     sw_x5, sw_y1, sw_lx, sw_hb, hwnd, HMENU(IDCANCEL),
                     MainInst, NULL);
   SendMessage(hClose, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

#if defined WRITE_YES                                        //Режим записи разрешен
   if(Conf.WriteYes == 1)
   {
      hWriteFi = CreateWindow("button", (Lan+177)->msg,      //"Копирование файла на HDD LG"
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
                     sw_xx1, sw_y2, sw_lx2, sw_hb, hwnd, HMENU(IDC_WRITE_FI),
                     MainInst, NULL);
      SendMessage(hWriteFi, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

      hWriteFo = CreateWindow("button", (Lan+178)->msg,      //"Копирование папки на HDD LG"
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
                     sw_xx2, sw_y2, sw_lx2, sw_hb, hwnd, HMENU(IDC_WRITE_FO),
                     MainInst, NULL);
      SendMessage(hWriteFo, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

      hNew_Fo = CreateWindow("button", (Lan+179)->msg,       //"Создание папки на HDD LG"
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
                     sw_xx3, sw_y2, sw_lx2, sw_hb, hwnd, HMENU(IDC_NEW_FO),
                     MainInst, NULL);
      SendMessage(hNew_Fo, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

      hRenFi = CreateWindow("button", (Lan+163)->msg,       //"Переименовать"
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
                     sw_xx4, sw_y2, sw_lx2, sw_hb, hwnd, HMENU(IDC_REN_FI),
                     MainInst, NULL);
      SendMessage(hRenFi, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

      hDelFi = CreateWindow("button", (Lan+187)->msg,       //"Удалить"
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,
                     sw_xx5, sw_y2, sw_lx2, sw_hb, hwnd, HMENU(IDC_DEL_FI),
                     MainInst, NULL);
      SendMessage(hDelFi, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));
      hCorr67 = CreateWindow("button", (Lan+193)->msg,       //"Correction",
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_MULTILINE,
                     WRect.right-64, sw_y2+4, 64, 16, hwnd, HMENU(IDC_CORR67),
                     MainInst, NULL);
      SendMessage(hCorr67, WM_SETFONT, (WPARAM)MyFontSm/*MyFont*/, LPARAM(TRUE));
   }
#endif

   char myName[7];
   for(int i=0; i<6; i++) *(myName + i) = char(*(MyName + i) + KK);
   *(myName + 6) = 0;
   hAbout = CreateWindowEx(WS_EX_STATICEDGE, "button", myName,//Val238
                     WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                     WRect.right-50, WRect.bottom-22, 50, 22, hwnd, HMENU(IDC_ABOUT),
                     MainInst, NULL);
   SendMessage(hAbout, WM_SETFONT, (WPARAM)MyFont, LPARAM(TRUE));

   HBITMAP hBitMap;
   HIMAGELIST hImageList;                                    //Иконки для дерева файлов
   hImageList = ImageList_Create(16, 16, ILC_COLOR16, 15, 15);
   hBitMap = LoadBitmap(MainInst, MAKEINTRESOURCE(IDB_ICON));
   ImageList_Add(hImageList, hBitMap, NULL);                                                                                      // Macro: Attach the image, to the image list
   SendMessage(hwndTree, TVM_SETIMAGELIST, 0, (LPARAM)hImageList);
   return TRUE;
}