void WcsInfoPanel::parentResized(QSize sz) { resize(sz.width(), 60); qDebug() << sz.width(); float fontsize = 1./80. * (sz.width() - 390) + 7; QFont font; font.setPointSize(fontsize); updateFontSize(font); }
/* TextStylePrefsPanel::onFontChanged * Called when the font chooser font is changed *******************************************************************/ void TextStylePrefsPanel::onFontChanged(wxFontPickerEvent& e) { // Update relevant style properties updateFontFace(); updateFontSize(); updateFontBold(); updateFontItalic(); updateFontUnderlined(); updatePreview(); }
void MainWindow::updateEditButtonsState() { editingEnabled = JS("isOnEditableArea();").toBool(); emit editButtonsStateChanged(editingEnabled); if (editingEnabled) { QString f = JS("document.queryCommandValue('fontName');").toString(); emit updateFont(QFont(f)); int size = JS("document.queryCommandValue('fontSize');").toInt(); emit updateFontSize(size - 1); } }
CATextViewWin32(CATextView* e) : m_pCATextView(e) , m_pContainerView(NULL) , m_pCursorMark(NULL) , m_pImageView(NULL) , m_iCurPos(0) , m_curSelCharRange(std::make_pair(0, 0)) , m_iStartMovePos(0) , m_bCallbackTextChanged(true) { m_hEditCur = LoadCursor(NULL, IDC_IBEAM); updateFontSize(); }
void DiagnosticsDisplay::onInitialize() { static int counter = 0; scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode(); orbit_node_ = scene_node_->createChildSceneNode(); // ?? line_ = new rviz::BillboardLine(context_->getSceneManager(), scene_node_); msg_ = new rviz::MovableText("not initialized", "Liberation Sans", 0.05); msg_->setTextAlignment(rviz::MovableText::H_CENTER, rviz::MovableText::V_ABOVE); frame_id_property_->setFrameManager(context_->getFrameManager()); orbit_node_->attachObject(msg_); msg_->setVisible(false); orbit_theta_ = M_PI * 2.0 / 6 * counter++; updateLineWidth(); updateAxis(); updateDiagnosticsNamespace(); updateRadius(); updateRosTopic(); updateFontSize(); }
DiagnosticsDisplay::DiagnosticsDisplay() : rviz::Display(), msg_(0) { ros_topic_property_ = new rviz::RosTopicProperty( "Topic", "/diagnostics_agg", ros::message_traits::datatype<diagnostic_msgs::DiagnosticArray>(), "diagnostic_msgs::DiagnosticArray topic to subscribe to.", this, SLOT( updateRosTopic() )); frame_id_property_ = new rviz::TfFrameProperty( "frame_id", rviz::TfFrameProperty::FIXED_FRAME_STRING, "the parent frame_id to visualize diagnostics", this, 0, true); diagnostics_namespace_property_ = new rviz::EditableEnumProperty( "diagnostics namespace", "/", "diagnostics namespace to visualize diagnostics", this, SLOT(updateDiagnosticsNamespace())); radius_property_ = new rviz::FloatProperty( "radius", 1.0, "radius of diagnostics circle", this, SLOT(updateRadius())); line_width_property_ = new rviz::FloatProperty( "line width", 0.03, "line width", this, SLOT(updateLineWidth())); axis_property_ = new rviz::EnumProperty( "axis", "x", "axis", this, SLOT(updateAxis())); axis_property_->addOption("x", 0); axis_property_->addOption("y", 1); axis_property_->addOption("z", 2); font_size_property_ = new rviz::FloatProperty( "font size", 0.05, "font size", this, SLOT(updateFontSize())); }
WcsInfoPanel::WcsInfoPanel(bool ref, QWidget *parent) : QFrame(parent) { // Set up user interface from the Designer file qDebug() << "Initializing WcsInfoPanel ..."; ui.setupUi(this); // Set up frame style setFrameStyle(QFrame::Panel | QFrame::StyledPanel); // Set up colors setAutoFillBackground(true); setBackgroundRole(QPalette::Window); QPalette palette; QColor bgcolor = QColor(0, 0, 0, 100); QColor textcolor = QColor(230, 230, 230); palette.setColor(QPalette::Background, bgcolor); palette.setColor(QPalette::WindowText, textcolor); setPalette(palette); // Resize font QFont font; font.setPointSize(11); updateFontSize(font); reference = ref; // Specifics settings for FITS and EPO if (ref) { ui.misc2->clear(); } else { ui.misc1->setText("Orientation:"); ui.misc1_input2->clear(); } }
BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) { switch (Message) { case WM_INITDIALOG : { NppParameters *nppParamInst = NppParameters::getInstance(); _hCheckBold = ::GetDlgItem(_hSelf, IDC_BOLD_CHECK); _hCheckItalic = ::GetDlgItem(_hSelf, IDC_ITALIC_CHECK); _hCheckUnderline = ::GetDlgItem(_hSelf, IDC_UNDERLINE_CHECK); _hFontNameCombo = ::GetDlgItem(_hSelf, IDC_FONT_COMBO); _hFontSizeCombo = ::GetDlgItem(_hSelf, IDC_FONTSIZE_COMBO); _hSwitch2ThemeCombo = ::GetDlgItem(_hSelf, IDC_SWITCH2THEME_COMBO); _hFgColourStaticText = ::GetDlgItem(_hSelf, IDC_FG_STATIC); _hBgColourStaticText = ::GetDlgItem(_hSelf, IDC_BG_STATIC); _hFontNameStaticText = ::GetDlgItem(_hSelf, IDC_FONTNAME_STATIC); _hFontSizeStaticText = ::GetDlgItem(_hSelf, IDC_FONTSIZE_STATIC); _hStyleInfoStaticText = ::GetDlgItem(_hSelf, IDC_STYLEDESCRIPTION_STATIC); _colourHooker->setColour(RGB(0xFF, 0x00, 0x00)); _colourHooker->hookOn(_hStyleInfoStaticText); _currentThemeIndex = -1; int defaultThemeIndex = 0; ThemeSwitcher & themeSwitcher = nppParamInst->getThemeSwitcher(); for(size_t i = 0 ; i < themeSwitcher.size() ; i++) { std::pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(i); int j = ::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, (LPARAM)themeInfo.first.c_str()); if (! themeInfo.second.compare( nppParamInst->getNppGUI()._themeName ) ) { _currentThemeIndex = j; } if (! themeInfo.first.compare(TEXT("Default")) ) { defaultThemeIndex = j; } } if (_currentThemeIndex == -1) { _currentThemeIndex = defaultThemeIndex; } ::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0); for(int i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; i++) ::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[i]); const std::vector<generic_string> & fontlist = (NppParameters::getInstance())->getFontList(); for (size_t i = 0 ; i < fontlist.size() ; i++) { int j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str()); ::SendMessage(_hFontNameCombo, CB_SETITEMDATA, j, (LPARAM)fontlist[i].c_str()); } _pFgColour = new ColourPicker; _pBgColour = new ColourPicker; _pFgColour->init(_hInst, _hSelf); _pBgColour->init(_hInst, _hSelf); POINT p1, p2; alignWith(_hFgColourStaticText, _pFgColour->getHSelf(), ALIGNPOS_RIGHT, p1); alignWith(_hBgColourStaticText, _pBgColour->getHSelf(), ALIGNPOS_RIGHT, p2); p1.x = p2.x = ((p1.x > p2.x)?p1.x:p2.x) + 10; p1.y -= 4; p2.y -= 4; ::MoveWindow((HWND)_pFgColour->getHSelf(), p1.x, p1.y, 25, 25, TRUE); ::MoveWindow((HWND)_pBgColour->getHSelf(), p2.x, p2.y, 25, 25, TRUE); _pFgColour->display(); _pBgColour->display(); ::EnableWindow(::GetDlgItem(_hSelf, IDOK), _isDirty); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE/*!_isSync*/); ETDTProc enableDlgTheme = (ETDTProc)nppParamInst->getEnableThemeDlgTexture(); if (enableDlgTheme) { enableDlgTheme(_hSelf, ETDT_ENABLETAB); redraw(); } updateGlobalOverrideCtrls(); loadLangListFromNppParam(); setVisualFromStyleList(); goToCenter(); return TRUE; } case WM_DESTROY: { if (_pFgColour) { _pFgColour->destroy(); delete _pFgColour; _pFgColour = NULL; } if (_pBgColour) { _pBgColour->destroy(); delete _pBgColour; _pBgColour = NULL; } return TRUE; } case WM_HSCROLL : { if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER)) { int percent = ::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); (NppParameters::getInstance())->SetTransparent(_hSelf, percent); } return TRUE; } case WM_COMMAND : { if (HIWORD(wParam) == EN_CHANGE) { int editID = LOWORD(wParam); if (editID == IDC_USER_KEYWORDS_EDIT) { updateUserKeywords(); notifyDataModified(); apply(); } else if (editID == IDC_USER_EXT_EDIT) { updateExtension(); notifyDataModified(); apply(); } } else { switch (wParam) { case IDC_BOLD_CHECK : updateFontStyleStatus(BOLD_STATUS); notifyDataModified(); apply(); break; case IDC_ITALIC_CHECK : updateFontStyleStatus(ITALIC_STATUS); notifyDataModified(); apply(); break; case IDC_UNDERLINE_CHECK : updateFontStyleStatus(UNDERLINE_STATUS); notifyDataModified(); apply(); break; case IDCANCEL : //::MessageBox(NULL, TEXT("cancel"), TEXT(""), MB_OK); if (_isDirty) { NppParameters *nppParamInst = NppParameters::getInstance(); if (_restoreInvalid) { generic_string str( nppParamInst->getNppGUI()._themeName ); nppParamInst->reloadStylers( &str[0] ); } LexerStylerArray & lsArray = nppParamInst->getLStylerArray(); StyleArray & globalStyles = nppParamInst->getGlobalStylers(); if (_restoreInvalid) { _lsArray = _styles2restored = lsArray; _globalStyles = _gstyles2restored = globalStyles; } else { globalStyles = _globalStyles = _gstyles2restored; lsArray = _lsArray = _styles2restored; } restoreGlobalOverrideValues(); _restoreInvalid = false; _isDirty = false; _isThemeDirty = false; setVisualFromStyleList(); //(nppParamInst->getNppGUI())._themeName ::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0); ::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0); } ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE/*!_isSync*/); display(false); return TRUE; case IDC_SAVECLOSE_BUTTON : { if (_isDirty) { LexerStylerArray & lsa = (NppParameters::getInstance())->getLStylerArray(); StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers(); _lsArray = lsa; _globalStyles = globalStyles; updateThemeName(_themeName); _restoreInvalid = false; _currentThemeIndex = ::SendMessage(_hSwitch2ThemeCombo, CB_GETCURSEL, 0, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE); _isDirty = false; } _isThemeDirty = false; (NppParameters::getInstance())->writeStyles(_lsArray, _globalStyles); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE); //_isSync = true; display(false); ::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0); return TRUE; } case IDC_SC_TRANSPARENT_CHECK : { bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_SC_TRANSPARENT_CHECK, BM_GETCHECK, 0, 0)); if (isChecked) { int percent = ::SendDlgItemMessage(_hSelf, IDC_SC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); (NppParameters::getInstance())->SetTransparent(_hSelf, percent); } else (NppParameters::getInstance())->removeTransparent(_hSelf); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SC_PERCENTAGE_SLIDER), isChecked); return TRUE; } case IDC_GLOBAL_FG_CHECK : { GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableFg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); apply(); return TRUE; } case IDC_GLOBAL_BG_CHECK: { GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableBg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); apply(); return TRUE; } case IDC_GLOBAL_FONT_CHECK : { GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableFont = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); apply(); return TRUE; } case IDC_GLOBAL_FONTSIZE_CHECK : { GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableFontSize = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); apply(); return TRUE; } case IDC_GLOBAL_BOLD_CHECK : { GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableBold = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); apply(); return TRUE; } case IDC_GLOBAL_ITALIC_CHECK : { GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableItalic = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); apply(); return TRUE; } case IDC_GLOBAL_UNDERLINE_CHECK : { GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableUnderLine = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); apply(); return TRUE; } default: { switch (HIWORD(wParam)) { case CBN_SELCHANGE : // == case LBN_SELCHANGE : { switch (LOWORD(wParam)) { case IDC_FONT_COMBO : updateFontName(); notifyDataModified(); apply(); break; case IDC_FONTSIZE_COMBO : updateFontSize(); notifyDataModified(); apply(); break; case IDC_LANGUAGES_LIST : { int i = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETCURSEL, 0, 0); if (i != LB_ERR) { bool prevThemeState = _isThemeDirty; setStyleListFromLexer(i); _isThemeDirty = prevThemeState; } break; } case IDC_STYLES_LIST : setVisualFromStyleList(); break; case IDC_SWITCH2THEME_COMBO : switchToTheme(); setVisualFromStyleList(); notifyDataModified(); _isThemeDirty = false; apply(); break; NO_DEFAULT_CASE; } return TRUE; } case CPN_COLOURPICKED: { assert(_pFgColour); assert(_pBgColour); if ((HWND)lParam == _pFgColour->getHSelf()) { updateColour(C_FOREGROUND); notifyDataModified(); int tabColourIndex; if ((tabColourIndex = whichTabColourIndex()) != -1) { //::SendMessage(_hParent, WM_UPDATETABBARCOLOUR, tabColourIndex, _pFgColour->getColour()); TabBarPlus::setColour(_pFgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex); return TRUE; } apply(); return TRUE; } else if ((HWND)lParam == _pBgColour->getHSelf()) { updateColour(C_BACKGROUND); notifyDataModified(); int tabColourIndex; if ((tabColourIndex = whichTabColourIndex()) != -1) { tabColourIndex = (int)tabColourIndex == TabBarPlus::inactiveText? TabBarPlus::inactiveBg : tabColourIndex; TabBarPlus::setColour(_pBgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex); return TRUE; } apply(); return TRUE; } else return FALSE; } default : { return FALSE; } } } } } } break; default : break; } return FALSE; }
TextToolBar::TextToolBar(DiagramView* diagram) : QToolBar("Text") { mDiagram = diagram; connect(mDiagram, SIGNAL(propertiesChanged()), this, SLOT(updateDiagramUnits())); connect(this, SIGNAL(propertyChanged(const QString&,const QVariant&)), mDiagram, SLOT(updateItemProperty(const QString&,const QVariant&))); connect(this, SIGNAL(propertiesChanged(const QHash<QString,QVariant>&)), mDiagram, SLOT(updateDefaultItemProperties(const QHash<QString,QVariant>&))); mFontFamilyCombo = new QFontComboBox(); mFontFamilyCombo->setCurrentFont(QFont("Arial")); mFontFamilyCombo->setToolTip("Font Family"); connect(mFontFamilyCombo, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(updateFontFamily(const QString&))); mFontSizeEdit = new UnitsValueEdit(mDiagram->scene()->units(), UnitsValueEdit::PositivesOnly, false); mFontSizeEdit->setValue(mFontSizeEdit->units() == UnitsMils ? 100 : 2.5); mFontSizeEdit->setToolTip("Font Size"); connect(mFontSizeEdit, SIGNAL(editingFinished()), this, SLOT(updateFontSize())); mFontBoldButton = new QToolButton(); mFontBoldButton = new QToolButton(); mFontBoldButton->setIcon(QIcon(":/icons/oxygen/format-text-bold.png")); mFontBoldButton->setToolTip("Font Bold"); mFontBoldButton->setCheckable(true); mFontBoldButton->setChecked(false); connect(mFontBoldButton, SIGNAL(toggled(bool)), this, SLOT(updateFontBold(bool))); mFontItalicButton = new QToolButton(); mFontItalicButton->setIcon(QIcon(":/icons/oxygen/format-text-italic.png")); mFontItalicButton->setToolTip("Font Italic"); mFontItalicButton->setCheckable(true); mFontItalicButton->setChecked(false); connect(mFontItalicButton, SIGNAL(toggled(bool)), this, SLOT(updateFontItalic(bool))); mFontUnderlineButton = new QToolButton(); mFontUnderlineButton->setIcon(QIcon(":/icons/oxygen/format-text-underline.png")); mFontUnderlineButton->setToolTip("Font Underline"); mFontUnderlineButton->setCheckable(true); mFontUnderlineButton->setChecked(false); connect(mFontUnderlineButton, SIGNAL(toggled(bool)), this, SLOT(updateFontUnderline(bool))); mFontOverlineButton = new QToolButton(); mFontOverlineButton->setIcon(QIcon(":/icons/oxygen/format-text-overline.png")); mFontOverlineButton->setToolTip("Font Overline"); mFontOverlineButton->setCheckable(true); mFontOverlineButton->setChecked(false); connect(mFontOverlineButton, SIGNAL(toggled(bool)), this, SLOT(updateFontOverline(bool))); mFontStrikeOutButton = new QToolButton(); mFontStrikeOutButton->setIcon(QIcon(":/icons/oxygen/format-text-strikethrough.png")); mFontStrikeOutButton->setToolTip("Font Strike-Out"); mFontStrikeOutButton->setCheckable(true); mFontStrikeOutButton->setChecked(false); connect(mFontStrikeOutButton, SIGNAL(toggled(bool)), this, SLOT(updateFontStrikeOut(bool))); mHorizontalAlignmentButton = new AlignmentHorizontalToolButton(); mHorizontalAlignmentButton->setToolTip("Horizontal Alignment"); connect(mHorizontalAlignmentButton, SIGNAL(alignmentChanged(Qt::Alignment)), this, SLOT(updateAlignmentHorizontal(Qt::Alignment))); mVerticalAlignmentButton = new AlignmentVerticalToolButton(); mVerticalAlignmentButton->setToolTip("Vertical Alignment"); connect(mVerticalAlignmentButton, SIGNAL(alignmentChanged(Qt::Alignment)), this, SLOT(updateAlignmentVertical(Qt::Alignment))); mTextColorButton = new ColorToolButton(QIcon(":/icons/oxygen/text.png"), "Text Color"); mTextColorButton->setColor(QColor(0, 0, 0)); connect(mTextColorButton, SIGNAL(colorChanged(const QColor&)), this, SLOT(updateTextColor(const QColor&))); setObjectName("TextToolBar"); addWidget(mFontFamilyCombo); addWidget(mFontSizeEdit); addSeparator(); addWidget(mFontBoldButton); addWidget(mFontItalicButton); addWidget(mFontUnderlineButton); addWidget(mFontOverlineButton); addWidget(mFontStrikeOutButton); addSeparator(); addWidget(mHorizontalAlignmentButton); addWidget(mVerticalAlignmentButton); addSeparator(); addWidget(mTextColorButton); emit propertiesChanged(properties()); }
/* TextStylePrefsPanel::onCBOverrideFontSize * Called when the 'Override' font size checkbox is changed *******************************************************************/ void TextStylePrefsPanel::onCBOverrideFontSize(wxCommandEvent& e) { updateFontSize(); updatePreview(); }