Example #1
0
options::options (Gtk::Window & parent, perform * a_p):
    Gtk::Dialog ("Options", parent, true, true),
    m_perf(a_p)
{
#if GTK_MINOR_VERSION < 12
    m_tooltips = manage(new Tooltips());
#endif

    HBox *hbox = manage (new HBox ());
    get_vbox ()->pack_start (*hbox, false, false);

    get_action_area ()->set_border_width (2);
    hbox->set_border_width (6);

    m_button_ok = manage (new Button(Gtk::Stock::OK));
    get_action_area ()->pack_end (*m_button_ok, false, false);
    m_button_ok->signal_clicked ().connect (mem_fun (*this, &options::hide));

    m_notebook = manage (new Notebook ());
    hbox->pack_start (*m_notebook);

    add_midi_clock_page();
    add_midi_input_page();
    add_keyboard_page();
    add_mouse_page();
    add_jack_sync_page();
}
void
ExpireDialog::init()
{
    _spinner.set_numeric (true);
    _spinner.set_digits (1);
    _spinner.set_range (0, 30);
    _spinner.set_snap_to_ticks();
    _spinner.set_adjustment (_adj);
    _spinner.set_value (AppContext::get().get_expire());

    Gtk::VBox *vbox = get_vbox();
    vbox->pack_start (_label1, Gtk::PACK_SHRINK, 10);
    _box.add (*new Gtk::HBox);
    _box.pack_start (_spinner, Gtk::PACK_SHRINK, 10);
    _box.pack_start (_label2, Gtk::PACK_SHRINK, 0);
    _box.add (*new Gtk::HBox);
    vbox->pack_start (_box, Gtk::PACK_EXPAND_PADDING, 10);

    add_button (_("Do expire"), 1);
    add_button (Gtk::Stock::CANCEL, 0);

    /// Move focus to Do button
    cwidget_list_t list = get_action_area()->get_children();
    for (cwidget_list_t::iterator it = list.begin(); it != list.end(); ++it)
        if (get_response_for_widget (**it) == 1)
        { const_cast<Widget&>(**it).grab_focus(); break; }
    
    _changed_connection = _adj.signal_value_changed().connect (
            sigc::mem_fun (*this, &ExpireDialog::on_value_changed));
    
    show_all();
}
Example #3
0
ResolutionDialog::ResolutionDialog( Gtk::Widget * widget )
:	Dialog			( _("Resolution") ),
	m_resetButton	( Gtk::Stock::UNDO ),
	m_applyButton	( Gtk::Stock::APPLY ),
	m_widget		( widget ),
	m_oldResolution	( widget->get_width(), widget->get_height() ),
	m_newResolution	( 0, 0 )
{
	// Creates the main layout.
	Gtk::Label	* label = Gtk::manage( new Gtk::Label(_("Select, in the list bellow, a resolution to apply, \nor specify your own."), 0, 0) );
	Gtk::VBox	* box	= Gtk::manage( new Gtk::VBox(false, 8) );
	
	box->set_border_width( 12 );
	box->pack_start( *label, Gtk::PACK_SHRINK );
	box->pack_start( m_resolutions, Gtk::PACK_SHRINK );
	get_vbox()->add( *box );
	
	
	// Adds buttons.
	get_action_area()->add( m_resetButton );
	get_action_area()->add( m_applyButton );
	add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE );
	
	m_applyButton.set_sensitive( false );
	
	
	// Connects to some signals.
	m_applyButton.signal_clicked().connect( sigc::mem_fun(this, &ResolutionDialog::applyClicked) );
	m_resetButton.signal_clicked().connect( sigc::mem_fun(this, &ResolutionDialog::resetClicked) );
	m_resolutions.get_entry()->signal_changed().connect( sigc::mem_fun(this, &ResolutionDialog::resolutionChanged) );
	
	
	// Fills the resolution box with predefined resolutions.
	m_resolutions.append_text(_("1024x768"));
	m_resolutions.append_text(_("800x600"));
	m_resolutions.append_text(_("720x576"));
	m_resolutions.append_text(_("640x480"));
	
	
	// Shows the whole things
	show_all();
	
	
	// Assigns the initial resolution.
	m_resolutions.get_entry()->set_text( resolutionToString(m_oldResolution.first, m_oldResolution.second) );
}
Example #4
0
AboutDialog::AboutDialog () : OK("OK"), canvas() {
  set_title ("About EOGI");
  set_usize (400, 200);
  // don't allow resizing
  set_policy ( false, false, false );

  get_vbox()->add( &canvas );
  get_action_area()->add( &OK );

  connect_to_method ( OK.clicked, this, &AboutDialog::ok_clicked );
	
  OK.show();
  canvas.show();
}
Example #5
0
TDialogInit::TDialogInit(unsigned _max, 
			 unsigned *_generaciones, unsigned *_tamPop, 
			 unsigned *_numGenes, unsigned *_bitXgen,
			 unsigned *_rangeVal,
			 float *_rate, float *_select,
			 unsigned *_OkCancel) :
  OK("OK"), Cancel("Cancel"), 
  frameG("Number of Generations"), cajaG(false, 5),
  frameP("Initial Pop. Size"), cajaP(false, 5),
  frameNG("Num. Genes"), cajaNG(false, 5),
  frameBG("Bits x Gen"), cajaBG(false, 5),
  frameR("Rate to kill"), cajaR(false, 5),
  frameS("\% to reproduce"), cajaS(false, 5),
  devG(_generaciones), devP(_tamPop), devNG(_numGenes), devBG(_bitXgen),
  devR(_rate), devS(_select),
  OkCancel(_OkCancel), max(_max)
{
  set_title ("Initial Parameters");
  set_policy ( false, false, false );

  set_border_width(3);

  cajaG.set_border_width (7);
  cajaP.set_border_width (7);
  cajaNG.set_border_width (7);
  cajaBG.set_border_width (7);
  cajaR.set_border_width (7);
  cajaS.set_border_width (7);
  
  // value, lower, upper, step incr, page incr, page size
  //number of generations.
  AdjG = new Gtk_Adjustment ( (*devG), 0,max, 1,10, 0 );
  ScaleG = new Gtk_HScale(*AdjG);
  ScaleG->set_digits(0); // make scales use integers
  ScalesBoxG = new Gtk_VBox(false, 0);
  ScalesBoxG->pack_end (*ScaleG);
  ScaleG->show();
  ScalesBoxG->show();

  //pop. size
  AdjP = new Gtk_Adjustment ( (*devP), 0,max, 1,10, 0 );
  ScaleP = new Gtk_HScale(*AdjP);
  ScaleP->set_digits(0);
  ScalesBoxP = new Gtk_VBox(false, 0);
  ScalesBoxP->pack_end (*ScaleP);
  ScaleP->show();
  ScalesBoxP->show();

  //number of genes
  AdjNG = new Gtk_Adjustment ( (*devNG), 1,100, 1,10, 0 );
  ScaleNG = new Gtk_HScale(*AdjNG);
  ScaleNG->set_digits(0); // make scales use integers
  ScalesBoxNG = new Gtk_VBox(false, 0);
  ScalesBoxNG->pack_end (*ScaleNG);
  ScaleNG->show();
  ScalesBoxNG->show();

  //bits x gen
  AdjBG = new Gtk_Adjustment ( (*devBG), 1,100, 1,10, 0 );
  ScaleBG = new Gtk_HScale(*AdjBG);
  ScaleBG->set_digits(0); // make scales use integers
  ScalesBoxBG = new Gtk_VBox(false, 0);
  ScalesBoxBG->pack_end (*ScaleBG);
  ScaleBG->show();
  ScalesBoxBG->show();

  //rate for the coach
  AdjR = new Gtk_Adjustment ( (*devR), 0.0,1.0, 0.1,0.2, 0 );
  ScaleR = new Gtk_HScale(*AdjR);
  ScaleR->set_digits(1);
  ScalesBoxR = new Gtk_VBox(false, 0);
  ScalesBoxR->pack_end (*ScaleR);
  ScaleR->show();
  ScalesBoxR->show();

  //select for the chaperon
  AdjS = new Gtk_Adjustment ( (*devS), 0.0,100.0, 1.0,10.0, 0 );
  ScaleS = new Gtk_HScale(*AdjS);
  ScaleS->set_digits(1);
  ScalesBoxS = new Gtk_VBox(false, 0);
  ScalesBoxS->pack_end (*ScaleS);
  ScaleS->show();
  ScalesBoxS->show();

  // More assembly...
  Gtk_HBox * aa = get_action_area();
  aa->add(&OK);
  aa->add(&Cancel);
  OK.show();
  Cancel.show();

  Gtk_VBox * v = get_vbox();
  v->add(&frameG);
  v->add(&frameP);
  v->add(&frameNG);
  v->add(&frameBG);
  v->add(&frameR);
  v->add(&frameS);
  frameG.add(&cajaG);
  frameP.add(&cajaP);
  frameNG.add(&cajaNG);
  frameBG.add(&cajaBG);
  frameR.add(&cajaR);
  frameS.add(&cajaS);
  cajaG.pack_start(*ScalesBoxG);
  cajaP.pack_start(*ScalesBoxP);
  cajaNG.pack_start(*ScalesBoxNG);
  cajaBG.pack_start(*ScalesBoxBG);
  cajaR.pack_start(*ScalesBoxR);
  cajaS.pack_start(*ScalesBoxS);

  cajaG.show();
  cajaP.show();
  cajaNG.show();
  cajaBG.show();
  cajaR.show();
  cajaS.show();

  frameG.show();
  frameP.show();
  frameNG.show();
  frameBG.show();
  frameR.show();
  frameS.show();

  connect_to_method( OK.clicked,this,&TDialogInit::ok_clicked );
  connect_to_method( Cancel.clicked,this,&TDialogInit::cancel_clicked );

}

void TDialogInit::ok_clicked() {
  *devG=(unsigned) AdjG->get_value();
  *devP=(unsigned) AdjP->get_value();
  //  *devNG=(unsigned) AdjNG->get_value();
  //  *devBG=(unsigned) AdjBG->get_value();
  *devR=(float) AdjR->get_value();
  *devS=(float) AdjS->get_value();
  *OkCancel = 1;
  closed();
}
MESignPostInfoDialog::MESignPostInfoDialog(
      OldConnection* conn, uint32 toNodeID, MEMapArea* mapArea)
{

   m_connection = conn;
   m_toNodeID = toNodeID;
   m_mapArea = mapArea;
   m_editSpDialog = NULL;

   char tmpStr[256];
   sprintf( tmpStr, "%s, 0x%x",
            "Sign post info", m_mapArea->getMap()->getMapID() );
   set_title(tmpStr);
   
   // list with all sign posts for this connection
   Gtk::Frame* frame = manage(new Gtk::Frame("Signposts:"));

   // Create ListStore and add to TreeView
   m_listStore = Gtk::ListStore::create(m_columns);
   m_treeView.set_model(m_listStore);

   // Add visible columns to TreeView
   m_treeView.append_column("REMOVE ME", m_columns.m_info);
   m_treeView.set_headers_visible(false);

   // Create selection object to handle selections
   m_selection = m_treeView.get_selection();
   if(!m_selection)
   { 
      // If this doesn't work we're in trouble.
      mc2log << error << "No selection object created for corresponding "
             << "TreeView" << endl;
      MC2_ASSERT(false);
   }


   Gtk::ScrolledWindow* scrolledWin = manage(new Gtk::ScrolledWindow());
   scrolledWin->set_size_request(200, 150);
   scrolledWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
   scrolledWin->add(m_treeView);
   frame->add(*scrolledWin);
   get_vbox()->pack_start(*frame, true, true, 5);

   // buttons for Edit and Close in the action area
   Gtk::HBox* actionBox = manage(new Gtk::HBox());
   if (m_mapArea != NULL) {
      Gtk::Button* editButton = manage(new Gtk::Button("Edit"));
      editButton->set_size_request(75, 25);
      editButton->signal_clicked().connect(
            sigc::mem_fun(*this, &MESignPostInfoDialog::editSpPressed));
      actionBox->pack_start(*editButton);
   } else {
      // empty label..
      Gtk::Label* editLabel = manage(new Gtk::Label(""));
      editLabel->set_size_request(75, 25);
      actionBox->pack_start(*editLabel);
   }
   Gtk::Button* closeButton = manage(new Gtk::Button("Close"));
   closeButton->signal_clicked().connect(
                  sigc::mem_fun(*this, &MESignPostInfoDialog::closePressed));
   closeButton->set_size_request(75, 25);
   actionBox->pack_start(*closeButton);
   get_action_area()->pack_start(*actionBox);

   // Don't show the dialog now, wait for show()-command.
}
Example #7
0
void
file_chooser::common_ctor_logic_()
{
  do_overwrite_confirmation_ = true;
  single_image_mode_         = false;

  if (!column) column = new model_columns;

  Glib::RefPtr< Gtk::ListStore > types;
  types = Gtk::ListStore::create (*column);
  {
    Gtk::TreeModel::Row r;
    extension_list      l;

    r = *(types->append ());
    r[column->text] = _("By extension");
    r[column->exts] = l;

    r = *(types->append ());
    r[column->text] = _("JPEG");
#if __cplusplus >= 201103L
    l = {".jpeg", ".jpg"};
#else
    l = list_of (".jpeg")(".jpg");
#endif
    r[column->exts] = l;

    r = *(types->append ());
    r[column->text] = _("PDF");
#if __cplusplus >= 201103L
    l = {".pdf"};
#else
    l = list_of (".pdf");
#endif
    r[column->exts] = l;

    r = *(types->append ());
    r[column->text] = _("PNG");
#if __cplusplus >= 201103L
    l = {".png"};
#else
    l = list_of (".png");
#endif
    r[column->exts] = l;

    r = *(types->append ());
    r[column->text] = _("PNM");
#if __cplusplus >= 201103L
    l = {".pnm"};
#else
    l = list_of (".pnm");
#endif
    r[column->exts] = l;

    r = *(types->append ());
    r[column->text] = _("TIFF");
#if __cplusplus >= 201103L
    l = {".tiff", ".tif"};
#else
    l = list_of (".tiff")(".tif");
#endif
    r[column->exts] = l;
  }

  file_type_.set_model (types);
  file_type_.set_headers_visible (false);
  file_type_.append_column ("", column->text);
  file_type_.set_rules_hint ();
  file_type_.get_selection ()->signal_changed ()
    .connect (sigc::mem_fun (*this, &file_chooser::on_file_type_changed));

  expander_.set_label (_("File Type"));
  expander_.add (file_type_);

  single_file_.set_label (_("Save all images in a single file"));
  single_file_.signal_toggled ()
    .connect (sigc::mem_fun (*this, &file_chooser::on_single_file_toggled));

  Gtk::VBox *extras (Gtk::manage (new Gtk::VBox));
  extras->pack_start (expander_);
  extras->pack_start (single_file_);

  // Set up the dialog, using layout values from Gtk::FileChooserDialog
  set_has_separator (false);
  set_border_width (5);
  get_action_area ()->set_border_width (5);

  Gtk::Box *content_area = get_vbox ();
  content_area->set_spacing (2);
  content_area->pack_start (impl_  , Gtk::PACK_EXPAND_WIDGET);
  content_area->pack_start (*extras, Gtk::PACK_SHRINK);
  content_area->show_all ();
  {
    // FIXME determine the default width and height in a way similar
    //       to how Gtk::FileChooserDialog does.  Its implementation
    //       uses an internal function which takes font information
    //       and numbers of characters and lines into account.
    //       See file_chooser_widget_default_size_changed()
    int width = 800, height = 600;
    set_default_size (width, height);
  }

  add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  add_button (Gtk::Stock::OK    , Gtk::RESPONSE_ACCEPT);

  // FIXME leave this to the "application" or tie it to file_type_
  {
    Gtk::FileFilter filter;
    filter.add_mime_type ("application/pdf");
    filter.add_mime_type ("image/*");
    filter.set_name (_("PDFs and Image Files"));
    add_filter (filter);
  }
  {
    Gtk::FileFilter filter;
    filter.add_mime_type ("image/*");
    filter.set_name (_("Image Files"));
    add_filter (filter);
  }
  {
    Gtk::FileFilter filter;
    filter.add_pattern ("*");
    filter.set_name (_("All Files"));
    add_filter (filter);
  }

  gui_name_change_dispatch_
    .connect (sigc::mem_fun (*this, &file_chooser::signal_name_change_));
  signal_name_change ()
    .connect (sigc::mem_fun (*this, &file_chooser::on_name_change_));

  cancel_watch_ = false;
  watch_thread_ = new thread (&file_chooser::watch_, this);
}
Example #8
0
options::options (Gtk::Window & parent, perform * a_p):
    Gtk::Dialog ("Options", parent, true, true)
{
    m_perf = a_p;
    VBox *vbox = NULL;
    
    HBox *hbox = manage (new HBox ());
    get_vbox ()->pack_start (*hbox, false, false);

    get_action_area ()->set_border_width (2);
    hbox->set_border_width (6);

    m_button_ok = manage (new Button ("Ok"));
    get_action_area ()->pack_end (*m_button_ok, false, false);
    m_button_ok->signal_clicked ().connect (mem_fun (*this, &options::hide));


    m_notebook = manage (new Notebook ());
    hbox->pack_start (*m_notebook);

    // Clock  Buses
    int buses = m_perf->get_master_midi_bus ()->get_num_out_buses ();
    //Notebook *clock_notebook = manage( new Notebook());
    //clock_notebook->set_scrollable(true);

    vbox = manage(new VBox());
    m_notebook->pages().push_back(Notebook_Helpers::TabElem(*vbox,
                "MIDI Clock"));

    CheckButton *check;
    Label *label;
    
    Gtk::Tooltips * tooltips = manage (new Tooltips ());

    for (int i = 0; i < buses; i++)
    {  
        HBox *hbox2 = manage (new HBox ());
        label = manage( new Label(m_perf->get_master_midi_bus ()->
                                            get_midi_out_bus_name (i), 0));

        hbox2->pack_start (*label, false, false);
        
        
        Gtk::RadioButton * rb_off = manage (new RadioButton ("Off"));
        add_tooltip( rb_off, "Midi Clock will be disabled.");
        
        Gtk::RadioButton * rb_on = manage (new RadioButton ("On (Pos)"));
        add_tooltip( rb_on,
                "Midi Clock will be sent. Midi Song Position and Midi Continue will be sent if starting greater than tick 0 in song mode, otherwise Midi Start is sent.");

        Gtk::RadioButton * rb_mod = manage (new RadioButton ("On (Mod)"));
        add_tooltip( rb_mod, "Midi Clock will be sent.  Midi Start will be sent and clocking will begin once the song position has reached the modulo of the specified Size. (Used for gear that doesn't respond to Song Position)");

        Gtk::RadioButton::Group group = rb_off->get_group ();
        rb_on->set_group (group);
        rb_mod->set_group (group);

        rb_off->signal_toggled().connect (sigc::bind(mem_fun (*this, &options::clock_callback_off), i, rb_off ));
        rb_on->signal_toggled ().connect (sigc::bind(mem_fun (*this, &options::clock_callback_on),  i, rb_on  ));
        rb_mod->signal_toggled().connect (sigc::bind(mem_fun (*this, &options::clock_callback_mod), i, rb_mod ));
        
        hbox2->pack_end (*rb_mod, false, false ); 
        hbox2->pack_end (*rb_on, false, false);
        hbox2->pack_end (*rb_off, false, false);

        vbox->pack_start( *hbox2, false, false );
       
        switch ( m_perf->get_master_midi_bus ()->get_clock (i))
        {
            case e_clock_off: rb_off->set_active(1); break;
            case e_clock_pos: rb_on->set_active(1); break;
            case e_clock_mod: rb_mod->set_active(1); break;
        }
                              
        // SET DEFAULT STATES check->set_active (m_perf->get_master_midi_bus ()->get_clock (i));
    }

    Adjustment *clock_mod_adj = new Adjustment( midibus::get_clock_mod(), 1, 16 << 10, 1 );
    SpinButton *clock_mod_spin = new SpinButton( *clock_mod_adj );

    HBox *hbox2 = manage (new HBox ());
    
    //m_spinbutton_bpm->set_editable( false );
    hbox2->pack_start(*(manage( new Label( "Clock Start Modulo (1/16 Notes)"))), false, false, 4);
    hbox2->pack_start(*clock_mod_spin, false, false );

    vbox->pack_start( *hbox2, false, false );
    
    clock_mod_adj->signal_value_changed().connect( sigc::bind(mem_fun(*this,&options::clock_mod_callback),clock_mod_adj));

    // add controls for input method
    {
        Adjustment *adj = new Adjustment( global_interactionmethod, 0, e_number_of_interactions-1, 1 );
        SpinButton *spin = new SpinButton( *adj );

        HBox *hbox2 = manage (new HBox ());
        HBox *hbox3 = manage (new HBox ());

        //m_spinbutton_bpm->set_editable( false );
        interaction_method_label = new Label("Input Method");
        hbox2->pack_start(*(manage( interaction_method_label )), false, false, 4);
        hbox2->pack_start(*spin, false, false );

        vbox->pack_start( *hbox2, false, false );

        interaction_method_desc_label = new Label(" ----- ");
        hbox3->pack_start(*(manage( interaction_method_desc_label )), false, false, 4);
        vbox->pack_start(*hbox3, false, false );

        adj->signal_value_changed().connect( sigc::bind(mem_fun(*this,&options::interaction_method_callback),adj));

        // force it to refresh.
        interaction_method_callback( adj );
    }

    // Input Buses
    buses = m_perf->get_master_midi_bus ()->get_num_in_buses ();

    vbox = manage (new VBox ());
    m_notebook->pages ().
        push_back (Notebook_Helpers::TabElem (*vbox, "MIDI Input"));

    for (int i = 0; i < buses; i++)
    {

        check =
            manage (new
                    CheckButton (m_perf->get_master_midi_bus ()->
                        get_midi_in_bus_name (i), 0));
        check->signal_toggled ().
            connect (bind (mem_fun (*this, &options::input_callback), i, check));
        check->set_active (m_perf->get_master_midi_bus ()->get_input (i));

        vbox->pack_start (*check, false, false);
    }

    // KeyBoard keybinding setup (editor for .seq42rc keybindings.
    vbox = manage (new VBox ());
    m_notebook->pages ().push_back (Notebook_Helpers::TabElem (*vbox, "Keyboard"));
    {
        Label* label;
        KeyBindEntry* entry;
        HBox *hbox;

        #define AddKey(text, integer) \
            label = manage (new Label( text )); \
            hbox->pack_start (*label, false, false, 4); \
            entry = manage (new KeyBindEntry( &integer )); \
            hbox->pack_start (*entry, false, false, 4);

        hbox = manage (new HBox ());
        AddKey( "start:", m_perf->m_key_start );
        AddKey( "stop:", m_perf->m_key_stop );
        AddKey( "toggle looping:", m_perf->m_key_loop );
        vbox->pack_start (*hbox, false, false);

        hbox = manage (new HBox ());
        AddKey( "bpm dn:", m_perf->m_key_bpm_dn );
        AddKey( "bpm up:", m_perf->m_key_bpm_up );
        vbox->pack_start (*hbox, false, false);

        #undef AddKey
    }

    // Jack
#ifdef JACK_SUPPORT
    VBox *vbox2 = manage (new VBox ());
    vbox2->set_border_width (4);
    m_notebook->pages().push_back(Notebook_Helpers::TabElem(*vbox2,
                "Jack Sync"));

    check = manage (new CheckButton ("Jack Transport"));
    check->set_active (global_with_jack_transport);
    add_tooltip( check, "Enable sync with JACK Transport.");
    check->signal_toggled ().
        connect (bind
                (mem_fun (*this, &options::transport_callback), e_jack_transport,
                 check));
    vbox2->pack_start (*check, false, false);

    check = manage (new CheckButton ("Transport Master"));
    check->set_active (global_with_jack_master);
    add_tooltip( check, "Seq42 will attempt to serve as JACK Master.");
    check->signal_toggled ().
        connect (bind
                (mem_fun (*this, &options::transport_callback), e_jack_master,
                 check));

    vbox2->pack_start (*check, false, false);

    check = manage (new CheckButton ("Master Conditional"));
    check->set_active (global_with_jack_master_cond);
    add_tooltip( check,
            "Seq42 will fail to be master if there is already a master set.");
    check->signal_toggled ().
        connect (bind
                (mem_fun (*this, &options::transport_callback), e_jack_master_cond,
                 check));

    vbox2->pack_start (*check, false, false);


    Gtk::Button * button = manage (new Button ("Connect"));
    add_tooltip( button, "Connect to Jack.");
    button->signal_clicked().connect(bind(mem_fun(*this,
                    &options::transport_callback), e_jack_connect, button));
    vbox2->pack_start (*button, false, false);

    button = manage (new Button ("Disconnect"));
    add_tooltip( button, "Disconnect Jack.");
    button->signal_clicked().connect(bind(mem_fun(*this,
                    &options::transport_callback), e_jack_disconnect, button));
    vbox2->pack_start (*button, false, false);
#endif

    /* show everything */
    show_all_children ();
}
Example #9
0
    HIGMessageDialog::HIGMessageDialog(Gtk::Window *parent,
                                       GtkDialogFlags flags, Gtk::MessageType msg_type, 
                                       Gtk::ButtonsType btn_type, const Glib::ustring & header,
                                       const Glib::ustring & msg)
      : Gtk::Dialog()
      , m_extra_widget(NULL)
    {
      set_border_width(5);
      set_resizable(false);
      set_title("");

      get_vbox()->set_spacing(12);
      get_action_area()->set_layout(Gtk::BUTTONBOX_END);

      m_accel_group = Glib::RefPtr<Gtk::AccelGroup>(Gtk::AccelGroup::create());
      add_accel_group(m_accel_group);

      Gtk::HBox *hbox = manage(new Gtk::HBox (false, 12));
      hbox->set_border_width(5);
      hbox->show();
      get_vbox()->pack_start(*hbox, false, false, 0);

      switch (msg_type) {
      case Gtk::MESSAGE_ERROR:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_ERROR,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      case Gtk::MESSAGE_QUESTION:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_QUESTION,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      case Gtk::MESSAGE_INFO:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_INFO,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      case Gtk::MESSAGE_WARNING:
        m_image = new Gtk::Image (Gtk::Stock::DIALOG_WARNING,
                                  Gtk::ICON_SIZE_DIALOG);
        break;
      default:
        m_image = new Gtk::Image ();
        break;
      }

      if (m_image) {
        Gtk::manage(m_image);
        m_image->show();
        m_image->property_yalign().set_value(0);
        hbox->pack_start(*m_image, false, false, 0);
      }

      Gtk::VBox *label_vbox = manage(new Gtk::VBox (false, 0));
      label_vbox->show();
      hbox->pack_start(*label_vbox, true, true, 0);

      std::string title = str(boost::format("<span weight='bold' size='larger'>%1%"
                                            "</span>\n") % header.c_str());

      Gtk::Label *label;

      label = manage(new Gtk::Label (title));
      label->set_use_markup(true);
      label->set_justify(Gtk::JUSTIFY_LEFT);
      label->set_line_wrap(true);
      label->set_alignment (0.0f, 0.5f);
      label->show();
      label_vbox->pack_start(*label, false, false, 0);

      label = manage(new Gtk::Label(msg));
      label->set_use_markup(true);
      label->set_justify(Gtk::JUSTIFY_LEFT);
      label->set_line_wrap(true);
      label->set_alignment (0.0f, 0.5f);
      label->show();
      label_vbox->pack_start(*label, false, false, 0);
      
      m_extra_widget_vbox = manage(new Gtk::VBox (false, 0));
      m_extra_widget_vbox->show();
      label_vbox->pack_start(*m_extra_widget_vbox, true, true, 12);

      switch (btn_type) {
      case Gtk::BUTTONS_NONE:
        break;
      case Gtk::BUTTONS_OK:
        add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK, true);
        break;
      case Gtk::BUTTONS_CLOSE:
        add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE, true);
        break;
      case Gtk::BUTTONS_CANCEL:
        add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, true);
        break;
      case Gtk::BUTTONS_YES_NO:
        add_button (Gtk::Stock::NO, Gtk::RESPONSE_NO, false);
        add_button (Gtk::Stock::YES, Gtk::RESPONSE_YES, true);
        break;
      case Gtk::BUTTONS_OK_CANCEL:
        add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL, false);
        add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK, true);
        break;
      }

      if (parent){
        set_transient_for(*parent);
      }

      if ((flags & GTK_DIALOG_MODAL) != 0) {
        set_modal(true);
      }

      if ((flags & GTK_DIALOG_DESTROY_WITH_PARENT) != 0) {
        property_destroy_with_parent().set_value(true);
      }
    }
Example #10
0
PreferencesDialogImpl::PreferencesDialogImpl() : Gtk::Dialog()
{
    m_editorEntry = NULL;
    m_ctagsEntry = NULL;

    // dialog properties
    set_title("Preferences");
    set_position(GTK_WIN_POS_CENTER);
    set_modal(true);
    set_border_width(10);
    set_policy(false, false, true);

    // create the Default button
    Gtk::Button* defaultButton = manage(new Gtk::Button("Default"));
    defaultButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::defaultButtonCB));
    defaultButton->set_usize(80, -1);
    defaultButton->set_flags(GTK_CAN_DEFAULT);
    defaultButton->show();

    // create the Apply button
    Gtk::Button* applyButton = manage(new Gtk::Button("Apply"));
    applyButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::applyButtonCB));
    applyButton->set_usize(80, -1);
    applyButton->set_flags(GTK_CAN_DEFAULT);
    applyButton->show();

    // create the OK button and make it default
    Gtk::Button* okButton = manage(new Gtk::Button("OK"));
    okButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::okButtonCB));
    okButton->set_usize(80, -1);
    okButton->set_flags(GTK_CAN_DEFAULT);
    okButton->grab_default();
    okButton->show();

    // create the Cancel button
    Gtk::Button* cancelButton = manage(new Gtk::Button("Cancel"));
    cancelButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::cancelButtonCB));
    cancelButton->set_usize(80, -1);
    cancelButton->set_flags(GTK_CAN_DEFAULT);
    cancelButton->show();

    // add the buttons to the hbox
    Gtk::HBox* hbox = get_action_area();
    hbox->set_spacing(10);
    hbox->pack_start(*defaultButton, false, false);
    hbox->pack_start(*applyButton, false, false);
    hbox->pack_start(*okButton, false, false);
    hbox->pack_start(*cancelButton, false, false);

    // editor stuff
    Gtk::HBox* editorBox = manage(new Gtk::HBox());
    Gtk::Label* editorLabel = manage(new Gtk::Label("Editor Command: "));
    editorLabel->show();
    editorBox->pack_start(*editorLabel, false, false);
    m_editorEntry = manage(new Gtk::Entry());
    m_editorEntry->set_text(g_configMap[Config::EDITOR[0]]);
    m_editorEntry->show();
    editorBox->pack_end(*m_editorEntry);
    editorBox->show();

    // ctags stuff
    Gtk::HBox* ctagsBox = manage(new Gtk::HBox());
    Gtk::Label* ctagsLabel = manage(new Gtk::Label("Ctags Command: "));
    ctagsLabel->show();
    ctagsBox->pack_start(*ctagsLabel, false, false);
    m_ctagsEntry = manage(new Gtk::Entry());
    m_ctagsEntry->set_text(g_configMap[Config::CTAGS[0]]);
    m_ctagsEntry->show();
    ctagsBox->pack_end(*m_ctagsEntry);
    ctagsBox->show();

    // add everything to the vbox
    Gtk::VBox* vbox = get_vbox();
    vbox->set_spacing(5);
    vbox->pack_start(*editorBox, false, false);
    vbox->pack_start(*ctagsBox, false, false);

    show();
    Gtk::Main::run();
}