Ejemplo n.º 1
0
TransferFunctionEditorWidget::TransferFunctionEditorWidget(QWidget *parent) :  
  QSplitter(Qt::Vertical, parent)
{
  m_parent = parent;

  m_splineEditorWidget = new SplineEditorWidget(this);
  m_gradientEditorWidget = new GradientEditorWidget(this);

  addWidget(m_splineEditorWidget);
  addWidget(m_gradientEditorWidget);

  QList<int> ssz;
  ssz << 150 << 75;
  setSizes(ssz);

  setChildrenCollapsible(false);

  QObject::connect(m_splineEditorWidget, SIGNAL(giveHistogram(int)),
		   this, SLOT(changeHistogram(int)));

  QObject::connect(m_gradientEditorWidget, SIGNAL(gradientChanged(QGradientStops)),
		   m_splineEditorWidget, SLOT(setGradientStops(QGradientStops)));

  QObject::connect(m_splineEditorWidget, SIGNAL(selectEvent(QGradientStops)),
		   m_gradientEditorWidget, SLOT(setColorGradient(QGradientStops)));

  QObject::connect(m_splineEditorWidget, SIGNAL(deselectEvent()),
		   m_gradientEditorWidget, SLOT(resetColorGradient()));

  QObject::connect(m_splineEditorWidget, SIGNAL(transferFunctionChanged(QImage)),
		   this, SLOT(transferFunctionChanged(QImage)));
}
Ejemplo n.º 2
0
int SELECTION_TOOL::selectConnection( const TOOL_EVENT& aEvent )
{
    BOARD_CONNECTED_ITEM* item = m_selection.Item<BOARD_CONNECTED_ITEM>( 0 );
    int segmentCount;

    if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T )
        return 0;

    clearSelection();
    TRACK* trackList = getModel<BOARD>()->MarkTrace( static_cast<TRACK*>( item ), &segmentCount,
                                                        NULL, NULL, true );

    if( segmentCount == 0 )
        return 0;

    for( int i = 0; i < segmentCount; ++i )
    {
        select( trackList );
        trackList = trackList->Next();
    }

    // Inform other potentially interested tools
    TOOL_EVENT selectEvent( SelectedEvent );
    m_toolMgr->ProcessEvent( selectEvent );

    return 0;
}
Ejemplo n.º 3
0
void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
{
    if( aItem->IsSelected() )
    {
        deselect( aItem );

        // Inform other potentially interested tools
        TOOL_EVENT deselectEvent( DeselectedEvent );
        m_toolMgr->ProcessEvent( deselectEvent );
    }
    else
    {
        if( !m_additive )
            clearSelection();

        // Prevent selection of invisible or inactive items
        if( selectable( aItem ) )
        {
            select( aItem );

            // Inform other potentially interested tools
            TOOL_EVENT selectEvent( SelectedEvent );
            m_toolMgr->ProcessEvent( selectEvent );
        }
    }
}
TransferFunctionEditorWidget::TransferFunctionEditorWidget(QWidget *parent) :
  QSplitter(Qt::Vertical, parent)
{

  m_splineEditorWidget = new SplineEditorWidget(this);
  m_gradientEditorWidget = new GradientEditorWidget(this);

  addWidget(m_splineEditorWidget);
  addWidget(m_gradientEditorWidget);

  setChildrenCollapsible(false);

  QObject::connect(m_splineEditorWidget, SIGNAL(giveHistogram(int)),
		   SLOT(changeHistogram(int)));

  QObject::connect(m_gradientEditorWidget, SIGNAL(gradientChanged(QGradientStops)),
		   m_splineEditorWidget, SLOT(setGradientStops(QGradientStops)));

  QObject::connect(m_splineEditorWidget, SIGNAL(selectEvent(QGradientStops)),
		   m_gradientEditorWidget, SLOT(setColorGradient(QGradientStops)));

  QObject::connect(m_splineEditorWidget, SIGNAL(transferFunctionChanged(QImage)),
		   SLOT(transferFunctionChanged(QImage)));

  QObject::connect(m_splineEditorWidget, SIGNAL(applyUndo(bool)),
		   SIGNAL(applyUndo(bool)));

  QObject::connect(m_gradientEditorWidget, SIGNAL(applyUndo(bool)),
		   SIGNAL(applyUndo(bool)));
}
int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
{
    QObject *fo = qApp->focusObject();
    if (!fo)
        return false;

    QString surroundingText;
    if (!inputMethodQuery(fo, Qt::ImSurroundingText, &surroundingText))
        return -1;
    const DWORD memSize = sizeof(RECONVERTSTRING)
                          + (surroundingText.length() + 1) * sizeof(ushort);
    if (QWindowsContext::verboseInputMethods)
        qDebug() << __FUNCTION__ << " reconv=" << reconv
                 << " surroundingText=" << surroundingText
                 << " size=" << memSize;
    // If memory is not allocated, return the required size.
    if (!reconv)
        return surroundingText.isEmpty() ? -1 : int(memSize);

    int pos = 0;
    inputMethodQuery(fo, Qt::ImCursorPosition, &pos);
    // Find the word in the surrounding text.
    QTextBoundaryFinder bounds(QTextBoundaryFinder::Word, surroundingText);
    bounds.setPosition(pos);
    if (bounds.isAtBoundary()) {
        if (QTextBoundaryFinder::EndWord == bounds.boundaryReasons())
            bounds.toPreviousBoundary();
    } else {
        bounds.toPreviousBoundary();
    }
    const int startPos = bounds.position();
    bounds.toNextBoundary();
    const int endPos = bounds.position();
    if (QWindowsContext::verboseInputMethods)
        qDebug() << __FUNCTION__ << " boundary=" << startPos << endPos;
    // Select the text, this will be overwritten by following IME events.
    QList<QInputMethodEvent::Attribute> attributes;
    attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, startPos, endPos-startPos, QVariant());
    QInputMethodEvent selectEvent(QString(), attributes);
    QCoreApplication::sendEvent(fo, &selectEvent);

    reconv->dwSize = memSize;
    reconv->dwVersion = 0;

    reconv->dwStrLen = surroundingText.size();
    reconv->dwStrOffset = sizeof(RECONVERTSTRING);
    reconv->dwCompStrLen = endPos - startPos; // TCHAR count.
    reconv->dwCompStrOffset = startPos * sizeof(ushort); // byte count.
    reconv->dwTargetStrLen = reconv->dwCompStrLen;
    reconv->dwTargetStrOffset = reconv->dwCompStrOffset;
    ushort *pastReconv = reinterpret_cast<ushort *>(reconv + 1);
    qCopy(surroundingText.utf16(), surroundingText.utf16() + surroundingText.size(),
          pastReconv);
    return memSize;
}
Ejemplo n.º 6
0
void
MainFrame::OnAnoubisOptionShow(wxCommandEvent& event)
{
	this->Show(event.GetInt());
	Module *module = MainUtils::instance()->getModule(ANOUBIS);
	int id = module->getToolbarId();

	/*
	 * Select the corresponding Modul Tab in the Toolbar
	 */
	tb_LeftToolbarModule->ToggleTool(MODANOUBIS_ID_TOOLBAR, true);

	wxCommandEvent selectEvent(wxEVT_COMMAND_MENU_SELECTED, id);
	selectEvent.SetInt(id);
	this->AddPendingEvent(selectEvent);

	event.Skip();
}
Ejemplo n.º 7
0
int SELECTION_TOOL::selectCopper( const TOOL_EVENT& aEvent )
{
    std::list<BOARD_CONNECTED_ITEM*> itemsList;
    RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
    BOARD_CONNECTED_ITEM* item = m_selection.Item<BOARD_CONNECTED_ITEM>( 0 );

    clearSelection();
    ratsnest->GetConnectedItems( item, itemsList, (RN_ITEM_TYPE)( RN_TRACKS | RN_VIAS ) );

    BOOST_FOREACH( BOARD_CONNECTED_ITEM* i, itemsList )
        select( i );

    // Inform other potentially interested tools
    if( itemsList.size() > 0 )
    {
        TOOL_EVENT selectEvent( SelectedEvent );
        m_toolMgr->ProcessEvent( selectEvent );
    }

    return 0;
}
Ejemplo n.º 8
0
void
MainFrame::OnEscalationsShow(wxCommandEvent& event)
{
	Show(event.GetInt());
	if (event.GetInt()) {
		Raise();
		RequestUserAttention(wxUSER_ATTENTION_ERROR);
	}
	Module *module = MainUtils::instance()->getModule(ANOUBIS);
	int id = module->getToolbarId();

	/*
	 * Select the corresponding Modul Tab in the Toolbar
	 */
	tb_LeftToolbarModule->ToggleTool(MODANOUBIS_ID_TOOLBAR, true);

	wxCommandEvent selectEvent(wxEVT_COMMAND_MENU_SELECTED, id);
	selectEvent.SetInt(id);
	this->AddPendingEvent(selectEvent);

	event.Skip();
}
Ejemplo n.º 9
0
void MainWindow::findEvent() {
    FindEventDialog findDialog(storage.getEvents(), this);
    connect(&findDialog, SIGNAL(eventFound(CalendarEvent)),
            calendar, SLOT(selectEvent(CalendarEvent)));
    findDialog.exec();
}
// Initialize the dialog widgets and connect the signals/slots
void MeteorShowerDialog::createDialogContent()
{
	ui->setupUi(dialog);
	ui->tabs->setCurrentIndex(0);
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
	plugin = GETSTELMODULE(MeteorShowers);

	// Settings tab / updates group	
	connect(ui->internetUpdates, SIGNAL(clicked(bool)), this, SLOT(setUpdatesEnabled(bool)));
	connect(ui->updateButton, SIGNAL(clicked()), this, SLOT(updateJSON()));
	connect(plugin, SIGNAL(updateStateChanged(MeteorShowers::UpdateState)), this, SLOT(updateStateReceiver(MeteorShowers::UpdateState)));
	connect(plugin, SIGNAL(jsonUpdateComplete(void)), this, SLOT(updateCompleteReceiver(void)));
	connect(ui->updateFrequencySpinBox, SIGNAL(valueChanged(int)), this, SLOT(setUpdateValues(int)));
	refreshUpdateValues(); // fetch values for last updated and so on

	updateTimer = new QTimer(this);
	connect(updateTimer, SIGNAL(timeout()), this, SLOT(refreshUpdateValues()));
	updateTimer->start(7000);

	// Settings tab / event group
	connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(checkDates()));
	refreshRangeDates();

	treeWidget = ui->listEvents;
	initListEvents();
	connect(treeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(selectEvent(QModelIndex)));

	// Settings tab / radiant group
	ui->displayRadiant->setChecked(plugin->getFlagRadiant());
	connect(ui->displayRadiant, SIGNAL(clicked(bool)), plugin, SLOT(setFlagRadiant(bool)));
	ui->activeRadiantsOnly->setChecked(plugin->getFlagActiveRadiant());
	connect(ui->activeRadiantsOnly, SIGNAL(clicked(bool)), plugin, SLOT(setFlagActiveRadiant(bool)));
	ui->radiantLabels->setChecked(plugin->getFlagLabels());
	connect(ui->radiantLabels, SIGNAL(clicked(bool)), plugin, SLOT(setFlagLabels(bool)));
	ui->fontSizeSpinBox->setValue(plugin->getLabelFontSize());
	connect(ui->fontSizeSpinBox, SIGNAL(valueChanged(int)), plugin, SLOT(setLabelFontSize(int)));

	// Settings tab / meteor showers group
	ui->displayMeteorShower->setChecked(plugin->getEnableAtStartup());
	connect(ui->displayMeteorShower, SIGNAL(clicked(bool)), plugin, SLOT(setEnableAtStartup(bool)));
	ui->displayShowMeteorShowerButton->setChecked(plugin->getFlagShowMSButton());
	connect(ui->displayShowMeteorShowerButton, SIGNAL(clicked(bool)), plugin, SLOT(setFlagShowMSButton(bool)));

	// /////////////////////////////////////////

	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));

	connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(restoreDefaults()));
	connect(ui->saveSettingsButton, SIGNAL(clicked()), this, SLOT(saveSettings()));

	// Markers tab
	refreshColorMarkers();
	connect(ui->changeColorARG, SIGNAL(clicked()), this, SLOT(setColorARG()));
	connect(ui->changeColorARR, SIGNAL(clicked()), this, SLOT(setColorARR()));
	connect(ui->changeColorIR, SIGNAL(clicked()), this, SLOT(setColorIR()));

	// About tab
	setAboutHtml();
	StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
	if (gui != NULL)
	{
		ui->aboutTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
	}

	updateGuiFromSettings();
}
Ejemplo n.º 11
0
void
SplineEditorWidget::selectSpineEvent(QGradientStops stops)
{
  emit selectEvent(stops);
}
Ejemplo n.º 12
0
SplineEditorWidget::SplineEditorWidget(QWidget *parent) :
  QWidget(parent)
{
  m_parent = parent;

  QPen m_pointPen;
  QBrush m_pointBrush;
  QPen m_connectionPen;
  m_pointPen = QPen(QColor(0, 0, 0, 255), 1);
  m_connectionPen = QPen(QColor(200, 200, 200, 150), 1);
  m_pointBrush = QBrush(QColor(255, 255, 255, 200));

  m_1dHist  = new QRadioButton("1D", this);
  m_2dHist  = new QRadioButton("2D", this);

  m_vol1 = new QRadioButton("V1", this);
  m_vol2 = new QRadioButton("V2", this);
  m_vol3 = new QRadioButton("V3", this);
  m_vol4 = new QRadioButton("V4", this);

  QButtonGroup *butGrp1 = new QButtonGroup(this);
  butGrp1->setExclusive(true);
  butGrp1->addButton(m_1dHist);
  butGrp1->addButton(m_2dHist);
  QButtonGroup *butGrp2 = new QButtonGroup(this);
  butGrp2->setExclusive(true);
  butGrp2->addButton(m_vol1);
  butGrp2->addButton(m_vol2);
  butGrp2->addButton(m_vol3);
  butGrp2->addButton(m_vol4);

  m_2dHist->setChecked(true);
  m_vol1->setChecked(true);

  QHBoxLayout *hbox = new QHBoxLayout();
  hbox->addStretch();
  hbox->addWidget(m_vol4);
  hbox->addWidget(m_vol3);
  hbox->addWidget(m_vol2);
  hbox->addWidget(m_vol1);

  m_gbotValue = new QLineEdit("1.0");
  m_gbotValue->setMaximumSize(30, 25);
  QRegExp rx("(\\-?\\d*\\.?\\d*\\s?)");
  QRegExpValidator *validator = new QRegExpValidator(rx,0);
  m_gbotValue->setValidator(validator);

  m_gtopValue = new QLineEdit("1.0");
  m_gtopValue->setMaximumSize(30, 25);
  m_gtopValue->setValidator(validator);

  QHBoxLayout *hboxt = new QHBoxLayout();
  hboxt->addWidget(m_gbotValue);
  hboxt->addStretch();
  hboxt->addWidget(m_1dHist);
  hboxt->addWidget(m_2dHist);
  hboxt->addStretch();
  hboxt->addWidget(m_gtopValue);

  m_gbotSlider = new QSlider(Qt::Vertical);
  m_gbotSlider->setRange(0, 255);
  m_gbotSlider->setValue(0);

  m_gtopSlider = new QSlider(Qt::Vertical);
  m_gtopSlider->setRange(0, 255);
  m_gtopSlider->setValue(255);

  m_16bitEditor = new RemapHistogramWidget(this);
  m_16bitEditor->setSizePolicy(QSizePolicy::Expanding,
			       QSizePolicy::Expanding);

  m_splineEditor = new SplineEditor(this);
  m_splineEditor->setSizePolicy(QSizePolicy::Expanding,
				QSizePolicy::Expanding);
  QHBoxLayout *hbox1 = new QHBoxLayout;
  hbox1->addWidget(m_gbotSlider);
  hbox1->addWidget(m_splineEditor);
  hbox1->addWidget(m_16bitEditor);
  hbox1->addWidget(m_gtopSlider);

  QVBoxLayout *vbox = new QVBoxLayout();
  vbox->addLayout(hboxt);
  vbox->addLayout(hbox1);
  vbox->addLayout(hbox);

  setLayout(vbox);

  m_vol1->hide();
  m_vol2->hide();
  m_vol3->hide();
  m_vol4->hide();


  m_splineEditor->setShapePen(m_pointPen);
  m_splineEditor->setConnectionPen(m_connectionPen);
  m_splineEditor->setShapeBrush(m_pointBrush);


  connect(m_gtopSlider, SIGNAL(sliderReleased()),
	  this, SLOT(gtopSliderReleased()));
  connect(m_gbotSlider, SIGNAL(sliderReleased()),
	  this, SLOT(gbotSliderReleased()));
  connect(m_gtopValue, SIGNAL(editingFinished()),
	  this, SLOT(gValueChanged()));
  connect(m_gbotValue, SIGNAL(editingFinished()),
	  this, SLOT(gValueChanged()));

  connect(m_1dHist, SIGNAL(toggled(bool)),
	  this, SLOT(hist1DClicked(bool)));

  connect(m_2dHist, SIGNAL(toggled(bool)),
	  this, SLOT(hist2DClicked(bool)));

  connect(m_vol1, SIGNAL(toggled(bool)),
	  this, SLOT(vol1Clicked(bool)));

  connect(m_vol2, SIGNAL(toggled(bool)),
	  this, SLOT(vol2Clicked(bool)));

  connect(m_vol3, SIGNAL(toggled(bool)),
	  this, SLOT(vol3Clicked(bool)));

  connect(m_vol4, SIGNAL(toggled(bool)),
	  this, SLOT(vol4Clicked(bool)));

  connect(m_splineEditor, SIGNAL(refreshDisplay()),
	  this, SLOT(update()));

  connect(m_splineEditor, SIGNAL(splineChanged()),
	  this, SLOT(updateTransferFunction()));

  connect(m_splineEditor, SIGNAL(selectEvent(QGradientStops)),
	  this, SLOT(selectSpineEvent(QGradientStops)));

  connect(m_splineEditor, SIGNAL(deselectEvent()),
	  this, SLOT(deselectSpineEvent()));

  connect(m_splineEditor, SIGNAL(applyUndo(bool)),
	  this, SIGNAL(applyUndo(bool)));

  connect(m_16bitEditor, SIGNAL(newMapping(float, float)),
	  this, SLOT(updateTransferFunction(float, float)));

  setMinimumSize(200, 200);

  m_16bitEditor->hide();
}
Ejemplo n.º 13
0
void CTimeBarFrame::OnSelect(wxTreeEvent& /*event*/)
{
    wxCommandEvent selectEvent(TIMTBAR_SELECTITEM_EVENT, GetId());
    selectEvent.SetEventObject(this);
    ProcessWindowEvent(selectEvent);
}
Ejemplo n.º 14
0
bool SELECTION_TOOL::selectMultiple()
{
    bool cancelled = false;     // Was the tool cancelled while it was running?
    m_multiple = true;          // Multiple selection mode is active
    KIGFX::VIEW* view = getView();
    getViewControls()->SetAutoPan( true );

    view->Add( m_selArea );

    while( OPT_TOOL_EVENT evt = Wait() )
    {
        if( evt->IsCancel() )
        {
            cancelled = true;
            break;
        }

        if( evt->IsDrag( BUT_LEFT ) )
        {
            if( !m_additive )
                clearSelection();

            // Start drawing a selection box
            m_selArea->SetOrigin( evt->DragOrigin() );
            m_selArea->SetEnd( evt->Position() );
            m_selArea->ViewSetVisible( true );
            m_selArea->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
        }

        if( evt->IsMouseUp( BUT_LEFT ) )
        {
            // End drawing the selection box
            m_selArea->ViewSetVisible( false );

            // Mark items within the selection box as selected
            std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
            BOX2I selectionBox = m_selArea->ViewBBox();
            view->Query( selectionBox, selectedItems );         // Get the list of selected items

            std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR>::iterator it, it_end;

            for( it = selectedItems.begin(), it_end = selectedItems.end(); it != it_end; ++it )
            {
                BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it->first );

                // Add only those items that are visible and fully within the selection box
                if( !item->IsSelected() && selectable( item ) &&
                        selectionBox.Contains( item->ViewBBox() ) )
                {
                    select( item );
                }
            }

            // Do not display information about selected item,as there is more than one
            m_frame->SetCurItem( NULL );

            if( !m_selection.Empty() )
            {
                // Inform other potentially interested tools
                TOOL_EVENT selectEvent( SelectedEvent );
                m_toolMgr->ProcessEvent( selectEvent );
            }

            break;  // Stop waiting for events
        }
    }

    view->Remove( m_selArea );
    m_multiple = false;         // Multiple selection mode is inactive
    getViewControls()->SetAutoPan( false );

    return cancelled;
}