Inkscape
Vector Graphics Editor
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages Concepts
Inkscape::UI::Dialog::DialogContainer Class Reference

A widget that manages DialogNotebook's and other widgets inside a horizontal DialogMultipaned containing vertical DialogMultipaned's or other widgets. More...

#include <dialog-container.h>

Inheritance diagram for Inkscape::UI::Dialog::DialogContainer:

Public Types

enum  DockLocation {
  TopLeft , BottomLeft , TopRight , BottomRight ,
  Start , End , Middle
}
 

Public Member Functions

 DialogContainer (InkscapeWindow *inkscape_window)
 
 ~DialogContainer () override
 
DialogMultipanedget_columns ()
 
std::unique_ptr< DialogMultipanedcreate_column ()
 
void new_dialog (const Glib::ustring &dialog_type)
 Add new dialog to the current container or in a floating window, based on preferences.
 
void new_dialog (const Glib::ustring &dialog_type, DialogNotebook *notebook)
 Overloaded new_dialog.
 
DialogWindownew_floating_dialog (const Glib::ustring &dialog_type)
 Add a new floating dialog (or reuse existing one if it's already up)
 
bool has_dialog_of_type (DialogBase *dialog)
 
DialogBaseget_dialog (const Glib::ustring &dialog_type)
 
void link_dialog (DialogBase *dialog)
 
void unlink_dialog (DialogBase *dialog)
 
std::multimap< Glib::ustring, DialogBase * > const & get_dialogs () const
 
void toggle_dialogs ()
 
void update_dialogs ()
 
void set_inkscape_window (InkscapeWindow *inkscape_window)
 
InkscapeWindowget_inkscape_window ()
 
bool dock_dialog (Gtk::Widget &page, DialogNotebook &source, DockLocation location, DialogMultipaned *multipaned, DialogNotebook *notebook)
 
Glib::RefPtr< Glib::KeyFile > save_container_state ()
 Save container state.
 
void load_container_state (Glib::KeyFile *keyfile, bool include_floating)
 Load last open window's dialog configuration state.
 
void restore_window_position (DialogWindow *window)
 
void store_window_position (DialogWindow *window)
 
std::shared_ptr< Glib::KeyFile > get_container_state (const window_position_t *position) const
 
void load_container_state (Glib::KeyFile &state, const std::string &window_id)
 

Private Types

using parent_type = Gtk::Box
 

Private Member Functions

void setup_drag_and_drop (DialogMultipaned *column)
 
std::unique_ptr< DialogBasedialog_factory (Glib::ustring const &dialog_type)
 Get an instance of a DialogBase dialog using the associated dialog name.
 
DialogWindowcreate_new_floating_dialog (Glib::ustring const &dialog_type, bool blink)
 
DialogMultipanedget_create_multipaned (DialogMultipaned *multipaned, DockLocation location)
 
DialogMultipanedcreate_multipaned (bool left)
 
DialogNotebookget_notebook (DialogMultipaned *pane, DockLocation location)
 
void on_unrealize () override
 No zombie windows.
 
std::unique_ptr< DialogNotebookprepare_drop (Glib::ValueBase const &value)
 
void column_empty (DialogMultipaned *column)
 If a DialogMultipaned column is empty and it can be removed, remove it.
 
DialogBasefind_existing_dialog (const Glib::ustring &dialog_type)
 

Static Private Member Functions

static bool recreate_dialogs_from_state (InkscapeWindow *inkscape_window, const Glib::KeyFile *keyfile)
 

Private Attributes

InkscapeWindow_inkscape_window = nullptr
 
std::unique_ptr< DialogMultipaned_columns
 
std::vector< GType > _drop_gtypes
 
std::multimap< Glib::ustring, DialogBase * > dialogs
 Due to the way Gtk handles dragging between notebooks, one can either allow multiple instances of the same dialog in a notebook or restrict dialogs to docks tied to a particular document window.
 
std::vector< sigc::scoped_connection > _connections
 

Detailed Description

A widget that manages DialogNotebook's and other widgets inside a horizontal DialogMultipaned containing vertical DialogMultipaned's or other widgets.

Definition at line 46 of file dialog-container.h.

Member Typedef Documentation

◆ parent_type

Definition at line 48 of file dialog-container.h.

Member Enumeration Documentation

◆ DockLocation

Enumerator
TopLeft 
BottomLeft 
TopRight 
BottomRight 
Start 
End 
Middle 

Definition at line 71 of file dialog-container.h.

Constructor & Destructor Documentation

◆ DialogContainer()

Inkscape::UI::Dialog::DialogContainer::DialogContainer ( InkscapeWindow inkscape_window)

◆ ~DialogContainer()

Inkscape::UI::Dialog::DialogContainer::~DialogContainer ( )
override

Definition at line 73 of file dialog-container.cpp.

References dialogs.

Member Function Documentation

◆ column_empty()

void Inkscape::UI::Dialog::DialogContainer::column_empty ( DialogMultipaned column)
private

If a DialogMultipaned column is empty and it can be removed, remove it.

Definition at line 1000 of file dialog-container.cpp.

References parent, and Inkscape::UI::Dialog::DialogMultipaned::remove().

Referenced by create_column().

◆ create_column()

std::unique_ptr< DialogMultipaned > Inkscape::UI::Dialog::DialogContainer::create_column ( )

◆ create_multipaned()

DialogMultipaned * Inkscape::UI::Dialog::DialogContainer::create_multipaned ( bool  left)
private

Definition at line 1017 of file dialog-container.cpp.

References _columns, and create_column().

Referenced by get_create_multipaned().

◆ create_new_floating_dialog()

DialogWindow * Inkscape::UI::Dialog::DialogContainer::create_new_floating_dialog ( Glib::ustring const &  dialog_type,
bool  blink 
)
private

◆ dialog_factory()

std::unique_ptr< DialogBase > Inkscape::UI::Dialog::DialogContainer::dialog_factory ( Glib::ustring const &  dialog_type)
private

◆ dock_dialog()

◆ find_existing_dialog()

DialogBase * Inkscape::UI::Dialog::DialogContainer::find_existing_dialog ( const Glib::ustring &  dialog_type)
private

◆ get_columns()

DialogMultipaned * Inkscape::UI::Dialog::DialogContainer::get_columns ( )
inline

◆ get_container_state()

std::shared_ptr< Glib::KeyFile > Inkscape::UI::Dialog::DialogContainer::get_container_state ( const window_position_t position) const

◆ get_create_multipaned()

DialogMultipaned * Inkscape::UI::Dialog::DialogContainer::get_create_multipaned ( DialogMultipaned multipaned,
DockLocation  location 
)
private

◆ get_dialog()

DialogBase * Inkscape::UI::Dialog::DialogContainer::get_dialog ( const Glib::ustring &  dialog_type)

◆ get_dialogs()

std::multimap< Glib::ustring, DialogBase * > const & Inkscape::UI::Dialog::DialogContainer::get_dialogs ( ) const
inline

◆ get_inkscape_window()

InkscapeWindow * Inkscape::UI::Dialog::DialogContainer::get_inkscape_window ( )
inline

Definition at line 70 of file dialog-container.h.

References _inkscape_window.

◆ get_notebook()

DialogNotebook * Inkscape::UI::Dialog::DialogContainer::get_notebook ( DialogMultipaned pane,
DockLocation  location 
)
private

◆ has_dialog_of_type()

bool Inkscape::UI::Dialog::DialogContainer::has_dialog_of_type ( DialogBase dialog)

Definition at line 546 of file dialog-container.cpp.

References dialogs, and Inkscape::UI::Dialog::DialogBase::get_type().

◆ link_dialog()

◆ load_container_state() [1/2]

void Inkscape::UI::Dialog::DialogContainer::load_container_state ( Glib::KeyFile &  state,
const std::string &  window_id 
)

◆ load_container_state() [2/2]

◆ new_dialog() [1/2]

◆ new_dialog() [2/2]

◆ new_floating_dialog()

DialogWindow * Inkscape::UI::Dialog::DialogContainer::new_floating_dialog ( const Glib::ustring &  dialog_type)

Add a new floating dialog (or reuse existing one if it's already up)

Definition at line 438 of file dialog-container.cpp.

References create_new_floating_dialog().

Referenced by new_dialog(), new_dialog(), and tool_preferences().

◆ on_unrealize()

void Inkscape::UI::Dialog::DialogContainer::on_unrealize ( )
overrideprivate

No zombie windows.

TODO: Need to work on this as it still leaves Gtk::Window! (?)

Definition at line 971 of file dialog-container.cpp.

References _columns, _connections, and remove().

◆ prepare_drop()

std::unique_ptr< DialogNotebook > Inkscape::UI::Dialog::DialogContainer::prepare_drop ( Glib::ValueBase const &  value)
private

◆ recreate_dialogs_from_state()

◆ restore_window_position()

void Inkscape::UI::Dialog::DialogContainer::restore_window_position ( DialogWindow window)

◆ save_container_state()

Glib::RefPtr< Glib::KeyFile > Inkscape::UI::Dialog::DialogContainer::save_container_state ( )

Save container state.

The configuration of open dialogs and the relative positions of the notebooks are saved.

The structure of such a KeyFile is:

There is a "Windows" group that records the number of the windows: [Windows] Count=1

A "WindowX" group saves the number of columns the window's container has and whether the window is floating:

[Window0] ColumnCount=1 Floating=false

For each column, we have a "WindowWColumnX" group, where X is the index of the column. "BeforeCanvas" checks if the column is before the canvas or not. "NotebookCount" records how many notebooks are in each column and "NotebookXDialogs" records a list of the types for the dialogs in notebook X.

[Window0Column0] Notebook0Dialogs=Text; NotebookCount=2 BeforeCanvas=false

Definition at line 864 of file dialog-container.cpp.

References _columns, Inkscape::UI::Dialog::dm_get_window_position(), get_columns(), Inkscape::UI::Dialog::DialogWindow::get_container(), Inkscape::UI::Dialog::get_key(), Inkscape::UI::Dialog::get_notebook_dialogs(), InkscapeApplication::instance(), key, Inkscape::UI::Dialog::save_wnd_position(), and width.

Referenced by Inkscape::UI::Dialog::DialogManager::save_dialogs_state().

◆ set_inkscape_window()

void Inkscape::UI::Dialog::DialogContainer::set_inkscape_window ( InkscapeWindow inkscape_window)

◆ setup_drag_and_drop()

◆ store_window_position()

void Inkscape::UI::Dialog::DialogContainer::store_window_position ( DialogWindow window)

◆ toggle_dialogs()

◆ unlink_dialog()

void Inkscape::UI::Dialog::DialogContainer::unlink_dialog ( DialogBase dialog)

◆ update_dialogs()

void Inkscape::UI::Dialog::DialogContainer::update_dialogs ( )

Definition at line 533 of file dialog-container.cpp.

References dialogs.

Referenced by Inkscape::UI::Dialog::DialogWindow::update_dialogs().

Member Data Documentation

◆ _columns

◆ _connections

std::vector<sigc::scoped_connection> Inkscape::UI::Dialog::DialogContainer::_connections
private

Definition at line 118 of file dialog-container.h.

Referenced by create_column(), on_unrealize(), and setup_drag_and_drop().

◆ _drop_gtypes

std::vector<GType> Inkscape::UI::Dialog::DialogContainer::_drop_gtypes
private

Definition at line 96 of file dialog-container.h.

Referenced by setup_drag_and_drop().

◆ _inkscape_window

InkscapeWindow* Inkscape::UI::Dialog::DialogContainer::_inkscape_window = nullptr
private

◆ dialogs

std::multimap<Glib::ustring, DialogBase *> Inkscape::UI::Dialog::DialogContainer::dialogs
private

Due to the way Gtk handles dragging between notebooks, one can either allow multiple instances of the same dialog in a notebook or restrict dialogs to docks tied to a particular document window.

(More explicitly, use one group name for all notebooks or use a unique group name for each document window with related floating docks.) For the moment we choose the former which requires a multimap here as we use the dialog type as a key.

Definition at line 107 of file dialog-container.h.

Referenced by get_dialog(), get_dialogs(), has_dialog_of_type(), link_dialog(), load_container_state(), recreate_dialogs_from_state(), set_inkscape_window(), unlink_dialog(), update_dialogs(), and ~DialogContainer().


The documentation for this class was generated from the following files: