OpStatusField::OpStatusField(DesktopWindowStatusType type) : m_global_widget(FALSE), m_status_type(type), m_desktop_window(0) { SetEllipsis(g_pcui->GetIntegerPref(PrefsCollectionUI::EllipsisInCenter) == 1 ? ELLIPSIS_CENTER : ELLIPSIS_END); m_underlying_status_text.Set(UNI_L("")); switch (type) { case STATUS_TYPE_ALL: SetGrowValue(2); GetBorderSkin()->SetImage("Status Skin"); break; case STATUS_TYPE_TITLE: GetBorderSkin()->SetImage("Status Title Skin"); break; case STATUS_TYPE_TOOLBAR: case STATUS_TYPE_INFO: GetBorderSkin()->SetImage("Status Info Skin"); break; } SetWrap(FALSE); }
// Common initialization code, used by all constructors. void STTexture::Initialize() { mTexId = 0; glGenTextures(1, &mTexId); // Default filtering and addressing options: SetFilter(GL_LINEAR, GL_LINEAR); SetWrap(GL_CLAMP, GL_CLAMP); }
/** @brief Draws a char on the screen * @param xx Horizontal location to draw the char at * @param yy Vertical location to draw the char at * @param c char to draw * @todo clean this function up. It's messy and doesn't make sense (but it works..) */ int DrawChar(int xx, int yy, int c) { //uint8_t* f = Verdana_font_11; if (c == 32)// a space return FNT(1)>>2; // Space is 1/4 font height (yuk); int i = c - FNT(3); if (i < 0 || i >= FNT(4)) { return 0; } int ci = 6 + i * 2; int width = (FNT(ci) << 8) | FNT(ci + 1); // simplify int height = FNT(1); int src = 0; if (i > 0) { src = (FNT(ci - 2) << 8) | FNT(ci - 1); width -= src; } // clip? src += (6 + 2 * FNT(4)) * 8; // start of pixels (roll into cols) uint8_t mask = 0x80 >> (src & 7); // Mask at start of line int end = (src+width) >> 3; // number of bytes read src >>= 3; int makeup = FNT(5) - (end + 1 - src); for (uint8_t y = 0; y < (uint8_t)height; y++) { uint8_t p = FNT(src++); uint8_t m = mask; for (uint8_t x = 0; x < (uint8_t)width; x++) { if (p & m) { SetWrap(x + xx, y + yy, 1, 1); SetGRAM(); _ph = x; _pv = y; SolidFill(2); } m >>= 1; if (m == 0) { p = FNT(src++); if (p == 0 && (width-x) <= 8) // early out break; m = 0x80; } } src += makeup; } return width; }
void DrawImage_P( const uint8_t *im, int width, int height, int x, int y ) { int i, max = 0; SetWrap(x, y, width, height); //set the access area to the correct area SetGRAM(); max = width * height * 2; //2 as writing 16 bit values for (i = 0; i < max; i ++) { write_data(pgm_read_byte(im + i)); } }
/** @brief Draws a rectangle of solid colour * @param x x start location * @param y y start location * @param width The width of the rectangle (x direction) * @param height The height on the rectangle (y direction) * @param colour The colour of the rectangle */ void Rectangle(uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint16_t colour) { SetWrap(x,y,width,height); SetGRAM(); SetColor(colour); // Keep 16 bit int range while (height > 128) { SolidFill(width*128); height -= 128; } SolidFill(width*height); }
CTexture::CTexture(glm::uvec2 const & size, TextureFormat const format) : mId(0) , mSize(size) { glGenTextures(1, &mId); glBindTexture(GL_TEXTURE_2D, mId); glTexImage2D(GL_TEXTURE_2D, 0, static_cast<GLint>(format), mSize.x, mSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); CB_GL_CHECKERRORS(); glBindTexture(GL_TEXTURE_2D, 0); SetFilter(TextureFilter::LINEAR, TextureFilter::LINEAR, TextureFilter::LINEAR); SetWrap(TextureWrap::CLAMP_TO_EDGE, TextureWrap::CLAMP_TO_EDGE); }
WEBC_BOOL HTMLEditBoxDisplay::SetElementStyle (void) { // Set wrap switch (TEXTAREA_ELEMENT->Wrap()) { case TEXTAREA_WRAP_OFF: SetWrap(0); break; default: SetWrap(1); break; } CSSPropertyValue overflowValue; if (TEXTAREA_ELEMENT->GetStyleFromCSS(CSS_PROPERTY_OVERFLOW, &overflowValue) == CSS_VALUE_SPECIFIED) { if (CSS_OVERFLOW_HIDDEN == overflowValue.overflow) { // WebEditBox:: SetScrollMode (SCROLL_MODE_NONE); } } return (HTMLEditDisplay<WebEditBox>::SetElementStyle()); }
tcSoundConsole::tcSoundConsole(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& configFile, const wxString& name, tc3DWindow2* graphicsHost) : tcXmlWindow(parent, pos, size, configFile, name, graphicsHost), soundEffect("consolebeep"), lastEffect(0) { if (!config) { fprintf(stderr, "tcSoundConsole::tcSoundConsole - Missing xml config\n"); return; } TiXmlNode* root = config->FirstChild("Window"); if (!root) { fprintf(stderr, "tcSoundConsole::tcSoundConsole - Missing top level <Window> tag\n"); return; } TiXmlNode* current = root->FirstChild("TextBox"); int topMargin = 0; int bottomMargin = 0; int wrap = 30; if (current) { TiXmlElement* elt = current->ToElement(); elt->Attribute("TopMargin", &topMargin); elt->Attribute("BottomMargin", &bottomMargin); elt->Attribute("Wrap", &wrap); } textBox = new tcConsoleBox(this, current); textBox->SetActive(true); textBox->SetSize(0, topMargin, size.GetWidth(), size.GetHeight() - (topMargin + bottomMargin)); SetWrap(wrap); SetBorderDraw(true); }
/** * Init some default values */ void CScintillaBibWnd::Init() { CScintillaWnd::Init(); SetDisplayFolding(TRUE); SetDisplayLinenumbers(TRUE); SetDisplaySelection(FALSE); // BibTeX LoadLexerLib(LEXBIB_LIB); SetLexer(LEXBIB_NAME); SetWrap(SC_WRAP_WORD); // Setup some BibTeX styles SetForeground(SCE_L_COMMAND, RGB(0, 0, 160)); SetForeground(SCE_L_MATH, RGB(150, 150, 40)); SetForeground(SCE_L_COMMENT, RGB(0, 128, 0)); SetForeground(SCE_L_TAG, RGB(0, 0, 255)); SetItalic(SCE_L_COMMENT, TRUE); SetBold(SCE_BIB_ITEM, TRUE); SetBold(SCE_BIB_END, TRUE); SetForeground(SCE_BIB_END, RGB(255, 0, 0)); SetBold(SCE_BIB_START, TRUE); SetForeground(SCE_BIB_START, RGB(255, 0, 0)); SetForeground(SCE_BIB_FIELD, RGB(140, 0, 70)); SetForeground(SCE_BIB_KEY, RGB(140, 0, 0)); SetBold(SCE_BIB_KEY, TRUE); // We also need HTML SetBold(SCE_H_ATTRIBUTEUNKNOWN, FALSE); SetBold(SCE_H_ATTRIBUTE, FALSE); SetBold(SCE_H_SINGLESTRING, FALSE); SetBold(SCE_H_DOUBLESTRING, FALSE); SetBold(SCE_H_TAG, TRUE); SetBold(SCE_H_TAGUNKNOWN, TRUE); SetForeground(SCE_H_TAGUNKNOWN, RGB(255, 0, 0)); // SetItalic(SCE_H_COMMENT, TRUE); // Marker DefineMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0xFF)); DefineMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); }
DWORD CRichtextLayout::CalcSize(CCalcInfo* pci, SIZE* psize, SIZE* psizeDefault) { Assert(ElementOwner()); Assert(pci); Assert(psize); CScopeFlag csfCalcing(this); CRichtext* pTextarea = DYNCAST(CRichtext, ElementOwner()); Listen(); CSaveCalcInfo sci(pci, this); CSize sizeOriginal; DWORD grfReturn; GetSize(&sizeOriginal); if(_fForceLayout) { pci->_grfLayout |= LAYOUT_FORCE; _fForceLayout = FALSE; } grfReturn = (pci->_grfLayout & LAYOUT_FORCE); if(pci->_grfLayout & LAYOUT_FORCE) { _fSizeThis = TRUE; _fAutoBelow = FALSE; _fPositionSet = FALSE; _fContainsRelative = FALSE; } BOOL fRecalcText = FALSE; BOOL fNormalMode = pci->_smMode==SIZEMODE_NATURAL || pci->_smMode==SIZEMODE_SET || pci->_smMode==SIZEMODE_FULLSIZE; BOOL fWidthChanged = (fNormalMode ? psize->cx!=sizeOriginal.cx : FALSE); BOOL fHeightChanged = (fNormalMode ? psize->cy!=sizeOriginal.cy : FALSE); fRecalcText = (fNormalMode && (IsDirty() || _fSizeThis || fWidthChanged || fHeightChanged)) || (pci->_grfLayout&LAYOUT_FORCE) || (pci->_smMode==SIZEMODE_MMWIDTH && !_fMinMaxValid) || (pci->_smMode==SIZEMODE_MINWIDTH && (!_fMinMaxValid || _xMin<0)); // If this site is in need of sizing, then size it if(fRecalcText) { //BUGBUG (gideons) should modify Cols and Rows if user resizes CUnitValue uvWidth = pTextarea->GetFirstBranch()->GetCascadedwidth(); CUnitValue uvHeight = pTextarea->GetFirstBranch()->GetCascadedheight(); int charX = 1; int charY = 1; // If dirty, ensure display tree nodes exist if(_fSizeThis && (EnsureDispNode(pci, (grfReturn&LAYOUT_FORCE))==S_FALSE)) { grfReturn |= LAYOUT_HRESIZE | LAYOUT_VRESIZE; } SetWrap(); _fContentsAffectSize = FALSE; if(uvWidth.IsNullOrEnum() || uvHeight.IsNullOrEnum()) { charX = pTextarea->GetAAcols(); Assert(charX > 0); charY = pTextarea->GetAArows(); Assert(charY > 0); } grfReturn |= CalcSizeHelper(pci, charX, charY, psize); if(fNormalMode) { grfReturn |= super::CalcSize(pci, psize); } if(psizeDefault) { *psizeDefault = *psize; } // If size changes occurred, size the display nodes if(fNormalMode && grfReturn&(LAYOUT_FORCE|LAYOUT_HRESIZE|LAYOUT_VRESIZE)) { SizeDispNode(pci, *psize); SizeContentDispNode(CSize(_dp.GetMaxWidth(), _dp.GetHeight())); } if(pci->_smMode == SIZEMODE_MMWIDTH) { // for minmax mode min width is returned in cy. _xMin = psize->cy = psize->cx; } } else { grfReturn = super::CalcSize(pci, psize); } return grfReturn; }