/** * @brief Sets the sprite model. * @param model The sprite model, or nullptr to remove any model. * This class does not take ownership on the model. * The model can be deleted safely. */ void SpritePreviewer::set_model(SpriteModel* model) { if (this->model != nullptr) { this->model->disconnect(this); this->model = nullptr; } this->model = model; if (model != nullptr) { connect(&model->get_selection_model(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(update_selection())); update_selection(); connect(model, SIGNAL(animation_frame_delay_changed(Index,uint32_t)), this, SLOT(update_frame_delay())); connect(model, SIGNAL(animation_image_changed(Index,QString)), this, SLOT(update_frames())); connect(model, SIGNAL(direction_position_changed(Index,QPoint)), this, SLOT(update_frames())); connect(model, SIGNAL(direction_size_changed(Index,QSize)), this, SLOT(update_frames())); connect(model, SIGNAL(direction_num_frames_changed(Index,int)), this, SLOT(update_frames())); connect(model, SIGNAL(direction_num_columns_changed(Index,int)), this, SLOT(update_frames())); connect(model, SIGNAL(direction_origin_changed(Index,QPoint)), this, SLOT(update_origin())); }
void pageup(editor_t *ed, int select) { int i; update_selection(ed, select); if (ed->line < ed->lines) { ed->linepos = ed->toppos = 0; ed->line = ed->topline = 0; } else { for (i = 0; i < ed->lines; i++) { int newpos = prev_line(ed, ed->linepos); if (newpos < 0) return; ed->linepos = newpos; ed->line--; if (ed->topline > 0) { ed->toppos = prev_line(ed, ed->toppos); ed->topline--; } } } ed->refresh = 1; adjust(ed); }
void right(editor_t *ed, int select) { update_selection(ed, select); if (ed->col < line_length(ed, ed->linepos)) { ed->col++; } else { int newpos = next_line(ed, ed->linepos); if (newpos < 0) return; ed->col = 0; ed->linepos = newpos; ed->line++; if (ed->line >= ed->topline + ed->lines) { ed->toppos = next_line(ed, ed->toppos); ed->topline++; ed->refresh = 1; } } ed->lastcol = ed->col; adjust(ed); }
void left(editor_t *ed, int select) { update_selection(ed, select); if (ed->col > 0) { ed->col--; } else { int newpos = prev_line(ed, ed->linepos); if (newpos < 0) return; ed->col = line_length(ed, newpos); ed->linepos = newpos; ed->line--; if (ed->line < ed->topline) { ed->toppos = ed->linepos; ed->topline = ed->line; ed->refresh = 1; } } ed->lastcol = ed->col; adjust(ed); }
void top(editor_t *ed, int select) { update_selection(ed, select); ed->toppos = ed->topline = ed->margin = 0; ed->linepos = ed->line = ed->col = ed->lastcol = 0; ed->refresh = 1; }
void EngineView::paint_ui(CmdBufferRecorder& recorder, const FrameToken& token) { y_profile(); update(); TextureView* output = nullptr; { FrameGraph graph(context()->resource_pool()); auto gbuffer = render_gbuffer(graph, &_scene_view, content_size()); auto lighting = render_lighting(graph, gbuffer, _ibl_data); auto tone_mapping = render_tone_mapping(graph, lighting); FrameGraphImageId output_image = tone_mapping.tone_mapped; { FrameGraphPassBuilder builder = graph.add_pass("ImGui texture pass"); builder.add_texture_input(output_image, PipelineStage::FragmentBit); builder.set_render_func([&output, output_image](CmdBufferRecorder& rec, const FrameGraphPass* pass) { auto out = std::make_unique<TextureView>(pass->resources()->image<ImageUsage::TextureBit>(output_image)); output = out.get(); rec.keep_alive(std::move(out)); }); } std::move(graph).render(recorder); recorder.keep_alive(_ibl_data); } // ImGui { if(output) { ImGui::GetWindowDrawList()->AddImage(output, position() + math::Vec2(ImGui::GetWindowContentRegionMin()), position() + math::Vec2(ImGui::GetWindowContentRegionMax())); } /*if(&context()->scene().scene_view() == &_scene_view)*/ { _gizmo.paint(recorder, token); if(!_gizmo.is_dragging()) { update_selection(); } } } }
bool EditorToolboxWidget::on_mouse_motion(const SDL_MouseMotionEvent& motion) { Vector mouse_pos = VideoSystem::current()->get_viewport().to_logical(motion.x, motion.y); float x = mouse_pos.x - static_cast<float>(m_Xpos); float y = mouse_pos.y - static_cast<float>(m_Ypos); if (x < 0) { m_hovered_item = HoveredItem::NONE; m_tile_scrolling = TileScrolling::NONE; return false; } if (y < 0) { if (y < -38) { m_hovered_item = HoveredItem::TILEGROUP; } else if (y < -16) { m_hovered_item = HoveredItem::OBJECTS; } else { m_hovered_item = HoveredItem::TOOL; m_hovered_tile = get_tool_pos(mouse_pos); } m_tile_scrolling = TileScrolling::NONE; return false; } else { m_hovered_item = HoveredItem::TILE; m_hovered_tile = get_tile_pos(mouse_pos); if (m_dragging && m_input_type == InputType::TILE) { update_selection(); } } if (y < 16) { m_tile_scrolling = TileScrolling::UP; m_using_scroll_wheel = false; } else if (y > static_cast<float>(SCREEN_HEIGHT - 16 - m_Ypos)) { m_tile_scrolling = TileScrolling::DOWN; m_using_scroll_wheel = false; } else { m_tile_scrolling = TileScrolling::NONE; } return false; }
void FlockViewer::pull (Seconds time, StereoAudioFrame & sound_out) { bool selected = update_selection(); if (m_mouse_state.left_down() and selected) { float beat = m_beat + m_key_counter.get(); size_t v = active_voice(); Flock::set_rhythm(v, beat); Flock::set_harmony(v, m_selection); } Flock::sample(sound_out); m_pca.add_sample(harmony().get_beat(), 1 / m_pca_timescale); plot_pitch(); }
void up(editor_t *ed, int select) { int newpos; update_selection(ed, select); newpos = prev_line(ed, ed->linepos); if (newpos < 0) return; ed->linepos = newpos; ed->line--; if (ed->line < ed->topline) { ed->toppos = ed->linepos; ed->topline = ed->line; ed->refresh = 1; } adjust(ed); }
void pagedown(editor_t *ed, int select) { int i; update_selection(ed, select); for (i = 0; i < ed->lines; i++) { int newpos = next_line(ed, ed->linepos); if (newpos < 0) break; ed->linepos = newpos; ed->line++; ed->toppos = next_line(ed, ed->toppos); ed->topline++; } ed->refresh = 1; adjust(ed); }
void bottom(editor_t *ed, int select) { update_selection(ed, select); for (;;) { int newpos = next_line(ed, ed->linepos); if (newpos < 0) break; ed->linepos = newpos; ed->line++; if (ed->line >= ed->topline + ed->lines) { ed->toppos = next_line(ed, ed->toppos); ed->topline++; ed->refresh = 1; } } ed->col = ed->lastcol = line_length(ed, ed->linepos); adjust(ed); }
void down(editor_t *ed, int select) { int newpos; update_selection(ed, select); newpos = next_line(ed, ed->linepos); if (newpos < 0) return; ed->linepos = newpos; ed->line++; if (ed->line >= ed->topline + ed->lines) { ed->toppos = next_line(ed, ed->toppos); ed->topline++; ed->refresh = 1; } adjust(ed); }
void wordright(editor_t *ed, int select) { int pos, end, phase, next; update_selection(ed, select); pos = ed->linepos + ed->col; end = text_length(ed); next = next_line(ed, ed->linepos); phase = 0; while (pos < end) { int ch = get(ed, pos); if (phase == 0) { if (wordchar(ch)) phase = 1; } else { if (!wordchar(ch)) break; } pos++; if (pos == next) { ed->linepos = next; next = next_line(ed, ed->linepos); ed->line++; ed->refresh = 1; } } ed->col = pos - ed->linepos; if (ed->line >= ed->topline + ed->lines) { ed->toppos = next_line(ed, ed->toppos); ed->topline++; } ed->lastcol = ed->col; adjust(ed); }
void wordleft(editor_t *ed, int select) { int pos, phase; update_selection(ed, select); pos = ed->linepos + ed->col; phase = 0; while (pos > 0) { int ch = get(ed, pos - 1); if (phase == 0) { if (wordchar(ch)) phase = 1; } else { if (!wordchar(ch)) break; } pos--; if (pos < ed->linepos) { ed->linepos = prev_line(ed, ed->linepos); ed->line--; ed->refresh = 1; } } ed->col = pos - ed->linepos; if (ed->line < ed->topline) { ed->toppos = ed->linepos; ed->topline = ed->line; } ed->lastcol = ed->col; adjust(ed); }
void ElementsCtrlBase::OnSelectionChanged() { update_selection(); // -- first update this control's stuff that we have to do upon selection change m_btn_copy->Enable( m_selels.size() == 1 ); wxGetApp().mainframe()->edit_menu()->Enable( wxID_COPY, m_btn_copy->IsEnabled() ); m_btn_paste->Enable( m_copyfrom != 0 && m_selels.size() > 0 ); wxGetApp().mainframe()->edit_menu()->Enable( wxID_PASTE, m_btn_paste->IsEnabled() ); m_btn_reset->Enable( m_selels.size() > 0 ); m_btn_insert->Enable( m_selels.size() == 1 ); m_btn_delete->Enable( m_selels.size() > 0 ); for( cit_elements cit = m_selels.begin(); cit != m_selels.end(); ++cit ) if( !(*cit)->is_removable() ) { m_btn_delete->Enable(false); break; } // -- propagate the element selection wxGetApp().mainframe()->OnElementSelectionChanged(); }
void Overlay::draw (const Projection& projection, bool is_3D, int axis, int slice) { if (!is_3D) { // set up OpenGL environment: gl::Enable (gl::BLEND); gl::Disable (gl::DEPTH_TEST); gl::DepthMask (gl::FALSE_); gl::ColorMask (gl::TRUE_, gl::TRUE_, gl::TRUE_, gl::TRUE_); gl::BlendFunc (gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA); gl::BlendEquation (gl::FUNC_ADD); } bool need_to_update = false; for (int i = 0; i < image_list_model->rowCount(); ++i) { if (image_list_model->items[i]->show && !hide_all_button->isChecked()) { Item* image = dynamic_cast<Item*>(image_list_model->items[i]); need_to_update |= !std::isfinite (image->intensity_min()); image->transparent_intensity = image->opaque_intensity = image->intensity_min(); if (is_3D) window.get_current_mode()->overlays_for_3D.push_back (image); else image->render3D (image->slice_shader, projection, projection.depth_of (window.focus())); } } if (need_to_update) update_selection(); if (!is_3D) { // restore OpenGL environment: gl::Disable (gl::BLEND); gl::Enable (gl::DEPTH_TEST); gl::DepthMask (gl::TRUE_); } }
FormEfficiencyCalibration::FormEfficiencyCalibration(QSettings &settings, XMLableDB<Qpx::Detector>& newDetDB, QWidget *parent) : QWidget(parent), ui(new Ui::FormEfficiencyCalibration), detectors_(newDetDB), settings_(settings) { ui->setupUi(this); this->setWindowTitle("Efficiency calib"); loadSettings(); style_fit.default_pen = QPen(Qt::blue, 0); style_pts.themes["selected"] = QPen(Qt::black, 7); ui->PlotCalib->setLabels("channel", "energy"); ui->tablePeaks->verticalHeader()->hide(); ui->tablePeaks->setColumnCount(4); ui->tablePeaks->setHorizontalHeaderLabels({"chan", "energy", "cps", QString(QChar(0x03B5)) + "-rel"}); ui->tablePeaks->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tablePeaks->setSelectionMode(QAbstractItemView::ExtendedSelection); ui->tablePeaks->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tablePeaks->horizontalHeader()->setStretchLastSection(true); ui->tablePeaks->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->tablePeaks->show(); connect(ui->tablePeaks, SIGNAL(itemSelectionChanged()), this, SLOT(selection_changed_in_table())); connect(ui->PlotCalib, SIGNAL(selection_changed()), this, SLOT(selection_changed_in_calib_plot())); ui->PlotCalib->set_scale_type_x("Logarithmic"); ui->PlotCalib->set_scale_type_y("Logarithmic"); ui->isotopes->show(); connect(ui->isotopes, SIGNAL(isotopeSelected()), this, SLOT(isotope_chosen())); QShortcut* shortcut = new QShortcut(QKeySequence(QKeySequence::Delete), ui->tablePeaks); connect(shortcut, SIGNAL(activated()), this, SLOT(on_pushMarkerRemove_clicked())); ui->isotopes->set_editable(false); //file formats for opening mca spectra std::vector<std::string> spectypes = Qpx::Spectrum::Factory::getInstance().types(); QStringList filetypes; for (auto &q : spectypes) { Qpx::Spectrum::Template* type_template = Qpx::Spectrum::Factory::getInstance().create_template("1D"); if (!type_template->input_types.empty()) filetypes.push_back("Spectrum " + QString::fromStdString(q) + "(" + catExtensions(type_template->input_types) + ")"); delete type_template; } mca_load_formats_ = catFileTypes(filetypes); ui->plotSpectrum->setFit(&fit_data_); connect(ui->plotSpectrum, SIGNAL(selection_changed(std::set<double>)), this, SLOT(update_selection(std::set<double>))); connect(ui->plotSpectrum, SIGNAL(data_changed()), this, SLOT(update_data())); connect(ui->spectrumSelector, SIGNAL(itemSelected(SelectorItem)), this, SLOT(spectrumDetails(SelectorItem))); connect(ui->spectrumSelector, SIGNAL(itemToggled(SelectorItem)), this, SLOT(spectrumLooksChanged(SelectorItem))); }
void Overlay::selection_changed_slot (const QItemSelection &, const QItemSelection &) { update_selection(); }
/** * @brief Updates everything in the gui. */ void SpriteEditor::update() { update_sprite_id_field(); update_description_to_gui(); update_selection(); }
void home(editor_t *ed, int select) { update_selection(ed, select); ed->col = ed->lastcol = 0; adjust(ed); }
void end(editor_t *ed, int select) { update_selection(ed, select); ed->col = ed->lastcol = line_length(ed, ed->linepos); adjust(ed); }