Example #1
0
perftime::perftime( perform *a_perf, mainwnd *a_main, Adjustment *a_hadjust ) :
    m_black(Gdk::Color("black")),
    m_white(Gdk::Color("white")),
    m_grey(Gdk::Color("green")),
    //m_grey(Gdk::Color("grey")),

    m_mainperf(a_perf),
    m_mainwnd(a_main),
    m_hadjust(a_hadjust),

    m_perf_scale_x(c_perf_scale_x),

    m_4bar_offset(0),

    m_snap(c_ppqn),
    m_measure_length(c_ppqn * 4)
{
    add_events( Gdk::BUTTON_PRESS_MASK |
                Gdk::BUTTON_RELEASE_MASK );

    // in the constructor you can only allocate colors,
    // get_window() returns 0 because we have not been realized
    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();
    colormap->alloc_color( m_black );
    colormap->alloc_color( m_white );
    colormap->alloc_color( m_grey );

    m_hadjust->signal_value_changed().connect( mem_fun( *this, &perftime::change_horz ));

    set_double_buffered( false );
}
Example #2
0
seqtime::seqtime(sequence *a_seq, int a_zoom,
                 Gtk::Adjustment   *a_hadjust): DrawingArea() 
{     
    m_seq = a_seq;
    m_zoom = a_zoom;

    m_hadjust = a_hadjust;

    add_events( Gdk::BUTTON_PRESS_MASK | 
		Gdk::BUTTON_RELEASE_MASK );

    // in the construor you can only allocate colors, 
    // get_window() returns 0 because we have not be realized
    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();

    m_black = Gdk::Color( "black" );
    m_white = Gdk::Color( "white" );
    m_grey  = Gdk::Color( "grey" );

    colormap->alloc_color( m_black );
    colormap->alloc_color( m_white );
    colormap->alloc_color( m_grey );

    /* set default size */
    set_size_request( 10, c_timearea_y );

    m_scroll_offset_ticks = 0;
    m_scroll_offset_x = 0;

    set_double_buffered( false );
    

}
DimRegionChooser::DimRegionChooser()
{
    // get_window() would return 0 because the Gdk::Window has not yet been realized
    // So we can only allocate the colors here - the rest will happen in on_realize().
    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();

    black = Gdk::Color("black");
    white = Gdk::Color("white");
    red = Gdk::Color("#8070ff");
    blue = Gdk::Color("blue");
    green = Gdk::Color("green");

    colormap->alloc_color(black);
    colormap->alloc_color(white);
    colormap->alloc_color(red);
    colormap->alloc_color(blue);
    colormap->alloc_color(green);
    instrument = 0;
    region = 0;
    dimregno = -1;
    focus_line = 0;
    resize.active = false;
    cursor_is_resize = false;
    h = 20;
    w = 800;
    set_flags(Gtk::CAN_FOCUS);
    add_events(Gdk::BUTTON_PRESS_MASK | Gdk::POINTER_MOTION_MASK |
               Gdk::POINTER_MOTION_HINT_MASK);

    for (int i = 0 ; i < 256 ; i++) dimvalue[i] = 0;
}
Example #4
0
maintime::maintime( ): DrawingArea() 
{     
    // in the construor you can only allocate colors, 
    // get_window() returns 0 because we have not be realized
    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();

    m_black = Gdk::Color( "black" );
    m_white = Gdk::Color( "white" );
    m_grey  = Gdk::Color( "grey" );

    colormap->alloc_color( m_black );
    colormap->alloc_color( m_white );
    colormap->alloc_color( m_grey );

    m_tick = 0;
} 
Example #5
0
seqkeys::seqkeys(sequence *a_seq,
                 Gtk::Adjustment *a_vadjust ): DrawingArea() 
{     
    m_seq = a_seq;
    
    m_vadjust = a_vadjust;
    
    add_events( Gdk::BUTTON_PRESS_MASK | 
		Gdk::BUTTON_RELEASE_MASK |
		Gdk::ENTER_NOTIFY_MASK |
		Gdk::LEAVE_NOTIFY_MASK |
		Gdk::POINTER_MOTION_MASK |
		Gdk::SCROLL_MASK);

    /* set default size */
    set_size_request( c_keyarea_x +1, 10 );

    //m_window_x = 10;
    //m_window_y = c_keyarea_y;

    // in the construor you can only allocate colors, 
    // get_window() returns 0 because we have not be realized
    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();

    m_black = Gdk::Color( "black" );
    m_white = Gdk::Color( "white" );
    m_grey = Gdk::Color( "grey" );
  
    colormap->alloc_color( m_black );
    colormap->alloc_color( m_white );
    colormap->alloc_color( m_grey );
    
    m_keying = false;
    m_hint_state = false;

    m_scroll_offset_key = 0;
    m_scroll_offset_y = 0;

    m_scale = 0;
    m_key = 0;

    set_double_buffered( false );
}
Example #6
0
ClassificationCell::ClassificationCell()
{
  Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();
  
  white = Gdk::Color("white");
  green = Gdk::Color("green");
  lightgreen = Gdk::Color("light green");
  lightred= Gdk::Color("indian red");
  red = Gdk::Color("red");
  black = Gdk::Color("black");

  colormap->alloc_color(lightgreen);
  colormap->alloc_color(white);
  colormap->alloc_color(green);
  colormap->alloc_color(lightred);
  colormap->alloc_color(red);
  colormap->alloc_color(black);
  set_size_request(40, 30);

  value = 0.0;
}
Example #7
0
seqkeys::seqkeys
(
    sequence * a_seq,
    Gtk::Adjustment * a_vadjust
) :
    Gtk::DrawingArea        (),
    m_gc                    (),
    m_window                (),
    m_black                 (Gdk::Color("black")),
    m_white                 (Gdk::Color("white")),
    m_grey                  (Gdk::Color("grey")),
    m_pixmap                (),
    m_window_x              (0),
    m_window_y              (0),
    m_vadjust               (a_vadjust),
    m_seq                   (a_seq),
    m_scroll_offset_key     (0),
    m_scroll_offset_y       (0),
    m_hint_state            (false),
    m_hint_key              (0),
    m_keying                (false),
    m_keying_note           (0),
    m_scale                 (0),
    m_key                   (0)
{
    add_events
    (
        Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK |
        Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK |
        Gdk::POINTER_MOTION_MASK | Gdk::SCROLL_MASK
    );
    set_size_request(c_keyarea_x + 1, 10);          /* set default size */

    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();
    colormap->alloc_color(m_black);
    colormap->alloc_color(m_white);
    colormap->alloc_color(m_grey);
    set_double_buffered(false);
}
RegionChooser::RegionChooser() :
    m_VirtKeybModeChoice(_("Virtual Keyboard Mode")),
    currentActiveKey(-1)
{
    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();

    red = Gdk::Color("#8070ff");
    grey1 = Gdk::Color("#b0b0b0");
    activeKeyColor = Gdk::Color("#ff0000");
    white = Gdk::Color("#ffffff");
    black = Gdk::Color("#000000");

    colormap->alloc_color(red);
    colormap->alloc_color(grey1);
    colormap->alloc_color(activeKeyColor);
    colormap->alloc_color(white);
    colormap->alloc_color(black);
    instrument = 0;
    region = 0;
    resize.active = false;
    move.active = false;
    cursor_is_resize = false;
    h1 = REGION_BLOCK_HEIGHT;

    // properties of the virtual keyboard
    {
        const char* choices[] = { _("normal"), _("chord"), NULL };
        static const virt_keyboard_mode_t values[] = {
            VIRT_KEYBOARD_MODE_NORMAL,
            VIRT_KEYBOARD_MODE_CHORD
        };
        m_VirtKeybModeChoice.set_choices(choices, values);
        m_VirtKeybModeChoice.set_value(VIRT_KEYBOARD_MODE_NORMAL);
    }
    m_VirtKeybVelocityLabelDescr.set_text(_("Note-On Velocity:"));
    m_VirtKeybVelocityLabel.set_text("-");
    m_VirtKeybOffVelocityLabelDescr.set_text(_("Note-Off Velocity:"));
    m_VirtKeybOffVelocityLabel.set_text("-");
    m_VirtKeybPropsBox.pack_start(m_VirtKeybModeChoice.label, Gtk::PACK_SHRINK);
    m_VirtKeybPropsBox.pack_start(m_VirtKeybModeChoice.widget, Gtk::PACK_SHRINK);
    m_VirtKeybPropsBox.pack_start(m_VirtKeybVelocityLabelDescr, Gtk::PACK_SHRINK);
    m_VirtKeybPropsBox.pack_start(m_VirtKeybVelocityLabel, Gtk::PACK_SHRINK);
    m_VirtKeybPropsBox.pack_start(m_VirtKeybOffVelocityLabelDescr, Gtk::PACK_SHRINK);
    m_VirtKeybPropsBox.pack_start(m_VirtKeybOffVelocityLabel, Gtk::PACK_SHRINK);
    m_VirtKeybPropsBox.set_spacing(10);
    m_VirtKeybPropsBox.show();

    actionGroup = Gtk::ActionGroup::create();
    actionGroup->add(Gtk::Action::create("Properties",
                                         Gtk::Stock::PROPERTIES),
                     sigc::mem_fun(*this,
                                   &RegionChooser::show_region_properties));
    actionGroup->add(Gtk::Action::create("Remove", Gtk::Stock::REMOVE),
                     sigc::mem_fun(*this, &RegionChooser::delete_region));
    actionGroup->add(Gtk::Action::create("Add", Gtk::Stock::ADD),
                     sigc::mem_fun(*this, &RegionChooser::add_region));
    actionGroup->add(Gtk::Action::create("Dimensions", _("Dimensions...")),
                     sigc::mem_fun(*this, &RegionChooser::manage_dimensions));

    uiManager = Gtk::UIManager::create();
    uiManager->insert_action_group(actionGroup);
    Glib::ustring ui_info =
        "<ui>"
        "  <popup name='PopupMenuInsideRegion'>"
        "    <menuitem action='Properties'/>"
        "    <menuitem action='Dimensions'/>"
        "    <menuitem action='Remove'/>"
        "  </popup>"
        "  <popup name='PopupMenuOutsideRegion'>"
        "    <menuitem action='Add'/>"
        "  </popup>"
        "</ui>";
    uiManager->add_ui_from_string(ui_info);

    popup_menu_inside_region = dynamic_cast<Gtk::Menu*>(
        uiManager->get_widget("/PopupMenuInsideRegion"));
    popup_menu_outside_region = dynamic_cast<Gtk::Menu*>(
        uiManager->get_widget("/PopupMenuOutsideRegion"));

    add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK |
               Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK);

    dimensionManager.region_to_be_changed_signal.connect(
        region_to_be_changed_signal.make_slot()
    );
    dimensionManager.region_changed_signal.connect(
        region_changed_signal.make_slot()
    );
    dimensionManager.region_changed_signal.connect(
        sigc::hide(
            sigc::mem_fun(*this, &RegionChooser::on_dimension_manager_changed)
        )
    );
    keyboard_key_hit_signal.connect(
        sigc::mem_fun(*this, &RegionChooser::on_note_on_event)
    );
    keyboard_key_released_signal.connect(
        sigc::mem_fun(*this, &RegionChooser::on_note_off_event)
    );
}
Example #9
0
perfroll::perfroll( perform *a_perf,
                    perfedit * a_perf_edit,
                    Adjustment * a_hadjust,
                    Adjustment * a_vadjust  ) :
    m_window(NULL),
    m_black(Gdk::Color("black")),
    m_white(Gdk::Color("white")),
    m_grey(Gdk::Color("grey")),
    m_lt_grey(Gdk::Color("light grey")),

    m_pixmap(NULL),
    m_mainperf(a_perf),
    m_perfedit(a_perf_edit),

    m_perf_scale_x(c_perf_scale_x),       // 32 ticks per pixel

    m_old_progress_ticks(0),

    m_4bar_offset(0),
    m_sequence_offset(0),
    m_roll_length_ticks(0),
    m_drop_y(0),
    m_drop_sequence(0),

    m_vadjust(a_vadjust),
    m_hadjust(a_hadjust),

    m_moving(false),
    m_growing(false),

    have_button_press(false),
    transport_follow(true),
    trans_button_press(false),
    m_zoom(c_perf_scale_x)
{
    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();
    colormap->alloc_color( m_black );
    colormap->alloc_color( m_white );
    colormap->alloc_color( m_grey );
    colormap->alloc_color( m_lt_grey );

    //m_text_font_6_12 = Gdk_Font( c_font_6_12 );

    add_events( Gdk::BUTTON_PRESS_MASK |
                Gdk::BUTTON_RELEASE_MASK |
                Gdk::POINTER_MOTION_MASK |
                Gdk::KEY_PRESS_MASK |
                Gdk::KEY_RELEASE_MASK |
                Gdk::FOCUS_CHANGE_MASK |
                Gdk::SCROLL_MASK );

    set_size_request( 10, 10 );

    set_double_buffered( false );

    for( int i=0; i<c_total_seqs; ++i )
        m_sequence_active[i]=false;

    switch (global_interactionmethod)
    {
    case e_fruity_interaction:
        m_interaction = new FruityPerfInput;
        break;
    default:
    case e_seq32_interaction:
        m_interaction = new Seq32PerfInput;
        break;
    }
}
Example #10
0
seqroll::seqroll(perform *a_perf,
                 sequence *a_seq, 
                 int a_zoom, 
                 int a_snap, 
                 seqdata *a_seqdata_wid, 
                 seqevent *a_seqevent_wid,
                 seqkeys *a_seqkeys_wid,
                 int a_pos, 
                 Adjustment *a_hadjust,
                 Adjustment *a_vadjust )
: DrawingArea() 
{    
    using namespace Menu_Helpers;

    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();

    m_black = Gdk::Color( "black" );
    m_white = Gdk::Color( "white" );
    m_grey  = Gdk::Color( "gray" );
    m_dk_grey = Gdk::Color( "gray50" );
    m_red = Gdk::Color( "orange" );

    colormap->alloc_color( m_black );
    colormap->alloc_color( m_white );
    colormap->alloc_color( m_grey );
    colormap->alloc_color( m_dk_grey );
    colormap->alloc_color( m_red );

    m_perform = a_perf;
    m_seq =   a_seq;
    m_zoom = a_zoom;
    m_snap =  a_snap;
    m_seqdata_wid = a_seqdata_wid;
    m_seqevent_wid = a_seqevent_wid;
    m_seqkeys_wid = a_seqkeys_wid;
    m_pos = a_pos;

    m_clipboard = new sequence( );

    add_events( Gdk::BUTTON_PRESS_MASK | 
		Gdk::BUTTON_RELEASE_MASK |
		Gdk::POINTER_MOTION_MASK |
		Gdk::KEY_PRESS_MASK |
		Gdk::KEY_RELEASE_MASK |
		Gdk::FOCUS_CHANGE_MASK |
		Gdk::ENTER_NOTIFY_MASK |
		Gdk::LEAVE_NOTIFY_MASK |
		Gdk::SCROLL_MASK);

    m_selecting = false;
    m_moving    = false;
	m_moving_init = false;
    m_growing   = false;
    m_adding    = false;
    m_painting  = false;
    m_paste     = false;

    m_old_progress_x = 0;

    m_scale = 0;
    m_key = 0;

    m_vadjust = a_vadjust;
    m_hadjust = a_hadjust;

    m_window_x = 10;
    m_window_y = 10;

    m_scroll_offset_ticks = 0;
    m_scroll_offset_key = 0;

    m_scroll_offset_x = 0;
    m_scroll_offset_y = 0;

    m_background_sequence = 0;
    m_drawing_background_seq = false;

    set_double_buffered( false );
}
Example #11
0
seqroll::seqroll
(
    perform * a_perf,
    sequence * a_seq,
    int a_zoom,
    int a_snap,
    seqdata * a_seqdata_wid,
    seqevent * a_seqevent_wid,
    seqkeys * a_seqkeys_wid,
    int a_pos,
    Gtk::Adjustment * a_hadjust,
    Gtk::Adjustment * a_vadjust
) :
    m_gc                    (),
    m_window                (),
    m_black                 (Gdk::Color("black")),
    m_white                 (Gdk::Color("white")),
    m_grey                  (Gdk::Color("gray")),
    m_dk_grey               (Gdk::Color("gray50")),
    m_red                   (Gdk::Color("orange")),
    m_pixmap                (),
    m_mainperf              (a_perf),
    m_window_x              (10),       // why so small?
    m_window_y              (10),
    m_current_x             (0),
    m_current_y             (0),
    m_drop_x                (0),
    m_drop_y                (0),
    m_vadjust               (a_vadjust),
    m_hadjust               (a_hadjust),
    m_background            (),         // another pixmap
    m_old                   (),
    m_selected              (),
    m_seq                   (a_seq),
    m_clipboard             (new sequence()),
    m_seqdata_wid           (a_seqdata_wid),
    m_seqevent_wid          (a_seqevent_wid),
    m_seqkeys_wid           (a_seqkeys_wid),
    m_fruity_interaction    (),
    m_seq24_interaction     (),
    m_pos                   (a_pos),
    m_zoom                  (a_zoom),
    m_snap                  (a_snap),
    m_note_length           (0),
    m_scale                 (0),
    m_key                   (0),
    m_selecting             (false),
    m_moving                (false),
    m_moving_init           (false),
    m_growing               (false),
    m_painting              (false),
    m_paste                 (false),
    m_is_drag_pasting       (false),
    m_is_drag_pasting_start (false),
    m_justselected_one      (false),
    m_move_delta_x          (0),
    m_move_delta_y          (0),
    m_move_snap_offset_x    (0),
    m_old_progress_x        (0),
    m_scroll_offset_ticks   (0),
    m_scroll_offset_key     (0),
    m_scroll_offset_x       (0),
    m_scroll_offset_y       (0),
    m_background_sequence   (0),
    m_drawing_background_seq(false),
    m_ignore_redraw         (false)
{
    Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap();
    colormap->alloc_color(m_black);
    colormap->alloc_color(m_white);
    colormap->alloc_color(m_grey);
    colormap->alloc_color(m_dk_grey);
    colormap->alloc_color(m_red);

//  m_clipboard = new sequence();

    add_events
    (
        Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK |
        Gdk::POINTER_MOTION_MASK | Gdk::KEY_PRESS_MASK |
        Gdk::KEY_RELEASE_MASK | Gdk::FOCUS_CHANGE_MASK |
        Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK |
        Gdk::SCROLL_MASK
    );
    set_double_buffered(false);
}