Пример #1
0
// Create the objects panel (for manipulating the target_addobjectives objects)
void ObjectivesEditor::setupEntitiesPanel()
{
	// Tree view listing the target_addobjectives entities
    Gtk::TreeView* entityList = gladeWidget<Gtk::TreeView>(
        "entitiesTreeView"
    );
    entityList->set_model(_objectiveEntityList);
	entityList->set_headers_visible(false);

	entityList->get_selection()->signal_changed().connect(
		sigc::mem_fun(*this, &ObjectivesEditor::_onEntitySelectionChanged)
    );
	
	// Active-at-start column (checkbox)
	Gtk::CellRendererToggle* startToggle = Gtk::manage(new Gtk::CellRendererToggle);
	startToggle->signal_toggled().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onStartActiveCellToggled)
    );
	
	Gtk::TreeViewColumn* startCol = Gtk::manage(new Gtk::TreeViewColumn(_("Start")));
	startCol->add_attribute(startToggle->property_active(), _objEntityColumns.startActive);
	
	entityList->append_column(*startCol);
	
	// Name column
	entityList->append_column(*Gtk::manage(new gtkutil::TextColumn("", _objEntityColumns.displayName)));
	
    // Connect button signals
    Gtk::Button* addButton = gladeWidget<Gtk::Button>("createEntityButton");
	addButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onAddEntity)
    );

    Gtk::Button* delButton = gladeWidget<Gtk::Button>("deleteEntityButton");
	delButton->set_sensitive(false); // disabled at start
	delButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onDeleteEntity)
    );
}
Пример #2
0
CheatListDialog::CheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
    : Gtk::Dialog(_pstDialog)
{
    refBuilder->get_widget("CheatOpenButton", m_poCheatOpenButton);
    refBuilder->get_widget("CheatSaveButton", m_poCheatSaveButton);
    refBuilder->get_widget("CheatAddButton", m_poCheatAddButton);
    refBuilder->get_widget("CheatRemoveButton", m_poCheatRemoveButton);
    refBuilder->get_widget("CheatRemoveAllButton", m_poCheatRemoveAllButton);
    refBuilder->get_widget("CheatMarkAllButton", m_poCheatMarkAllButton);
    refBuilder->get_widget("CheatTreeView", m_poCheatTreeView);

    // Tree View model
    m_poCheatListStore = Gtk::ListStore::create(m_oRecordModel);

    m_poCheatTreeView->set_model(m_poCheatListStore);

    Gtk::CellRendererToggle* pRenderer = Gtk::manage(new Gtk::CellRendererToggle());

    int cols_count = m_poCheatTreeView->append_column("", *pRenderer);

    pRenderer->signal_toggled().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatToggled));

    Gtk::TreeViewColumn* pColumn = m_poCheatTreeView->get_column(cols_count - 1);

    if (pColumn)
        pColumn->add_attribute(pRenderer->property_active(), m_oRecordModel.bEnabled);

    m_poCheatTreeView->append_column("Description", m_oRecordModel.uDesc);

    m_poCheatOpenButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatListOpen));
    m_poCheatSaveButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatListSave));
    m_poCheatAddButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatAdd));
    m_poCheatRemoveButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatRemove));
    m_poCheatRemoveAllButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatRemoveAll));
    m_poCheatMarkAllButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatMarkAll));

    bMark = false;
}
Пример #3
0
Cal3dStoreOptions::Cal3dStoreOptions(Cal3dStore & s) :
                                     OptionBox("Cal3d Options"),
                                     m_cal3dStore(s)
{
    Gtk::VBox * vbox = this;

    m_columns = new Gtk::TreeModelColumnRecord();
    m_nameColumn = new Gtk::TreeModelColumn<Glib::ustring>();
    m_selectColumn = new Gtk::TreeModelColumn<bool>();
    m_idColumn = new Gtk::TreeModelColumn<int>();
    m_componentColumn = new Gtk::TreeModelColumn<ComponentType>();
    m_columns->add(*m_nameColumn);
    m_columns->add(*m_selectColumn);
    m_columns->add(*m_idColumn);
    m_columns->add(*m_componentColumn);

    m_treeModel = Gtk::TreeStore::create(*m_columns);

    m_treeView = manage( new Gtk::TreeView() );

    m_treeView->set_model( m_treeModel );

    m_treeView->append_column("Component", *m_nameColumn);

    Gtk::CellRendererToggle * crt = manage( new Gtk::CellRendererToggle() );
    crt->signal_toggled().connect( sigc::mem_fun(*this, &Cal3dStoreOptions::enableToggled) );
    int column_no = m_treeView->append_column("View", *crt);
    Gtk::TreeViewColumn * column = m_treeView->get_column(column_no - 1);
    column->add_attribute(crt->property_active(), *m_selectColumn);
    column->set_clickable();

    m_refTreeSelection = m_treeView->get_selection();
    m_refTreeSelection->set_mode(Gtk::SELECTION_SINGLE);
    // m_refTreeSelection->signal_changed().connect( sigc::mem_fun(*this, &Cal3dStoreOptions::selectionChanged) );

    Gtk::ScrolledWindow *scrolled_window = manage(new Gtk::ScrolledWindow());
    scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
    scrolled_window->set_size_request(250,150);
    scrolled_window->add(*m_treeView);

    vbox->pack_start(*scrolled_window);

    Gtk::HBox * bothbox = manage( new Gtk::HBox );

    Gtk::Button * b = manage( new Gtk::Button("Wuh...") );
    // b->signal_clicked().connect(sigc::mem_fun(*this, &Cal3dStoreOptions::typesPressed));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    vbox->pack_start(*bothbox, Gtk::PACK_SHRINK, 6);

    animationRow = *(m_treeModel->append());
    animationRow[*m_nameColumn] = Glib::ustring("Animations");

    actionRow = *(m_treeModel->append());
    actionRow[*m_nameColumn] = Glib::ustring("Actions");

    meshRow = *(m_treeModel->append());
    meshRow[*m_nameColumn] = Glib::ustring("Meshes");

    materialRow = *(m_treeModel->append());
    materialRow[*m_nameColumn] = Glib::ustring("Materials");

    Cal3dModel & m = s.getModel();

    m.skeletonLoaded.connect(sigc::mem_fun(*this, &Cal3dStoreOptions::skeletonLoaded));
    m.animationLoaded.connect(sigc::mem_fun(*this, &Cal3dStoreOptions::animationLoaded));
    m.actionLoaded.connect(sigc::mem_fun(*this, &Cal3dStoreOptions::actionLoaded));
    m.meshLoaded.connect(sigc::mem_fun(*this, &Cal3dStoreOptions::meshLoaded));
    m.materialLoaded.connect(sigc::mem_fun(*this, &Cal3dStoreOptions::materialLoaded));
}
Пример #4
0
KeyframeTree::KeyframeTree()
{
	const KeyframeTreeStore::Model model;

	{	// --- O N / O F F ----------------------------------------------------
		Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_(" ")) );

		// Set up the on/off cell-renderer
		Gtk::CellRendererToggle* cellrenderer = Gtk::manage( new Gtk::CellRendererToggle() );
		cellrenderer->signal_toggled().connect(sigc::mem_fun(*this, &studio::KeyframeTree::on_keyframe_toggle));
		column->pack_start(*cellrenderer,false);
		column->add_attribute(cellrenderer->property_active(), model.active);
		append_column(*column);
	}
	{
		Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Time")) );

		cell_renderer_time = Gtk::manage( new CellRenderer_Time() );
		column->pack_start(*cell_renderer_time,true);
		column->add_attribute(cell_renderer_time->property_time(), model.time);
		cell_renderer_time->signal_edited().connect(sigc::mem_fun(*this,&studio::KeyframeTree::on_edited_time));

		column->set_reorderable();
		column->set_resizable();
		column->set_clickable();
		column->set_sort_column(model.time);

		append_column(*column);
	}
	{
		Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Length")) );

		cell_renderer_time_delta = Gtk::manage( new CellRenderer_Time() );
		column->pack_start(*cell_renderer_time_delta,true);
		column->add_attribute(cell_renderer_time_delta->property_time(), model.time_delta);
		cell_renderer_time_delta->signal_edited().connect(sigc::mem_fun(*this,&studio::KeyframeTree::on_edited_time_delta));

		column->set_reorderable();
		column->set_resizable();
		column->set_clickable(false);
		// column->set_sort_column(model.time_delta);

		append_column(*column);
	}
	{
		Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Jump")) );

		Gtk::CellRendererText* cell_renderer_jump=Gtk::manage(new Gtk::CellRendererText());
		column->pack_start(*cell_renderer_jump,true);
		cell_renderer_jump->property_text()=_("(JMP)");
		cell_renderer_jump->property_foreground()="#003a7f";

		column->set_reorderable();
		column->set_resizable();
		column->set_clickable(false);

		append_column(*column);
	}
	{
		Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Description")) );

		cell_renderer_description=Gtk::manage(new Gtk::CellRendererText());
		column->pack_start(*cell_renderer_description,true);
		column->add_attribute(cell_renderer_description->property_text(), model.description);
		cell_renderer_description->signal_edited().connect(sigc::mem_fun(*this,&studio::KeyframeTree::on_edited_description));

		column->set_reorderable();
		column->set_resizable();
		column->set_clickable();
		column->set_sort_column(model.description);

		append_column(*column);
	}

	set_enable_search(true);
	set_search_column(model.description);

	// This makes things easier to read.
	set_rules_hint();

	// Make us more sensitive to several events
	add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);

	// Listen to the changed selection signal to perform kf synchro thrue canvas interface
	get_selection()->signal_changed().connect(sigc::mem_fun(*this, &studio::KeyframeTree::on_selection_changed));
	send_selection = false;
}
Пример #5
0
LayerWindow::LayerWindow(MainWindow & mw) : OptionBox("Layers"),
                                            m_currentModel(0)
{
    // destroy.connect(slot(this, &LayerWindow::destroy_handler));
    // Gtk::VBox * vbox = manage( new Gtk::VBox(false, 2) );
    Gtk::VBox * vbox = this;

    Gtk::HBox * tophbox = manage( new Gtk::HBox() );

    tophbox->pack_start(*(manage( new Gtk::Label("Model:") )), Gtk::PACK_SHRINK, 2);
    m_modelMenu = manage( new Gtk::OptionMenu() );

    tophbox->pack_start(*m_modelMenu, Gtk::PACK_EXPAND_WIDGET, 2);
    tophbox->pack_start(*(manage( new Gtk::Label("WOOT") ) ), Gtk::PACK_SHRINK, 2);
   
    vbox->pack_start(*tophbox, Gtk::PACK_SHRINK, 2);
    
    m_columns = new Gtk::TreeModelColumnRecord();
    m_visColumn = new Gtk::TreeModelColumn<bool>();
    m_typeColumn = new Gtk::TreeModelColumn<Glib::ustring>();
    m_nameColumn = new Gtk::TreeModelColumn<Glib::ustring>();
    m_ptrColumn = new Gtk::TreeModelColumn<Layer*>();
    m_columns->add(*m_visColumn);
    m_columns->add(*m_typeColumn);
    m_columns->add(*m_nameColumn);
    m_columns->add(*m_ptrColumn);

    m_treeModel = Gtk::ListStore::create(*m_columns);

    m_treeView = manage( new Gtk::TreeView() );

    m_treeView->set_model( m_treeModel );

    Gtk::CellRendererToggle * crt = manage( new Gtk::CellRendererToggle() );
    crt->signal_toggled().connect( sigc::mem_fun(*this, &LayerWindow::visibleToggled) );
    int column_no = m_treeView->append_column("Visible", *crt);
    Gtk::TreeViewColumn * column = m_treeView->get_column(column_no - 1);
    column->add_attribute(crt->property_active(), *m_visColumn);
    column->set_clickable();

    m_treeView->append_column("Type", *m_typeColumn);
    m_treeView->append_column("Name", *m_nameColumn);

    m_refTreeSelection = m_treeView->get_selection();
    m_refTreeSelection->set_mode(Gtk::SELECTION_SINGLE);
    m_refTreeSelection->signal_changed().connect( sigc::mem_fun(*this, &LayerWindow::selectionChanged) );

    vbox->pack_start(*manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK);

    Gtk::ScrolledWindow *scrolled_window = manage(new Gtk::ScrolledWindow());
    scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
    scrolled_window->set_size_request(250,150);
    scrolled_window->add(*m_treeView);

    vbox->pack_start(*scrolled_window);

    Gtk::HBox * bothbox = manage( new Gtk::HBox() );
    Gtk::Button * b = manage( new Gtk::Button() );


    Glib::RefPtr<Gdk::Bitmap> pixmask;
    Glib::RefPtr<Gdk::Pixmap> p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, newlayer_xpm);
    b->add_pixmap(p, pixmask);

    b->signal_clicked().connect(sigc::mem_fun(*this, &LayerWindow::newLayerRequested));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, raise_xpm);
    b->add_pixmap(p, pixmask);
    b->signal_clicked().connect(sigc::mem_fun(*this, &LayerWindow::raiseLayer));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, lower_xpm);
    b->add_pixmap(p, pixmask);
    b->signal_clicked().connect(sigc::mem_fun(*this, &LayerWindow::lowerLayer));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, duplicate_xpm);
    b->add_pixmap(p, pixmask);
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, delete_xpm);
    b->add_pixmap(p, pixmask);
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    vbox->pack_start(*bothbox, Gtk::PACK_SHRINK, 6);

    // add(*vbox);
    // set_title("Layers");
    set_sensitive(false);

    // FIXME Organise the xpms
    //m_eye = gdk_pixmap_create_from_xpm_d(m_clist->gtkobj()->clist_window,
            //&m_eyemask, &GTK_WIDGET(m_clist->gtkobj())->style->white, eye_xpm);

    //m_null = gdk_pixmap_create_from_xpm_d(m_clist->gtkobj()->clist_window,
           //&m_nullmask, &GTK_WIDGET(m_clist->gtkobj())->style->white, null_xpm);

    m_newLayerWindow = new NewLayerWindow();
    // show_all();

    mw.modelAdded.connect(sigc::mem_fun(*this, &LayerWindow::modelAdded));
    mw.currentModelChanged.connect(sigc::mem_fun(*this, &LayerWindow::currentModelChanged));

    signal_delete_event().connect(sigc::mem_fun(*this, &LayerWindow::deleteEvent));
}