void Lyrics::SetHighlightFont() // for kHighlightLyrics { wxFont newFont(mKaraokeFontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); mHighlightTextCtrl->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, newFont)); mHighlightTextCtrl->SetStyle(0, mHighlightTextCtrl->GetLastPosition(), wxTextAttr(wxNullColour, wxNullColour, newFont)); }
static void test_font(skiatest::Reporter* reporter) { uint32_t flags = 0; SkAutoTUnref<SkFont> font(SkFont::Create(nullptr, 24, SkFont::kA8_MaskType, flags)); REPORTER_ASSERT(reporter, font->getTypeface()); REPORTER_ASSERT(reporter, 24 == font->getSize()); REPORTER_ASSERT(reporter, 1 == font->getScaleX()); REPORTER_ASSERT(reporter, 0 == font->getSkewX()); REPORTER_ASSERT(reporter, SkFont::kA8_MaskType == font->getMaskType()); uint16_t glyphs[5]; sk_bzero(glyphs, sizeof(glyphs)); int count = font->textToGlyphs("Hello", 5, kUTF8_SkTextEncoding, glyphs, SK_ARRAY_COUNT(glyphs)); REPORTER_ASSERT(reporter, 5 == count); for (int i = 0; i < count; ++i) { REPORTER_ASSERT(reporter, 0 != glyphs[i]); } REPORTER_ASSERT(reporter, glyphs[0] != glyphs[1]); // 'h' != 'e' REPORTER_ASSERT(reporter, glyphs[2] == glyphs[3]); // 'l' == 'l' SkAutoTUnref<SkFont> newFont(font->cloneWithSize(36)); REPORTER_ASSERT(reporter, newFont.get()); REPORTER_ASSERT(reporter, font->getTypeface() == newFont->getTypeface()); REPORTER_ASSERT(reporter, 36 == newFont->getSize()); // double check we haven't changed REPORTER_ASSERT(reporter, 24 == font->getSize()); // double check we haven't changed SkPaint paint; paint.setTextSize(18); font.reset(SkFont::Testing_CreateFromPaint(paint)); REPORTER_ASSERT(reporter, font.get()); REPORTER_ASSERT(reporter, font->getSize() == paint.getTextSize()); REPORTER_ASSERT(reporter, SkFont::kBW_MaskType == font->getMaskType()); }
MainWindow::MainWindow() { QFont newFont("Courier", 10, QFont::Normal, false); textEdit = new QPlainTextEdit; QPalette p = textEdit->palette(); textEdit->setReadOnly(true); p.setColor(QPalette::Active, QPalette::Base, Qt::black); p.setColor(QPalette::Inactive, QPalette::Base, Qt::black); p.setColor(QPalette::Active, QPalette::Text,Qt::white); p.setColor(QPalette::Inactive, QPalette::Text,Qt::white); textEdit->setPalette(p); setCentralWidget(textEdit); textEdit->setFont(newFont); createActions(); createMenus(); createToolBars(); createStatusBar(); readSettings(); setCurrentFile(""); setUnifiedTitleAndToolBarOnMac(true); }
void QtnPropertyDelegateQFont::drawValueImpl(QStylePainter& painter, const QRect& rect, const QStyle::State& state, bool* needTooltip) const { QFont value = owner().value(); QRect textRect = rect; if (textRect.isValid()) { QRect br; QFont oldFont = painter.font(); QFont newFont(value); newFont.setPointSize(oldFont.pointSize()); painter.setFont(newFont); painter.drawText(textRect, Qt::AlignLeading | Qt::AlignVCenter, "A", &br); painter.setFont(oldFont); textRect.setLeft(br.right() + 3); } if (textRect.isValid()) { QtnPropertyDelegateTypedEx<QtnPropertyQFontBase>::drawValueImpl(painter, textRect, state, needTooltip); } }
Boolean DetailsTreeHandler :: fontChanged(IEvent& evt) { IFUNCTRACE_DEVELOP(); IContainerControl* thisContainer = (IContainerControl*)evt.window(); IContainerControl* otherContainer; if(thisContainer==treeCnr) { otherContainer = &(treeCnr->detailsContainer()); } else { otherContainer = treeCnr; } // We need to keep track of the top level entry to this // function so that we avoid a ping-pong affect that could // occur between the two containers on font a change. This // works since the font change notification is WinSent. Boolean fNested = treeCnr->fontChangeStarted(); treeCnr->setFontChangeStarted(true); if(!fNested) { IFont newFont(thisContainer); otherContainer->setFont(newFont); treeCnr->setFontChangeStarted(false); } return false; }
void FloatMaxView::draw(QPainter * p) { FloatXIn1OutView::draw(p); QFont newFont("helvetica",10); p->setFont(newFont); p->drawText(getDrawingPlace(), AlignCenter, "Max"); }
DebugOutput::DebugOutput(QWidget * parent): QDialog(parent), ui(new Ui::DebugOutput) { ui->setupUi(this); #ifdef __APPLE__ QFont newFont("Courier", 13); ui->Output->setFont(newFont); ui->Output->setAttribute(Qt::WA_MacNormalSize); #endif #if defined WIN32 || !defined __GNUC__ QFont newFont("Courier", 9); ui->Output->setFont(newFont); #endif }
void Nightcharts::drawTitle(QPainter *painter, int width, QString title) { painter->setPen(Qt::SolidLine); QFont font = painter->font(); QFont newFont(font.family(), font.pointSize()*1.5, QFont::Bold); painter->setFont(newFont); painter->drawText((width - painter->fontMetrics().width(title))/2, painter->fontMetrics().height(), title); }
void Prefs_UserInterface::changeStoryEditorFont() { bool ok; QFont newFont(QFontDialog::getFont( &ok, seFont, this )); if (!ok) return; seFont = newFont; storyEditorFontPushButton->setText(seFont.family()); }
static int l_font_fromEmbedded(lua_State *L) { #include "font_ttf.h" int fontsize = luaL_optint(L, 1, DEFAULT_FONTSIZE); Font *self = newFont(L); const char *err = loadFontFromMemory(self, font_ttf, sizeof(font_ttf), fontsize); if (err) luaL_error(L, "%s", err); return 1; }
static int l_font_fromString(lua_State *L) { size_t len; const char *data = luaL_checklstring(L, 1, &len); int fontsize = luaL_optint(L, 2, DEFAULT_FONTSIZE); Font *self = newFont(L); const char *err = loadFontFromMemory(self, data, len, fontsize); if (err) luaL_error(L, "%s", err); return 1; }
void QFontComboBoxPrivate::_q_currentChanged(const QString &text) { Q_Q(QFontComboBox); QFont newFont(text); if (currentFont != newFont) { currentFont = newFont; emit q->currentFontChanged(currentFont); } }
void OSDWidget::setFontScale( int scale ) { double fontScale = static_cast<double>( scale ) / 100.0; // update font, reuse old one QFont newFont( font() ); newFont.setPointSizeF( defaultPointSize() * fontScale ); setFont( newFont ); }
void DataRecorderView::draw(QPainter * p) { drawFrame(p); QFont newFont(QString::fromLatin1("helvetica"),10); p->setFont(newFont); p->drawText(getDrawingPlace(), AlignCenter, QString::fromLatin1("Data\nRec")); CompView::draw(p); }
void newString(char * characters, int x, int y){ int cnt=0; while (*characters){ newFont(*characters, x, y); x = x+codersCrux_22ptDescriptors[*characters-0x2c][0]+1; if(cnt>6){y+=2;x=0; cnt=0;} *characters++; cnt++; } }
void TodoView::updateConfig() { KConfig *config(kapp->getConfig()); config->setGroup("Fonts"); QFont newFont(config->readFontEntry("Todo Font", &font())); setTableFont(newFont); updateView(); // this is somewhat bad because it also resorts the list... }
void ComponentPropertyStyleWidget::slotFontDialog() { QFont newFont(m_font); int result = KFontDialog::getFont(newFont); if(result == KFontDialog::Accepted) { m_font = newFont; m_exampleFont->setFont(m_font); m_exampleFont->setText(m_font.family()); } }
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ void MercuryPalette::DrawScaledTextPx(QPainter* pPainter, QRect textRect, int flags, QString text, int pixelFontSize640) { QFont oldFont = pPainter->font(); QFont newFont(oldFont); int pixelSize = pixelFontSize640; QRect finalTextRect(textRect); newFont.setPixelSize(pixelSize); pPainter->setFont(newFont); pPainter->drawText(finalTextRect, flags, text); pPainter->setFont(oldFont); }
void QFontDialogPrivate::_q_updateSample() { // compute new font int pSize = sizeEdit->text().toInt(); QFont newFont(fdb.font(familyList->currentText(), style, pSize)); newFont.setStrikeOut(strikeout->isChecked()); newFont.setUnderline(underline->isChecked()); if (familyList->currentText().isEmpty()) sampleEdit->clear(); updateSampleFont(newFont); }
void KviTopicWidget::applyOptions() { //set the font m_pLabel->applyOptions(); QFont newFont(KVI_OPTION_FONT(KviOption_fontLabel)); newFont.setKerning(false); newFont.setStyleStrategy(QFont::StyleStrategy(newFont.styleStrategy() | QFont::ForceIntegerMetrics)); setFont(newFont); if(m_pCompletionBox) m_pCompletionBox->setFont(newFont); // reset topic html too (in case colors have been changed) m_pLabel->setText(KviHtmlGenerator::convertToHtml(KviQString::toHtmlEscaped(m_szTopic))); }
int main(int argc, char *argv[]) { Q_INIT_RESOURCE(application); QApplication app(argc, argv); app.setOrganizationName("C0ntag10n"); app.setApplicationName("Software Authentication Cracker"); //specify a new font. QFont newFont("Impact", 12, QFont::Bold); //set font of application QApplication::setFont(newFont); QApplication::setQuitOnLastWindowClosed(false); MainWindow::instance()->show(); return app.exec(); }
void FontSetupPage::changeFont(const QFont &font) { m_plainTextEdit->moveCursor(QTextCursor::Start); m_plainTextEdit->moveCursor(QTextCursor::End, QTextCursor::KeepAnchor); QFont newFont(font); newFont.setBold(m_plainTextEdit->font().bold()); newFont.setStyle(m_plainTextEdit->font().style()); newFont.setPointSize(m_plainTextEdit->font().pointSize()); m_plainTextEdit->setFont(newFont); m_plainTextEdit->moveCursor(QTextCursor::Start); m_font = font; }
static int l_font_fromFile(lua_State *L) { const char *filename = luaL_checkstring(L, 1); int fontsize = luaL_optint(L, 2, DEFAULT_FONTSIZE); Font *self = newFont(L); size_t len; void *data = fs_read(filename, &len); /* Load new font */ if (!data) { luaL_error(L, "could not open file '%s'", filename); } const char *err = loadFontFromMemory(self, data, len, fontsize); free(data); if (err) luaL_error(L, "%s", err); return 1; }
void FloatLatchView::draw(QPainter * p) { CompView::draw(p); QRect rect(getDrawingPlace()); rect.rLeft() ++; rect.rTop() += 1 + m_ctrlBlock->getRect(false).bottom(); rect.rBottom() ++; p->setPen(QPen(black, 2)); p->setBrush(NoBrush); p->drawRect(rect); QFont newFont("helvetica",8); p->setFont(newFont); p->setPen(black); p->drawText(rect, (AlignHCenter | AlignTop), "Latch"); }
int main(void) { GPIO_InitTypeDef GPIO_InitStructure; //RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE); //enable gpioB peripherial clock RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); //enable gpioA peripherial clock GPIO_InitStructure.GPIO_Pin = SCE|RES|DC|SCLK|SDIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_SetBits(GPIOA, SCE|RES|DC|SCLK|SDIN); LCDinit(); //initialize LCD parameters while(count--) { LCDString("Hello worlds! "); } setXY(0,5); //while(count2--){ //writeCharInv('C'); // } newString("0.123457",0,2); floatToString(value-count2); newFont('V',55,5); /*To Do: */ return 0; }
void CharSelectEnhanced::setDoc(ScribusDoc* doc) { // tDebug("CharSelectEnhanced setDoc start"); if (m_doc != doc) { m_doc = doc; m_charTableModel->setDoc(m_doc); delEdit(); setupRangeCombo(); newCharClass(1); } QString oldFont(m_fontInUse); m_fontInUse = m_doc->currentStyle.charStyle().font().scName(); if (oldFont != m_fontInUse && !m_fontInUse.isEmpty()) { setCurrentComboItem(fontSelector, m_fontInUse); newFont(fontSelector->currentIndex()); } // tDebug("CharSelectEnhanced setDoc end"); }
BitcoinGUI::BitcoinGUI(QWidget *parent): QMainWindow(parent), clientModel(0), walletModel(0), encryptWalletAction(0), changePassphraseAction(0), aboutQtAction(0), trayIcon(0), notificator(0), rpcConsole(0) { resize(850, 550); setWindowTitle(tr("FloridaCoin") + " - " + tr("Wallet")); #ifndef Q_WS_MAC qApp->setWindowIcon(QIcon(":icons/bitcoin")); setWindowIcon(QIcon(":icons/bitcoin")); #else setUnifiedTitleAndToolBarOnMac(true); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif //specify a new font. // QFont newFont("Comic Sans MS", 10); #ifdef Q_WS_MAC QFont newFont("Lucida Grande", 12); #else QFont newFont("Arial", 10); #endif //set font of application QApplication::setFont(newFont); // Accept D&D of URIs setAcceptDrops(true); // Create actions for the toolbar, menu bar and tray/dock icon createActions(); // Create application menu bar createMenuBar(); // Create the toolbars createToolBars(); // Create the tray icon (or setup the dock icon) createTrayIcon(); // Create tabs overviewPage = new OverviewPage(); miningPage = new MiningPage(this); transactionsPage = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(); transactionView = new TransactionView(this); vbox->addWidget(transactionView); transactionsPage->setLayout(vbox); addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab); receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab); sendCoinsPage = new SendCoinsDialog(this); signVerifyMessageDialog = new SignVerifyMessageDialog(this); centralWidget = new QStackedWidget(this); centralWidget->addWidget(overviewPage); centralWidget->addWidget(miningPage); centralWidget->addWidget(transactionsPage); centralWidget->addWidget(addressBookPage); centralWidget->addWidget(receiveCoinsPage); centralWidget->addWidget(sendCoinsPage); #ifdef FIRST_CLASS_MESSAGING centralWidget->addWidget(signVerifyMessageDialog); #endif setCentralWidget(centralWidget); // Create status bar statusBar(); // Status bar notification icons QFrame *frameBlocks = new QFrame(); frameBlocks->setContentsMargins(0,0,0,0); frameBlocks->setMinimumWidth(80); frameBlocks->setMaximumWidth(80); QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); frameBlocksLayout->setContentsMargins(3,0,3,0); frameBlocksLayout->setSpacing(3); labelEncryptionIcon = new QLabel(); labelMiningIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelEncryptionIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelMiningIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelConnectionsIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelBlocksIcon); frameBlocksLayout->addStretch(); // Progress bar and label for blocks download progressBarLabel = new QLabel(); progressBarLabel->setVisible(false); progressBar = new QProgressBar(); progressBar->setAlignment(Qt::AlignCenter); progressBar->setVisible(false); statusBar()->addWidget(progressBarLabel); statusBar()->addWidget(progressBar); statusBar()->addPermanentWidget(frameBlocks); syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this); labelBlocksIcon->setMovie(syncIconMovie); syncIconMovie->start(); // Clicking on a transaction on the overview page simply sends you to transaction history page connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage())); connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex))); // Doubleclicking on a transaction on the transaction history page shows details connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails())); rpcConsole = new RPCConsole(this); connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); // Clicking on "Verify Message" in the address book sends you to the verify message tab connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString))); // Clicking on "Sign Message" in the Much receive page sends you to the sign message tab connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString))); gotoOverviewPage(); }
BitcoinGUI::BitcoinGUI(QWidget *parent) : QMainWindow(parent), clientModel(0), encryptWalletAction(0), changePassphraseAction(0), aboutQtAction(0), trayIcon(0), notificator(0), rpcConsole(0), prevBlocks(0) { restoreWindowGeometry(); setWindowTitle(tr("Champcoin") + " - " + tr("Wallet")); #ifndef Q_OS_MAC QApplication::setWindowIcon(QIcon(":icons/bitcoin")); setWindowIcon(QIcon(":icons/bitcoin")); #else setUnifiedTitleAndToolBarOnMac(true); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif // Create wallet frame and make it the central widget walletFrame = new WalletFrame(this); setCentralWidget(walletFrame); // Kinglordcoin: Specify Arial as new font. QFont newFont("Arial", 10); // Kinglordcoin: Set new application font QApplication::setFont(newFont); // Accept D&D of URIs setAcceptDrops(true); // Create actions for the toolbar, menu bar and tray/dock icon // Needs walletFrame to be initialized createActions(); // Create application menu bar createMenuBar(); // Create the toolbars createToolBars(); // Create system tray icon and notification createTrayIcon(); // Create status bar statusBar(); // Status bar notification icons QFrame *frameBlocks = new QFrame(); frameBlocks->setContentsMargins(0,0,0,0); frameBlocks->setMinimumWidth(56); frameBlocks->setMaximumWidth(56); QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); frameBlocksLayout->setContentsMargins(3,0,3,0); frameBlocksLayout->setSpacing(3); labelEncryptionIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelEncryptionIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelConnectionsIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelBlocksIcon); frameBlocksLayout->addStretch(); // Progress bar and label for blocks download progressBarLabel = new QLabel(); progressBarLabel->setVisible(false); progressBar = new QProgressBar(); progressBar->setAlignment(Qt::AlignCenter); progressBar->setVisible(false); // Override style sheet for progress bar for styles that have a segmented progress bar, // as they make the text unreadable (workaround for issue #1071) // See https://qt-project.org/doc/qt-4.8/gallery.html QString curStyle = QApplication::style()->metaObject()->className(); if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle") { progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }"); } statusBar()->addWidget(progressBarLabel); statusBar()->addWidget(progressBar); statusBar()->addPermanentWidget(frameBlocks); syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this); rpcConsole = new RPCConsole(this); connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); // prevents an oben debug window from becoming stuck/unusable on client shutdown connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide())); // Install event filter to be able to catch status tip events (QEvent::StatusTip) this->installEventFilter(this); // Initially wallet actions should be disabled setWalletActionsEnabled(false); }
void SetAppearance(QApplication *app, AppearanceAttributes *aa) { const char *mName = "SetAppearance: "; // Get the current appearance attributes. AppearanceAttributes currentAtts; GetAppearance(app, ¤tAtts); // // Set the style // std::string newStyle(aa->GetStyle()); if(aa->GetUseSystemDefault()) newStyle = aa->GetDefaultStyle(); bool changeStyle = newStyle != currentAtts.GetDefaultStyle(); if(changeStyle) { debug1 << mName << "Setting style to: " << newStyle << endl; // Set the style via the style name. app->setStyle(newStyle.c_str()); } // // Set the font. // std::string newFont(aa->GetFontName()); if(aa->GetUseSystemDefault()) newFont = aa->GetDefaultFontName(); bool changeFont = (newFont != currentAtts.GetDefaultFontName()) || changeStyle; if(changeFont) { QFont font; bool okay = true; if(newFont.size() > 0 && newFont[0] == '-') { // It's probably an XLFD font = QFont(newFont.c_str()); debug1 << mName << "The font looks like XLFD: " << newFont << endl; } else okay = font.fromString(newFont.c_str()); if(okay) { debug1 << mName << "Font okay. name=" << font.toString().toStdString() << endl; app->setFont(font); // Force the font change on all top level widgets. // for each top level widget... foreach(QWidget *w, QApplication::topLevelWidgets()) w->setFont(font); } else debug1 << mName << "Font NOT okay. name=" << font.toString().toStdString() << endl; } // // Set the application colors // std::string newBG(aa->GetBackground()); std::string newFG(aa->GetForeground()); if(aa->GetUseSystemDefault()) { newBG = aa->GetDefaultBackground(); newFG = aa->GetDefaultForeground(); } bool changeColors = newBG != currentAtts.GetDefaultBackground() || newFG != currentAtts.GetDefaultForeground(); bool colorStyle = newStyle != "macintosh"; if(changeColors && colorStyle) { QColor bg(newBG.c_str()); QColor fg(newFG.c_str()); QColor btn(bg); // Put the converted RGB format color into the appearance attributes // in case the colors were given as color names. if(!aa->GetUseSystemDefault()) { char tmp[20]; sprintf(tmp, "#%02x%02x%02x", bg.red(), bg.green(), bg.blue()); aa->SetBackground(tmp); sprintf(tmp, "#%02x%02x%02x", fg.red(), fg.green(), fg.blue()); aa->SetForeground(tmp); } debug1 <<mName << "Setting BG color to: " << newBG << endl; debug1 <<mName << "Setting FG color to: " << newFG << endl; int h,s,v; fg.getHsv(&h,&s,&v); QColor base = Qt::white; bool bright_mode = false; if(v >= 255 - 50) { base = btn.dark(150); bright_mode = true; } QPalette pal(fg, btn, btn.light(), btn.dark(), btn.dark(150), fg, Qt::white, base, bg); // pal.setCurrentColorGroup(QPalette::Normal); if (bright_mode) { // pal.setColor(QPalette::Text, fg); // pal.setColor(QPalette::WindowText, fg); pal.setColor(QPalette::Normal, QPalette::HighlightedText, base ); pal.setColor(QPalette::Normal, QPalette::Highlight, Qt::white ); } else { // pal.setColor(QPalette::Text, fg); // pal.setColor(QPalette::WindowText, fg); pal.setColor(QPalette::Normal, QPalette::HighlightedText, Qt::white ); pal.setColor(QPalette::Normal, QPalette::Highlight, Qt::darkBlue ); } // Set inactive colors // pal.setCurrentColorGroup(QPalette::Inactive); if (bright_mode) { // pal.setColor(QPalette::Inactive, QPalette::Text, fg); // pal.setColor(QPalette::Inactive, QPalette::WindowText, fg); pal.setColor(QPalette::Inactive, QPalette::HighlightedText, base ); pal.setColor(QPalette::Inactive, QPalette::Highlight, Qt::white ); } else { // pal.setColor(QPalette::Inactive, QPalette::Text, fg); // pal.setColor(QPalette::Inactive, QPalette::WindowText, fg); pal.setColor(QPalette::Inactive, QPalette::HighlightedText, Qt::white ); pal.setColor(QPalette::Inactive, QPalette::Highlight, Qt::darkBlue ); } // Set disabled colors QColor disabled((fg.red()+btn.red())/2, (fg.green()+btn.green())/2, (fg.blue()+btn.blue())/2); // pal.setCurrentColorGroup(QPalette::Disabled); pal.setColor(QPalette::Disabled, QPalette::WindowText, disabled); pal.setColor(QPalette::Disabled, QPalette::Light, btn.light( 125 )); pal.setColor(QPalette::Disabled, QPalette::Text, disabled); pal.setColor(QPalette::Disabled, QPalette::Base, Qt::white); if (bright_mode) { pal.setColor(QPalette::Disabled, QPalette::HighlightedText, base); pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::white); } else { pal.setColor(QPalette::Disabled, QPalette::HighlightedText, Qt::white); pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::darkBlue); } app->setPalette(pal); } }
//----------------------------------------------------------------- // format the textbox contents. void mgTextScan::scan( unsigned int &posn) // starting position { // parse buffer and format text m_clipped = false; // set state to default m_page->getDefaultFormat(m_justify, m_leftMargin, m_rightMargin, m_indent, m_wrap); m_page->getDefaultFont(m_fontFace, m_fontSize, m_fontItalic, m_fontBold, m_color); m_baseFontSize = m_fontSize; newFont(); // temporaries for when we return values to defaults mgString face; short left, right, indent, size; BOOL wrap, italic, bold; DWORD color; mgTextAlign justify; unsigned int count = 0; BOOL endBuffer = false; while (!m_clipped && !endBuffer) { mgFormatCmd cmd = m_buffer->readCommand(posn); switch (cmd) { case mgJustifyCmd: { m_justify = m_buffer->readJustify(posn); if (m_justify == mgTextAlignHDefault) m_page->getDefaultFormat(m_justify, left, right, indent, wrap); break; } case mgLeftMarginCmd: { short value = m_buffer->readLeftMargin(posn); if (value == MGDEFAULTSHORT) m_page->getDefaultFormat(justify, m_leftMargin, right, indent, wrap); else m_leftMargin = (m_page->getUnits()*value)/100; newMargins(); break; } case mgRightMarginCmd: { short value = m_buffer->readRightMargin(posn); if (value == MGDEFAULTSHORT) m_page->getDefaultFormat(justify, left, m_rightMargin, indent, wrap); else m_rightMargin = (m_page->getUnits()*value)/100; newMargins(); break; } case mgIndentCmd: { short value = m_buffer->readIndent(posn); if (value == MGDEFAULTSHORT) m_page->getDefaultFormat(justify, left, right, m_indent, wrap); else m_indent = (m_page->getUnits() * value)/100; newMargins(); break; } case mgWrapCmd: { mgBooleanAttr value = m_buffer->readWrap(posn); if (value == mgDefaultBoolean) m_page->getDefaultFormat(justify, left, right, indent, m_wrap); else m_wrap = value == mgTrue; break; } case mgFontFaceCmd: m_buffer->readFontFace(posn, m_fontFace); if (m_fontFace.equals("default")) m_page->getDefaultFont(m_fontFace, size, italic, bold, color); newFont(); break; case mgFontSizeCmd: { short value = m_buffer->readFontSize(posn); if (value == MGDEFAULTSHORT) m_page->getDefaultFont(face, m_fontSize, italic, bold, color); else m_fontSize = (m_baseFontSize * value)/100; newFont(); break; } case mgFontItalicCmd: { mgBooleanAttr value = m_buffer->readFontItalic(posn); if (value == mgDefaultBoolean) m_page->getDefaultFont(face, size, m_fontItalic, bold, color); else m_fontItalic = value == mgTrue; newFont(); break; } case mgFontBoldCmd: { mgBooleanAttr value = m_buffer->readFontBold(posn); if (value == mgDefaultBoolean) m_page->getDefaultFont(face, size, italic, m_fontBold, color); else m_fontBold = value == mgTrue; newFont(); break; } case mgColorCmd: m_color = m_buffer->readColor(posn); if (m_color == MGDEFAULTCOLOR) m_page->getDefaultFont(face, size, italic, bold, m_color); break; case mgAnchorCmd: // m_anchor = (mgAnchorDesc*) m_buffer->readPtr(posn); break; case mgSpaceCmd: newWord(); addSpace(m_buffer->readSpace(posn)); break; case mgTabCmd: { newWord(); short value = m_buffer->readTab(posn); value = (m_page->getUnits() * value)/100; addTab(value); break; } case mgTextCmd: { int textLen; const char* text; m_buffer->readText(posn, textLen, text); if (!m_wrap) addFrag(false, text, textLen); else { // writeText has converted whitespace to blanks and removed // duplicate blanks. However, a single word may be broken into // multiple fragments due to tags within the word. // ex: <b>T</b>est while (textLen > 0) { int c = 0xFF & text[0]; BOOL isBlank = isspace(c) != 0; if (isBlank) { newWord(); text++; textLen--; } // count characters of next word int len = 0; while (len < textLen) { c = 0xFF & text[len]; if (!isspace(c)) len++; else break; } addFrag(isBlank, text, len); text += len; textLen -= len; } } break; } case mgChildCmd: { // read child info const void* child; mgTextAlign halign; mgTextAlign valign; m_buffer->readChild(posn, child, halign, valign); newWord(); // breaks the current word addChild(child, halign, valign); break; } case mgBreakCmd: { int height = m_buffer->readBreak(posn); newWord(); // breaks the current word newLine(height); break; } case mgClearCmd: { mgTextAlign clear = m_buffer->readClear(posn); clearMargins(clear); break; } case mgTargetCmd: addTarget((int*) m_buffer->readTarget(posn)); break; case mgDoneCmd: newWord(); // breaks the current word done(); // end of input endBuffer = true; break; } } }