ScriptSlots::ScriptSlots() :
    m_closeButton(Gtk::Stock::CLOSE)
{
    m_instrument = NULL;

    add(m_vbox);
    
    m_generalInfoLabel.set_text(_(
        "Each row (\"slot\") references one instrument script that shall be "
        "executed by the sampler for currently selected instrument. Slots are "
        "executed consecutively from top down."
    ));
    m_generalInfoLabel.set_line_wrap();
    m_vbox.pack_start(m_generalInfoLabel, Gtk::PACK_SHRINK);

    m_dragHintLabel.set_text(_(
        "Drag & drop a script from main window to this window to add a new "
        "script slot for this instrument."
    ));
    m_dragHintLabel.set_line_wrap();
    m_scrolledWindow.add(m_vboxSlots);
    m_scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    m_vbox.pack_start(m_scrolledWindow);
    
    m_vbox.pack_start(m_dragHintLabel, Gtk::PACK_SHRINK);

    m_buttonBox.set_layout(Gtk::BUTTONBOX_END);
    m_buttonBox.pack_start(m_closeButton);
    m_closeButton.set_can_default();
    m_closeButton.grab_focus();
    m_vbox.pack_start(m_buttonBox, Gtk::PACK_SHRINK);

    m_closeButton.signal_clicked().connect(
        sigc::mem_fun(*this, &ScriptSlots::onButtonClose)
    );
    
    signal_hide().connect(
        sigc::mem_fun(*this, &ScriptSlots::onWindowHide)
    );

    // establish drag&drop between scripts tree view on main diwno and this
    // ScriptSlots window
    std::vector<Gtk::TargetEntry> drag_target_gig_script;
    drag_target_gig_script.push_back(Gtk::TargetEntry("gig::Script"));
    drag_dest_set(drag_target_gig_script);
    signal_drag_data_received().connect(
        sigc::mem_fun(*this, &ScriptSlots::onScriptDragNDropDataReceived)
    );

    show_all_children();

    resize(460,300);
}
Exemple #2
0
Gui_MyWindow::Gui_MyWindow(Gui_ProcessorHandler& processor_hand,ProcessingOptions& opts):
     Gtk::Window(),

     m_processor_hand(processor_hand),

     m_controlPanel(m_processor_hand,m_result_map),
     m_draw_frame(m_processor_hand,m_controlPanel.signal_show_decorator(),m_controlPanel.signal_show_mask()),
     m_result_frame(m_processor_hand,m_controlPanel.signal_set_to_NA(),m_result_map),


     m_Cursor_wait (Gdk::WATCH)
{
    DEV_INFOS(Glib::get_user_config_dir ());

    this->set_title(PROGRAM_NAME);

    this->set_border_width(10);
    m_v_paned.set_border_width(5);


    this->add(m_hbox);
    m_hbox.pack_start(m_controlPanel,false,false);

    m_hbox.pack_start(m_v_paned);
    m_v_paned.pack1(m_draw_frame);
    m_v_paned.pack2(m_result_frame);

    this->show_all_children();
    this->show();


    /* Change the cursor when processing */
    m_processor_hand.signal_state().connect( sigc::mem_fun(*this,&Gui_MyWindow::changeCursor));

    /*For drag and drop*/
    std::list<Gtk::TargetEntry> listTargets;
    listTargets.push_back(Gtk::TargetEntry("text/uri-list"));
    drag_dest_set(listTargets, Gtk::DEST_DEFAULT_MOTION | Gtk::DEST_DEFAULT_DROP, Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
    signal_drag_data_received().connect(sigc::mem_fun(*this, &Gui_MyWindow::on_dropped_file));
    m_result_frame.signal_object_selected().connect(sigc::mem_fun(m_draw_frame, &Gui_DisplayFrame::on_show_specific_object));
    m_draw_frame.signal_click_on_obj().connect(sigc::mem_fun(m_result_frame, &Gui_ResultFrame::on_click_object)) ;
    m_ref_window = get_window();
}