コード例 #1
0
ファイル: selectioncontroller.cpp プロジェクト: aveminus/freq
    void SelectionController::
            toolfactory()
    {
        setLayout(new QHBoxLayout());
        layout()->setMargin(0);
        /*

#ifndef TARGET_hast
        ellipse_model_.reset( new Selections::EllipseModel(      render_view()->model));
        ellipse_view_.reset( new Selections::EllipseView(        ellipse_model_.data() ));
        ellipse_controller_ = new Selections::EllipseController( ellipse_view_.data(), this );
#endif
*/
        rectangle_model_.reset( new Selections::RectangleModel(      render_view()->model, _project ));
        rectangle_view_.reset( new Selections::RectangleView(        rectangle_model_.data() ));
        rectangle_controller_ = new Selections::RectangleController( rectangle_view_.data(), this );
/*
#ifndef TARGET_hast
        spline_model_.reset( new Selections::SplineModel(      render_view()->model));
        spline_view_.reset( new Selections::SplineView(        spline_model_.data(), &render_view()->model->project()->worker ));
        spline_controller_ = new Selections::SplineController( spline_view_.data(), this );

        peak_model_.reset( new Selections::PeakModel(       render_view()->model) );
        peak_view_.reset( new Selections::PeakView(         peak_model_.data(), &render_view()->model->project()->worker ));
        peak_controller_ = new Selections::PeakController(  peak_view_.data(), this );
#endif
*/
    }
コード例 #2
0
ファイル: BasicGrid.cpp プロジェクト: komiga/Onsang
void
BasicGrid::render_impl(
	UI::Widget::RenderData& rd
) noexcept {
	UI::GridRenderData grid_rd{
		rd,
		is_focused(),
		is_focused()
	};
	render_view(
		grid_rd,
		!enum_cast(queued_actions() & UI::UpdateActions::flag_noclear)
	);

	auto const& view = this->view();
	Rect const empty_frame{
		{view.content_frame.pos.x, view.content_frame.pos.y + view.row_count},
		{
			view.content_frame.size.width,
			max_ce(0, view.fit_count - view.row_count)
		}
	};
	if (0 < empty_frame.size.height) {
		grid_rd.rd.terminal.clear_back(empty_frame);
		grid_rd.rd.terminal.put_line(
			empty_frame.pos,
			empty_frame.size.height,
			Axis::vertical,
			tty::make_cell('~',
				tty::Color::blue | tty::Attr::bold,
				tty::Color::term_default
			)
		);
	}
}
コード例 #3
0
//-----------------------------------------------------------------------------
// name: on_event_2()
// desc: ...
//-----------------------------------------------------------------------------
t_CKUINT AudicleFaceShredder::on_event_2( const AudicleEvent & event )
{
    static t_CKUINT m_mouse_down = FALSE;
    static Point2D last;
    map<t_CKUINT, Shred_Data *>::iterator iter;
    t_CKBOOL hit = FALSE;
    Point2D diff;

    if( event.type == ae_event_INPUT )
    {
        InputEvent * ie = (InputEvent *)event.data;
        if( ie->type == ae_input_MOUSE )
        {
            ie->popStack();
            
            for( iter = m_map.begin(); iter != m_map.end(); iter++ )
            {
                if( ie->checkID( (*iter).second->name ) )
                {
                    if( ie->state == ae_input_DOWN )
                        (*iter).second->mouse_down = 1;
                    else
                    {
                        if( (*iter).second->mouse_down == 1 )
                            (*iter).second->mouse_clicked = 1;
                        (*iter).second->mouse_down = 0;
                        if( m_mouse_down )
                            m_mouse_down = FALSE;
                        fprintf( stderr, "click: %s\n", (*iter).second->stat->name.c_str() );
                    }
                }
            }
            
            if( hit == FALSE )
            {
                if( ie->state == ae_input_DOWN )
                {
                    m_mouse_down = TRUE;
                    last = ie->pos;
                }
                else
                    m_mouse_down = FALSE;
            }
        }
        else if( ie->type == ae_input_MOTION )
        {
            if( m_mouse_down )
            {
                m_eye_y += ( ie->pos - last ).length() * ( ie->pos[1] < last[1] ? 2.0 : -2.0 );
                last = ie->pos;
                render_view();
            }
        }
    }

    return AudicleFace::on_event( event );
}
コード例 #4
0
ファイル: selectioncontroller.cpp プロジェクト: aveminus/freq
 void SelectionController::
         mousePressEvent ( QMouseEvent * e )
 {
     if (Qt::RightButton == e->button())
     {
         this->setCurrentSelection(Signal::OperationDesc::ptr());
         render_view()->redraw();
     }
 }
コード例 #5
0
//-----------------------------------------------------------------------------
// name: on_event()
// desc: ...
//-----------------------------------------------------------------------------
t_CKUINT AudicleFaceVMSpace::on_event( const AudicleEvent & event )
{
    static t_CKUINT m_mouse_down = FALSE;
    static t_CKUINT which = 0;
    static Point2D last;
    t_CKBOOL hit = FALSE;
    Point2D diff;

    if( event.type == ae_event_INPUT )
    {
        InputEvent * ie = (InputEvent *)event.data;
        if( ie->type == ae_input_MOUSE )
        {
            ie->popStack();

            if( ie->checkID( g_id ) )
            {
                if( ie->state == ae_input_DOWN )
                {
                    hit = TRUE;
                    sphere_down = TRUE;
                }
                else
                {
                    if( !g_window ) g_window = g_hamm;
                    else if( g_window == g_hamm ) g_window = g_hann;
                    else if( g_window == g_hann ) g_window = g_rect;
                    else if( g_window == g_rect ) g_window = NULL;
                    g_changed = TRUE;
                    g_changedf = 1.0;
                    g_rate = .0250;
                }
            }
            
            if( ie->checkID( g_id2 ) )
            {
                if( ie->state == ae_input_DOWN )
                {
                    hit = TRUE;
                    sphere_down2 = TRUE;
                    g_rate = .0125;
                }
                else
                {
                    g_changed = TRUE;
                    g_changedf = 1.0;
                }
            }
            
            if( ie->state == ae_input_UP && sphere_down )
                sphere_down = FALSE;
                
            if( ie->state == ae_input_UP && sphere_down2 )
                sphere_down2 = FALSE;

            if( hit == FALSE )
            {
                if( ie->state == ae_input_DOWN )
                {
                    which = !!(ie->mods & ae_input_CTRL);
                    m_mouse_down = TRUE;
                    last = ie->pos;
                }
                else
                    m_mouse_down = FALSE;
            }
        }
        else if( ie->type == ae_input_MOTION )
        {
            if( m_mouse_down )
            {
                if( which )
                {
                    fp[0] += ( ie->pos - last ).length() * ( ie->pos[0] < last[0] ? -1.0 : 1.0 );
                    last = ie->pos;
                }
                else
                {
                    m_eye_y += ( ie->pos - last ).length() * ( ie->pos[1] < last[1] ? 2.0 : -2.0 );
                    last = ie->pos;
                    render_view();
                }
            }
        }
    }

    return AudicleFace::on_event( event );
}