Beispiel #1
0
void CamWnd::constructGUIComponents()
{
    constructToolbar();

    // Set up GL widget
    _camGLWidget->set_events(  Gdk::EXPOSURE_MASK 
                             | Gdk::BUTTON_PRESS_MASK 
                             | Gdk::BUTTON_RELEASE_MASK 
                             | Gdk::POINTER_MOTION_MASK 
                             | Gdk::SCROLL_MASK);
    _camGLWidget->set_flags(Gtk::CAN_FOCUS);
    _camGLWidget->set_size_request(CAMWND_MINSIZE_X, CAMWND_MINSIZE_Y);
    _camGLWidget->property_can_focus() = true;

    _camGLWidget->signal_size_allocate().connect(
        sigc::mem_fun(*this, &CamWnd::onSizeAllocate)
    );
    _camGLWidget->signal_expose_event().connect(
        sigc::mem_fun(*this, &CamWnd::onExpose)
    );

    // Pack GL widget into outer widget
    Gtk::Container* glWidgetFrame = gladeWidget<Gtk::Container>(
        "glWidgetFrame"
    );
    glWidgetFrame->add(*_camGLWidget);
}
Beispiel #2
0
bool CamWnd::onWindowStateEvent(GdkEventWindowState* ev)
{
    if ((ev->changed_mask & (GDK_WINDOW_STATE_ICONIFIED|GDK_WINDOW_STATE_WITHDRAWN)) != 0)
    {
        // Now let's see what the new state of the window is
        if ((ev->new_window_state & (GDK_WINDOW_STATE_ICONIFIED|GDK_WINDOW_STATE_WITHDRAWN)) == 0)
        {
            // Window got maximised again, re-add the GL widget to fix it from going gray
            Gtk::Widget* glWidget = getWidget();

            // greebo: Unfortunate hack to fix the grey GL renderviews in Win32
            Gtk::Container* container = glWidget->get_parent();

            if (container != NULL)
            {
                glWidget->reference();
                container->remove(*glWidget);
                container->add(*glWidget);
                glWidget->unreference();
            }
        }
    }

    return false;
}
Beispiel #3
0
 void MainWindow::constructDeltaChooseScale(Gtk::Container &parentContainer) {
   deltaChooseLabel.set_text("Delta:");
   parentContainer.add(deltaChooseLabel);
   deltaChooseScale.set_adjustment(Gtk::Adjustment::create(0, 0, 10, 1, 1));
   deltaChooseScale.set_digits(0);
   deltaChooseScale.set_size_request(100);
   parentContainer.add(deltaChooseScale);
 }
Beispiel #4
0
 void MainWindow::constructBrushSizeScale(Gtk::Container &parentContainer) {
   brushSizeLabel.set_text("Brush size:");
   parentContainer.add(brushSizeLabel);
   brushSizeScale.set_adjustment(Gtk::Adjustment::create(30, 1, 75, 1, 5));
   brushSizeScale.set_digits(0);
   brushSizeScale.set_size_request(100);
   parentContainer.add(brushSizeScale);
 }
Beispiel #5
0
Gtk::Window *
DockItem::getWindow()
{
    g_return_val_if_fail(_gdl_dock_item, 0);
    Gtk::Container *parent = getWidget().get_parent();
    parent = (parent ? parent->get_parent() : 0);
    return (parent ? dynamic_cast<Gtk::Window *>(parent) : 0);
}
Beispiel #6
0
 void MainWindow::constructScale(Gtk::Container &parentContainer, Gtk::Scale &scale, Gtk::Label &label, const std::string &name) {
   label.set_text(name + ":");
   parentContainer.add(label);
   scale.set_adjustment(Gtk::Adjustment::create(1.0, -10000.0, 150000.0, 10.0, 1.0));
   scale.set_digits(4);
   scale.set_size_request(100);
   scale.signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::on_scale_value_changed));
   parentContainer.add(scale);
 }
Beispiel #7
0
 void MainWindow::constructModeChooseComboBox(Gtk::Container &parentContainer) {
   modeChooseLabel.set_text("Mode:");
   parentContainer.add(modeChooseLabel);
   for (std::vector<std::string>::iterator mode = modes.begin(); mode != modes.end(); ++mode) {
     modeChooseComboBox.append(*mode);
   }
   modeChooseComboBox.signal_changed().connect(sigc::mem_fun(*this, &MainWindow::on_modeChooseComboBox_changed));
   modeChooseComboBox.set_active(0);
   parentContainer.add(modeChooseComboBox);
 }
// Activate parent if necessary
void PersistentTransientWindow::activateParent()
{
	// Only activate if this window is active already
	if (gobj()->is_active)
	{
		Gtk::Container* toplevel = get_toplevel();

		if (toplevel != NULL && toplevel->is_toplevel() &&
			toplevel->is_visible() && dynamic_cast<Gtk::Window*>(toplevel) != NULL)
		{
			static_cast<Gtk::Window*>(toplevel)->present();
		}
	}
}
Beispiel #9
0
MainWindow *MainWindow::get_owning(Gtk::Widget & widget)
{
  Gtk::Container *container = widget.get_parent();
  if(!container) {
    return dynamic_cast<MainWindow*>(&widget);
  }

  Gtk::Container *cntr = container->get_parent();
  while(cntr) {
    container = cntr;
    cntr = container->get_parent();
  }

  return dynamic_cast<MainWindow*>(container);
}
Beispiel #10
0
void VRGuiVectorEntry::init(string placeholder, string label,  sigc::slot<void, OSG::Vec3f&> sig) {
    Gtk::Fixed* ph;
    VRGuiBuilder()->get_widget(placeholder.c_str(), ph);
    Gtk::Container* frame = ph->get_parent();
    frame->remove(*ph);

    Gtk::HBox* hb = new Gtk::HBox();
    frame->add(*hb);

    Gtk::Label* lbl = new Gtk::Label();
    lbl->set_text(label.c_str());
    lbl->set_size_request(50, -1);

    ex = new Gtk::Entry();
    ey = new Gtk::Entry();
    ez = new Gtk::Entry();
    ex->set_has_frame(false);
    ey->set_has_frame(false);
    ez->set_has_frame(false);
    ex->set_size_request(50, -1);
    ey->set_size_request(50, -1);
    ez->set_size_request(50, -1);

    Gtk::VSeparator *s1, *s2, *s3;
    s1 = new Gtk::VSeparator();
    s2 = new Gtk::VSeparator();
    s3 = new Gtk::VSeparator();

    hb->pack_start(*lbl, false, false, 2);
    hb->pack_start(*s1, false, false, 0);
    hb->pack_start(*ex, false, false, 0);
    hb->pack_start(*s2, false, false, 0);
    hb->pack_start(*ey, false, false, 0);
    hb->pack_start(*s3, false, false, 0);
    hb->pack_start(*ez, false, false, 0);
    frame->show_all();

    sigc::slot<bool,GdkEventFocus*> sif = sigc::bind(&VRGuiVectorEntry::proxy, sig, ex, ey, ez);
    ex->signal_focus_out_event().connect( sif );
    ey->signal_focus_out_event().connect( sif );
    ez->signal_focus_out_event().connect( sif );

    sigc::slot<bool> sia_b = sigc::bind<GdkEventFocus*>(&VRGuiVectorEntry::proxy, 0, sig, ex, ey, ez);
    sigc::slot<void> sia = sigc::hide_return( sia_b );
    ex->signal_activate().connect(sia);
    ey->signal_activate().connect(sia);
    ez->signal_activate().connect(sia);
}
Beispiel #11
0
void PackTrackWindow(Gtk::Container& contr, TWFunctor tw_fnr)
{
    Gtk::VPaned& vpaned = *Gtk::manage(new Gtk::VPaned);
    contr.add(vpaned);

    Timeline::DAMonitor& mon = *Gtk::manage(new Timeline::DAMonitor);

#ifdef VOB_MVIEWER_INTRUSION
    {
        Mpeg::Player& plyr = mon.GetPlayer();
        Bunch& bunch = Bunch::Instance();

        //const char* dvd_path = "/mnt/ntfs/DVD_Demystified";
        const char* dvd_path = "/media/cdrom";

        bunch.dvd = DVDOpen(dvd_path);
        bunch.wrp = new DtorAction(bl::bind(&DVDClose, bunch.dvd));

        DVD::FillVobArr(bunch.dvd_vobs, bunch.dvd);
        DVD::VobPtr vob = DVD::FindVob(bunch.dvd_vobs, 1, 1); //34, 1); 
        ptr::shared<DVD::VobStreambuf> strm_buf = new DVD::VobStreambuf(vob, bunch.dvd);

        io::cout << "Vob size = " << strm_buf->Size() << io::endl;
        
        plyr.OpenFBuf(strm_buf);
    }
#endif // VOB_MVIEWER_INTRUSION

    TrackLayout& layout = *Gtk::manage(new TrackLayout(mon));
    {
        Gtk::VBox& vbox = *Gtk::manage(new Gtk::VBox);
        vpaned.add1(vbox);

        Gtk::HPaned& hpaned = *Gtk::manage(new Gtk::HPaned);
        SetUpdatePos(hpaned, UnnamedPrefs().srcBrw1Wdh);
        vbox.pack_start(hpaned, true, true, 0);

        tw_fnr(hpaned, mon, layout);

        Gtk::HSeparator& hsep = *Gtk::manage(new Gtk::HSeparator);
        vbox.pack_end(hsep, false, true, 0);
    }

    // 2 шкала
    PackTrackLayout(vpaned, layout);

    // 3 приведение к гармоничной форме
    gtk_container_child_set(vpaned.Gtk::Container::gobj(), 
                            vpaned.get_child1()->gobj(), "resize", TRUE,  NULL);
    gtk_container_child_set(vpaned.Gtk::Container::gobj(), 
                            vpaned.get_child2()->gobj(), "resize", FALSE, NULL);

    vpaned.signal_realize().connect(bb::bind(&SetGarmonicHeightForTrk, boost::ref(vpaned)));
}
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL, 6),
  m_Button_Quit(Gtk::Stock::QUIT),
  m_Button_Clear("Clear")
{
  set_title("Gtk::InfoBar example");
  set_border_width(6);
  set_default_size(400, 200);

  add(m_VBox);

  // Add the message label to the InfoBar:
  Gtk::Container* infoBarContainer =
    dynamic_cast<Gtk::Container*>(m_InfoBar.get_content_area());
  if (infoBarContainer)
    infoBarContainer->add(m_Message_Label);

  // Add an ok button to the InfoBar:
  m_InfoBar.add_button(Gtk::Stock::OK, 0);

  // Add the InfoBar to the vbox:
  m_VBox.pack_start(m_InfoBar, Gtk::PACK_SHRINK);

  // Create the buffer and set it for the TextView:
  m_refTextBuffer = Gtk::TextBuffer::create();
  m_TextView.set_buffer(m_refTextBuffer);

  // Add the TreeView, inside a ScrolledWindow:
  m_ScrolledWindow.add(m_TextView);

  // Show the scrollbars only when they are necessary:
  m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);

  m_VBox.pack_start(m_ScrolledWindow);

  // Add button box:
  m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);

  m_ButtonBox.pack_start(m_Button_Clear, Gtk::PACK_SHRINK);
  m_ButtonBox.pack_start(m_Button_Quit, Gtk::PACK_SHRINK);
  m_ButtonBox.set_spacing(6);
  m_ButtonBox.set_layout(Gtk::BUTTONBOX_END);

  // Connect signals:
  m_InfoBar.signal_response().connect(sigc::mem_fun(*this,
              &ExampleWindow::on_infobar_response) );
  m_Button_Quit.signal_clicked().connect(sigc::mem_fun(*this,
              &ExampleWindow::on_button_quit) );
  m_Button_Clear.signal_clicked().connect(sigc::mem_fun(*this,
              &ExampleWindow::on_button_clear) );
  m_refTextBuffer->signal_changed().connect(sigc::mem_fun(*this,
              &ExampleWindow::on_textbuffer_changed) );

  show_all_children();

  // Keep the InfoBar hidden until a message needs to be shown:
  m_InfoBar.hide();

  // Make the clear button insensitive until text is typed in the buffer.  When
  // the button is sensitive and it is pressed, the InfoBar is displayed with a
  // message.
  m_Button_Clear.set_sensitive(false);
}
Beispiel #13
0
 void MainWindow::constructPlayButton(Gtk::Container &parentContainer) {
   playButton.set_label("Play");
   playButton.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_playButton_clicked));
   playButton.set_sensitive(false);
   parentContainer.add(playButton);
 }
Beispiel #14
0
 void MainWindow::constructOpenButton(Gtk::Container &parentContainer) {
   openButton.set_label("Open");
   openButton.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_openButton_clicked));
   parentContainer.add(openButton);
 }
Beispiel #15
0
 void MainWindow::constructSaveButton(Gtk::Container &parentContainer) {
   saveButton.set_label("Save");
   saveButton.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_saveButton_clicked) );
   parentContainer.add(saveButton);
 }
Beispiel #16
0
BookReader::BookReader() :
    m_popover(m_book_area),
    m_popover_label("Go to page:"),
    m_popover_box(Gtk::ORIENTATION_HORIZONTAL, 12)
{

    //sort out signal handlers.
    info_bar_hide_dispatcher.connect(sigc::mem_fun(*this, &BookReader::info_bar_hide));

    set_orientation(ORIENTATION_VERTICAL);


    m_infobar_label.set_text("");
    m_infobar_box.set_orientation(ORIENTATION_HORIZONTAL);
    m_infobar_box.set_spacing(12);
    m_infobar_box.pack_start(m_infobar_spinner);
    m_infobar_box.pack_start(m_infobar_label);
    m_infobar_box.show_all();
    Gtk::Container * infoBarContainer =
        dynamic_cast<Gtk::Container *>(m_infobar.get_content_area());

    if (infoBarContainer)	{
        infoBarContainer->add(m_infobar_box);
    }

    m_infobar.set_no_show_all(true);
    m_infobar.set_show_close_button(true);
    m_infobar.signal_response().connect(sigc::mem_fun( *this, &BookReader::on_infobar_response) );

    pack_start(m_infobar, Gtk::PACK_SHRINK);

    m_book_area.set_hexpand(true);
    m_box.pack_start(m_book_area);
    m_box.set_border_width(15);

    pack_start(m_box);

    //m_entry.set_max_length(10);
    m_popover_entry.set_width_chars(4);
    m_popover_entry.set_max_width_chars(4);
    m_popover_entry.set_text("");
    m_popover_entry.signal_activate().connect(sigc::mem_fun(*this, &BookReader::on_goto_page));

    m_popover_box.set_vexpand(true);
    m_popover_box.set_hexpand(true);
    m_popover_box.pack_start(m_popover_label);
    m_popover_box.pack_start(m_popover_entry);
    m_popover_box.show_all();

    //m_popover.add_label("Sup holmes");
    m_popover.add(m_popover_box);
    m_popover.set_position(Gtk::POS_LEFT);
    m_popover.set_border_width(8);
    m_popover.set_modal(true);
    //m_popover.set_visible(true);

    auto stylecontext = m_popover.get_style_context();
    stylecontext->add_class(GTK_STYLE_CLASS_INFO);

    if(!pages.finished_loading()) {
        info_bar_loading();
    }
    else {
        info_bar_hide();
    }

}
Beispiel #17
0
void child_set_property(Gtk::Container& container, Gtk::Widget& child, const char *property_name, bool value) {
    GValue v = {0};
    g_value_init(&v, G_TYPE_BOOLEAN);
    g_value_set_boolean(&v, value);
    gtk_container_child_set_property(container.gobj(), child.gobj(), property_name, &v);
}
Beispiel #18
0
 void MainWindow::constructExitButton(Gtk::Container &parentContainer) {
   exitButton.set_label("Exit");
   parentContainer.add(exitButton);
 }
void SplitPaneLayout::constructLayout()
{
	_splitPane = SplitPaneView();

	_cameraPosition = getCameraPositionFromRegistry();

	const Glib::RefPtr<Gtk::Window>& parent = GlobalMainFrame().getTopLevelWindow();

	// Create a new camera window and parent it
	_camWnd = GlobalCamera().createCamWnd();
	 // greebo: The mainframe window acts as parent for the camwindow
	_camWnd->setContainer(parent);

	_camera = Gtk::manage(new gtkutil::FramedWidget(*_camWnd->getWidget()));

	// Allocate paned widgets
	_splitPane.horizPane.reset(new Gtk::HPaned);
	_splitPane.vertPane1 = Gtk::manage(new Gtk::VPaned);
	_splitPane.vertPane2 = Gtk::manage(new Gtk::VPaned);

	// Arrange the widgets into the paned views
	_splitPane.horizPane->pack1(*_splitPane.vertPane1, true, true);
	_splitPane.horizPane->pack2(*_splitPane.vertPane2, true, true);

	// Retrieve the main container of the main window
	Gtk::Container* mainContainer = GlobalMainFrame().getMainContainer();
	mainContainer->add(*_splitPane.horizPane);

	_splitPane.horizPane->set_position(200);
	_splitPane.vertPane1->set_position(200);
	_splitPane.vertPane2->set_position(400);

	_splitPane.posHPane.connect(_splitPane.horizPane.get());
	_splitPane.posVPane1.connect(_splitPane.vertPane1);
	_splitPane.posVPane2.connect(_splitPane.vertPane2);

	// Attempt to restore this layout's state, this will also construct the orthoviews
	restoreStateFromPath(RKEY_SPLITPANE_ROOT);

	// Distribute widgets among quadrants
	distributeWidgets();

    {
		Gtk::Frame* textureBrowser = Gtk::manage(new gtkutil::FramedWidget(
			*GlobalTextureBrowser().constructWindow(parent)
		));

		// Add the Media Browser page
		GlobalGroupDialog().addPage(
	    	"textures",	// name
	    	"Textures", // tab title
	    	"icon_texture.png", // tab icon
	    	*textureBrowser, // page widget
	    	_("Texture Browser")
	    );
    }

	GlobalGroupDialog().showDialogWindow();

	// greebo: Now that the dialog is shown, tell the Entity Inspector to reload
	// the position info from the Registry once again.
	GlobalEntityInspector().restoreSettings();

	GlobalGroupDialog().hideDialogWindow();

	mainContainer->show_all();
}
void RenderPreview::initialisePreview()
{
#if 0
#ifdef WIN32
    // greebo: Unfortunate hack to fix the grey GL renderviews in the EntityChooser
    // and other windows that are hidden instead of destroyed when closed.
    Gtk::Container* container = get_parent();
    bool wasShown = get_visible();

    if (container != NULL)
    {
        if (wasShown)
        {
            hide();
        }

        container->remove(*this);
        container->add(*this);

        if (wasShown)
        {
            show();
        }
    }

#endif
#endif
	// Grab the GL widget with sentry object
	wxPaintDC dc(_glWidget);
	_glWidget->SetCurrent(GlobalOpenGL().getwxGLContext());
	
    // Set up the camera
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(PREVIEW_FOV, 1, 0.1, 10000);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    // Set up the lights
    glEnable(GL_LIGHTING);

    glEnable(GL_LIGHT0);
    GLfloat l0Amb[] = { 0.3f, 0.3f, 0.3f, 1.0f };
    GLfloat l0Dif[] = { 1.0f, 1.0f, 1.0f, 1.0f };
    GLfloat l0Pos[] = { 1.0f, 1.0f, 1.0f, 0.0f };
    glLightfv(GL_LIGHT0, GL_AMBIENT, l0Amb);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, l0Dif);
    glLightfv(GL_LIGHT0, GL_POSITION, l0Pos);

    glEnable(GL_LIGHT1);
    GLfloat l1Dif[] = { 1.0, 1.0, 1.0, 1.0 };
    GLfloat l1Pos[] = { 0.0, 0.0, 1.0, 0.0 };
    glLightfv(GL_LIGHT1, GL_DIFFUSE, l1Dif);
    glLightfv(GL_LIGHT1, GL_POSITION, l1Pos);

    if (_renderSystem->shaderProgramsAvailable())
    {
        _renderSystem->setShaderProgram(
            RenderSystem::SHADER_PROGRAM_INTERACTION
        );
    }
}