void MenuItem::Measure(HDC hDC, SIZE *size) { const char *title = GetDisplayString(); int is = m_pMenu->m_iconSize; if (-2 == is) is = MenuInfo.nIconSize; if (m_isNOP && m_ItemID == MENUITEM_ID_NORMAL && 0 == title[0]) { // empty [nop]: height = 66% size->cx = 0; if (Settings_compactSeparators == true) { size->cy = 5; } else { size->cy = MenuInfo.nItemHeight[is] * 5 / 8; } return; } RECT r = { 0, 0, 0, 0 }; DrawText(hDC, title, -1, &r, DT_MENU_MEASURE_STANDARD); size->cx = r.right; size->cy = MenuInfo.nItemHeight[is]; }
void TitleItem::Paint(HDC hDC) { StyleItem *pSI = &mStyle.MenuTitle; RECT rect; GetItemRect(&rect); int spacing = MenuInfo.nTitleIndent; int just = pSI->Justify | DT_MENU_STANDARD; int bw = pSI->borderWidth; COLORREF bc = pSI->borderColor; rect.bottom -= bw; if (false == pSI->parentRelative) { MakeStyleGradient(hDC, &rect, pSI, false); if (bw) draw_line_h(hDC, rect.left, rect.right, rect.bottom, bw, bc); } _InflateRect(&rect, -spacing, 0); if (pSI->parentRelative) { if (bw) draw_line_h(hDC, rect.left, rect.right, rect.bottom, bw, bc); rect.bottom -= MenuInfo.nTitlePrAdjust; just = just & ~DT_VCENTER | DT_BOTTOM; } if (pSI->FontHeight) BBDrawText(hDC, GetDisplayString(), -1, &rect, just, pSI); }
static void SetTriggerText(UInt16 selected) { FormPtr frmP = FrmGetActiveForm(); if (FormIsNot(frmP, FormReply)) return; char* str = (char *)CtlGetLabel ((ControlPtr) GetObjectPtr (frmP, TriggerGroup)); StrNCopy(str, GetDisplayString(selected), 19); CtlDrawControl((ControlPtr) GetObjectPtr (frmP, TriggerGroup)); }
std::string Board::GetDisplayString(int index) { for (std::set<Plane *>::iterator it = planesIn.begin(); it != planesIn.end(); ++it) { Plane *plane = *it; if (index == plane->GetName() - 'A') return GetDisplayString(plane); } return ""; }
ComboList * DataFieldEnum::CreateComboList() const { ComboList *combo_list = new ComboList(); for (auto it = entries.begin(), end = entries.end(); it != end; ++it) combo_list->Append(it->GetId(), it->GetString(), it->GetDisplayString(), it->GetHelp()); combo_list->ComboPopupItemSavedIndex = value; return combo_list; }
void MenuItem::Measure(HDC hDC, SIZE *size) { const char *title = GetDisplayString(); RECT r = { 0, 0, 0, 0 }; bbDrawText(hDC, title, &r, DT_MENU_MEASURE_STANDARD, 0); size->cx = r.right; size->cy = MenuInfo.nItemHeight; //#ifdef BBOPT_MENUICONS if (m_hIcon && Settings_menu.iconSize)/* BlackboxZero 1.3.2012 */ size->cy = imax(MenuInfo.nIconSize+2, size->cy); //#endif }
void xorg::testing::XServer::TestStartup(void) { Display* test_display = XOpenDisplay(GetDisplayString().c_str()); if (test_display) { XCloseDisplay(test_display); std::string message; message += "A server is already running on "; message += GetDisplayString(); message += "."; throw std::runtime_error(message); } std::string log = d_->options["-logfile"]; /* The Xorg server won't start unless the log file and the old log file are * writable. */ bool logfile_was_present; std::ifstream file_test; file_test.open(log.c_str()); logfile_was_present = file_test.good(); std::ofstream log_test; log_test.open(log.c_str(), std::ofstream::out); log_test.close(); if (log_test.fail()) { throw std::runtime_error("X.org server log file " + log + " is not writable."); } else if (!logfile_was_present) unlink(log.c_str()); std::string old_log_file = log + ".old"; file_test.open(old_log_file.c_str()); logfile_was_present = file_test.good(); log_test.open(old_log_file.c_str(), std::ofstream::out); log_test.close(); if (log_test.fail()) { throw std::runtime_error("X.org old server log file " + old_log_file + " is not writable."); } else if (!logfile_was_present) unlink(old_log_file.c_str()); }
void Board::DrawEntryPlanes(HDC dc) { int i = 0; for (std::set<Plane *>::iterator it = planesDisplay.begin(); it != planesDisplay.end(); ++it) { Plane *plane = *it; int x = (i/16) * 10 + BoardWidth + 2 ; int y = (i % 16); std::string str = GetDisplayString(plane); TextOut(dc, x * TextWidth, y * TextHeight, str.c_str(), str.size()); i++; } }
static void ListDrawDataFunc(Int16 itemNum, RectangleType *bounds, Char **itemsText) { char string[20]; StrNCopy(string, GetDisplayString(itemNum), 19); WinSetUnderlineMode(noUnderline); FntSetFont(stdFont); Int16 width = bounds->extent.x; Int16 len = StrLen(string); Boolean noFit = false; FntCharsInWidth(string, &width, &len, &noFit); WinEraseRectangle(bounds, 0); WinDrawChars(string, len, bounds->topLeft.x, bounds->topLeft.y); }
void FSCSDiff::OnSCSEditorUpdateSelectionFromNodes(const TArray<FSCSEditorTreeNodePtrType>& SelectedNodes) { FText InspectorTitle = FText::GetEmpty(); TArray<UObject*> InspectorObjects; InspectorObjects.Empty(SelectedNodes.Num()); for (auto NodeIt = SelectedNodes.CreateConstIterator(); NodeIt; ++NodeIt) { auto NodePtr = *NodeIt; if(NodePtr.IsValid() && NodePtr->CanEditDefaults()) { InspectorTitle = FText::FromString(NodePtr->GetDisplayString()); InspectorObjects.Add(NodePtr->GetComponentTemplate()); } } if( Inspector.IsValid() ) { SKismetInspector::FShowDetailsOptions Options(InspectorTitle, true); Inspector->ShowDetailsForObjects(InspectorObjects, Options); } }
void xorg::testing::XServer::Start(const std::string &program) { TestStartup(); std::vector<std::string> args; std::map<std::string, std::string>::iterator it; std::string err_msg; sigset_t sig_mask; struct timespec sig_timeout = {3, 0}; /* 3 sec + 0 nsec */ /* add SIGUSR1 to the signal mask */ sigemptyset(&sig_mask); sigaddset(&sig_mask, SIGUSR1); sigaddset(&sig_mask, SIGCHLD); if (sigprocmask(SIG_BLOCK, &sig_mask, NULL)) { err_msg.append("Failed to set signal mask: "); err_msg.append(std::strerror(errno)); throw std::runtime_error(err_msg); } pid_t pid = Fork(); if (pid == 0) { #ifdef __linux if (getenv("XORG_GTEST_XSERVER_KEEPALIVE")) prctl(PR_SET_PDEATHSIG, 0); #endif /* set SIGUSR1 handler to SIG_IGN, XServer tests for this and will * send SIGUSR1 when ready */ sighandler_t old_handler; old_handler = signal(SIGUSR1, SIG_IGN); if (old_handler == SIG_ERR) { err_msg.append("Failed to set signal handler: "); err_msg.append(std::strerror(errno)); throw std::runtime_error(err_msg); } /* unblock for the child process so the server receives SIGUSR1, needed for VT switching */ sigemptyset(&sig_mask); sigaddset(&sig_mask, SIGUSR1); if (sigprocmask(SIG_UNBLOCK, &sig_mask, NULL)) { err_msg.append("Failed to unblock signal mask: "); err_msg.append(std::strerror(errno)); throw std::runtime_error(err_msg); } args.push_back(std::string(GetDisplayString())); for (it = d_->options.begin(); it != d_->options.end(); it++) { args.push_back(it->first); if (!it->second.empty()) args.push_back(it->second); } Process::Start(program.empty() ? d_->path_to_server : program, args); /* noreturn */ } /* parent */ char *sleepwait = getenv("XORG_GTEST_XSERVER_SIGSTOP"); if (sleepwait) raise(SIGSTOP); /* wait for SIGUSR1 from XServer */ int recv_sig = sigtimedwait(&sig_mask, NULL, &sig_timeout); if (recv_sig == SIGCHLD) { GetState(); } else if (recv_sig != SIGUSR1 && errno != EAGAIN) { err_msg.append("Error while waiting for XServer startup: "); err_msg.append(std::strerror(errno)); throw std::runtime_error(err_msg); } sigemptyset(&sig_mask); sigaddset(&sig_mask, SIGCHLD); sigaddset(&sig_mask, SIGUSR1); sigprocmask(SIG_UNBLOCK, &sig_mask, NULL); /* Ignore SIGUSR1, it's triggered on server regeneration. Tests that need * to handle SIGUSR1 will have to install their own signal handler anyways */ signal(SIGUSR1 ,SIG_IGN); RegisterXIOErrorHandler(); RegisterXErrorHandler(); }
void MenuItem::Paint(HDC hDC) { RECT rect; COLORREF cr0 = (COLORREF)-1; bool lit = false; StyleItem *pSI = &mStyle.MenuFrame; if (m_bActive && 0 == (m_isNOP & (MI_NOP_TEXT | MI_NOP_SEP)) && (0 == (m_isNOP & MI_NOP_DISABLED) || m_pSubMenu)) { // draw hilite bar GetItemRect(&rect); pSI = &mStyle.MenuHilite; MakeStyleGradient(hDC, &rect, pSI, pSI->bordered); cr0 = SetTextColor(hDC, pSI->TextColor); lit = true; } else if (m_isNOP & MI_NOP_DISABLED) { cr0 = SetTextColor(hDC, mStyle.MenuFrame.disabledColor); } //dbg_printf("Menu separator style is: %s",Settings_menuSeparatorStyle); // draw separator if (m_isNOP & MI_NOP_LINE) { int x, y = m_nTop + m_nHeight / 2; // Noccy: Looks like we have to remove some pixels here to prevent it from overwriting the right border. int left = m_nLeft + ((Settings_menuFullSeparatorWidth)?1:mStyle.MenuSepMargin) - 1; int right = m_nLeft + m_nWidth - ((Settings_menuFullSeparatorWidth)?1:mStyle.MenuSepMargin); // int dist = (m_nWidth + 1) / 2 - ((Settings_menuFullSeparatorWidth==true)?mStyle.MenuFrame.borderWidth:mStyle.MenuSepMargin); int dist = (m_nWidth+1) / 2 - ((Settings_menuFullSeparatorWidth)?1:mStyle.MenuSepMargin); COLORREF c = mStyle.MenuSepColor; COLORREF cs = pSI->ShadowColor; if (pSI->ShadowXY) { int yS = y + pSI->ShadowY; int leftS = left + pSI->ShadowX; int rightS = right + pSI->ShadowX; if (0 == stricmp(Settings_menuSeparatorStyle,"gradient")) { // Gradient shadow for (x = 0; x <= dist; ++x) { int pos, hue = x * 255 / dist; pos = leftS + x; SetPixel(hDC, pos, yS, mixcolors(cs, GetPixel(hDC, pos, y), hue)); pos = rightS - x; SetPixel(hDC, pos, yS, mixcolors(cs, GetPixel(hDC, pos, y), hue)); } } else if (0 == stricmp(Settings_menuSeparatorStyle,"flat")) { // Flat shadow for (x = 0; x <= dist; ++x) { int pos; pos = leftS + x; SetPixel(hDC, pos, yS, cs); pos = rightS - x; SetPixel(hDC, pos, yS, cs); } } else if (0 == stricmp(Settings_menuSeparatorStyle,"bevel")) { // Bevel shadow is simply none... } } if (0 == stricmp(Settings_menuSeparatorStyle,"gradient")) { for (x = 0; x <= dist; ++x) { int pos, hue = x * 255 / dist; pos = left + x; SetPixel(hDC, pos, y, mixcolors(c, GetPixel(hDC, pos, y), hue)); pos = right - x; SetPixel(hDC, pos, y, mixcolors(c, GetPixel(hDC, pos, y), hue)); } } else if (0 == stricmp(Settings_menuSeparatorStyle,"flat")) { for (x = 0; x <= dist; ++x) { int pos; //, hue = x * 255 / dist; pos = left + x; SetPixel(hDC, pos, y, c); pos = right - x; SetPixel(hDC, pos, y, c); } } else if (0 == stricmp(Settings_menuSeparatorStyle,"bevel")) { for (x = 0; x <= dist; ++x) { int pos; pos = left + x; SetPixel(hDC, pos, y, mixcolors(0x00000000, GetPixel(hDC, pos, y), 160)); pos = right - x; SetPixel(hDC, pos, y, mixcolors(0x00000000, GetPixel(hDC, pos, y), 160)); pos = left + x; SetPixel(hDC, pos, y+1, mixcolors(0x00FFFFFF, GetPixel(hDC, pos, y+1), 160)); pos = right - x; SetPixel(hDC, pos, y+1, mixcolors(0x00FFFFFF, GetPixel(hDC, pos, y+1), 160)); } } } int iconSize = m_pMenu->m_iconSize; if (-2 == iconSize) iconSize = MenuInfo.nIconSize; GetTextRect(&rect, iconSize); // [load and ]draw menu item icon if (iconSize) { bool bSmallIcon = (16 >= iconSize); // load menu item icon if (NULL == m_hIcon || bSmallIcon != m_bSmallIcon) { DestroyIcon(m_hIcon), m_hIcon = NULL; m_bSmallIcon = bSmallIcon; switch (m_iconMode) { case IM_PIDL: { const _ITEMIDLIST *pidl = (MENUITEM_ID_SF == m_ItemID) ? ((SpecialFolderItem*)this)->check_pidl() : m_pidl; if (pidl) { SHFILEINFO sfi; HIMAGELIST sysimgl = (HIMAGELIST)SHGetFileInfo((LPCSTR)pidl, 0, &sfi, sizeof(SHFILEINFO), SHGFI_PIDL | SHGFI_SYSICONINDEX | (bSmallIcon ? SHGFI_SMALLICON : SHGFI_LARGEICON)); if (sysimgl) m_hIcon = ImageList_GetIcon(sysimgl, sfi.iIcon, ILD_NORMAL); } } break; case IM_TASK: { const struct tasklist *tl = (struct tasklist *)m_im_stuff; m_hIcon = CopyIcon(bSmallIcon ? tl->icon : tl->icon_big); } break; case IM_PATH: char *icon = (char *)m_im_stuff; char *path = strrchr(icon, ','); int idx; if (path) idx = atoi(path + 1), *path = 0; else idx = 0; if (bSmallIcon) ExtractIconEx(icon, idx, NULL, &m_hIcon, 1); else ExtractIconEx(icon, idx, &m_hIcon, NULL, 1); if (path) *path = ','; break; } } // draw menu item icon if (m_hIcon) { int top = rect.top + (m_nHeight - iconSize) / 2; int adjust = (MenuInfo.nItemIndent[iconSize] - iconSize) / 2; int left = ((DT_LEFT == FolderItem::m_nBulletPosition) ? rect.right : m_nLeft) + adjust; drawIco(left, top, iconSize, m_hIcon, hDC, !m_bActive, Settings_menuIconSaturation, Settings_menuIconHue); } } /* Noccy: Added DT_NOPREFIX to BBDrawText to prevent ampersand (&) to be interpreted as a hotkey. Note: Reverted. */ // draw menu item text const char *title = GetDisplayString(); if (0 == (m_ItemID & (~MENUITEM_ID_CI & (MENUITEM_ID_CIInt|MENUITEM_ID_CIStr))) || Settings_menusBroamMode) BBDrawText(hDC, title, -1, &rect, mStyle.MenuFrame.Justify | DT_MENU_STANDARD, pSI); else if (m_ItemID != MENUITEM_ID_CIStr) BBDrawText(hDC, title, -1, &rect, DT_CENTER | DT_MENU_STANDARD, pSI); // set back previous textColor if ((COLORREF)-1 != cr0) SetTextColor(hDC, cr0); if (m_isChecked) // draw check-mark { pSI = &mStyle.MenuHilite; bool pr = pSI->parentRelative; if (lit != pr) pSI = &mStyle.MenuFrame; int x, y = m_nTop + m_nHeight / 2; if ((FolderItem::m_nBulletPosition == DT_RIGHT) == (0 == (MENUITEM_ID_FOLDER & m_ItemID))) x = m_nLeft + m_nWidth - MenuInfo.nItemIndent[iconSize] / 2 - 1; else x = m_nLeft + MenuInfo.nItemIndent[iconSize] / 2; const int r = 3; rect.left = x - r; rect.right = x + r; rect.top = y - r; rect.bottom = y + r; if (pr) MakeGradient(hDC, rect, B_SOLID, pSI->TextColor, 0, false, BEVEL_FLAT, 0, 0, 0, 0); else MakeStyleGradient(hDC, &rect, pSI, false); } }
void MenuItem::Paint(HDC hDC) { RECT rc, rhi; StyleItem *pSI; COLORREF TC, BC; int j; GetTextRect(&rc); pSI = &mStyle.MenuFrame; if (m_bActive && false == m_bNOP) { // draw hilite bar GetItemRect(&rhi); pSI = &mStyle.MenuHilite; MakeStyleGradient(hDC, &rhi, pSI, pSI->bordered); TC = pSI->TextColor; BC = pSI->foregroundColor; } else if (m_bDisabled) { BC = TC = pSI->disabledColor; } else { TC = pSI->TextColor; BC = pSI->foregroundColor; } j = m_Justify; if (MENUITEM_CUSTOMTEXT != j) { if (MENUITEM_STANDARD_JUSTIFY == j) j = mStyle.MenuFrame.Justify; // draw menu item text //bbDrawText(hDC, GetDisplayString(), &rc, j | DT_MENU_STANDARD, TC); /* BlackboxZero 1.5.2012 */ BBDrawText(hDC, GetDisplayString(), -1, &rc, j | DT_MENU_STANDARD, pSI); } //#ifdef BBOPT_MENUICONS if ( Settings_menu.iconSize ) /* BlackboxZero 1.3.2012 */ this->DrawIcon(hDC); //#endif if (m_bChecked) // draw check-mark { int d, atright; //#ifdef BBOPT_MENUICONS if ( Settings_menu.iconSize ) { /* BlackboxZero 1.3.2012 */ if (m_ItemID & MENUITEM_ID_FOLDER) atright = MenuInfo.nBulletPosition == FOLDER_LEFT; else atright = true; } else { //#else if (MenuInfo.nItemLeftIndent != MenuInfo.nItemRightIndent) atright = MenuInfo.nBulletPosition != FOLDER_LEFT; else if (m_ItemID & MENUITEM_ID_FOLDER) atright = MenuInfo.nBulletPosition == FOLDER_LEFT; else atright = j != DT_LEFT; } //#endif rc.bottom = (rc.top = m_nTop) + m_nHeight + 1; if (atright) { d = MenuInfo.nItemRightIndent + mStyle.MenuHilite.borderWidth; rc.left = (rc.right = m_nLeft + m_nWidth) - d + 1; } else { d = MenuInfo.nItemLeftIndent + mStyle.MenuHilite.borderWidth; rc.right = (rc.left = m_nLeft) + d; } #if 1 bbDrawPix(hDC, &rc, BC, BS_CHECK); #else { bool pr, lit; const int w = 6; pSI = &mStyle.MenuHilite; pr = pSI->parentRelative; lit = m_bActive && false == m_bNOP; if (lit != pr) pSI = &mStyle.MenuFrame; rc.left = (rc.left + rc.right - w)/2; rc.right = rc.left + w; rc.top = (rc.top + rc.bottom - w)/2; rc.bottom = rc.top + w; if (pr) MakeGradient(hDC, rc, B_SOLID, pSI->TextColor, 0, false, BEVEL_FLAT, 0, 0, 0, 0); else MakeStyleGradient(hDC, &rc, pSI, false); } #endif } }