Exemplo n.º 1
0
SplashScreen::SplashScreen(Gtk::Window *parent) :
	Gtk::Window(Gtk::WINDOW_POPUP),
	f_parent( parent )
{
    molib::moWCString splash_path( Common::GetFullPathnameForImage( SPLASH_IMAGE ) );

	if( splash_path != "" )
	{
		splash_path = molib::moFile::FullPath(splash_path);
		f_splash.set( splash_path.c_str() );
	}

	set_type_hint(Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN);
	set_title(gettext("Turn Watcher Splashscreen"));
	set_resizable(false);
	set_decorated(false);
	set_has_frame(false);
	set_position(Gtk::WIN_POS_CENTER);
	set_transient_for(*f_parent);	// avoid having an icon in toolbar
	set_modal(true);		// the first click closes the splash no matter where
	set_keep_above();		// keep splashscreen on top of everything
	set_icon( Gdk::Pixbuf::create_from_xpm_data( Helmet_xpm ) );

	add(f_box);

	f_box.add(f_splash);

	f_box.set_events(Gdk::BUTTON_PRESS_MASK);
	f_box.signal_button_press_event().connect(
			sigc::mem_fun(*this, &SplashScreen::on_button_press_event));

	show_all_children();
}
/**
 * Constructor
 * @param p_win				Reference on parent window
 * @param p_dataMode		Reference on datamodel
 * @param il				Reference on the InputLanguage used by parent editor
 * @param p_m_elementId		Element id
 * @param editable			True for edition mode, False otherwise
 */
AnnotationPropertiesDialog::AnnotationPropertiesDialog(Gtk::Window& p_win, DataModel& p_dataModel, const string& p_elementId, bool p_editable)
: Gtk::Dialog(TRANSAG_DISPLAY_NAME, p_win, true, true), m_dataModel(p_dataModel), m_editable(p_editable)
{
	m_elementId = p_elementId ;
	m_elementType = m_dataModel.getElementType(m_elementId) ;

#ifdef __APPLE__
	if (&p_win)
		set_transient_for(p_win);
#endif

}
Exemplo n.º 3
0
ChooseFileWindow::ChooseFileWindow(MainWindow* mainWindow, Gtk::FileChooserAction file_chooser_action)
    : Gtk::FileChooserDialog("Select a wavefront file", file_chooser_action),
      mainWindow(mainWindow),
      selected_path("")
{

  add_button("_Cancel", Gtk::RESPONSE_CANCEL);
  add_button("Select", Gtk::RESPONSE_OK);

  set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
  set_modal();
  set_transient_for(*mainWindow);

  auto filter_obj = Gtk::FileFilter::create();
  filter_obj->set_name("Wavefront .obj files");
  filter_obj->add_pattern("*.obj");
  filter_obj->add_pattern("*.OBJ");
  add_filter(filter_obj);
}
Exemplo n.º 4
0
tempopopup::tempopopup(tempo *a_tempo) :
    m_tempo(a_tempo),
    m_escape(false),
    m_return(false),
    m_is_typing(false),
    m_current_beats(0),
    m_base_time_ms(0),
    m_last_time_ms(0)
{
 //   std::string title = "BPM";
 //   set_title(title);
    set_size_request(150, 50);
    
#if GTK_MINOR_VERSION < 12
    m_tooltips = manage( new Tooltips() );
#endif
    
    /* bpm spin button */
    m_adjust_bpm = manage(new Adjustment(m_tempo->m_mainperf->get_bpm(), c_bpm_minimum -1, c_bpm_maximum, 1));
    m_spinbutton_bpm = manage( new SpinButton( *m_adjust_bpm ));
    m_spinbutton_bpm->set_editable( true );
    m_spinbutton_bpm->set_digits(2);                             // 2 = two decimal precision
    m_adjust_bpm->signal_value_changed().connect(
        mem_fun(*this, &tempopopup::adj_callback_bpm ));
 
    m_spinbutton_bpm->set_numeric();
    
    add_tooltip
    ( 
        m_spinbutton_bpm,
        "Adjust beats per minute (BPM) value.\n"
        "Values range from 0 to 600.00.\n"
        "Escape to leave without setting\n"
        "Entry of 0 indicates a STOP marker.\n"
    );
    
    m_spinbutton_bpm->set_update_policy(Gtk::UPDATE_IF_VALID);  // ignore bad entries
    
    Label* bpmlabel = manage(new Label("BPM"));
    
    /* bpm tap tempo button - sequencer64 */
    m_button_tap = manage(new Button("0"));
    m_button_tap->signal_clicked().connect(sigc::mem_fun(*this, &tempopopup::tap));
    add_tooltip
    (
        m_button_tap,
        "Tap in time to set the beats per minute (BPM) value. "
        "After 5 seconds of no taps, the tap-counter will reset to 0. "
        "Also see the File / Options / Keyboard / Tap BPM key assignment."
    );
    m_button_tap->set_can_focus(false);  // to force all keys to the spin button
    
    HBox *hbox = manage(new HBox());
    hbox->set_border_width(6);
    
    hbox->pack_start(*bpmlabel, Gtk::PACK_SHRINK);
    hbox->pack_start(*m_spinbutton_bpm, Gtk::PACK_SHRINK );
    hbox->pack_start(*m_button_tap, Gtk::PACK_SHRINK, 5 );
    
    add(*hbox);
    set_modal();                            // keep focus until done
    set_transient_for(*m_tempo->m_perfedit); // always on top
    set_decorated(false);                   // don't show title bar
    
    add_events( Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK );
    
    m_timeout_connect = Glib::signal_timeout().connect(
                        mem_fun(*this, &tempopopup::timer_callback), 25);
}
TransformObjectWindow::TransformObjectWindow(MainWindow* mainWindow, DrawableObject* object)
    : mainWindow(mainWindow),
      object(object),
      label_translation_x("Translate X:"),
      label_translation_y("Translate Y:"),
      label_translation_z("Translate Z:"),
      label_scale_sx("Scale X:"),
      label_scale_sy("Scale Y:"),
      label_scale_sz("Scale Z:"),
      label_rotate_axis("Rotate around:"),
      label_rotate_x("Point X:"),
      label_rotate_y("Point Y:"),
      label_rotate_z("Point Z:"),
      label_rotate_degree("Angle to rotate:"),
      label_rotate_point("Reference point:"),
      label_rotate_axis_x1("Axis X\u2081"),
      label_rotate_axis_y1("Axis Y\u2081"),
      label_rotate_axis_z1("Axis Z\u2081"),
      label_rotate_axis_x2("Axis X\u2082"),
      label_rotate_axis_y2("Axis Y\u2082"),
      label_rotate_axis_z2("Axis Z\u2082"),
      m_vbox(Gtk::ORIENTATION_VERTICAL),
      button_close("Close"),
      button_add_translation("Translate"),
      button_add_scale("Scale"),
      button_add_rotate("Rotate")
{
  set_title("Transform Object");
  set_border_width(12);
  set_resizable(false);

  add(m_vbox);

  m_vbox.pack_start(m_notebook);
  m_vbox.pack_start(button_close, Gtk::PACK_SHRINK);

  //Add translation grid
  translation_grid.set_column_homogeneous(true);
  translation_grid.set_row_spacing(10);
  translation_grid.set_column_spacing(10);
  translation_grid.attach(label_translation_x, 1, 1, 1, 1);
  translation_grid.attach(label_translation_y, 1, 2, 1, 1);
  translation_grid.attach(label_translation_z, 1, 3, 1, 1);
  translation_grid.attach(translation_x_field, 2, 1, 1, 1);
  translation_grid.attach(translation_y_field, 2, 2, 1, 1);
  translation_grid.attach(translation_z_field, 2, 3, 1, 1);
  translation_grid.attach(button_add_translation, 1, 4, 2, 1);
  translation_grid.set_border_width(10);

  //Add scale grid
  scale_grid.set_column_homogeneous(true);
  scale_grid.set_row_spacing(10);
  scale_grid.set_column_spacing(10);
  scale_grid.attach(label_scale_sx, 1, 1, 1, 1);
  scale_grid.attach(label_scale_sy, 1, 2, 1, 1);
  scale_grid.attach(label_scale_sz, 1, 3, 1, 1);
  scale_grid.attach(scale_sx_field, 2, 1, 1, 1);
  scale_grid.attach(scale_sy_field, 2, 2, 1, 1);
  scale_grid.attach(scale_sz_field, 2, 3, 1, 1);
  scale_grid.attach(button_add_scale, 1, 4, 2, 1);
  scale_grid.set_border_width(10);

  //Add rotate grid
  rotate_axis.append("X Axis");
  rotate_axis.append("Y Axis");
  rotate_axis.append("Z Axis");
  rotate_axis.append("Custom Axis");
  rotate_axis.set_active(0);
  rotate_axis.signal_changed().connect(
    sigc::mem_fun(*this, &TransformObjectWindow::on_rotate_axis_changed));
    rotate_grid.set_column_homogeneous(true);
  rotate_point.append("Object Center");
  rotate_point.append("World Center");
  rotate_point.append("Custom Point");
  rotate_point.set_active(0);
  rotate_point.signal_changed().connect(
    sigc::mem_fun(*this, &TransformObjectWindow::on_rotate_point_changed));
  rotate_grid.set_row_spacing(10);
  rotate_grid.set_column_spacing(10);
  rotate_grid.attach(label_rotate_degree, 1, 1, 2, 1);
  rotate_grid.attach(rotate_degree_field, 3, 1, 2, 1);
  rotate_grid.attach(label_rotate_axis, 1, 2, 2, 1);
  rotate_grid.attach(rotate_axis, 3, 2, 2, 1);
  rotate_grid.attach(label_rotate_point, 1, 6, 2, 1);
  rotate_grid.attach(rotate_point, 3, 6, 2, 1);
  rotate_grid.attach(button_add_rotate, 1, 10, 4, 1);
  rotate_grid.set_border_width(10);

  button_close.signal_clicked().connect(sigc::mem_fun(*this,
    &TransformObjectWindow::on_button_close));

  button_add_translation.signal_clicked().connect(sigc::mem_fun(*this,
    &TransformObjectWindow::on_button_translate));

  button_add_scale.signal_clicked().connect(sigc::mem_fun(*this,
    &TransformObjectWindow::on_button_scale));

  button_add_rotate.signal_clicked().connect(sigc::mem_fun(*this,
    &TransformObjectWindow::on_button_rotate));

  m_notebook.append_page(translation_grid, "Translate");
  m_notebook.append_page(scale_grid, "Scale");
  m_notebook.append_page(rotate_grid, "Rotate");

  set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
  set_modal();
  set_transient_for(*mainWindow);

  show_all_children();
}
Exemplo n.º 6
0
ActivityDialog::ActivityDialog(ActivitiesWindow *parent, Activity *activity)
  : parent(parent), activity(activity)
{
  set_icon_from_file("images/act100x80.gif");
  if(activity)
  {
    Gtk::Dialog(_("Edit activity"), parent);
    set_title(_("Edit activity"));
    std::stringstream ss;
    ss << activity->get_id();
    number_entry.set_text(ss.str());
    name_entry.set_text(activity->get_name());
    
    Glib::RefPtr<Gtk::TextBuffer> text_buffer = desc_area.get_buffer();
    text_buffer->set_text(activity->get_description());
    start_date_entry.set_text(activity->get_start_date_str_eu());
    end_date_entry.set_text(activity->get_end_date_str_eu());
    check_button_finished.set_active(activity->is_finished());
  }
  else
  {
    Gtk::Dialog(_("Edit activity"), parent);
    set_title(_("New activity"));
  }
  set_transient_for(*parent);

  add_button(Gtk::Stock::CANCEL, 2);
  if(activity)
    add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
  else
    add_button(_("Create activity"), Gtk::RESPONSE_OK);

  Gtk::Box *cont_area = get_vbox();
  Gtk::Table main_table(10, 3);
  main_table.set_row_spacings(10);
  cont_area->pack_start(main_table);

  Gtk::Label main_label;
  if(activity)
    main_label.set_text(_("Edit properties for activity:"));
  else
    main_label.set_text(_("Enter properties for new activity:"));
  main_table.attach(main_label, 0, 3, 0, 1);

  Gtk::Label no_label(_("Activity number:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
  main_table.attach(no_label, 0, 3, 1, 2);
  main_table.attach(number_entry, 0, 3, 2, 3);

  Gtk::Label name_label(_("Activity name:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
  main_table.attach(name_label, 0, 3, 3, 4);
  main_table.attach(name_entry, 0, 3, 4, 5);

  Gtk::Label desc_label(_("Description:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
  main_table.attach(desc_label, 0, 3, 5, 6);
  Gtk::ScrolledWindow desc_scroll;
  desc_scroll.add(desc_area);
  desc_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  main_table.attach(desc_scroll, 0, 3, 6, 7);

  Gtk::Label start_date_label(_("Start date:"), Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
  start_date_entry.set_max_length(10);
  start_date_entry.set_width_chars(14);
  Gtk::Button start_cal_button(_("Calendar"));
  start_cal_button.signal_clicked().connect(sigc::mem_fun(*this, &ActivityDialog::on_click_start_calendar));
  main_table.attach(start_date_label, 0, 1, 7, 8);
  main_table.attach(start_date_entry, 1, 2, 7, 8);
  main_table.attach(start_cal_button, 2, 3, 7, 8, Gtk::SHRINK, Gtk::SHRINK);

  Gtk::Label end_date_label(_("End date:"), Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
  end_date_entry.set_max_length(10);
  end_date_entry.set_width_chars(14);
  Gtk::Button end_cal_button(_("Calendar"));
  end_cal_button.signal_clicked().connect(sigc::mem_fun(*this, &ActivityDialog::on_click_end_calendar));
  main_table.attach(end_date_label, 0, 1, 8, 9);
  main_table.attach(end_date_entry, 1, 2, 8, 9);
  main_table.attach(end_cal_button, 2, 3, 8, 9, Gtk::SHRINK, Gtk::SHRINK);

  check_button_finished.set_label(_("Activity finished"));
  main_table.attach(check_button_finished, 1, 3, 9, 10);

  show_all_children();
  while(true)
  {
    int result = run();
    if(result == Gtk::RESPONSE_OK)
    {
      Glib::ustring error_msg;
      if(name_entry.get_text().size() == 0)
	error_msg = _("Activity must have a name.\n");
      if(start_date_entry.get_text().size() == 0)
	error_msg += _("Activity must have a start date.\n");
      if(end_date_entry.get_text().size() == 0)
	error_msg += _("Activity must have an end date.");
      if(error_msg.size() > 0)
      {
	  Gtk::MessageDialog message(error_msg, false, Gtk::MESSAGE_ERROR);
	  message.set_icon_from_file("images/HaPr_high_80x100_ver2.gif");
	  message.run();
      }
      else
      {
	Activity newa;
	newa.set_number(number_entry.get_text());
	newa.set_name(name_entry.get_text());
	Glib::RefPtr<Gtk::TextBuffer> desc_buffer = desc_area.get_buffer();
	newa.set_description(desc_buffer->get_text());
	newa.set_start_date(start_date_entry.get_text());
	newa.set_end_date(end_date_entry.get_text());
	newa.set_finished(check_button_finished.get_active());

	if(activity)
	  newa.set_id(activity->get_id());

	parent->add_edit_activity(&newa);
	break;
      }
    }
    else
      break;
  }
}
Exemplo n.º 7
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);
      }
    }