void Notifier::onInsertDocument() { if (!_queryInfo._info.isValid()) return; DocumentTextEditor editor(_queryInfo._info, "{\n \n}", false, dynamic_cast<QWidget*>(_observer)); editor.setCursorPosition(1, 4); editor.setWindowTitle("Insert Document"); int result = editor.exec(); if (result != QDialog::Accepted) return; DocumentTextEditor::ReturnType obj = editor.bsonObj(); for (DocumentTextEditor::ReturnType::const_iterator it = obj.begin(); it != obj.end(); ++it) { _shell->server()->insertDocument(*it, _queryInfo._info._ns); } }
bool InputMethodController::confirmCompositionOrInsertText(const String& text, ConfirmCompositionBehavior confirmBehavior) { if (!hasComposition()) { if (!text.length()) return false; editor().insertText(text, 0); return true; } if (text.length()) { confirmComposition(text); return true; } if (confirmBehavior != KeepSelection) return confirmComposition(); SelectionOffsetsScope selectionOffsetsScope(this); return confirmComposition(); }
void VCXYPadProperties::slotEditClicked() { /* Get a list of selected fixtures */ QList <VCXYPadFixture> list(selectedFixtures()); /* Start editor */ VCXYPadFixtureEditor editor(this, list); if (editor.exec() == QDialog::Accepted) { QListIterator <VCXYPadFixture> it(editor.fixtures()); while (it.hasNext() == true) { VCXYPadFixture fxi(it.next()); QTreeWidgetItem* item = fixtureItem(fxi); updateFixtureItem(item, fxi); } m_tree->header()->resizeSections(QHeaderView::ResizeToContents); } }
void PlainTextEditorWidget::configure(const MimeType &mimeType) { Highlighter *highlighter = new Highlighter(); baseTextDocument()->setSyntaxHighlighter(highlighter); setCodeFoldingSupported(false); if (!mimeType.isNull()) { m_isMissingSyntaxDefinition = true; setMimeTypeForHighlighter(highlighter, mimeType); const QString &type = mimeType.type(); setMimeType(type); QString definitionId = Manager::instance()->definitionIdByMimeType(type); if (definitionId.isEmpty()) definitionId = findDefinitionId(mimeType, true); if (!definitionId.isEmpty()) { m_isMissingSyntaxDefinition = false; const QSharedPointer<HighlightDefinition> &definition = Manager::instance()->definition(definitionId); if (!definition.isNull() && definition->isValid()) { m_commentDefinition.isAfterWhiteSpaces = definition->isCommentAfterWhiteSpaces(); m_commentDefinition.singleLine = definition->singleLineComment(); m_commentDefinition.multiLineStart = definition->multiLineCommentStart(); m_commentDefinition.multiLineEnd = definition->multiLineCommentEnd(); setCodeFoldingSupported(true); } } else if (editorDocument()) { const QString &fileName = editorDocument()->filePath(); if (TextEditorSettings::highlighterSettings().isIgnoredFilePattern(fileName)) m_isMissingSyntaxDefinition = false; } } setFontSettings(TextEditorSettings::fontSettings()); emit configured(editor()); }
void Terrain::showTerrainDefinitionForTexture () { if (!GlobalSelectionSystem().areFacesSelected()) { gtkutil::infoDialog(_("No faces selected")); return; } const Face &face = g_SelectedFaceInstances.last().getFace(); const std::string shader = face.GetShader(); const DataBlock* blockData = getTerrainDefitionForTexture(shader); if (blockData) { // found it, now show it ui::UFOScriptEditor editor("ufos/" + blockData->getFilename()); editor.goToLine(blockData->getLineNumber()); editor.show(); return; } gtkutil::infoDialog(_("Could not find any associated terrain definition")); }
void BsonTableView::onInsertDocument() { if (_queryInfo.isNull) return; DocumentTextEditor editor(QtUtils::toQString(_queryInfo.serverAddress), QtUtils::toQString(_queryInfo.databaseName), QtUtils::toQString(_queryInfo.collectionName), "{\n \n}"); editor.setCursorPosition(1, 4); editor.setWindowTitle("Insert Document"); int result = editor.exec(); activateWindow(); if (result == QDialog::Accepted) { mongo::BSONObj obj = editor.bsonObj(); _shell->server()->insertDocument(obj, _queryInfo.databaseName, _queryInfo.collectionName); _shell->query(0, _queryInfo); } }
void CRenderDevice::message_loop() { #ifdef INGAME_EDITOR if (editor()) { message_loop_editor (); return; } #endif // #ifdef INGAME_EDITOR MSG msg; PeekMessage (&msg, NULL, 0U, 0U, PM_NOREMOVE ); while (msg.message != WM_QUIT) { if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage (&msg); continue; } on_idle (); } }
virtual void visitBlock(QTextBlock &block, const QTextCursor &caret) { for (QTextBlock::iterator it = block.begin(); it != block.end(); ++it) { QTextCursor fragmentSelection(caret); fragmentSelection.setPosition(it.fragment().position()); fragmentSelection.setPosition(it.fragment().position() + it.fragment().length(), QTextCursor::KeepAnchor); if (fragmentSelection.anchor() >= fragmentSelection.position()) { continue; } visitFragmentSelection(fragmentSelection); } QList<QTextCharFormat>::Iterator it = m_formats.begin(); Q_FOREACH (QTextCursor cursor, m_cursors) { QTextFormat prevFormat(cursor.charFormat()); cursor.setCharFormat(*it); editor()->registerTrackedChange(cursor, KoGenChange::FormatChange, kundo2_i18n("Formatting"), *it, prevFormat, false); ++it; }
QWidget *QueryConstraintsDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { switch (index.column()) { case 0: break; case 1: { ::Tools::Memory::ScopedPointer<QComboBox> editor(new QComboBox(parent)); editor->addItem(toUnicode(LiquidDb::GroupConstraint::operatorToString(LiquidDb::GroupConstraint::And)), LiquidDb::GroupConstraint::And); editor->addItem(toUnicode(LiquidDb::GroupConstraint::operatorToString(LiquidDb::GroupConstraint::Or)), LiquidDb::GroupConstraint::Or); editor->setCurrentIndex(0); return editor.take(); } } return 0; }
void PlayListHeaderModel::execEdit(int index, QWidget *parent) { if(index < 0 || index >= m_columns.size()) { qWarning("ColumnManager: index is out of range"); return; } if(!parent) parent = qApp->activeWindow(); ColumnEditor editor(m_columns[index].name, m_columns[index].pattern, parent); if(editor.exec() == QDialog::Accepted) { m_columns[index].name = editor.name(); m_columns[index].pattern = editor.pattern(); emit columnChanged(index); emit headerChanged(); updatePlayLists(); } }
void RKSpinBox::updateDisplay () { if (updating_b) return; updating_b = true; if (mode == Real) { if (value () != 0) { int change = value (); setValue (0); int power; if (real_value != 0) { power = (int) log10 (fabs (real_value)) - default_precision; if (power < (-default_precision)) power = -default_precision; if (power > 10) power = 10; } else { power = -default_precision; } double step = pow (10, power); real_value += change * step; if (real_value > real_max) real_value = real_max; if (real_value < real_min) real_value = real_min; } setUpdatesEnabled (false); QSpinBox::updateDisplay (); // need this to enable/disable the button correctly editor ()->setText (QString ().setNum (real_value)); setUpdatesEnabled (true); } else { QSpinBox::updateDisplay (); int power; if (value () != 0) power = (int) log10 (abs (value ())); else power = 1; int step = (int) pow (10, power-1); if (step < 1) step = 1; setSteps (step, 10*step); } updating_b = false; }
bool InputMethodController::confirmComposition(const String& text, ConfirmCompositionBehavior confirmBehavior) { if (!hasComposition()) return false; Optional<Editor::RevealSelectionScope> revealSelectionScope; if (confirmBehavior == KeepSelection) revealSelectionScope.emplace(&editor()); // If the composition was set from existing text and didn't change, then // there's nothing to do here (and we should avoid doing anything as that // may clobber multi-node styled text). if (!m_isDirty && composingText() == text) { clear(); return true; } // Select the text that will be deleted or replaced. selectComposition(); if (frame().selection().isNone()) return false; dispatchCompositionEndEvent(frame(), text); if (!frame().document()) return false; // If text is empty, then delete the old composition here. If text is // non-empty, InsertTextCommand::input will delete the old composition with // an optimized replace operation. if (text.isEmpty()) TypingCommand::deleteSelection(*frame().document(), 0); clear(); insertTextForConfirmedComposition(text); return true; }
void InputMethodController::finishComposition(const String& text, FinishCompositionMode mode) { ASSERT(mode == ConfirmComposition || mode == CancelComposition); UserTypingGestureIndicator typingGestureIndicator(m_frame); Editor::RevealSelectionScope revealSelectionScope(&editor()); if (mode == CancelComposition) ASSERT(text == emptyString()); else selectComposition(); if (m_frame->selection().isNone()) return; // Dispatch a compositionend event to the focused node. // We should send this event before sending a TextEvent as written in Section 6.2.2 and 6.2.3 of // the DOM Event specification. if (Element* target = m_frame->document()->focusedElement()) { RefPtr<CompositionEvent> event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->domWindow(), text); target->dispatchEvent(event, IGNORE_EXCEPTION); } // If text is empty, then delete the old composition here. If text is non-empty, InsertTextCommand::input // will delete the old composition with an optimized replace operation. if (text.isEmpty() && mode != CancelComposition) { ASSERT(m_frame->document()); TypingCommand::deleteSelection(*m_frame->document(), 0); } m_compositionNode = 0; m_customCompositionUnderlines.clear(); insertTextForConfirmedComposition(text); if (mode == CancelComposition) { // An open typing command that disagrees about current selection would cause issues with typing later on. TypingCommand::closeTyping(m_frame); } }
OP_STATUS SpeedDialConfigController::ShowThumbnailPreview() { OpString resolved_address; ResolveUrlName(m_address.Get(), resolved_address); if (resolved_address.IsEmpty()) return OpStatus::OK; OpString resolved_title; RETURN_IF_ERROR(resolved_title.Set(m_title.Get())); if (resolved_title.IsEmpty()) { OpString history_url; RETURN_IF_ERROR(GetUrlAndTitleFromHistory(m_address.Get(), history_url, resolved_title)); } CleanUpTemporaryExtension(); // Generate thumbnail EntryEditor editor(*this); editor.SetUrl(resolved_address); editor.SetTitle(resolved_title, FALSE); editor.SetExtensionId(NULL); return OpStatus::OK; }
void FacebookComposerWidget::slotPostMediaSubmitted(Choqok::Account* theAccount, Choqok::Post* post) { kDebug(); if( currentAccount() == theAccount && post == postToSubmit() ) { kDebug()<<"Accepted"; disconnect(currentAccount()->microblog(), SIGNAL(postCreated(Choqok::Account*,Choqok::Post*)), this, SLOT(slotPostMediaSubmitted(Choqok::Account*,Choqok::Post*)) ); disconnect(currentAccount()->microblog(), SIGNAL(errorPost(Choqok::Account*,Choqok::Post*,Choqok::MicroBlog::ErrorType, QString,Choqok::MicroBlog::ErrorLevel)), this, SLOT(slotErrorPost(Choqok::Account*,Choqok::Post*))); if(btnAbort){ btnAbort->deleteLater(); } Choqok::NotifyManager::success(i18n("New post submitted successfully")); editor()->clear(); replyToId.clear(); editorContainer()->setEnabled(true); setPostToSubmit( 0L ); cancelAttachMedium(); currentAccount()->microblog()->updateTimelines(currentAccount()); }
int main( int argc, char** argv ) { kvs::glut::Application app( argc, argv ); kvs::StructuredVolumeObject* object = NULL; if ( argc > 1 ) object = new kvs::StructuredVolumeImporter( std::string( argv[1] ) ); else object = new kvs::HydrogenVolumeData( kvs::Vector3ui( 32, 32, 32 ) ); kvs::RayCastingRenderer* renderer = new kvs::RayCastingRenderer(); renderer->setShader( kvs::Shader::BlinnPhong() ); renderer->enableLODControl(); kvs::glut::Screen screen( &app ); screen.registerObject( object, renderer ); screen.show(); TransferFunctionEditor editor( &screen ); editor.setVolumeObject( object ); editor.show(); return( app.run() ); }
void RdfTest::testCreateMarkers() { QObject parent; // the rdf storage. In calligra, it's part of the KoDocument. KoDocumentRdf rdfDoc; // create a document QTextDocument doc; KoTextRangeManager rangeManager(&parent); KoTextDocument textDoc(&doc); textDoc.setTextRangeManager(&rangeManager); KoTextEditor editor(&doc); textDoc.setTextEditor(&editor); // insert some lorem ipsum editor.insertText(lorem); // insert a table and set a bookmark on it with semantics QString newId = insertTableWithSemItem(editor, rdfDoc, "test item1"); // insert some more lorem before the table editor.insertText(lorem); // verify that the bookmark marks the table and only that QPair<int,int> position = rdfDoc.findExtent(newId); QCOMPARE(position.first, 2*(lorem.length()+1)); QCOMPARE(position.second, 2*(lorem.length()+1)+TABLESIZE-1); editor.setPosition(position.first + 1); QPair<int,int> position2 = rdfDoc.findExtent(&editor); qDebug()<<position<<position2; QCOMPARE(position, position2); // check that the id is like we expext QCOMPARE(rdfDoc.findXmlId(&editor), newId); }
void InputMethodController::setCompositionFromExistingText(const Vector<CompositionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) { Element* editable = m_frame.selection().rootEditableElement(); Position base = m_frame.selection().base().downstream(); Node* baseNode = base.anchorNode(); if (editable->firstChild() == baseNode && editable->lastChild() == baseNode && baseNode->isTextNode()) { m_compositionNode = nullptr; m_customCompositionUnderlines.clear(); if (base.anchorType() != Position::PositionIsOffsetInAnchor) return; if (!baseNode || baseNode != m_frame.selection().extent().anchorNode()) return; m_compositionNode = toText(baseNode); RefPtr<Range> range = PlainTextRange(compositionStart, compositionEnd).createRange(*editable); m_compositionStart = range->startOffset(); m_compositionEnd = range->endOffset(); m_customCompositionUnderlines = underlines; size_t numUnderlines = m_customCompositionUnderlines.size(); for (size_t i = 0; i < numUnderlines; ++i) { m_customCompositionUnderlines[i].startOffset += m_compositionStart; m_customCompositionUnderlines[i].endOffset += m_compositionStart; } // TODO(ojan): What was this for? Do we need it in sky since we // don't need to support legacy IMEs? if (baseNode->renderer()) baseNode->document().scheduleVisualUpdate(); return; } Editor::RevealSelectionScope revealSelectionScope(&editor()); SelectionOffsetsScope selectionOffsetsScope(this); setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); setComposition(m_frame.selectedText(), underlines, 0, 0); }
void ToolOptionWidget::onToolPropertyChanged( ToolType, ToolPropertyType ePropertyType ) { const Properties& p = editor()->tools()->currentTool()->properties; switch ( ePropertyType ) { case WIDTH: setPenWidth( p.width ); break; case FEATHER: setPenFeather( p.feather ); break; case PRESSURE: setPressure( p.pressure ); break; case INVISIBILITY: setPenInvisibility( p.invisibility ); break; case PRESERVEALPHA: setPreserveAlpha( p.preserveAlpha ); break; } }
void Dial::keyPressEvent(QKeyEvent* _event) { if (((_event->key() == Qt::Key_Enter) || (_event->key() == Qt::Key_Return))) { setEditorVisible(!editor()->hasFocus()); } float _step = singleStep(); if (_event->modifiers() & Qt::ShiftModifier) { _step = 1.0; } if (_event->modifiers() & Qt::ControlModifier) { _step = pageStep(); } if (_event->key() == Qt::Key_Left) { setValue(value() - _step); } if (_event->key() == Qt::Key_Right) { setValue(value() + _step); } }
void InputMethodController::setCompositionFromExistingText(const Vector<CompositionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd) { Element* editable = frame().selection().rootEditableElement(); Position base = frame().selection().base().downstream(); Node* baseNode = base.anchorNode(); if (baseNode && editable->firstChild() == baseNode && editable->lastChild() == baseNode && baseNode->isTextNode()) { m_compositionNode = nullptr; m_customCompositionUnderlines.clear(); if (base.anchorType() != Position::PositionIsOffsetInAnchor) return; if (baseNode != frame().selection().extent().anchorNode()) return; m_compositionNode = toText(baseNode); RefPtrWillBeRawPtr<Range> range = PlainTextRange(compositionStart, compositionEnd).createRange(*editable); if (!range) return; m_compositionStart = range->startOffset(); m_compositionEnd = range->endOffset(); m_customCompositionUnderlines = underlines; size_t numUnderlines = m_customCompositionUnderlines.size(); for (size_t i = 0; i < numUnderlines; ++i) { m_customCompositionUnderlines[i].startOffset += m_compositionStart; m_customCompositionUnderlines[i].endOffset += m_compositionStart; } if (baseNode->layoutObject()) baseNode->layoutObject()->setShouldDoFullPaintInvalidation(); return; } Editor::RevealSelectionScope revealSelectionScope(&editor()); SelectionOffsetsScope selectionOffsetsScope(this); setSelectionOffsets(PlainTextRange(compositionStart, compositionEnd)); setComposition(frame().selectedText(), underlines, 0, 0); }
//------------------------------------------------------------------------------ //! bool DFPolygonManipulator::onPointerPress( const Event& ev ) { _clearSel = false; // Vertex creation. if( Core::isKeyPressed( Key::SHIFT ) ) { // Intersection ray and normal. float t = CGConstf::infinity(); Rayf ray( camera()->position(), viewport()->direction( ev.position() ) ); Planef plane( Vec3f( 0.0f, 0.0f, 1.0f ) ); if( Intersector::trace( plane, ray, t ) ) { Vec3f p = ray.point(t); _editor->createVertex( p ); } return true; } // Picking. if( _renderable->pick( *viewport(), ev.position(), 10.0f, _pick ) ) { // Update selection. if( Core::isKeyPressed(Key::CTRL) ) { if( !_editor->toggleSelection( _pick ) ) _pick.invalidate(); } else if( !_editor->selection().has( _pick ) ) _editor->setSelection( _pick ); // Find intersection plane. Vec3f n( 0.0f, 0.0f, 1.0f ); Vec3f p = editor()->polygon()->vertex( _pick._idx ); _plane = Planef( n, p ); } else _clearSel = true; return !_clearSel; }
bool game_config_manager::init_game_config(FORCE_RELOAD_CONFIG force_reload) { // Add preproc defines according to the command line arguments. game_config::scoped_preproc_define multiplayer("MULTIPLAYER", cmdline_opts_.multiplayer); game_config::scoped_preproc_define test("TEST", cmdline_opts_.test); game_config::scoped_preproc_define editor("EDITOR", jump_to_editor_); game_config::scoped_preproc_define title_screen("TITLE_SCREEN", !cmdline_opts_.multiplayer && !cmdline_opts_.test && !jump_to_editor_); load_game_config(force_reload); game_config::load_config(game_config_.child("game_config")); hotkey::deactivate_all_scopes(); hotkey::set_scope_active(hotkey::SCOPE_MAIN_MENU); hotkey::load_hotkeys(game_config(), true); ::init_textdomains(game_config()); about::set_about(game_config()); ai::configuration::init(game_config()); return true; }
void OnyxDictFrame::onItemClicked(const QModelIndex & index) { onyx::screen::instance().enableUpdate(false); if (similar_words_checked_) { QString text = similar_words_model_.itemFromIndex(index)->data().toString(); editor()->setText(text); lookup(text); } else { dict_mgr_.select(dict_list_model_.itemFromIndex(index)->text()); if (!word_.isEmpty()) { lookup(word_); } else { showWidgetWhenInputIsEmpty(); } } onyx::screen::instance().enableUpdate(true); onyx::screen::instance().flush(this, onyx::screen::ScreenProxy::GU); }
void Notifier::onInsertDocument() { if (_queryInfo.isNull) return; DocumentTextEditor editor(QtUtils::toQString(_queryInfo.serverAddress), QtUtils::toQString(_queryInfo.databaseName), QtUtils::toQString(_queryInfo.collectionName), "{\n \n}"); editor.setCursorPosition(1, 4); editor.setWindowTitle("Insert Document"); int result = editor.exec(); if (result != QDialog::Accepted) return; DocumentTextEditor::ReturnType obj = editor.bsonObj(); for (DocumentTextEditor::ReturnType::const_iterator it = obj.begin(); it != obj.end(); ++it) { _shell->server()->insertDocument(*it, _queryInfo.databaseName, _queryInfo.collectionName); } _shell->query(0, _queryInfo); }
void TEditableToolbar::edit() { logger()->debug("edit"); // Create toolbar editor dialog TActionList all_actions = main_window->getAllNamedActions(); TToolbarEditor editor(main_window); editor.setAllActions(all_actions); editor.setActiveActions(actions); editor.setDefaultActions(default_actions); editor.setIconSize(iconSize().width()); // Execute if (editor.exec() == QDialog::Accepted) { // Get action names and update actions in all_actions QStringList new_actions = editor.saveActions(); // Load new actions setActionsFromStringList(new_actions, all_actions); // Update icon size setIconSize(QSize(editor.iconSize(), editor.iconSize())); // Save modified icon texts to pref TActionsEditor::saveToConfig(Settings::pref, main_window); Settings::pref->sync(); } }
EXIT_STATUS start(const config& game_conf, CVideo& video, const std::string& filename /* = "" */, bool take_screenshot /* = false */, const std::string& screenshot_filename /* = "map_screenshot.bmp" */) { EXIT_STATUS e = EXIT_ERROR; try { hotkey::scope_changer h_; hotkey::deactivate_all_scopes(); hotkey::set_scope_active(hotkey::SCOPE_EDITOR); editor_controller editor(game_conf, video); if (!filename.empty() && filesystem::file_exists (filename)) { if (filesystem::is_directory(filename)) { editor.context_manager_->set_default_dir(filename); editor.context_manager_->load_map_dialog(true); } else { editor.context_manager_->load_map(filename, false); } if (take_screenshot) { editor.do_screenshot(screenshot_filename); e = EXIT_NORMAL; } } if (!take_screenshot) e = editor.main_loop(); } catch (editor_exception& e) { ERR_ED << "Editor exception in editor::start: " << e.what() << std::endl; throw; } if (editor_action::get_instance_count() != 0) { ERR_ED << "Possibly leaked " << editor_action::get_instance_count() << " action objects" << std::endl; } return e; }
int main() { //cGeometry *simpleGeom = ManagerObjectLoader.loadDaeGeometry("core/objects/box.dae"); //cGeometry *simpleGeom = ManagerObjectLoader.loadDaeGeometry("core/objects/hiwo.dae"); cGeometry *simpleGeom = ManagerObjectLoader.loadDaeGeometry("core/objects/column.dae"); //cGeometry *simpleGeom = ManagerObjectLoader.loadDaeGeometry("core/objects/column1.dae"); cScene testScene; if(simpleGeom != NULL) testScene.addGeometry(simpleGeom); cWindow::tDesc winDesc; winDesc.captionName = _T("caption"); winDesc.brush = cWindow::eBrush::RENDER_; winDesc.appInstance = GetModuleHandle(NULL); winDesc.clientHeight = 600; winDesc.clientWidth = 800; winDesc.style = cWindow::eStyle::OVERLAPPED; cEnerIceBlock editor(winDesc); editor.setActiveScene(&testScene); editor.run(); //SAFE_DELETE(simpleGeom); return EXIT_SUCCESS; }
QCursor BaseTool::circleCursors() // Todo: only one instance required: make fn static? { Q_ASSERT( mEditor->getScribbleArea() ); qreal zoomFactor = editor()->view()->scaling(); //scale factor //qDebug() << "--->" << zoomFactor; qreal propWidth = properties.width * zoomFactor; qreal propFeather = properties.feather * zoomFactor; qreal width = propWidth + 0.5 * propFeather; if ( width < 1 ) { width = 1; } qreal radius = width / 2; qreal xyA = 1 + propFeather / 2; qreal xyB = 1 + propFeather / 8; qreal whA = qMax( 0.0, propWidth - xyA - 1 ); qreal whB = qMax( 0.0, width - propFeather / 4 - 2 ); QPixmap pixmap( width, width ); if ( !pixmap.isNull() ) { pixmap.fill( QColor( 255, 255, 255, 0 ) ); QPainter painter( &pixmap ); painter.setPen( QColor( 0, 0, 0, 255 ) ); painter.drawLine( QPointF( radius - 2, radius ), QPointF( radius + 2, radius ) ); painter.drawLine( QPointF( radius, radius - 2 ), QPointF( radius, radius + 2 ) ); painter.setRenderHints( QPainter::Antialiasing, true ); painter.setPen( QColor( 0, 0, 0, 0 ) ); painter.setBrush( QColor( 0, 255, 127, 64 ) ); painter.setCompositionMode( QPainter::CompositionMode_Exclusion ); painter.drawEllipse( QRectF( xyB, xyB, whB, whB ) ); // outside circle painter.setBrush( QColor( 255, 64, 0, 255 ) ); painter.drawEllipse( QRectF( xyA, xyA, whA, whA ) ); // inside circle painter.end(); } return QCursor( pixmap ); }
void TableofcontentsNoteAddin::on_note_opened () { m_toc_menu = manage(new Gtk::Menu); m_toc_menu->signal_hide().connect( sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_menu_hidden)); register_main_window_action_callback("tableofcontents-heading1", sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_level_1_action)); register_main_window_action_callback("tableofcontents-heading2", sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_level_2_action)); register_main_window_action_callback("tableofcontents-help", sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_toc_help_action)); register_main_window_action_callback("tableofcontents-goto-heading", sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_goto_heading)); auto win = get_window(); win->signal_foregrounded.connect(sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_foregrounded)); auto buffer = get_note()->get_buffer(); if(buffer) { buffer->signal_changed().connect(sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_note_changed)); } // Reacts to key press events win->signal_key_press_event().connect( sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_key_pressed)); // TOC can show up also in the contextual menu win->editor()->signal_populate_popup().connect( sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_populate_popup)); // Heading tags m_tag_bold = get_note()->get_tag_table()->lookup ("bold"); m_tag_large = get_note()->get_tag_table()->lookup ("size:large"); m_tag_huge = get_note()->get_tag_table()->lookup ("size:huge"); }