Пример #1
0
void WarningListDialog::add_warning(const Glib::ustring& warning)
{
  Gtk::HBox* hb = Gtk::manage(new Gtk::HBox);
  Gtk::Label* l = Gtk::manage(new Gtk::Label);
  hb->show();
  hb->set_spacing(LENGTH_BORDER_WIDTH*2);

  if(warning_icon)
  {
    Gtk::Image* img = Gtk::manage(new Gtk::Image(warning_icon));
    hb->pack_start(*img, false, false);
  }
  l->set_markup(warning);
  l->set_alignment(0., 0.5);
  l->set_line_wrap(true);
  hb->pack_start(*l);

  if(warnings.get_children().size())
  {
    Gtk::HSeparator* s = Gtk::manage(new Gtk::HSeparator);
    s->show();
    warnings.pack_start(*s, false, false, LENGTH_SMALLSPACE);
  }

  hb->show_all_children();
  warnings.pack_start(*hb, false, false);
}
Пример #2
0
void DocumentProperties::onNewExtraField ()
{
	Gtk::Dialog dialog ("New Field", *dialog_, true, false);

	Gtk::VBox *vbox = dialog.get_vbox ();

	Gtk::HBox hbox;
	hbox.set_spacing (12);
	vbox->pack_start (hbox, true, true, 0);

	Gtk::Label label ("Field name:", false);
	hbox.pack_start (label, false, false, 0);

	Gtk::Entry entry;
	entry.set_activates_default (true);
	hbox.pack_start (entry, true, true, 0);

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

	dialog.show_all ();
	vbox->set_border_width (12);

	if (dialog.run () == Gtk::RESPONSE_ACCEPT) {

		Gtk::ListStore::iterator it = extrafieldsstore_->children().begin ();
		Gtk::ListStore::iterator const end = extrafieldsstore_->children().end ();
		bool key_isnew = true;
		for (; it != end; ++it)
			if (Utility::firstCap ((*it)[extrakeycol_]) == Utility::firstCap (entry.get_text ())) {
				key_isnew = false;
			}
		if ( key_isnew ) {
			Gtk::ListStore::iterator row = extrafieldsstore_->append ();
			(*row)[extrakeycol_] = Utility::firstCap (entry.get_text ());
			(*row)[extravalcol_] = "";
		} else {
			Glib::ustring message;
			message = String::ucompose (
			"<b><big>%1</big></b>",
			_("This key already exists.\n"));
			Gtk::MessageDialog dialog (

			message, true,
			Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true);

			dialog.run ();

		}
	}
}
Пример #3
0
void c_PreferencesDlg::InitControls()
{
    for (const Utils::Const::Language_t &lang: Utils::Const::languages)
    {
        m_UILanguage.append(lang.name == Utils::Const::SYSTEM_DEFAULT_LANG ? _("System language") : lang.name);
        if (lang.langId == std::string(Configuration::UILanguage))
            m_UILanguage.set_active(m_UILanguage.get_model()->children().size()-1);
    }

    get_content_area()->pack_start(*Utils::PackIntoBox<Gtk::HBox>( {
                                        Gtk::manage(new Gtk::Label(_("User interface language:"))),
                                        &m_UILanguage } ),
                                   Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    int iconSizePx;
    Gtk::IconSize::lookup(Configuration::GetToolIconSize(), iconSizePx, iconSizePx);
    m_ToolIconSize.set_adjustment(Gtk::Adjustment::create(iconSizePx, MIN_ICON_SIZE_PIX, MAX_ICON_SIZE_PIX));
    m_ToolIconSize.set_digits(0);
    m_ToolIconSize.set_value_pos(Gtk::PositionType::POS_LEFT);
    for (unsigned sizeMark: { 8, 16, 24, 32, 40, 64, 80, 100, 128 })
        m_ToolIconSize.add_mark(sizeMark, Gtk::PositionType::POS_TOP, Glib::ustring::format(sizeMark));

    Gtk::HBox *boxToolIconSize = Gtk::manage(new Gtk::HBox());
    boxToolIconSize->pack_start(*Gtk::manage(new Gtk::Label(_("Tool icon size:"))), Gtk::PackOptions::PACK_SHRINK);
    boxToolIconSize->pack_start(m_ToolIconSize);
    boxToolIconSize->set_spacing(10);
    boxToolIconSize->show_all();

    get_content_area()->pack_start(*boxToolIconSize, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    m_ExportInactiveFramesQuality.set_label(_("Include inactive frames when exporting quality data"));
    m_ExportInactiveFramesQuality.set_active(Configuration::ExportInactiveFramesQuality);
    m_ExportInactiveFramesQuality.show();
    get_content_area()->pack_start(m_ExportInactiveFramesQuality, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    m_NumQualHistBins.set_adjustment(Gtk::Adjustment::create(Configuration::NumQualityHistogramBins, 10, Utils::Const::MaxQualityHistogramBins,
            1, 10, 10));
    get_content_area()->pack_start(*Utils::PackIntoBox<Gtk::HBox>(
            { Gtk::manage(new Gtk::Label(_("Number of frame quality histogram bins:"))),
              &m_NumQualHistBins }),
            Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    auto separator = Gtk::manage(new Gtk::Separator());
    separator->show();
    get_content_area()->pack_end(*separator, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels);

    add_button(_("OK"), Gtk::RESPONSE_OK);
    add_button(_("Cancel"), Gtk::RESPONSE_CANCEL);

    //FIXME: not working when a Gtk::Entry has focus! #### set_default(*get_widget_for_response(Gtk::ResponseType::RESPONSE_OK));
}
Пример #4
0
HistorySubMenu::HistorySubMenu( const std::string& url_history )
    : Gtk::Menu(),
      m_url_history( url_history )
{
    Gtk::MenuItem* item;

    // メニュー項目作成

    // 履歴クリア
    Gtk::Menu* menu = Gtk::manage( new Gtk::Menu() );
    item = Gtk::manage( new Gtk::MenuItem( "クリアする(_C)", true ) );
    menu->append( *item );
    item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_clear ) ); 

    item = Gtk::manage( new Gtk::MenuItem( "履歴クリア(_C)", true ) );
    item->set_submenu( *menu );
    append( *item );

    item = Gtk::manage( new Gtk::MenuItem( "サイドバーに全て表示(_S)", true ) );
    append( *item );
    item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_switch_sideber ) );

    // セパレータ
    item = Gtk::manage( new Gtk::SeparatorMenuItem() );
    append( *item );

    // 履歴項目
    for( int i = 0; i < CONFIG::get_history_size(); ++i ){

        Gtk::Image* image = Gtk::manage( new Gtk::Image() );
        m_vec_images.push_back( image );

        Gtk::Label* label = Gtk::manage( new Gtk::Label( HIST_NONAME ) );
        m_vec_label.push_back( label );

        Gtk::Label *label_motion = Gtk::manage( new Gtk::Label() );
        if( i == 0 ) label_motion->set_text( CONTROL::get_str_motions( CONTROL::RestoreLastTab ) );

        Gtk::HBox* hbox = Gtk::manage( new Gtk::HBox() );
        hbox->set_spacing( SPACING_MENU );
        hbox->pack_start( *image, Gtk::PACK_SHRINK );
        hbox->pack_start( *label, Gtk::PACK_SHRINK );
        hbox->pack_end( *label_motion, Gtk::PACK_SHRINK );

        Gtk::MenuItem* item = Gtk::manage( new Gtk::MenuItem( *hbox ) );
        append( *item );
        item->signal_activate().connect( sigc::bind< int >( sigc::mem_fun( *this, &HistorySubMenu::slot_active ), i ) );
        item->signal_button_press_event().connect( sigc::bind< int >( sigc::mem_fun( *this, &HistorySubMenu::slot_button_press ), i ) );
    }

    // ポップアップメニュー作成
    m_popupmenu.signal_deactivate().connect( sigc::mem_fun( *this, &HistorySubMenu::deactivate ) );

    item = Gtk::manage( new Gtk::MenuItem( "タブで開く" ) );
    item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_open_history ) );
    m_popupmenu.append( *item );

    item = Gtk::manage( new Gtk::SeparatorMenuItem() );
    m_popupmenu.append( *item );

    item = Gtk::manage( new Gtk::MenuItem( "履歴から削除" ) );
    item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_remove_history ) );
    m_popupmenu.append( *item );

    item = Gtk::manage( new Gtk::SeparatorMenuItem() );
    m_popupmenu.append( *item );

    item = Gtk::manage( new Gtk::MenuItem( "プロパティ" ) );
    item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_show_property ) );
    m_popupmenu.append( *item );

    m_popupmenu.show_all_children();
}
Пример #5
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();
}