void NotebookNoteAddin::update_menu()
  {
    //
    // Clear out the old list
    //
    for(std::list<Gtk::MenuItem *>::const_iterator iter = m_menu_items.begin();
        iter != m_menu_items.end(); ++iter) {
      m_menu->remove (**iter);
    }
    m_menu_items.clear();

    //
    // Build a new menu
    //
      
    // Add the "New Notebook..."
    Gtk::ImageMenuItem *newNotebookMenuItem =
      manage(new Gtk::ImageMenuItem (_("_New notebook..."), true));
    newNotebookMenuItem->set_image(*manage(new Gtk::Image(
      IconManager::obj().get_icon(IconManager::NOTEBOOK_NEW, 16))));
    newNotebookMenuItem->signal_activate()
      .connect(sigc::mem_fun(*this,&NotebookNoteAddin::on_new_notebook_menu_item));
    newNotebookMenuItem->show ();
    m_menu->append (*newNotebookMenuItem);
    m_menu_items.push_back(newNotebookMenuItem);
      
    // Add the "(no notebook)" item at the top of the list
    NotebookMenuItem *noNotebookMenuItem = manage(new NotebookMenuItem (m_radio_group,
                                                    get_note(), Notebook::Ptr()));
    noNotebookMenuItem->show_all ();
    m_menu->append (*noNotebookMenuItem);
    m_menu_items.push_back(noNotebookMenuItem);

    NotebookMenuItem *active_menu_item = noNotebookMenuItem;
    Notebook::Ptr current_notebook = NotebookManager::obj().get_notebook_from_note(get_note());
      
    // Add in all the real notebooks
    std::list<NotebookMenuItem*> notebookMenuItems;
    get_notebook_menu_items (notebookMenuItems);
    if (!notebookMenuItems.empty()) {
      Gtk::SeparatorMenuItem *separator = manage(new Gtk::SeparatorMenuItem ());
      separator->show_all ();
      m_menu->append (*separator);
      m_menu_items.push_back(separator);
        
      for(std::list<NotebookMenuItem*>::const_iterator iter = notebookMenuItems.begin();
          iter != notebookMenuItems.end(); ++iter) {
        NotebookMenuItem* item = *iter;
        item->show_all ();
        m_menu->append (*item);
        m_menu_items.push_back(item);
        if(current_notebook == item->get_notebook())
          active_menu_item = item;
      }
    }

    active_menu_item->set_active(true);
  }
void ExportToHtmlNoteAddin::on_note_opened()
{
	Gtk::ImageMenuItem *item =  manage(new Gtk::ImageMenuItem (_("Export to HTML")));
  item->set_image(*manage(new Gtk::Image (Gtk::Stock::SAVE, Gtk::ICON_SIZE_MENU)));
  item->signal_activate().connect(
    sigc::mem_fun(*this, &ExportToHtmlNoteAddin::export_button_clicked));
  item->show ();
  add_plugin_menu_item (item);
}
Exemple #3
0
void SeriesMenu::set_connection(const Glib::RefPtr<ImagePool::Series>& series, const sigc::slot<void, SeriesView*>& slot) {
	std::string uid = series->seriesinstanceuid();
	Gtk::ImageMenuItem* menuitem = m_menuitem[uid];
	if(menuitem == NULL) {
		return;
	}

	if(m_connections[uid]) {
		m_connections[uid].disconnect();
	}
	m_connections[uid] = menuitem->signal_activate().connect(sigc::bind(slot, m_views[uid]));
}
void VentanaCliente::initBarraDeMenu() {
    Gtk::ImageMenuItem* pAux;

    get_widget(MENU_SALIR, pAux);
    pAux->signal_activate().connect(sigc::mem_fun(*this,
                                    &VentanaCliente::on_salir_button_clicked));

    get_widget(MENU_CONFIGURAR, pAux);
    pAux->signal_activate().connect(sigc::mem_fun(*this,
                                    &VentanaCliente::on_configurar_button_clicked));

    get_widget(MENU_ACERCA_DE, pAux);
    pAux->signal_activate().connect(sigc::mem_fun(*this,
                                    &VentanaCliente::on_acerca_de_button_clicked));
}
MainWindow::MainWindow(BaseObjectType* pBaseObject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade) : Gtk::Window(pBaseObject) {
  appInstance->logEvent("MainWindow::MainWindow()", SEVERITY_DEBUG);
  Gtk::ImageMenuItem *menu;
  // get widgets
  appInstance->xml->get_widget_derived("contactsTree", contactsTree);
  appInstance->xml->get_widget_derived("statusCombo", statusCombo);
  appInstance->xml->get_widget("userAvatarImage", userAvatarImage);
  appInstance->xml->get_widget("usernameLabel", usernameLabel);
  appInstance->xml->get_widget("mailStatusLabel", mailStatusLabel);

  // connecting signal handlers
  appInstance->xml->get_widget("menuItemExit", menu);
  menu->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::menuItemExitOnActivate));
  appInstance->xml->get_widget("menuItemAbout", menu);
  menu->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::menuItemAboutOnActivate));
  appInstance->sigServer->signal_user_info_receive().connect(sigc::mem_fun(*this, &MainWindow::onUserInfoReceive));
}
Exemple #6
0
void SeriesMenu::add_series(const Glib::RefPtr<ImagePool::Series>& series, SeriesView* w) {
	char buffer[200];
	if(!series->description().empty()) {
		g_snprintf(buffer, sizeof(buffer), gettext("Series %li (%s)\n%s"), m_menuitem.size()+1, series->modality().c_str(), series->description().c_str());
	}
	else {
		g_snprintf(buffer, sizeof(buffer), gettext("Series %li (%s)\nNo description"), m_menuitem.size()+1, series->modality().c_str());
		
	}

	Gtk::ImageMenuItem* menuitem = manage(new Gtk::ImageMenuItem(buffer, true));
	add(*menuitem);
	menuitem->show();
	int key = GDK_a + m_menuitem.size();
	Gtk::AccelGroup::activate(*menuitem, key, Gdk::CONTROL_MASK);
	m_menuitem[series->seriesinstanceuid()] = menuitem;
	m_views[series->seriesinstanceuid()] = w;
}
void GUI::apply_grayscale_from_menu(Controller &controller, Gtk::ImageMenuItem &imagemenuitem) {

  if ( ! controller.image_file_loaded   ) { return ; }

  // Transform image into a grayscale image according choosen settings:

  switch ( stoi(imagemenuitem.get_name()) ) {

    case 0 :

      grayscale(controller.current_image_to_process, controller.current_image_to_process, "average") ;
      break ;

    case 1 :

      grayscale(controller.current_image_to_process, controller.current_image_to_process, "max")     ;
      break ;

    case 2 :

      grayscale(controller.current_image_to_process, controller.current_image_to_process, "min")     ;
      break ;

    case 3 :

      grayscale(controller.current_image_to_process, controller.current_image_to_process, "red")     ;
      break ;

    case 4 :

      grayscale(controller.current_image_to_process, controller.current_image_to_process, "green")    ;
      break ;

    case 5 :

      grayscale(controller.current_image_to_process, controller.current_image_to_process, "blue")     ;
      break ;

    #ifdef DEBUG
    default :
      // Cannot append due of the GUI interfacing.
      fprintf(stdout,"Error applying grayscale filter !!!\n") ;
      return ;
    #endif
 
  }

  // We register current frame in vector<cv::Mat> for undo-redo.
  controller.process_after_applying() ;

  // It convert current_image_to_process as src to RGB(A) in dst current_image_to_display.
  set_img(controller.current_image_to_process, controller.current_image_to_display, controller) ;  // It auto process conversion to RGB(A).

  // Reset some variables.
  after_applying_reset_settings(controller) ;

}
Exemple #8
0
void SeriesMenu::set_thumbnail(const Glib::RefPtr<ImagePool::Instance>& instance) {
	if(!instance || instance->pixels() == NULL) {
		return;
	}

	Gtk::ImageMenuItem* menuitem = m_menuitem[instance->series()->seriesinstanceuid()];
	if(menuitem == NULL) {
		return;
	}

	if(menuitem->get_image() != NULL) {
		return;
	}

	Aeskulap::SimpleDisplay* image = manage(new Aeskulap::SimpleDisplay);
	image->set_image(instance);
	menuitem->set_image(*image);
	return;
}
Exemple #9
0
  void ActionManager::load_interface()
  {
    Gtk::UIManager::ui_merge_id id = m_ui->add_ui_from_file(DATADIR"/gnote/UIManagerLayout.xml");
    DBG_ASSERT(id, "merge failed");
    Gtk::Window::set_default_icon_name("gnote");


    Gtk::ImageMenuItem *imageitem = (Gtk::ImageMenuItem*)m_ui->get_widget(
      "/MainWindowMenubar/FileMenu/FileMenuNewNotePlaceholder/NewNote");
    DBG_ASSERT(imageitem, "Item not found");
    if (imageitem) {
      imageitem->set_image(*manage(new Gtk::Image(m_newNote)));
    }
      
    imageitem = (Gtk::ImageMenuItem*)m_ui->get_widget (
      "/TrayIconMenu/TrayNewNotePlaceholder/TrayNewNote");
    DBG_ASSERT(imageitem, "Item not found");
    if (imageitem) {
      imageitem->set_image(*manage(new Gtk::Image(m_newNote)));
    }
  }
    void NotebookApplicationAddin::add_menu_items(Gtk::Menu * menu,   
                                                  std::list<Gtk::MenuItem*> & menu_items)
    {
      remove_menu_items (menu, menu_items);      

      NotebookNewNoteMenuItem *item;

      Glib::RefPtr<Gtk::TreeModel> model = NotebookManager::obj().get_notebooks();
      Gtk::TreeIter iter;
      
      // Add in the "New Notebook..." menu item
      Gtk::ImageMenuItem *newNotebookMenuItem =
        manage(new Gtk::ImageMenuItem (_("New Note_book..."), true));
      newNotebookMenuItem->set_image(*manage(new Gtk::Image(
          IconManager::obj().get_icon(IconManager::NOTEBOOK_NEW, 16))));
      newNotebookMenuItem->signal_activate()
        .connect(sigc::mem_fun(*this, &NotebookApplicationAddin::on_new_notebook_menu_item));
      newNotebookMenuItem->show_all ();
      menu->append (*newNotebookMenuItem);
      menu_items.push_back(newNotebookMenuItem);

      
      if (model->children().size() > 0) {
        Gtk::SeparatorMenuItem *separator = manage(new Gtk::SeparatorMenuItem ());
        separator->show_all ();
        menu->append (*separator);
        menu_items.push_back(separator);
        
        iter = model->children().begin();
        while (iter) {
          Notebook::Ptr notebook;
          iter->get_value(0, notebook);
          item = manage(new NotebookNewNoteMenuItem (notebook));
          item->show_all ();
          menu->append (*item);
          menu_items.push_back(item);
          ++iter;
        }
      }
    }
void GUI::apply_filter_from_menu(Controller &controller, Gtk::ImageMenuItem &imagemenuitem) {

  if ( ! controller.image_file_loaded   ) { return ; }


  bool is_alpha = controller.current_image_to_process.channels() == 4 ;

  Sharpen sharpen_filter(3, "diamond")      ;

  Sharpen sharpen_filter_more(3, "diamond") ;


  Find_Edges find_edges_filter(3) ;


  Mean mean_filter(3)      ;

  Mean mean_filter_more(5) ;


  cv::Mat kernel = make_kernel("rect", 3)  ;


  cv::Mat tmp = controller.current_image_to_process.clone() ;

  cv::Mat frame ;

  switch ( stoi(imagemenuitem.get_name()) ) {

    case 0 :
      
      // Pencil Sketch filter.
      pencil_sketch_filter(tmp, frame) ;
      break ;

    case 1 :
    
      // Stylisation filter.
      stylisation_filter(tmp, frame) ;
      break ;

    case 2 :
    
      // Detail Enhance filter.
      detail_enhance_filter(tmp, frame) ;
      break ;

    case 3 :
     
      // Edge Preserving filter.
      edge_preserving_filter(tmp, frame) ;
      break ;

    case 4 :

      // Stroke edges filter:
      stroke_edges(tmp, frame) ;
      break ;

    case 5 :

      // Invert Intensity filter:
      invert_intensity(tmp, frame) ;
      break ;

    case 6 :

      // Light Intensity filter:
      effect_light(tmp, frame) ;
      break ;

    case 7 :

      // Recolor-RC (Red-Cyan) filter:
      recolorRC(tmp, frame) ;
      break ;

    case 8 :

      // Recolor-RC (Red-Green-Value) filter:
      recolorRGV(tmp, frame) ;
      break ;

    case 9 :

      // Recolor-RC (Cyan-Magenta-Value) filter:
      recolorCMV(tmp, frame) ;
      break ;

    case 10 :

      // Extrema Maximal Filter:
      extrema(tmp, frame, "max") ;
      break ;

    case 11 :

      // Extrema Minimal Filter:
      extrema(tmp, frame, "min") ;
      break ;



    case 12 :

      // Sharpen filter:
      sharpen_filter.apply(tmp, frame)   ;
      break ;

    case 13 :

      // Sharpen More filter:
      sharpen_filter_more.apply(tmp, frame)   ;
      break ;

    case 14 :

      // Find Edges filter:

      if (is_alpha) {

        cv::Mat frame_rgb ;
        cv::Mat tmp_1     ;

        cvtColor(tmp, frame_rgb, cv::COLOR_BGRA2BGR) ;

        find_edges_filter.apply(frame_rgb, tmp_1)   ;

        vector<cv::Mat> tmp_2 ;
        vector<cv::Mat> tmp_3 ;

        cv::split(tmp,   tmp_2) ;
        cv::split(tmp_1, tmp_3) ;

        // Assign BGR channels.
        tmp_2[0] = tmp_3[0] ;
        tmp_2[1] = tmp_3[1] ;
        tmp_2[2] = tmp_3[2] ;

        // Final channels merging into result with alpha channel unchanged.
        cv::merge(tmp_2, frame) ;

        break ;


      }

      find_edges_filter.apply(tmp, frame)   ;
      break ;

    case 15 :

      // Mean Blur filter:
      mean_filter.apply(tmp, frame)   ;
      break ;

    case 16 :

      // Mean Blur More filter:
      mean_filter_more.apply(tmp, frame)   ;
      break ;


    case 17 :

      // Blur filter:
      blur_filter(tmp, frame) ;
      break ;

    case 18 :

      // Median Blur filter:
      median_blur_filter(tmp, frame) ;
      break ;

    case 19 :

      // Gaussian Blur filter:
      gaussian_blur_filter(tmp, frame) ;
      break ;

    case 20 :

      denoising_filter(tmp, frame) ;
      break ;

    case 21 :

      // Erode filter:
      erode_filter(tmp, frame, kernel, 1)   ;
      break ;

    case 22 :

      // Dilate filter:
      dilate_filter(tmp, frame, kernel, 1)   ;
      break ;

    case 23 :

      // Wave Horizontally filter:
      wave(tmp, frame, -1) ;
      break ;

    case 24 :

      // Wave Vertically filter:
      wave(tmp, frame,  1) ;
      break ;

    case 25 :

      // Wave Twice (Horizontally and Vertically) filter:
      wave(tmp, frame,  0) ;
      break ;

    case 26 :

      // Contours Sobel White filter.
      sobel_drawning(tmp, frame, 3, false, 1) ;
      break ;

    case 27 :

      // Contours Sobel Black filter.
      sobel_drawning(tmp, frame, 3, false, -1) ;
      break ;

    case 28 :

      // Contours Sobel Emboss filter.
      sobel_drawning(tmp, frame, 3, false, 0) ;
      break ;

    case 29 :

      // Emboss Sobel filter:
      sobel_emboss(tmp, frame, 3) ;
      break ;

    case 30 :

      // Emboss Laplacian filter:
      laplacian_emboss(tmp, frame, 3) ;
      break ;


    case 31 :

      // Binary White OTSU filter:
      // Build a binary image (a black and white only image) with white background (@arg value true)
      // based on the OTSU threshold computing algorithm (@arg value -1).
      build_binary_image(tmp, frame, -1, true) ;
      break ;

    case 32 :

      // Binary White TRIANGLE filter:
      // Build a binary image (a black and white only image) with white background (@arg value true)
      // based on the TRIANGLE threshold computing algorithm (@arg value 1).
      build_binary_image(tmp, frame,  1, true) ;
      break ;

    case 33 :

      // Binary White AVERAGE filter:
      // Build a binary image (a black and white only image) with white background (@arg value true)
      // based on the AVERAGE threshold from OTSU and TRIANGLE (@arg value 0).
      build_binary_image(tmp, frame,  0, true) ;
      break ;

    case 34 :

      // Binary Black OTSU filter:
      // Build a binary image (a black and white only image) with black background (@arg value true)
      // based on the OTSU threshold computing algorithm (@arg value -1).
      build_binary_image(tmp, frame, -1, false) ;
      break ;

    case 35 :

      // Binary Black TRIANGLE filter:
      // Build a binary image (a black and white only image) with black background (@arg value true)
      // based on the TRIANGLE threshold computing algorithm (@arg value 1).
      build_binary_image(tmp, frame,  1, false) ;
      break ;

    case 36 :

      // Binary Black AVERAGE filter:
      // Build a binary image (a black and white only image) with black background (@arg value true)
      // based on the AVERAGE threshold from OTSU and TRIANGLE (@arg value 0).
      build_binary_image(tmp, frame,  0, false) ;
      break ;

    case 37 :

      // Binary Contours White filter:
      // Build a binary image (a black and white only image) with contours detction on white background (@arg value false).
      laplacian_zero_crossing(tmp, frame, 19, false)  ;
      break ;

    case 38 :

      // Binary Contours Black filter:
      // Build a binary image (a black and white only image) with contours detction on black background (@arg value true).
      laplacian_zero_crossing(tmp, frame, 19, true)  ;
      break ;







    #ifdef DEBUG
    default :
      // Cannot append due of the GUI interfacing.
      fprintf(stdout,"Error applying filter !!!\n") ;
      return ;
    #endif

  }

  // We register current frame in vector<cv::Mat> for undo-redo.
  controller.process_after_applying(frame) ;

  // It convert current_image_to_process as src to RGB(A) in dst current_image_to_display.
  set_img(frame, controller.current_image_to_display, controller) ;  // It auto process conversion to RGB(A).

  // Reset some variables.
  after_applying_reset_settings(controller) ;

}
void GUI::apply_colorscale_from_menu(Controller &controller, Gtk::ImageMenuItem &imagemenuitem) {

  if ( ! controller.image_file_loaded   ) { return ; }

  cv::Mat tmp = controller.current_image_to_process.clone() ;

  cv::Mat frame ;


  // Apply a colorscale on the image according choosen settings:

  switch ( stoi(imagemenuitem.get_name()) ) {

    case 0 :

      colorscale(tmp, frame, "red", "average") ;
      break ;

    case 1 :

      colorscale(tmp, frame, "red", "max") ;
      break ;

    case 2 :

      colorscale(tmp, frame, "red", "min") ;
      break ;

    case 3 :

      colorscale(tmp, frame, "red", "red") ;
      break ;

    case 4 :

      colorscale(tmp, frame, "red", "green") ;
      break ;


    case 5 :

      colorscale(tmp, frame, "green", "average") ;
      break ;

    case 6 :

      colorscale(tmp, frame, "green", "max") ;
      break ;

    case 7 :

      colorscale(tmp, frame, "green", "min") ;
      break ;

    case 8 :

      colorscale(tmp, frame, "green", "red") ;
      break ;


    case 9 :

      colorscale(tmp, frame, "green", "blue") ;
      break ;


    case 10 :

      colorscale(tmp, frame, "blue", "average") ;
      break ;

    case 11 :

      colorscale(tmp, frame, "blue", "max") ;
      break ;

    case 12 :

      colorscale(tmp, frame, "blue", "min") ;
      break ;

    case 13 :

      colorscale(tmp, frame, "blue", "red") ;
      break ;

    case 14 :

      colorscale(tmp, frame, "blue", "green") ;
      break ;



    case 15 :

      colorscale(tmp, frame, "yellow", "average") ;
      break ;

    case 16 :

      colorscale(tmp, frame, "yellow", "max") ;
      break ;

    case 17 :

      colorscale(tmp, frame, "yellow", "min") ;
      break ;

    case 18 :

      colorscale(tmp, frame, "yellow", "red") ;
      break ;

    case 19 :

      colorscale(tmp, frame, "yellow", "green") ;
      break ;

    case 20 :

      colorscale(tmp, frame, "yellow", "blue") ;
      break ;


    case 21 :

      colorscale(tmp, frame, "pink", "average") ;
      break ;

    case 22 :

      colorscale(tmp, frame, "pink", "max") ;
      break ;

    case 23 :

      colorscale(tmp, frame, "pink", "min") ;
      break ;

    case 24 :

      colorscale(tmp, frame, "pink", "red") ;
      break ;

    case 25 :

      colorscale(tmp, frame, "pink", "green") ;
      break ;

    case 26 :

      colorscale(tmp, frame, "pink", "blue") ;
      break ;


    case 27 :

      colorscale(tmp, frame, "turquoise", "average") ;
      break ;

    case 28 :

      colorscale(tmp, frame, "turquoise", "max") ;
      break ;

    case 29 :

      colorscale(tmp, frame, "turquoise", "min") ;
      break ;

    case 30 :

      colorscale(tmp, frame, "turquoise", "red") ;
      break ;

    case 31 :

      colorscale(tmp, frame, "turquoise", "green") ;
      break ;

    case 32 :

      colorscale(tmp, frame, "turquoise", "blue") ;
      break ;


    #ifdef DEBUG
    default :
      // Cannot append due of the GUI interfacing.
      fprintf(stdout,"Error applying colorscale filter !!!\n") ;
      return ;
    #endif

  }

  // We register current frame in vector<cv::Mat> for undo-redo.
  controller.process_after_applying(frame) ;

  // It convert current_image_to_process as src to RGB(A) in dst current_image_to_display.
  set_img(frame, controller.current_image_to_display, controller) ;  // It auto process conversion to RGB(A).

  // Reset some variables.
  after_applying_reset_settings(controller) ;

}
Exemple #13
0
MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade) :
Gtk::Window(cobject),
m_refGlade(refGlade),
m_dialogFile(gettext("Open DICOM Image files")),
m_raise_opened(true),
m_netloader(Aeskulap::Configuration::get_instance().get_local_aet())
{
	/*Glib::RefPtr<Gdk::Pixbuf> icon = Aeskulap::IconFactory::load_from_file("aeskulap.png");

	if(icon) {
		set_icon(icon);
	}*/

	m_windowlevel = NULL;
	m_refGlade->get_widget_derived("windowlevel_add", m_windowlevel);

	m_about = NULL;
	m_refGlade->get_widget_derived("aboutdialog", m_about);

	m_prescandialog = NULL;
	m_refGlade->get_widget_derived("prescandialog", m_prescandialog);

	m_studymanager = NULL;
	m_refGlade->get_widget_derived("vbox_studymanager", m_studymanager);
	assert(m_studymanager != NULL);
	m_studymanager->signal_open_study.connect(sigc::mem_fun(*this, &MainWindow::on_study_open));

	m_settings = NULL;
	m_refGlade->get_widget_derived("settingswindow", m_settings);
	assert(m_settings != NULL);
	m_settings->signal_apply.connect(sigc::mem_fun(*this, &MainWindow::on_edit_settings_apply));

	m_mainNotebook = NULL;
	m_refGlade->get_widget("notebook_main", m_mainNotebook);
	m_mainNotebook->popup_enable();
	m_mainNotebook->signal_switch_page().connect(sigc::mem_fun(*this, &MainWindow::on_switch_page));

	Gtk::ImageMenuItem* item = NULL;

	m_refGlade->get_widget("file_open", item);
	item->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::on_file_open));

	m_refGlade->get_widget("dicomdir_open", item);
	item->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::on_dicomdir_open));

	m_refGlade->get_widget("file_exit", item);
	item->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::on_file_exit));

	m_itemViewFullscreen = NULL;
	m_refGlade->get_widget("view_fullscreen", m_itemViewFullscreen);
	m_itemViewFullscreen->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::on_view_fullscreen));

	m_refGlade->get_widget("edit_settings", item);
	item->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::on_edit_settings));

	{
		Gtk::ImageMenuItem* item = NULL;
		m_refGlade->get_widget("aeskulap_info", item);
		item->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::on_about));
	}

	m_dialogFile.set_select_multiple();

	m_dialog_check = manage(new Gtk::CheckButton(gettext("Bring opened files to front")));
	m_dialog_check->set_active(true);
	m_dialog_check->show();
	m_dialogFile.add_action_widget (*m_dialog_check, 1001);

	m_dialogFile.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
	m_dialogFile.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);

	m_filter_dicom.set_name(gettext("DICOM files"));
	m_filter_dicom.add_pattern("*.dcm");

	m_filter_any.set_name(gettext("Any files"));
	m_filter_any.add_pattern("*");

	m_filter_dicomdir.set_name(gettext("DICOMDIR files"));
	m_filter_dicomdir.add_pattern("DICOMDIR");
	m_filter_dicomdir.add_pattern("dicomdir");

	m_netloader.signal_study_added.connect(sigc::mem_fun(*this, &MainWindow::on_study_added));
	m_netloader.signal_error.connect(sigc::mem_fun(*this, &MainWindow::on_study_error));

	m_fileloader.signal_study_added.connect(sigc::mem_fun(*this, &MainWindow::on_study_added));
	m_fileloader.signal_prescan_progress.connect(sigc::mem_fun(*m_prescandialog, &PrescanDialog::set_progress));

	m_dicomdirloader.signal_study_added.connect(sigc::mem_fun(*this, &MainWindow::on_study_added));

	//Aeskulap::FloatWidget* f = new Aeskulap::FloatWidget(*this, 100,100);
	//f->show();
}
void NotebookApplicationAddin::initialize ()
{
    m_actionGroup = Glib::RefPtr<Gtk::ActionGroup>(Gtk::ActionGroup::create("Notebooks"));
    m_actionGroup->add(
        Gtk::Action::create ("NewNotebookMenuAction", Gtk::Stock::NEW,
                             _("Note_books"),
                             _("Create a new note in a notebook")));

    m_actionGroup->add(
        Gtk::Action::create ("NewNotebookAction", Gtk::Stock::NEW,
                             _("New Note_book..."),
                             _("Create a new notebook")));

    m_actionGroup->add(
        Gtk::Action::create ("NewNotebookNoteAction", Gtk::Stock::NEW,
                             _("_New Note"),
                             _("Create a new note in this notebook")));

    m_actionGroup->add(
        Gtk::Action::create ("OpenNotebookTemplateNoteAction", Gtk::Stock::OPEN,
                             _("_Open Template Note"),
                             _("Open this notebook's template note")));

    m_actionGroup->add(
        Gtk::Action::create ("DeleteNotebookAction", Gtk::Stock::DELETE,
                             _("Delete Note_book"),
                             _("Delete the selected notebook")));

    m_actionGroup->add(
        Gtk::Action::create ("TrayNewNotebookMenuAction", Gtk::Stock::NEW,
                             _("Notebooks"),
                             _("Create a new note in a notebook")));

    ActionManager & am(ActionManager::obj());
    m_notebookUi = am.get_ui()->add_ui_from_string (uixml);

    am.get_ui()->insert_action_group (m_actionGroup, 0);

    Gtk::MenuItem *item = dynamic_cast<Gtk::MenuItem*>(
                              am.get_widget ("/TrayIconMenu/TrayNewNotePlaceholder/TrayNewNotebookMenu"));
    if (item) {
        Gtk::ImageMenuItem *image_item = dynamic_cast<Gtk::ImageMenuItem*>(item);
        if (image_item) {
            image_item->set_image(*manage(new Gtk::Image(m_notebookIcon)));
        }
        m_trayNotebookMenu = manage(new Gtk::Menu());
        item->set_submenu(*m_trayNotebookMenu);

        m_trayNotebookMenu->signal_show()
        .connect(sigc::mem_fun(*this,
                               &NotebookApplicationAddin::on_tray_notebook_menu_shown));
        m_trayNotebookMenu->signal_hide()
        .connect(sigc::mem_fun(*this,
                               &NotebookApplicationAddin::on_tray_notebook_menu_hidden));
    }

    Gtk::ImageMenuItem *imageitem = dynamic_cast<Gtk::ImageMenuItem*>(
                                        am.get_widget ("/MainWindowMenubar/FileMenu/FileMenuNewNotePlaceholder/NewNotebookMenu"));
    if (imageitem) {
        imageitem->set_image(*manage(new Gtk::Image(m_notebookIcon)));
        m_mainWindowNotebookMenu = manage(new Gtk::Menu ());
        imageitem->set_submenu(*m_mainWindowNotebookMenu);

        m_mainWindowNotebookMenu->signal_show()
        .connect(sigc::mem_fun(*this,
                               &NotebookApplicationAddin::on_new_notebook_menu_shown));

        m_mainWindowNotebookMenu->signal_hide()
        .connect(sigc::mem_fun(*this,
                               &NotebookApplicationAddin::on_new_notebook_menu_hidden));
    }
    imageitem = dynamic_cast<Gtk::ImageMenuItem*>(
                    am.get_widget ("/NotebooksTreeContextMenu/NewNotebookNote"));
    if (imageitem) {
        imageitem->set_image(*manage(new Gtk::Image(am.get_new_note())));
    }

    NoteManager & nm(Gnote::obj().default_note_manager());

    for(Note::List::const_iterator iter = nm.get_notes().begin();
            iter != nm.get_notes().end(); ++iter) {
        const Note::Ptr & note(*iter);
        note->signal_tag_added().connect(
            sigc::mem_fun(*this, &NotebookApplicationAddin::on_tag_added));
        note->signal_tag_removed().connect(
            sigc::mem_fun(*this, &NotebookApplicationAddin::on_tag_removed));
    }

    nm.signal_note_added.connect(
        sigc::mem_fun(*this, &NotebookApplicationAddin::on_note_added));
    nm.signal_note_deleted.connect(
        sigc::mem_fun(*this, &NotebookApplicationAddin::on_note_deleted));

    m_initialized = true;
}
void Gobby::BrowserContextCommands::on_populate_popup(Gtk::Menu* menu)
{
	// TODO: Can this happen? Should we close the old popup here?
	g_assert(m_popup_menu == NULL);

	// Cancel previous attempts
	m_watch.reset(NULL);
	m_dialog.reset(NULL);

	InfBrowser* browser;
	InfBrowserIter iter;

	if(!m_browser.get_selected_browser(&browser))
		return;

	if(!m_browser.get_selected_iter(browser, &iter))
	{
		InfBrowserStatus browser_status;
		g_object_get(G_OBJECT(browser), "status",
		             &browser_status, NULL);

		if(browser_status == INF_BROWSER_CLOSED)
		{
			Gtk::ImageMenuItem *remove_item = Gtk::manage(
				new Gtk::ImageMenuItem(_("_Remove"), true));
			remove_item->set_image(*Gtk::manage(new Gtk::Image(
				Gtk::Stock::CLOSE, Gtk::ICON_SIZE_MENU)));
			remove_item->signal_activate().connect(sigc::bind(
				sigc::mem_fun(*this,
					&BrowserContextCommands::on_remove),
				browser));
			remove_item->show();
			menu->append(*remove_item);
		}

		return;
	}

	InfBrowserIter dummy_iter = iter;
	bool is_subdirectory = inf_browser_is_subdirectory(browser, &iter);
	bool is_toplevel = !inf_browser_get_parent(browser, &dummy_iter);

	// Watch the node, and close the popup menu when the node
	// it refers to is removed.
	m_watch.reset(new NodeWatch(browser, &iter));
	m_watch->signal_node_removed().connect(sigc::mem_fun(
		*this, &BrowserContextCommands::on_menu_node_removed));

	menu->signal_deactivate().connect(sigc::mem_fun(
		*this, &BrowserContextCommands::on_menu_deactivate));

	bool have_toplevel_entries = false;

	// Add "Disconnect" menu option if the connection
	// item has been clicked at
	if(is_toplevel && INFC_IS_BROWSER(browser))
	{
		Gtk::ImageMenuItem* disconnect_item = Gtk::manage(
			new Gtk::ImageMenuItem(
				_("_Disconnect from Server"), true));
		disconnect_item->set_image(*Gtk::manage(new Gtk::Image(
			Gtk::Stock::DISCONNECT, Gtk::ICON_SIZE_MENU)));
		disconnect_item->signal_activate().connect(sigc::bind(
			sigc::mem_fun(*this,
				&BrowserContextCommands::on_disconnect),
			INFC_BROWSER(browser)));
		disconnect_item->show();
		menu->append(*disconnect_item);
		have_toplevel_entries = true;
	}

	// Add create account option if the connection item has been clicked at
	if(is_toplevel)
	{
		const InfAclAccount* account =
			inf_browser_get_acl_local_account(browser);
		const InfAclAccountId acc_id =
			(account != NULL) ? account->id : 0;

		InfAclMask mask;
		inf_acl_mask_set1(&mask, INF_ACL_CAN_CREATE_ACCOUNT);
		inf_browser_check_acl(browser, &iter, acc_id, &mask, &mask);
		if(inf_acl_mask_has(&mask, INF_ACL_CAN_CREATE_ACCOUNT))
		{
			Gtk::Image* image = Gtk::manage(new Gtk::Image);
			image->set_from_icon_name("application-certificate",
			                          Gtk::ICON_SIZE_MENU);
			Gtk::ImageMenuItem* item =
				Gtk::manage(new Gtk::ImageMenuItem(
	                                _("Create _Account..."), true));
			item->set_image(*image);
			item->signal_activate().connect(sigc::bind(
				sigc::mem_fun(
					*this,
					&BrowserContextCommands::
						on_create_account),
				browser));
			item->show();
			menu->append(*item);
			have_toplevel_entries = true;
		}
	}

	// Separator, if we have entries dedicated to the browser itself
	if(have_toplevel_entries)
	{
		Gtk::SeparatorMenuItem* sep_item =
			Gtk::manage(new Gtk::SeparatorMenuItem);
		sep_item->show();
		menu->append(*sep_item);
	}

	// Create Document
	Gtk::ImageMenuItem* new_document_item = Gtk::manage(
		new Gtk::ImageMenuItem(_("Create Do_cument..."),
		                       true));
	new_document_item->set_image(*Gtk::manage(new Gtk::Image(
		Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU)));
	new_document_item->signal_activate().connect(sigc::bind(
		sigc::mem_fun(*this,
			&BrowserContextCommands::on_new),
		browser, iter, false));
	new_document_item->set_sensitive(is_subdirectory);
	new_document_item->show();
	menu->append(*new_document_item);

	// Create Directory

	// Check whether we have the folder-new icon, fall back to
	// Stock::DIRECTORY otherwise
	Glib::RefPtr<Gdk::Screen> screen = menu->get_screen();
	Glib::RefPtr<Gtk::IconTheme> icon_theme(
		Gtk::IconTheme::get_for_screen(screen));

	Gtk::Image* new_directory_image = Gtk::manage(new Gtk::Image);
	if(icon_theme->lookup_icon("folder-new",
	                           Gtk::ICON_SIZE_MENU,
	                           Gtk::ICON_LOOKUP_USE_BUILTIN))
	{
		new_directory_image->set_from_icon_name(
			"folder-new", Gtk::ICON_SIZE_MENU);
	}
	else
	{
		new_directory_image->set(
			Gtk::Stock::DIRECTORY, Gtk::ICON_SIZE_MENU);
	}

	Gtk::ImageMenuItem* new_directory_item = Gtk::manage(
		new Gtk::ImageMenuItem(_("Create Di_rectory..."),
		                       true));
	new_directory_item->set_image(*new_directory_image);
	new_directory_item->signal_activate().connect(sigc::bind(
		sigc::mem_fun(*this,
			&BrowserContextCommands::on_new),
		browser, iter, true));
	new_directory_item->set_sensitive(is_subdirectory);
	new_directory_item->show();
	menu->append(*new_directory_item);

	// Open Document
	Gtk::ImageMenuItem* open_document_item = Gtk::manage(
		new Gtk::ImageMenuItem(_("_Open Document..."), true));
	open_document_item->set_image(*Gtk::manage(new Gtk::Image(
		Gtk::Stock::OPEN, Gtk::ICON_SIZE_MENU)));
	open_document_item->signal_activate().connect(sigc::bind(
		sigc::mem_fun(*this,
			&BrowserContextCommands::on_open),
		browser, iter));
	open_document_item->set_sensitive(is_subdirectory);
	open_document_item->show();
	menu->append(*open_document_item);

	// Separator
	Gtk::SeparatorMenuItem* sep_item =
		Gtk::manage(new Gtk::SeparatorMenuItem);
	sep_item->show();
	menu->append(*sep_item);

	// Permissions
	Gtk::ImageMenuItem* permissions_item = Gtk::manage(
		new Gtk::ImageMenuItem(_("_Permissions..."), true));
	permissions_item->set_image(*Gtk::manage(new Gtk::Image(
		Gtk::Stock::PROPERTIES, Gtk::ICON_SIZE_MENU)));
	permissions_item->signal_activate().connect(sigc::bind(
		sigc::mem_fun(*this,
			&BrowserContextCommands::on_permissions),
		browser, iter));
	permissions_item->show();
	menu->append(*permissions_item);

	// Delete
	Gtk::ImageMenuItem* delete_item = Gtk::manage(
		new Gtk::ImageMenuItem(_("D_elete"), true));
	delete_item->set_image(*Gtk::manage(new Gtk::Image(
		Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU)));
	delete_item->signal_activate().connect(sigc::bind(
		sigc::mem_fun(*this,
			&BrowserContextCommands::on_delete),
		browser, iter));
	delete_item->set_sensitive(!is_toplevel);
	delete_item->show();
	menu->append(*delete_item);
	
	m_popup_menu = menu;
	menu->signal_selection_done().connect(
		sigc::mem_fun(
			*this,
			&BrowserContextCommands::on_popdown));
}