Terminal::Terminal() { dock_hint = GdkRectangle{0, 0, 0, 0}; vte = vte_terminal_new(); char *argv[] = { vte_get_user_shell(), NULL }; vte_terminal_spawn_sync(VTE_TERMINAL(vte), VTE_PTY_DEFAULT, NULL, argv, NULL, (GSpawnFlags)0, NULL, NULL, &child_pid, NULL, NULL); set_orientation(Gtk::ORIENTATION_VERTICAL); scrollbox.set_orientation(Gtk::ORIENTATION_HORIZONTAL); scrollbar.set_orientation(Gtk::ORIENTATION_VERTICAL); eventbox.add(label); eventbox.signal_button_press_event().connect(mem_fun(this, &Terminal::header_button_press)); VteRegex *regex = vte_regex_new_for_match("(https?://|www\\.)[^\\s]*", -1, PCRE2_MULTILINE, NULL); vte_terminal_match_add_regex(VTE_TERMINAL(vte), regex, 0); vte_terminal_set_scrollback_lines(VTE_TERMINAL(vte), 10000); g_signal_connect(vte, "bell", G_CALLBACK(Terminal::vte_beep), this); g_signal_connect(vte, "child-exited", G_CALLBACK(Terminal::vte_child_exited), this); g_signal_connect(vte, "button-press-event", G_CALLBACK(Terminal::vte_click), this); g_signal_connect(vte, "focus-in-event", G_CALLBACK(Terminal::vte_got_focus), this); g_signal_connect(vte, "focus-out-event", G_CALLBACK(Terminal::vte_lost_focus), this); g_signal_connect(vte, "selection-changed", G_CALLBACK(Terminal::vte_selection_changed), this); g_signal_connect(vte, "window-title-changed", G_CALLBACK(Terminal::vte_title_changed), this); searchbar.add(searchentry); searchbar.connect_entry(searchentry); searchentry.signal_focus_out_event().connect(mem_fun(this, &Terminal::searchentry_lost_focus)); searchentry.signal_key_release_event().connect(mem_fun(this, &Terminal::searchentry_keypress)); pack_start(eventbox, false, false, 0); pack_start(scrollbox, true, true, 0); pack_start(searchbar, false, false, 0); gtk_box_pack_start(GTK_BOX(scrollbox.gobj()), vte, true, true, 0); scrollbox.pack_start(scrollbar, false, false, 0); gtk_range_set_adjustment(GTK_RANGE(scrollbar.gobj()), gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(vte))); show_all_children(); find_label.terminal = this; find_label.set_alignment(0.0, 0.5); find_window->list_box.prepend(find_label); std::vector<Gtk::TargetEntry> listTargets; listTargets.push_back(Gtk::TargetEntry("SvanTerminal", Gtk::TARGET_SAME_APP, 0)); eventbox.drag_source_set(listTargets); drag_dest_set(listTargets); eventbox.signal_drag_begin().connect(sigc::mem_fun(this, &Terminal::on_my_drag_begin)); eventbox.signal_drag_failed().connect(sigc::mem_fun(this, &Terminal::on_my_drag_failed)); eventbox.signal_drag_end().connect(sigc::mem_fun(this, &Terminal::on_my_drag_end)); signal_drag_motion().connect(sigc::mem_fun(this, &Terminal::on_my_drag_motion)); signal_drag_drop().connect(sigc::mem_fun(this, &Terminal::on_my_drag_drop)); signal_drag_leave().connect(sigc::mem_fun(this, &Terminal::on_my_drag_leave)); }
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); }
NotebooksTreeView::NotebooksTreeView(NoteManager & manager, const Glib::RefPtr<Gtk::TreeModel> & model) : Gtk::TreeView(model) , m_note_manager(manager) { // Set up the notebooksTree as a drag target so that notes // can be dragged into the notebook. std::vector<Gtk::TargetEntry> targets; targets.push_back(Gtk::TargetEntry ("text/uri-list", Gtk::TARGET_SAME_APP, 1)); drag_dest_set(targets, Gtk::DEST_DEFAULT_ALL, Gdk::ACTION_MOVE); }
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(); }
void skins_configure (void) { if (config_window) { gtk_window_present ((GtkWindow *) config_window); return; } GtkWidget *appearance_page_vbox; GtkWidget *vbox37; GtkWidget *vbox38; GtkWidget *hbox12; GtkWidget *alignment94; GtkWidget *hbox13; GtkWidget *label103; GtkWidget *alignment95; GtkWidget *skin_view_scrolled_window; appearance_page_vbox = gtk_vbox_new (FALSE, 0); vbox37 = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (appearance_page_vbox), vbox37, TRUE, TRUE, 0); vbox38 = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox37), vbox38, FALSE, TRUE, 0); hbox12 = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox38), hbox12, TRUE, TRUE, 0); alignment94 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_box_pack_start (GTK_BOX (hbox12), alignment94, TRUE, TRUE, 0); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment94), 0, 4, 0, 0); hbox13 = gtk_hbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (alignment94), hbox13); label103 = gtk_label_new_with_mnemonic (_("<b>_Skin</b>")); gtk_box_pack_start (GTK_BOX (hbox13), label103, TRUE, TRUE, 0); gtk_label_set_use_markup (GTK_LABEL (label103), TRUE); gtk_misc_set_alignment (GTK_MISC (label103), 0, 0); alignment95 = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_box_pack_start (GTK_BOX (vbox38), alignment95, TRUE, TRUE, 0); gtk_widget_set_size_request (alignment95, -1, 172); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment95), 0, 0, 12, 0); skin_view_scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (alignment95), skin_view_scrolled_window); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (skin_view_scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (skin_view_scrolled_window), GTK_SHADOW_IN); skin_view = gtk_tree_view_new (); skin_view_realize ((GtkTreeView *) skin_view); skin_view_update ((GtkTreeView *) skin_view); gtk_container_add (GTK_CONTAINER (skin_view_scrolled_window), skin_view); gtk_widget_set_size_request (skin_view, -1, 100); mlp_create_widgets(GTK_BOX(vbox37), appearance_misc_widgets, G_N_ELEMENTS(appearance_misc_widgets)); g_signal_connect(skin_view, "drag-data-received", G_CALLBACK(on_skin_view_drag_data_received), NULL); drag_dest_set(skin_view); g_signal_connect(mainwin, "drag-data-received", G_CALLBACK(mainwin_drag_data_received), skin_view); GtkWidget * hbox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start ((GtkBox *) appearance_page_vbox, hbox, FALSE, FALSE, 0); GtkWidget * button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); g_signal_connect (button, "clicked", (GCallback) skins_configure_cleanup, NULL); gtk_widget_set_can_default (button, TRUE); gtk_box_pack_end ((GtkBox *) hbox, button, FALSE, FALSE, 0); config_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (config_window, "destroy", (GCallback) gtk_widget_destroyed, & config_window); gtk_window_set_type_hint ((GtkWindow *) config_window, GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_title ((GtkWindow *) config_window, _("Interface Preferences")); gtk_window_set_resizable ((GtkWindow *) config_window, FALSE); gtk_container_set_border_width ((GtkContainer *) config_window, 6); gtk_container_add ((GtkContainer *) config_window, appearance_page_vbox); gtk_widget_show_all (config_window); }