StimResponseEditor::StimResponseEditor() : gtkutil::BlockingTransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow()), _entity(NULL), _stimEditor(Gtk::manage(new StimEditor(_stimTypes))), _responseEditor(Gtk::manage(new ResponseEditor(getRefPtr(), _stimTypes))), _customStimEditor(Gtk::manage(new CustomStimEditor(_stimTypes))) { // Set the default border width in accordance to the HIG set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); signal_key_press_event().connect(sigc::mem_fun(*this, &StimResponseEditor::onWindowKeyPress), false); // Create the widgets populateWindow(); // Connect the window position tracker _windowPosition.loadFromPath(RKEY_WINDOW_STATE); _windowPosition.connect(this); _windowPosition.applyPosition(); // Show the dialog, this enters the gtk main loop show(); }
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(); }
/** \brief * * Constructor. Sets up a modeless window and adds the HUD component to a * ScrolledWindow component. * */ HUDWindow::HUDWindow() { set_type_hint(Gdk::WINDOW_TYPE_HINT_NORMAL); set_title(gettext("Player HUD Window")); set_resizable(true); set_decorated(true); set_position(Gtk::WIN_POS_CENTER); set_modal(false); set_icon( Gdk::Pixbuf::create_from_xpm_data( Helmet_xpm ) ); PositionWindow(); f_charView.AddHUDColumns(); f_charView.set_border_width( 1 ); //f_charView.update(); // f_scrolledWindow.add( f_charView ); f_scrolledWindow.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); f_scrolledWindow.set_shadow_type( Gtk::SHADOW_IN ); f_scrolledWindow.set_border_width( 1 ); // f_mainBox.pack_start( f_scrolledWindow, Gtk::PACK_EXPAND_WIDGET ); f_mainBox.pack_start( f_statusBox, Gtk::PACK_SHRINK ); // add( f_mainBox ); f_statusBox.Update(); show_all_children(); }
// Constructor creates widgets ObjectivesEditor::ObjectivesEditor() : gtkutil::BlockingTransientWindow( _(DIALOG_TITLE), GlobalMainFrame().getTopLevelWindow() ), gtkutil::GladeWidgetHolder("ObjectivesEditor.glade"), _objectiveEntityList(Gtk::ListStore::create(_objEntityColumns)), _objectiveList(Gtk::ListStore::create(_objectiveColumns)) { // Window properties set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); set_position(Gtk::WIN_POS_CENTER_ON_PARENT); // Add vbox to dialog add(*gladeWidget<Gtk::Widget>("mainVbox")); g_assert(get_child() != NULL); // Setup signals and tree views setupEntitiesPanel(); setupObjectivesPanel(); // Buttons not associated with a treeview panel Gtk::Button* logicButton = gladeWidget<Gtk::Button>( "editSuccessLogicButton" ); logicButton->signal_clicked().connect( sigc::mem_fun(*this, &ObjectivesEditor::_onEditLogic) ); Gtk::Button* conditionsButton = gladeWidget<Gtk::Button>( "editObjectiveConditionsButton" ); conditionsButton->signal_clicked().connect( sigc::mem_fun(*this, &ObjectivesEditor::_onEditObjConditions) ); gladeWidget<Gtk::Button>("cancelButton")->signal_clicked().connect( sigc::mem_fun(*this, &ObjectivesEditor::_onCancel) ); gladeWidget<Gtk::Button>("okButton")->signal_clicked().connect( sigc::mem_fun(*this, &ObjectivesEditor::_onOK) ); // Connect the window position tracker _windowPosition.loadFromPath(RKEY_WINDOW_STATE); _windowPosition.connect(this); _windowPosition.applyPosition(); _objectiveEClasses.clear(); xml::NodeList nodes = GlobalRegistry().findXPath(RKEY_OBJECTIVE_ENTS); for (xml::NodeList::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { _objectiveEClasses.push_back(i->getAttributeValue("name")); } }
FindAndReplaceShader::FindAndReplaceShader() : gtkutil::BlockingTransientWindow(_(FINDDLG_WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow()) { set_default_size(FINDDLG_DEFAULT_SIZE_X, FINDDLG_DEFAULT_SIZE_Y); set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); // Create all the widgets populateWindow(); // Propagate shortcuts to the main window GlobalEventManager().connectDialogWindow(this); }
GxSplashBox::GxSplashBox() : Gtk::Window(Gtk::WINDOW_POPUP) { set_redraw_on_allocate(true); set_app_paintable(); signal_expose_event().connect( sigc::group(&gx_cairo::splash_expose, GTK_WIDGET(gobj()), sigc::_1, (void*)0), false); set_decorated(false); set_type_hint(Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN); set_position(Gtk::WIN_POS_CENTER ); set_default_size(280,80); show_all(); }
FloatingCamWnd::FloatingCamWnd(const Glib::RefPtr<Gtk::Window>& parent) : PersistentTransientWindow(_("Camera"), parent, true) { CamWnd::setContainer(getRefPtr()); add(*Gtk::manage(new gtkutil::FramedWidget(*CamWnd::getWidget()))); set_type_hint(Gdk::WINDOW_TYPE_HINT_NORMAL); #ifdef WIN32 // This is to fix camviews from going grey in Windows, due to some GTK/GtkGLExt bug CamWnd::connectWindowStateEvent(*this); #endif }
Movie::Progress::Progress(MovieWindow& _parent, const struct MovieInfo &_movie, Movie::Renderer& _ren) : parent(_parent), renderer(_ren), chunks_done(0), chunks_count(0), frames_done(-1), npixels(_movie.height * _movie.width * (_movie.antialias ? 4 : 1)), nframes(_movie.count_frames()), movie(_movie) { // Precondition: GDK threads lock held vbox = Gtk::manage(new Gtk::VBox()); plotbar = Gtk::manage(new Gtk::ProgressBar()); framebar = Gtk::manage(new Gtk::ProgressBar()); moviebar = Gtk::manage(new Gtk::ProgressBar()); set_title("Movie progress"); set_type_hint(Gdk::WindowTypeHint::WINDOW_TYPE_HINT_UTILITY); Gtk::Label *lbl; #define LABEL(_txt) do { lbl = Gtk::manage(new Gtk::Label(_txt)); vbox->pack_start(*lbl); } while(0) LABEL("Current pass"); vbox->pack_start(*plotbar); LABEL("Current plot"); vbox->pack_start(*framebar); LABEL("Overall"); vbox->pack_start(*moviebar); Gtk::HButtonBox *bbox = Gtk::manage(new Gtk::HButtonBox()); vbox->pack_end(*bbox); cancel_btn = Gtk::manage(new Gtk::Button("Cancel")); cancel_btn->signal_clicked().connect(sigc::mem_fun(*this, &Movie::Progress::do_cancel)); bbox->pack_end(*cancel_btn); add(*vbox); show_all(); Glib::signal_timeout().connect( sigc::mem_fun(*this, &Movie::Progress::on_timer), 300 ); // Cannot call plot_complete() here as we already hold the GDK lock frames_traversed_gdklocked(1); // And set up an initial position.. Try to put this left of the Movie window. // This is tricky as the window resizes itself around its content soon after construction. // For now I'm going to cheat horribly and hard-wire what it ends up as on my machine :-) #define ASSUMED_PROGRESS_WIDTH 280 int ww, hh, px, py; Util::get_screen_geometry(*this, ww, hh); parent.get_position(px, py); int xx = px - ASSUMED_PROGRESS_WIDTH; int yy = py; // Put at same Y placement as parent, unless we don't fit if (yy + get_height() + 20 > hh) yy = hh - get_height() - 20; Util::fix_window_coords(*this, xx, yy); // Sanity check move(xx,yy); }
PageFlipPanel::PageFlipPanel() : up_button("U"), down_button("D") { int width = 50; up_button.signal_clicked().connect( sigc::mem_fun(*this, &PageFlipPanel::up_button_pressed)); down_button.signal_clicked().connect( sigc::mem_fun(*this, &PageFlipPanel::down_button_pressed)); vbox.pack_start(up_button, Gtk::PACK_EXPAND_WIDGET); vbox.pack_start(down_button); add(vbox); up_button.show(); down_button.show(); vbox.show(); set_default_size(width, Gdk::screen_height()); move(Gdk::screen_width()-width, 0); set_type_hint(Gdk::WINDOW_TYPE_HINT_DOCK); show(); gulong val[12]; val[0] = 0; val[1] = width; val[2] = 0; val[3] = 0; val[4] = 0; val[5] = 0; val[6] = 0; val[7] = 200; val[8] = 0; val[9] = 0; val[10] = 0; val[11] = 0; GtkWindow* gtkWindow = gobj(); gdk_property_change( GTK_WIDGET(gtkWindow)->window, gdk_atom_intern("_NET_WM_STRUT_PARTIAL", FALSE), gdk_atom_intern ("CARDINAL", FALSE), 32, GDK_PROP_MODE_REPLACE, (unsigned char *)val, 12); }
FloatWidget::FloatWidget(Gtk::Widget& parent, int width, int height) : m_width(width), m_height(height) { m_parent = &parent; resize(m_width, m_height); set_decorated(false); set_keep_above(); set_skip_taskbar_hint(true); set_skip_pager_hint(true); set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY); reparent(parent); m_widgetlist.insert(this); }
MD5AnimationViewer::MD5AnimationViewer() : gtkutil::BlockingTransientWindow(_("MD5 Animation Viewer"), GlobalMainFrame().getTopLevelWindow()), _modelList(Gtk::TreeStore::create(_modelColumns)), _modelPopulator(_modelList), _animList(Gtk::ListStore::create(_animColumns)), _preview(new AnimationPreview) { // Set the default border width in accordance to the HIG set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); // Set the default size of the window const Glib::RefPtr<Gtk::Window>& mainWindow = GlobalMainFrame().getTopLevelWindow(); Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(mainWindow); int height = static_cast<int>(rect.get_height() * 0.6f); set_default_size( static_cast<int>(rect.get_width() * 0.8f), height ); // Set the default size of the window _preview->setSize(rect.get_width() * 0.2f, height); // Main dialog vbox Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 12)); // Create a horizontal box to pack the treeview on the left and the preview on the right Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6)); hbox->pack_start(createListPane(), true, true, 0); Gtk::VBox* previewBox = Gtk::manage(new Gtk::VBox(false, 0)); previewBox->pack_start(*_preview, true, true, 0); hbox->pack_start(*previewBox, true, true, 0); vbox->pack_start(*hbox, true, true, 0); vbox->pack_end(createButtons(), false, false, 0); // Add main vbox to dialog add(*vbox); // Populate with model names populateModelList(); }
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); }
DifficultyDialog::DifficultyDialog() : gtkutil::BlockingTransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow()) { // Load the settings _settingsManager.loadSettings(); // Set the default border width in accordance to the HIG set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); set_modal(true); signal_key_press_event().connect(sigc::mem_fun(*this, &DifficultyDialog::onWindowKeyPress), false); // Create the widgets populateWindow(); // Connect the window position tracker _windowPosition.loadFromPath(RKEY_WINDOW_STATE); _windowPosition.connect(this); _windowPosition.applyPosition(); }
// Constructor SoundChooser::SoundChooser() : BlockingTransientWindow(_("Choose sound"), GlobalMainFrame().getTopLevelWindow()), _treeStore(Gtk::TreeStore::create(_columns)), _treeView(NULL), _preview(Gtk::manage(new SoundShaderPreview)) { set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); // Set the default size of the window Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalMainFrame().getTopLevelWindow()); set_default_size(rect.get_width() / 2, rect.get_height() / 2); // Main vbox Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 12)); vbx->pack_start(createTreeView(), true, true, 0); vbx->pack_start(*_preview, false, false, 0); vbx->pack_start(createButtons(), false, false, 0); add(*vbx); }
ConversationDialog::ConversationDialog() : gtkutil::BlockingTransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow()), _convEntityList(Gtk::ListStore::create(_convEntityColumns)), _entityView(NULL), _convList(Gtk::ListStore::create(_convColumns)) { // Set the default border width in accordance to the HIG set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); signal_key_press_event().connect(sigc::mem_fun(*this, &ConversationDialog::onWindowKeyPress), false); // Create the widgets populateWindow(); // Connect the window position tracker _windowPosition.loadFromPath(RKEY_WINDOW_STATE); _windowPosition.connect(this); _windowPosition.applyPosition(); // Show the dialog, this enters the gtk main loop show(); }
guiTools::guiTools(Controller *c, guiMain *gui) : m_Adjustment_Median_Radius(1.0, 1.0, 2.0, 1.0, 0.0, 0.0), m_SpinButton_Median_Radius(m_Adjustment_Median_Radius), m_Adjustment_Gauss_Radius(1.0, 1.0, 10.0, 1.0, 0.0, 0.0), m_SpinButton_Gauss_Radius(m_Adjustment_Gauss_Radius), m_Adjustment_Gauss_Sigma(1.0, 0.1, 5.0, 0.1, 0.0, 0.0), m_HScale_Gauss_Sigma(m_Adjustment_Gauss_Sigma), m_Adjustment_Bilateral_Radius(1.0, 1.0, 10.0, 1.0, 0.0, 0.0), m_SpinButton_Bilateral_Radius(m_Adjustment_Bilateral_Radius), m_Adjustment_Bilateral_Sigma_Color(1.0, 0.1, 500.0, 0.1, 0.0, 0.0), m_HScale_Bilateral_Sigma_Color(m_Adjustment_Bilateral_Sigma_Color), m_Adjustment_Bilateral_Sigma_Space(1.0, 0.1, 500.0, 0.1, 0.0, 0.0), m_HScale_Bilateral_Sigma_Space(m_Adjustment_Bilateral_Sigma_Space), m_Adjustment_Morphological_Radius(1.0, 1.0, 10.0, 1.0, 0.0, 0.0), m_SpinButton_Morphological_Radius(m_Adjustment_Morphological_Radius) { controller = c; frameManager = controller->getFrameManager(); frameProcessor = frameManager->getFrameProcessor(); mainGUI = gui; // Median filter m_medianFiter = false; m_Frame_Median.set_label("2D Median Filter"); m_CheckButton_Median.set_label("Enable"); m_CheckButton_Median.signal_clicked().connect( sigc::mem_fun(*this, &guiTools::on_checkbutton_median_clicked) ); m_CheckButton_Median_Masked.set_label("Use mask"); m_CheckButton_Median_Masked.set_active(true); m_CheckButton_Median_Masked.signal_clicked().connect( sigc::mem_fun(*this, &guiTools::on_checkbutton_median_masked_clicked) ); m_Label_Median_Radius.set_label("Radius:"); m_Label_Median_Radius.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP); m_kernelRadiusMedian = 1; m_HBox_Median_Radius.pack_start(m_Label_Median_Radius, Gtk::PACK_SHRINK, 5); m_Adjustment_Median_Radius.signal_value_changed().connect( sigc::mem_fun(*this, &guiTools::on_spinbutton_median_radius_value_changed) ); m_HBox_Median_Radius.pack_start(m_SpinButton_Median_Radius, Gtk::PACK_EXPAND_PADDING, 5); m_VBox_Median.pack_start(m_CheckButton_Median, Gtk::PACK_START, 5); m_VBox_Median.pack_start(m_CheckButton_Median_Masked, Gtk::PACK_SHRINK, 5); m_VBox_Median.pack_start(m_HBox_Median_Radius, Gtk::PACK_SHRINK, 5); m_VBox_Median.set_border_width(5); m_Frame_Median.add(m_VBox_Median); m_Frame_Median.set_border_width(5); // 3D Median filter m_medianFiter3D = false; m_Frame_Median3D.set_label("3D Median Filter"); m_CheckButton_Median3D.set_label("Enable"); m_CheckButton_Median3D.signal_clicked().connect( sigc::mem_fun(*this, &guiTools::on_checkbutton_median3D_clicked) ); m_CheckButton_Median3D_Masked.set_label("Use mask"); m_CheckButton_Median3D_Masked.set_active(true); m_CheckButton_Median3D_Masked.signal_clicked().connect( sigc::mem_fun(*this, &guiTools::on_checkbutton_median3D_masked_clicked) ); m_VBox_Median3D.pack_start(m_CheckButton_Median3D, Gtk::PACK_START, 5); m_VBox_Median3D.pack_start(m_CheckButton_Median3D_Masked, Gtk::PACK_SHRINK, 5); m_VBox_Median3D.set_border_width(5); m_Frame_Median3D.add(m_VBox_Median3D); m_Frame_Median3D.set_border_width(5); // Gaussian filter m_gaussianFiter = false; m_Frame_Gaussian.set_label("Gaussian Filter"); m_CheckButton_Gauss.set_label("Enable"); m_CheckButton_Gauss.signal_clicked().connect( sigc::mem_fun(*this, &guiTools::on_checkbutton_gauss_clicked) ); m_Label_Gauss_Radius.set_label("Radius:"); m_Label_Gauss_Radius.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP); m_CheckButton_Gauss_Auto_Sigma.set_label("Manual Sigma Adjustment"); m_CheckButton_Gauss_Auto_Sigma.signal_clicked().connect( sigc::mem_fun(*this, &guiTools::on_checkbutton_gauss_auto_sigma_clicked) ); m_kernelRadiusGauss = 1; m_HBox_Gauss_Radius.pack_start(m_Label_Gauss_Radius, Gtk::PACK_SHRINK, 5); m_Adjustment_Gauss_Radius.signal_value_changed().connect( sigc::mem_fun(*this, &guiTools::on_spinbutton_gauss_radius_value_changed) ); m_HBox_Gauss_Radius.pack_start(m_SpinButton_Gauss_Radius, Gtk::PACK_EXPAND_PADDING, 5); m_Label_Gauss_Auto_Sigma.set_label("Sigma:"); m_Label_Gauss_Auto_Sigma.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP); m_Label_Gauss_Auto_Sigma.set_sensitive(false); m_HBox_Gauss_Auto_Sigma.pack_start(m_Label_Gauss_Auto_Sigma, Gtk::PACK_SHRINK, 5); m_sigmaGauss = -1.0; m_Adjustment_Gauss_Sigma.set_value(frameProcessor->calcGaussianSigma(m_kernelRadiusGauss)); m_HScale_Gauss_Sigma.set_digits(2); m_HScale_Gauss_Sigma.set_draw_value(true); // Show position label m_HScale_Gauss_Sigma.set_value_pos(Gtk::POS_BOTTOM); // Where to draw the position label (if drawn at all) m_HScale_Gauss_Sigma.set_sensitive(false); m_HScale_Gauss_Sigma.signal_button_press_event().connect(sigc::mem_fun(*this, &guiTools::on_slider_gauss_sigma_clicked), false); m_HScale_Gauss_Sigma.signal_button_release_event().connect(sigc::mem_fun(*this, &guiTools::on_slider_gauss_sigma_released), false); m_HScale_Gauss_Sigma.signal_change_value().connect(sigc::mem_fun(*this, &guiTools::on_slider_gauss_sigma_change_value) ); m_HBox_Gauss_Auto_Sigma.add(m_HScale_Gauss_Sigma); m_VBox_Gauss.pack_start(m_CheckButton_Gauss, Gtk::PACK_START, 5); m_VBox_Gauss.pack_start(m_CheckButton_Gauss_Auto_Sigma, Gtk::PACK_SHRINK, 5); m_VBox_Gauss.pack_start(m_HBox_Gauss_Radius, Gtk::PACK_SHRINK, 5); m_VBox_Gauss.pack_start(m_HBox_Gauss_Auto_Sigma, Gtk::PACK_SHRINK, 5); m_VBox_Gauss.set_border_width(5); m_Frame_Gaussian.add(m_VBox_Gauss); m_Frame_Gaussian.set_border_width(5); // Bilateral filter m_bilateralFilter = false; m_Frame_Bilateral.set_label("Bilateral Filter"); m_CheckButton_Bilateral.set_label("Enable"); m_CheckButton_Bilateral.signal_clicked().connect( sigc::mem_fun(*this, &guiTools::on_checkbutton_bilateral_clicked) ); m_Label_Bilateral_Radius.set_label("Radius:"); m_Label_Bilateral_Radius.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP); m_kernelRadiusBilateral = 1; m_HBox_Bilateral_Radius.pack_start(m_Label_Bilateral_Radius, Gtk::PACK_SHRINK, 5); m_Adjustment_Bilateral_Radius.signal_value_changed().connect( sigc::mem_fun(*this, &guiTools::on_spinbutton_bilateral_radius_value_changed) ); m_HBox_Bilateral_Radius.pack_start(m_SpinButton_Bilateral_Radius, Gtk::PACK_EXPAND_PADDING, 5); m_Label_Bilateral_Sigma_Color.set_label("Sigma Color:"); m_Label_Bilateral_Sigma_Color.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP); m_HBox_Bilateral_Sigma_Color.pack_start(m_Label_Bilateral_Sigma_Color, Gtk::PACK_SHRINK, 5); m_sigmaBilateralColor = 50.0; m_Adjustment_Bilateral_Sigma_Color.set_value(m_sigmaBilateralColor); m_HScale_Bilateral_Sigma_Color.set_digits(2); m_HScale_Bilateral_Sigma_Color.set_draw_value(true); // Show position label m_HScale_Bilateral_Sigma_Color.set_value_pos(Gtk::POS_BOTTOM); // Where to draw the position label (if drawn at all) m_HScale_Bilateral_Sigma_Color.set_sensitive(true); m_HScale_Bilateral_Sigma_Color.signal_button_press_event().connect(sigc::mem_fun(*this, &guiTools::on_slider_bilateral_sigma_color_clicked), false); m_HScale_Bilateral_Sigma_Color.signal_button_release_event().connect(sigc::mem_fun(*this, &guiTools::on_slider_bilateral_sigma_color_released), false); m_HScale_Bilateral_Sigma_Color.signal_change_value().connect(sigc::mem_fun(*this, &guiTools::on_slider_bilateral_sigma_color_change_value) ); m_HBox_Bilateral_Sigma_Color.add(m_HScale_Bilateral_Sigma_Color); m_Label_Bilateral_Sigma_Space.set_label("Sigma Space:"); m_Label_Bilateral_Sigma_Space.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP); m_HBox_Bilateral_Sigma_Space.pack_start(m_Label_Bilateral_Sigma_Space, Gtk::PACK_SHRINK, 5); m_sigmaBilateralSpace = 3.0; m_Adjustment_Bilateral_Sigma_Space.set_value(m_sigmaBilateralSpace); m_HScale_Bilateral_Sigma_Space.set_digits(2); m_HScale_Bilateral_Sigma_Space.set_draw_value(true); // Show position label m_HScale_Bilateral_Sigma_Space.set_value_pos(Gtk::POS_BOTTOM); // Where to draw the position label (if drawn at all) m_HScale_Bilateral_Sigma_Space.set_sensitive(true); m_HScale_Bilateral_Sigma_Space.signal_button_press_event().connect(sigc::mem_fun(*this, &guiTools::on_slider_bilateral_sigma_space_clicked), false); m_HScale_Bilateral_Sigma_Space.signal_button_release_event().connect(sigc::mem_fun(*this, &guiTools::on_slider_bilateral_sigma_space_released), false); m_HScale_Bilateral_Sigma_Space.signal_change_value().connect(sigc::mem_fun(*this, &guiTools::on_slider_bilateral_sigma_space_change_value) ); m_HBox_Bilateral_Sigma_Space.add(m_HScale_Bilateral_Sigma_Space); m_VBox_Bilateral.pack_start(m_CheckButton_Bilateral, Gtk::PACK_START, 5); m_VBox_Bilateral.pack_start(m_HBox_Bilateral_Radius, Gtk::PACK_SHRINK, 5); m_VBox_Bilateral.pack_start(m_HBox_Bilateral_Sigma_Color, Gtk::PACK_SHRINK, 5); m_VBox_Bilateral.pack_start(m_HBox_Bilateral_Sigma_Space, Gtk::PACK_SHRINK, 5); m_VBox_Bilateral.set_border_width(5); m_Frame_Bilateral.add(m_VBox_Bilateral); m_Frame_Bilateral.set_border_width(5); // Morphological transformation m_morphologicalFilter = false; m_kernelRadiusMorphological = 1; m_kernelTypeMorphological = 0; m_Frame_Morphological.set_label("Opening Filter"); m_CheckButton_Morphological.set_label("Enable"); m_CheckButton_Morphological.signal_clicked().connect( sigc::mem_fun(*this, &guiTools::on_checkbutton_morphological_clicked) ); m_CheckButton_Morphological_Masked.set_label("Use mask"); m_CheckButton_Morphological_Masked.set_active(true); m_CheckButton_Morphological_Masked.signal_clicked().connect( sigc::mem_fun(*this, &guiTools::on_checkbutton_morphological_masked_clicked) ); m_Label_Morphological_Radius.set_label("Radius:"); m_Label_Morphological_Radius.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP); m_HBox_Morphological_Radius.pack_start(m_Label_Morphological_Radius, Gtk::PACK_SHRINK, 5); m_Adjustment_Morphological_Radius.signal_value_changed().connect( sigc::mem_fun(*this, &guiTools::on_spinbutton_morphological_radius_value_changed) ); m_HBox_Morphological_Radius.pack_start(m_SpinButton_Morphological_Radius, Gtk::PACK_EXPAND_PADDING, 5); m_Label_Morphological_Kerneltype.set_label("Kernel type:"); m_Label_Morphological_Kerneltype.set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP); m_HBox_Morphological_Kerneltype.pack_start(m_Label_Morphological_Kerneltype, Gtk::PACK_SHRINK, 5); m_Combo_Morphological_Kerneltype.append("Cross-shaped"); m_Combo_Morphological_Kerneltype.append("Rectangular"); m_Combo_Morphological_Kerneltype.append("Elliptic"); m_Combo_Morphological_Kerneltype.set_active(0); // Initial value m_Combo_Morphological_Kerneltype.set_size_request(120); m_Combo_Morphological_Kerneltype.signal_changed().connect(sigc::mem_fun(*this, &guiTools::on_combo_morphological_kerneltype_changed)); m_HBox_Morphological_Kerneltype.pack_start(m_Combo_Morphological_Kerneltype, Gtk::PACK_EXPAND_PADDING, 5); m_VBox_Morphological.pack_start(m_CheckButton_Morphological, Gtk::PACK_START, 5); m_VBox_Morphological.pack_start(m_CheckButton_Morphological_Masked, Gtk::PACK_SHRINK, 5); m_VBox_Morphological.pack_start(m_HBox_Morphological_Radius, Gtk::PACK_SHRINK, 5); m_VBox_Morphological.pack_start(m_HBox_Morphological_Kerneltype, Gtk::PACK_SHRINK, 5); m_VBox_Morphological.set_border_width(5); m_Frame_Morphological.add(m_VBox_Morphological); m_Frame_Morphological.set_border_width(5); m_VBox_Spatial_Filters.pack_start(m_Frame_Median, Gtk::PACK_START, 5); m_VBox_Spatial_Filters.pack_start(m_Frame_Median3D, Gtk::PACK_START, 5); m_VBox_Spatial_Filters.pack_start(m_Frame_Gaussian, Gtk::PACK_START, 5); m_VBox_Spatial_Filters.pack_start(m_Frame_Bilateral, Gtk::PACK_START, 5); m_VBox_Spatial_Filters.pack_start(m_Frame_Morphological, Gtk::PACK_START, 5); add(m_VBox_Spatial_Filters); set_title("OpenCV Filters"); set_skip_taskbar_hint(true); // No task bar entry set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); // No task bar entry, always on top set_size_request(250, 675); }
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(); }
EffectEditor::EffectEditor(const Glib::RefPtr<Gtk::Window>& parent, StimResponse& response, const unsigned int effectIndex, StimTypes& stimTypes, ui::ResponseEditor& editor) : gtkutil::BlockingTransientWindow(_(WINDOW_TITLE), parent), _argTable(NULL), _effectStore(Gtk::ListStore::create(_effectColumns)), _entityStore(Gtk::ListStore::create(_entityColumns)), _response(response), _effectIndex(effectIndex), _backup(_response.getResponseEffect(_effectIndex)), _editor(editor), _stimTypes(stimTypes) { set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); // Retrieve the map from the ResponseEffectTypes object ResponseEffectTypeMap& effectTypes = ResponseEffectTypes::Instance().getMap(); // Now populate the list store with all the possible effect types for (ResponseEffectTypeMap::iterator i = effectTypes.begin(); i != effectTypes.end(); ++i) { Gtk::TreeModel::Row row = *_effectStore->append(); row[_effectColumns.name] = i->first; row[_effectColumns.caption] = i->second->getAttribute("editor_caption").getValue(); } // Create the widgets populateWindow(); // Search the scenegraph for entities populateEntityListStore(); // Initialise the widgets with the current data ResponseEffect& effect = _response.getResponseEffect(_effectIndex); // Setup the selectionfinder to search for the name string gtkutil::TreeModel::SelectionFinder finder(effect.getName(), _effectColumns.name.index()); _effectStore->foreach_iter( sigc::mem_fun(finder, >kutil::TreeModel::SelectionFinder::forEach)); // Set the active row of the combo box to the current response effect type _effectTypeCombo->set_active(finder.getIter()); _stateToggle->set_active(effect.isActive()); // Create the alignment container that hold the (exchangable) widget table _argAlignment = Gtk::manage(new Gtk::Alignment(0.0f, 0.5f, 1.0f, 1.0f)); _argAlignment->set_padding(0, 0, 18, 0); _dialogVBox->pack_start(*_argAlignment, false, false, 3); // Parse the argument types from the effect and create the widgets createArgumentWidgets(effect); // Connect the signal to get notified of further changes _effectTypeCombo->signal_changed().connect(sigc::mem_fun(*this, &EffectEditor::onEffectTypeChange)); show(); }