예제 #1
0
ShortcutDialog::ShortcutDialog(int _number_tree, bool _lock_name)
{
	Icons::set_window_icon(this, ICO_ROOT_PERSONNAL, 15) ;

	table = NULL ;

	number_tree = _number_tree ;

	set_has_separator(false) ;
	set_title(_("Choose target shortcut")) ;
	//set_default_size(DIALOG_W, DIALOG_H) ;

	button_chooser = new Gtk::FileChooserButton(_("Configure shortcut"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER) ;

	Gtk::VBox* vbox = get_vbox() ;

	table = new Gtk::Table(2, 3, false) ;
	table->set_col_spacings(15) ;
	//vbox->pack_start((*file_chooser), true,true)  ;

	vbox->pack_start(BLANK1, false,false)  ;

	vbox->pack_start(table_align, false, false)  ;

	table_align.add(*table) ;
	table_align.set(Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER, 0, 0) ;
		//line 1
		table->attach(path_align, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK , 0, 0) ;
		table->attach(path_entry, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK , 0, 0) ;
		table->attach(*button_chooser, 2, 3, 0, 1, Gtk::FILL, Gtk::SHRINK , 0, 0) ;
			path_align.add(path_label) ;
			path_align.set(Gtk::ALIGN_LEFT, Gtk::ALIGN_LEFT, 0, 0) ;
		//line2
		table->attach(display_align, 0, 1, 1, 2, Gtk::FILL, Gtk::SHRINK , 0, 0) ;
		table->attach(display_entry, 1, 2, 1, 2, Gtk::FILL, Gtk::SHRINK , 0, 0) ;
			display_align.add(display_label) ;
			display_align.set(Gtk::ALIGN_LEFT, Gtk::ALIGN_LEFT, 0, 0) ;

	validate = new Gtk::Button(Gtk::Stock::OK) ;
	cancel = new Gtk::Button(Gtk::Stock::CANCEL) ;

	vbox->pack_start(BLANK2, false,false)  ;

	vbox->pack_start(separ, false,false)  ;

	vbox->pack_start(buttons_align, false, false) ;
	buttons_align.set(Gtk::ALIGN_RIGHT, Gtk::ALIGN_RIGHT, 0, 0) ;
		buttons_align.add(buttons_box) ;
				buttons_box.pack_start(*validate, false, false) ;
				buttons_box.pack_start(*cancel, false, false) ;

	BLANK1.set_label(" ");
	BLANK2.set_label(" ");
	path_label.set_label(_("Target path ")) ;
	display_label.set_label(_("Shortcut name ")) ;
	path_label.set_name("bold_label") ;
	display_label.set_name("bold_label") ;

	vbox->show_all_children(true) ;

	button_chooser->signal_selection_changed().connect( sigc::mem_fun(*this, &ShortcutDialog::on_selection_changed) ) ;
	validate->signal_clicked().connect( sigc::mem_fun(*this, &ShortcutDialog::on_validate) ) ;
	cancel->signal_clicked().connect( sigc::mem_fun(*this, &ShortcutDialog::on_cancel) ) ;

	path_entry.signal_changed().connect( sigc::mem_fun(*this, &ShortcutDialog::on_path_entry_signal_changed) ) ;

	lock_name = _lock_name ;
	if (lock_name)
		display_entry.set_sensitive(false) ;
}
예제 #2
0
void ResViewerViewImpl::setFileContentsByName(std::map<std::string,
    Glib::RefPtr<Gtk::TextBuffer> > FileContents)
{
  Glib::ustring ExistingTabSelection = "";
  if (mp_Notebook->get_current())
    ExistingTabSelection = mp_Notebook->get_current()->get_tab_label_text();

  int TabToSelect = 0;

  while (mp_Notebook->get_n_pages() > 1)
    mp_Notebook->remove_page(1);

  for (std::map<std::string, Glib::RefPtr<Gtk::TextBuffer> >::iterator it =
      FileContents.begin(); it != FileContents.end(); ++it)
  {
    Gtk::TextView* TextView = Gtk::manage(new Gtk::TextView(it->second));
    TextView->set_editable(false);
    TextView->set_visible(true);

    Gtk::ScrolledWindow* Win = Gtk::manage(new Gtk::ScrolledWindow());
    Win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    Win->set_visible(true);
    Win->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
    Win->add(*TextView);

    Gtk::Label* TabLabel = Gtk::manage(new Gtk::Label(it->first));
    Gtk::Label* MenuLabel = Gtk::manage(new Gtk::Label(it->first,
        Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER));

    Gtk::Button* SingleGNUplotButton = Gtk::manage(new Gtk::Button(
        _("Plot file with GNUplot\n(All-in-one window)")));
    Gtk::Button* MultiGNUplotButton = Gtk::manage(new Gtk::Button(
        _("Plot file with GNUplot\n(Multiple windows)")));

    Gtk::VBox* RightButtonsBox = Gtk::manage(new Gtk::VBox());
    RightButtonsBox->pack_start(*SingleGNUplotButton, Gtk::PACK_SHRINK);
    RightButtonsBox->pack_start(*MultiGNUplotButton, Gtk::PACK_SHRINK, 5);
    RightButtonsBox->show_all_children(true);
    RightButtonsBox->set_visible(true);

#if WIN32
    SingleGNUplotButton->set_sensitive(false);
    MultiGNUplotButton->set_sensitive(false);
#else
    if (ViewWithGNUplot::IsGNUplotAvailable())
    {
      SingleGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr<
          Gtk::TextBuffer>, std::string, std::string, std::string, bool>(
          sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked),
          (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep,
          m_CommentChar, true));
      SingleGNUplotButton->set_sensitive(true);

      MultiGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr<
          Gtk::TextBuffer>, std::string, std::string, std::string, bool>(
          sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked),
          (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep,
          m_CommentChar, false));
      MultiGNUplotButton->set_sensitive(true);
    }
    else
    {
      SingleGNUplotButton->set_sensitive(false);
      MultiGNUplotButton->set_sensitive(false);
    }
#endif

    Gtk::HBox* MainHBox = Gtk::manage(new Gtk::HBox());
    MainHBox->pack_start(*Win, Gtk::PACK_EXPAND_WIDGET, 5);
    MainHBox->pack_start(*RightButtonsBox, Gtk::PACK_SHRINK, 5);
    MainHBox->set_border_width(8);
    MainHBox->set_visible(true);

    int PageNum = mp_Notebook->append_page(*MainHBox, *TabLabel, *MenuLabel);

    if (it->first == ExistingTabSelection)
      TabToSelect = PageNum;

    mp_Notebook->set_tab_reorderable(*Win, true);
  }

  mp_Notebook->set_current_page(TabToSelect);
}