Ejemplo n.º 1
0
BOOL AboutDialog::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  switch (uMsg) {
    case WM_COMMAND: {
      // Icon click
      if (HIWORD(wParam) == STN_DBLCLK) {
        SetText(L"Orange");
        Stats.tigers_harmed++;
        taiga::orange.Start();
        return TRUE;
      }
      break;
    }

    case WM_NOTIFY: {
      switch (reinterpret_cast<LPNMHDR>(lParam)->code) {
        // Execute link
        case EN_LINK: {
          auto en_link = reinterpret_cast<ENLINK*>(lParam);
          if (en_link->msg == WM_LBUTTONUP) {
            ExecuteLink(rich_edit_.GetTextRange(&en_link->chrg));
            return TRUE;
          }
          break;
        }
      }
      break;
    }
  }

  return DialogProcDefault(hwnd, uMsg, wParam, lParam);
}
Ejemplo n.º 2
0
INT_PTR StatsDialog::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  ResizeProc(hwnd, uMsg, wParam, lParam);

  switch (uMsg) {
    case WM_CTLCOLORSTATIC: {
      win::Dc dc = reinterpret_cast<HDC>(wParam);
      dc.SetBkMode(TRANSPARENT);
      dc.DetachDc();
      return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
    }

    case WM_DRAWITEM: {
      // Draw score bars
      if (wParam == IDC_STATIC_ANIME_STAT2) {
        LPDRAWITEMSTRUCT dis = reinterpret_cast<LPDRAWITEMSTRUCT>(lParam);
        win::Rect rect = dis->rcItem;
        win::Dc dc = dis->hDC;

        dc.FillRect(dis->rcItem, ::GetSysColor(COLOR_WINDOW));

        int bar_height = GetTextHeight(dc.Get());
        int bar_max = rect.Width() * 3 / 4;

        for (int i = 10; i > 0; i--) {
          if (i < 10)
            rect.top += bar_height;

          if (Stats.score_distribution[i] > 0.0f) {
            int bar_width = static_cast<int>(bar_max * Stats.score_distribution[i]);
            rect.bottom = rect.top + bar_height - 2;
            rect.right = rect.left + bar_width;
            dc.FillRect(rect, ui::kColorDarkBlue);
          }

          if (Stats.score_count[i] > 0.0f) {
            std::wstring text = ToWstr(Stats.score_count[i]);
            win::Rect rect_text = rect;
            rect_text.left = rect_text.right += 8;
            rect_text.right = dis->rcItem.right;
            dc.EditFont(nullptr, 7);
            dc.SetBkMode(TRANSPARENT);
            dc.SetTextColor(::GetSysColor(COLOR_GRAYTEXT));
            dc.DrawText(text.c_str(), text.length(), rect_text,
                        DT_SINGLELINE | DT_VCENTER);
          }
        }

        dc.DetachDc();
        return TRUE;
      }
      break;
    }

    case WM_ERASEBKGND:
      return TRUE;
  }

  return DialogProcDefault(hwnd, uMsg, wParam, lParam);
}
Ejemplo n.º 3
0
INT_PTR CMyDialog::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
//	switch (uMsg)
//	{
    //Additional messages to be handled go here
//	}

    return DialogProcDefault(uMsg, wParam, lParam);
}
Ejemplo n.º 4
0
INT_PTR CMyDialog::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
//	switch (uMsg)
//	{

//	}

	// Pass unhandled messages on to parent DialogProc
	return DialogProcDefault(uMsg, wParam, lParam);
}
Ejemplo n.º 5
0
INT_PTR TorrentDialog::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  switch (uMsg) {
    // Forward mouse wheel messages to the list
    case WM_MOUSEWHEEL: {
      return list_.SendMessage(uMsg, wParam, lParam);
    }
  }

  return DialogProcDefault(hwnd, uMsg, wParam, lParam);
}
Ejemplo n.º 6
0
INT_PTR CMyDialog::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
//	switch (uMsg)
//	{
		//Additional messages to be handled go here
//	}


	//Use the dialogframe default message handling for remaining messages
	return DialogProcDefault(uMsg, wParam, lParam);
}
Ejemplo n.º 7
0
INT_PTR CMyDialog::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    // Pass resizing messages on to the resizer
    m_Resizer.HandleMessage(uMsg, wParam, lParam);
//  switch (uMsg)
//  {
//      //Additional messages to be handled go here
//  }
    // Pass unhandled messages on to parent DialogProc
    return DialogProcDefault(uMsg, wParam, lParam);
}
Ejemplo n.º 8
0
INT_PTR FeedConditionDialog::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  switch (uMsg) {
    case WM_CTLCOLORSTATIC: {
      win32::Dc dc = reinterpret_cast<HDC>(wParam);
      dc.SetBkMode(TRANSPARENT);
      dc.DetachDC();
      return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
    }
  }

  return DialogProcDefault(hwnd, uMsg, wParam, lParam);
}
Ejemplo n.º 9
0
BOOL AnimeDialog::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  switch (uMsg) {
    case WM_CTLCOLORSTATIC: {
      win32::Dc dc = reinterpret_cast<HDC>(wParam);
      HWND hwnd_control = reinterpret_cast<HWND>(lParam);
      dc.SetBkMode(TRANSPARENT);
      if (hwnd_control == GetDlgItem(IDC_EDIT_ANIME_TITLE))
        dc.SetTextColor(theme::COLOR_MAININSTRUCTION);
      dc.DetachDC();
      if (hwnd_control == GetDlgItem(IDC_EDIT_ANIME_TITLE))
        return reinterpret_cast<INT_PTR>(UI.brush_background.Get());
      return reinterpret_cast<INT_PTR>(::GetSysColorBrush(COLOR_WINDOW));
    }

    case WM_DRAWITEM: {
      // Draw anime image
      if (wParam == IDC_STATIC_ANIME_IMG) {
        LPDRAWITEMSTRUCT dis = reinterpret_cast<LPDRAWITEMSTRUCT>(lParam);
        win32::Rect rect = dis->rcItem;
        win32::Dc dc = dis->hDC;
        // Paint border
        dc.FillRect(rect, ::GetSysColor(COLOR_ACTIVEBORDER));
        rect.Inflate(-1, -1);
        dc.FillRect(rect, ::GetSysColor(COLOR_WINDOW));
        rect.Inflate(-1, -1);
        // Paint image
        auto image = ImageDatabase.GetImage(anime_id_);
        if (anime_id_ > anime::ID_UNKNOWN && image) {
          dc.SetStretchBltMode(HALFTONE);
          dc.StretchBlt(rect.left, rect.top, rect.Width(), rect.Height(), 
                        image->dc.Get(), 
                        0, 0, image->rect.Width(), image->rect.Height(), 
                        SRCCOPY);
        } else {
          dc.EditFont(nullptr, 64, TRUE);
          dc.SetBkMode(TRANSPARENT);
          dc.SetTextColor(::GetSysColor(COLOR_ACTIVEBORDER));
          dc.DrawText(L"?", 1, rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER);
          DeleteObject(dc.DetachFont());
        }
        dc.DetachDC();
        return TRUE;
      }
      break;
    }
  }
  
  return DialogProcDefault(hwnd, uMsg, wParam, lParam);
}
Ejemplo n.º 10
0
INT_PTR DimensionDialog::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
   switch (uMsg)
   {
   case WM_NOTIFY:
   {
      LPNMHDR pnmhdr = (LPNMHDR)lParam;
      switch (pnmhdr->code)
      {
      case LVN_ITEMCHANGED:
      {
         NMLISTVIEW * const plistview = (LPNMLISTVIEW)lParam;
         int idx = plistview->iItem;
         if (idx >= DIM_TABLE_SIZE || idx < 0)
            break;

         int width = (int)floorf(dimTable[idx].width*47.0f + 0.5f);
         int height = (int)floorf(dimTable[idx].height*47.0f + 0.5f);
         char textBuf[32];
         sprintf_s(textBuf, "%i", width);
         CString textStr(textBuf);
         SetDlgItemText(IDC_VP_WIDTH, textStr);
         sprintf_s(textBuf, "%i", height);
         textStr = CString(textBuf);
         SetDlgItemText(IDC_VP_HEIGHT, textStr);
         sprintf_s(textBuf, "%.03f", dimTable[idx].width);
         textStr = CString(textBuf);
         SetDlgItemText(IDC_SIZE_WIDTH, textStr);
         sprintf_s(textBuf, "%.03f", dimTable[idx].height);
         textStr = CString(textBuf);
         SetDlgItemText(IDC_SIZE_HEIGHT, textStr);
         float ratio = (float)height / width;
         sprintf_s(textBuf, "%.04f", ratio);
         textStr = CString(textBuf);
         SetDlgItemText(IDC_ASPECT_RATIO_EDIT, textStr);
         break;
      }
      }
      break;
   }
   case WM_COMMAND:
   {
      switch (HIWORD(wParam))
      {
      case EN_KILLFOCUS:
      {
         float sizeWidth, sizeHeight;
         int vpWidth, vpHeight;
         int ret = 0;
         if (LOWORD(wParam) == IDC_SIZE_WIDTH)
         {
            char textBuf[32];
            CString textStr;
            textStr = GetDlgItemText(IDC_SIZE_WIDTH);
            ret = sscanf_s(textStr.c_str(), "%f", &sizeWidth);
            if (ret != 1 || sizeWidth < 0.0f)
               sizeWidth = 0;
            int width = (int)floorf(sizeWidth*47.0f + 0.5f);
            sprintf_s(textBuf, "%i", width);
            CString textStr2(textBuf);
            SetDlgItemText(IDC_VP_WIDTH, textStr2);
         }
         if (LOWORD(wParam) == IDC_SIZE_HEIGHT)
         {
            char textBuf[32];
            CString textStr;
            textStr = GetDlgItemText(IDC_SIZE_HEIGHT);
            ret = sscanf_s(textStr.c_str(), "%f", &sizeHeight);
            if (ret != 1 || sizeHeight < 0.0f)
               sizeHeight = 0;
            int height = (int)floorf(sizeHeight*47.0f + 0.5f);
            sprintf_s(textBuf, "%i", height);
            CString textStr2(textBuf);
            SetDlgItemText(IDC_VP_HEIGHT, textStr2);
         }
         if (LOWORD(wParam) == IDC_VP_WIDTH)
         {
            char textBuf[32];
            CString textStr;
            textStr = GetDlgItemText(IDC_VP_WIDTH);
            ret = sscanf_s(textStr.c_str(), "%i", &vpWidth);
            if (ret != 1 || vpWidth < 0)
               vpWidth = 0;
            float width = (float)vpWidth / 47.0f;
            sprintf_s(textBuf, "%.3f", width);
            CString textStr2(textBuf);
            SetDlgItemText(IDC_SIZE_WIDTH, textStr2);
         }
         if (LOWORD(wParam) == IDC_VP_HEIGHT)
         {
            char textBuf[32];
            CString textStr;
            textStr = GetDlgItemText(IDC_VP_HEIGHT);
            ret = sscanf_s(textStr.c_str(), "%i", &vpHeight);
            if (ret != 1 || vpHeight < 0)
               vpHeight = 0;
            float height = (float)vpHeight / 47.0f;
            sprintf_s(textBuf, "%.03f", height);
            CString textStr2(textBuf);
            SetDlgItemText(IDC_SIZE_HEIGHT, textStr2);
         }
         break;
      }
      }
   }
   }
   return DialogProcDefault(uMsg, wParam, lParam);

}
Ejemplo n.º 11
0
INT_PTR Dialog::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  return DialogProcDefault(hwnd, uMsg, wParam, lParam);
}