Browse Source

Removed unnecessary widgets from headers

merge-requests/365/head
eidheim 10 years ago
parent
commit
b27a4eb145
  1. 20
      src/notebook.cc
  2. 2
      src/notebook.h
  3. 58
      src/window.cc
  4. 8
      src/window.h

20
src/notebook.cc

@ -27,18 +27,22 @@ namespace sigc {
Notebook::TabLabel::TabLabel(const boost::filesystem::path &path, std::function<void()> on_close) { Notebook::TabLabel::TabLabel(const boost::filesystem::path &path, std::function<void()> on_close) {
set_can_focus(false); set_can_focus(false);
set_tooltip_text(path.string()); set_tooltip_text(path.string());
hbox.set_can_focus(false);
auto button=Gtk::manage(new Gtk::Button());
auto hbox=Gtk::manage(new Gtk::HBox());
hbox->set_can_focus(false);
label.set_text(path.filename().string()+' '); label.set_text(path.filename().string()+' ');
label.set_can_focus(false); label.set_can_focus(false);
button.set_image_from_icon_name("window-close-symbolic", Gtk::ICON_SIZE_MENU); button->set_image_from_icon_name("window-close-symbolic", Gtk::ICON_SIZE_MENU);
button.set_can_focus(false); button->set_can_focus(false);
button.set_relief(Gtk::ReliefStyle::RELIEF_NONE); button->set_relief(Gtk::ReliefStyle::RELIEF_NONE);
hbox.pack_start(label, Gtk::PACK_SHRINK); hbox->pack_start(label, Gtk::PACK_SHRINK);
hbox.pack_end(button, Gtk::PACK_SHRINK); hbox->pack_end(*button, Gtk::PACK_SHRINK);
add(hbox); add(*hbox);
button.signal_clicked().connect(on_close); button->signal_clicked().connect(on_close);
signal_button_press_event().connect([on_close](GdkEventButton *event) { signal_button_press_event().connect([on_close](GdkEventButton *event) {
if(event->button==GDK_BUTTON_MIDDLE) { if(event->button==GDK_BUTTON_MIDDLE) {
on_close(); on_close();

2
src/notebook.h

@ -11,8 +11,6 @@
class Notebook : public Gtk::HPaned { class Notebook : public Gtk::HPaned {
class TabLabel : public Gtk::EventBox { class TabLabel : public Gtk::EventBox {
Gtk::HBox hbox;
Gtk::Button button;
public: public:
TabLabel(const boost::filesystem::path &path, std::function<void()> on_close); TabLabel(const boost::filesystem::path &path, std::function<void()> on_close);
Gtk::Label label; Gtk::Label label;

58
src/window.cc

@ -3,7 +3,6 @@
#include "menu.h" #include "menu.h"
#include "notebook.h" #include "notebook.h"
#include "directories.h" #include "directories.h"
//#include "api.h"
#include "dialogs.h" #include "dialogs.h"
#include "filesystem.h" #include "filesystem.h"
#include "project.h" #include "project.h"
@ -34,43 +33,54 @@ Window::Window() {
set_default_size(Config::get().window.default_size.first, Config::get().window.default_size.second); set_default_size(Config::get().window.default_size.first, Config::get().window.default_size.second);
directories_scrolled_window.add(Directories::get()); auto directories_scrolled_window=Gtk::manage(new Gtk::ScrolledWindow());
directory_and_notebook_panes.pack1(directories_scrolled_window, Gtk::SHRINK); directories_scrolled_window->add(Directories::get());
notebook_vbox.pack_start(Notebook::get()); notebook_vbox.pack_start(Notebook::get());
notebook_vbox.pack_end(EntryBox::get(), Gtk::PACK_SHRINK); notebook_vbox.pack_end(EntryBox::get(), Gtk::PACK_SHRINK);
directory_and_notebook_panes.pack1(*directories_scrolled_window, Gtk::SHRINK);
directory_and_notebook_panes.pack2(notebook_vbox, Gtk::SHRINK); directory_and_notebook_panes.pack2(notebook_vbox, Gtk::SHRINK);
directory_and_notebook_panes.set_position(static_cast<int>(0.2*Config::get().window.default_size.first)); directory_and_notebook_panes.set_position(static_cast<int>(0.2*Config::get().window.default_size.first));
vpaned.set_position(static_cast<int>(0.75*Config::get().window.default_size.second));
vpaned.pack1(directory_and_notebook_panes, true, false);
terminal_scrolled_window.add(Terminal::get()); auto info_and_status_hbox=Gtk::manage(new Gtk::HBox());
terminal_vbox.pack_start(terminal_scrolled_window); info_and_status_hbox->pack_start(Notebook::get().info, Gtk::PACK_SHRINK);
info_and_status_hbox.pack_start(Notebook::get().info, Gtk::PACK_SHRINK);
#if GTK_VERSION_GE(3, 12) #if GTK_VERSION_GE(3, 12)
info_and_status_hbox.set_center_widget(Project::debug_status_label()); info_and_status_hbox->set_center_widget(Project::debug_status_label());
#else #else
Project::debug_status_label().set_halign(Gtk::Align::ALIGN_CENTER); Project::debug_status_label().set_halign(Gtk::Align::ALIGN_CENTER);
info_and_status_hbox.pack_start(Project::debug_status_label()); info_and_status_hbox->pack_start(Project::debug_status_label());
#endif #endif
info_and_status_hbox.pack_end(Notebook::get().status, Gtk::PACK_SHRINK); info_and_status_hbox->pack_end(Notebook::get().status, Gtk::PACK_SHRINK);
terminal_vbox.pack_end(info_and_status_hbox, Gtk::PACK_SHRINK);
vpaned.pack2(terminal_vbox, true, true); terminal_scrolled_window.add(Terminal::get());
auto terminal_vbox=Gtk::manage(new Gtk::VBox());
terminal_vbox->pack_start(terminal_scrolled_window);
terminal_vbox->pack_end(*info_and_status_hbox, Gtk::PACK_SHRINK);
vpaned.set_position(static_cast<int>(0.75*Config::get().window.default_size.second));
vpaned.pack1(directory_and_notebook_panes, true, false);
vpaned.pack2(*terminal_vbox, true, true);
#if GTKMM_MAJOR_VERSION>3 || (GTKMM_MAJOR_VERSION==3 && GTKMM_MINOR_VERSION>=14) #if GTKMM_MAJOR_VERSION>3 || (GTKMM_MAJOR_VERSION==3 && GTKMM_MINOR_VERSION>=14)
overlay_vbox.set_hexpand(false); auto overlay_vbox=Gtk::manage(new Gtk::VBox());
overlay_vbox.set_halign(Gtk::Align::ALIGN_START); auto overlay_hbox=Gtk::manage(new Gtk::HBox());
overlay_hbox.set_hexpand(false); overlay_vbox->set_hexpand(false);
overlay_hbox.set_halign(Gtk::Align::ALIGN_END); overlay_vbox->set_halign(Gtk::Align::ALIGN_START);
overlay_vbox.pack_start(Info::get(), Gtk::PACK_SHRINK, 20); overlay_vbox->pack_start(Info::get(), Gtk::PACK_SHRINK, 20);
overlay_hbox.pack_end(overlay_vbox, Gtk::PACK_SHRINK, 20); overlay_hbox->set_hexpand(false);
overlay.add(vpaned); overlay_hbox->set_halign(Gtk::Align::ALIGN_END);
overlay.add_overlay(overlay_hbox); overlay_hbox->pack_end(*overlay_vbox, Gtk::PACK_SHRINK, 20);
auto overlay=Gtk::manage(new Gtk::Overlay());
overlay->add(vpaned);
overlay->add_overlay(*overlay_hbox);
#if GTKMM_MAJOR_VERSION>3 || (GTKMM_MAJOR_VERSION==3 && GTKMM_MINOR_VERSION>=18) #if GTKMM_MAJOR_VERSION>3 || (GTKMM_MAJOR_VERSION==3 && GTKMM_MINOR_VERSION>=18)
overlay.set_overlay_pass_through(overlay_hbox, true); overlay->set_overlay_pass_through(*overlay_hbox, true);
#endif #endif
add(overlay); add(*overlay);
#else #else
add(vpaned); add(vpaned);
#endif #endif

8
src/window.h

@ -20,15 +20,7 @@ private:
Gtk::VPaned vpaned; Gtk::VPaned vpaned;
Gtk::Paned directory_and_notebook_panes; Gtk::Paned directory_and_notebook_panes;
Gtk::VBox notebook_vbox; Gtk::VBox notebook_vbox;
Gtk::VBox terminal_vbox;
Gtk::ScrolledWindow directories_scrolled_window;
Gtk::ScrolledWindow terminal_scrolled_window; Gtk::ScrolledWindow terminal_scrolled_window;
Gtk::HBox info_and_status_hbox;
Gtk::VBox overlay_vbox;
Gtk::HBox overlay_hbox;
#if GTKMM_MAJOR_VERSION>3 || (GTKMM_MAJOR_VERSION==3 && GTKMM_MINOR_VERSION>=14)
Gtk::Overlay overlay;
#endif
Gtk::AboutDialog about; Gtk::AboutDialog about;
Glib::RefPtr<Gtk::CssProvider> css_provider; Glib::RefPtr<Gtk::CssProvider> css_provider;

Loading…
Cancel
Save