Inkscape
Vector Graphics Editor
|
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>
Public Types | |
enum | DockLocation { TopLeft , BottomLeft , TopRight , BottomRight , Start , End , Middle } |
Public Member Functions | |
DialogContainer (InkscapeWindow *inkscape_window) | |
~DialogContainer () override | |
DialogMultipaned * | get_columns () |
std::unique_ptr< DialogMultipaned > | create_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. | |
DialogWindow * | new_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) |
DialogBase * | get_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) |
InkscapeWindow * | get_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< DialogBase > | dialog_factory (Glib::ustring const &dialog_type) |
Get an instance of a DialogBase dialog using the associated dialog name. | |
DialogWindow * | create_new_floating_dialog (Glib::ustring const &dialog_type, bool blink) |
DialogMultipaned * | get_create_multipaned (DialogMultipaned *multipaned, DockLocation location) |
DialogMultipaned * | create_multipaned (bool left) |
DialogNotebook * | get_notebook (DialogMultipaned *pane, DockLocation location) |
void | on_unrealize () override |
No zombie windows. | |
std::unique_ptr< DialogNotebook > | prepare_drop (Glib::ValueBase const &value) |
void | column_empty (DialogMultipaned *column) |
If a DialogMultipaned column is empty and it can be removed, remove it. | |
DialogBase * | find_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 |
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.
|
private |
Definition at line 48 of file dialog-container.h.
Enumerator | |
---|---|
TopLeft | |
BottomLeft | |
TopRight | |
BottomRight | |
Start | |
End | |
Middle |
Definition at line 71 of file dialog-container.h.
Inkscape::UI::Dialog::DialogContainer::DialogContainer | ( | InkscapeWindow * | inkscape_window | ) |
Definition at line 78 of file dialog-container.cpp.
References _columns, _inkscape_window, Inkscape::append(), and setup_drag_and_drop().
|
override |
Definition at line 73 of file dialog-container.cpp.
References dialogs.
|
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().
std::unique_ptr< DialogMultipaned > Inkscape::UI::Dialog::DialogContainer::create_column | ( | ) |
Definition at line 92 of file dialog-container.cpp.
References _connections, column_empty(), and setup_drag_and_drop().
Referenced by create_multipaned(), Inkscape::UI::Dialog::DialogWindow::DialogWindow(), load_container_state(), new_dialog(), and recreate_dialogs_from_state().
|
private |
Definition at line 1017 of file dialog-container.cpp.
References _columns, and create_column().
Referenced by get_create_multipaned().
|
private |
Definition at line 443 of file dialog-container.cpp.
References _inkscape_window, dialog_factory(), find_existing_dialog(), recreate_dialogs_from_state(), Inkscape::UI::Dialog::DialogManager::set_floating_dialog_visibility(), and Inkscape::UI::Dialog::DialogManager::singleton().
Referenced by load_container_state(), and new_floating_dialog().
|
private |
Get an instance of a DialogBase dialog using the associated dialog name.
Definition at line 117 of file dialog-container.cpp.
References Inkscape::UI::Dialog::TraceDialog::create(), Inkscape::UI::Dialog::ExtensionsGallery::Effects, and Inkscape::UI::Dialog::ExtensionsGallery::Filters.
Referenced by create_new_floating_dialog(), and new_dialog().
bool Inkscape::UI::Dialog::DialogContainer::dock_dialog | ( | Gtk::Widget & | page, |
DialogNotebook & | source, | ||
DockLocation | location, | ||
DialogMultipaned * | multipaned, | ||
DialogNotebook * | notebook | ||
) |
Definition at line 1121 of file dialog-container.cpp.
References _columns, Inkscape::UI::Dialog::DialogMultipaned::append(), BottomLeft, BottomRight, Inkscape::UI::Dialog::DialogNotebook::close_notebook(), End, get_create_multipaned(), Inkscape::UI::Dialog::DialogNotebook::get_notebook(), get_notebook(), Inkscape::UI::Dialog::DialogNotebook::move_page(), page, Inkscape::UI::Dialog::DialogMultipaned::prepend(), Inkscape::UI::Dialog::DialogNotebook::select_page(), Start, TopLeft, and TopRight.
|
private |
Definition at line 201 of file dialog-container.cpp.
References Inkscape::UI::Dialog::DialogManager::find_floating_dialog(), get_dialog(), and Inkscape::UI::Dialog::DialogManager::singleton().
Referenced by create_new_floating_dialog(), new_dialog(), and new_dialog().
|
inline |
Definition at line 55 of file dialog-container.h.
References _columns.
Referenced by Inkscape::UI::Dialog::DialogWindow::DialogWindow(), get_create_multipaned(), load_container_state(), recreate_dialogs_from_state(), and save_container_state().
std::shared_ptr< Glib::KeyFile > Inkscape::UI::Dialog::DialogContainer::get_container_state | ( | const window_position_t * | position | ) | const |
Definition at line 786 of file dialog-container.cpp.
References _columns, Inkscape::UI::Dialog::get_key(), Inkscape::UI::Dialog::get_notebook_dialogs(), key, and Inkscape::UI::Dialog::save_wnd_position().
|
private |
Definition at line 1029 of file dialog-container.cpp.
References _columns, BottomLeft, BottomRight, create_multipaned(), End, get_columns(), Inkscape::UI::Dialog::DialogMultipaned::get_multipaned_children(), main(), Middle, Start, TopLeft, and TopRight.
Referenced by dock_dialog().
DialogBase * Inkscape::UI::Dialog::DialogContainer::get_dialog | ( | const Glib::ustring & | dialog_type | ) |
Definition at line 551 of file dialog-container.cpp.
References dialogs.
Referenced by find_existing_dialog(), get_clone_tiler_panel(), and Inkscape::UI::Widget::get_fill_and_stroke_panel().
|
inline |
Definition at line 66 of file dialog-container.h.
References dialogs.
Referenced by Inkscape::UI::Dialog::DialogWindow::update_dialogs(), and Inkscape::UI::Dialog::DialogWindow::update_window_size_to_fit_children().
|
inline |
Definition at line 70 of file dialog-container.h.
References _inkscape_window.
|
private |
Definition at line 1077 of file dialog-container.cpp.
References End, Inkscape::UI::end, Inkscape::UI::Dialog::DialogMultipaned::get_multipaned_children(), Start, TopLeft, TopRight, and w.
Referenced by dock_dialog().
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().
void Inkscape::UI::Dialog::DialogContainer::link_dialog | ( | DialogBase * | dialog | ) |
void Inkscape::UI::Dialog::DialogContainer::load_container_state | ( | Glib::KeyFile & | state, |
const std::string & | window_id | ||
) |
void Inkscape::UI::Dialog::DialogContainer::load_container_state | ( | Glib::KeyFile * | keyfile, |
bool | include_floating | ||
) |
Load last open window's dialog configuration state.
For the keyfile format, check save_container_state()
.
Definition at line 599 of file dialog-container.cpp.
References _columns, _inkscape_window, Inkscape::UI::Dialog::DialogMultipaned::append(), create_column(), create_new_floating_dialog(), dialogs, Inkscape::UI::Dialog::dm_restore_window_position(), Inkscape::Preferences::get(), get_columns(), Inkscape::UI::Dialog::DialogWindow::get_container(), get_dialog_data(), Inkscape::UI::Dialog::get_key(), Inkscape::UI::Dialog::DialogNotebook::get_notebook(), Inkscape::Preferences::getInt(), Inkscape::UI::Dialog::window_position_t::height, Inkscape::UI::Widget::height, key, new_dialog(), page, PREFS_DIALOGS_BEHAVIOR_DOCKABLE, PREFS_DIALOGS_BEHAVIOR_FLOATING, Inkscape::UI::Dialog::DialogMultipaned::prepend(), Inkscape::UI::Dialog::DialogNotebook::set_requested_height(), Inkscape::UI::Dialog::DialogMultipaned::set_restored_width(), Inkscape::UI::Dialog::DialogWindow::update_window_size_to_fit_children(), width, Inkscape::UI::Dialog::window_position_t::width, Inkscape::UI::Dialog::window_position_t::x, and Inkscape::UI::Dialog::window_position_t::y.
Referenced by Inkscape::UI::Dialog::DialogManager::dialog_defaults(), and Inkscape::UI::Dialog::DialogManager::restore_dialogs_state().
void Inkscape::UI::Dialog::DialogContainer::new_dialog | ( | const Glib::ustring & | dialog_type | ) |
Add new dialog to the current container or in a floating window, based on preferences.
Definition at line 184 of file dialog-container.cpp.
References find_existing_dialog(), Inkscape::Preferences::get(), new_dialog(), new_floating_dialog(), PREFS_DIALOGS_BEHAVIOR_DOCKABLE, PREFS_DIALOGS_BEHAVIOR_FLOATING, Inkscape::UI::Dialog::DialogManager::should_open_floating(), and Inkscape::UI::Dialog::DialogManager::singleton().
Referenced by Inkscape::UI::Widget::LayerSelector::_layerChoose(), Inkscape::UI::Dialog::ColorItem::action_edit(), dialog_open(), get_clone_tiler_panel(), Inkscape::UI::Widget::get_fill_and_stroke_panel(), load_container_state(), new_dialog(), Inkscape::UI::Toolbar::LPEToolbar::open_lpe_dialog(), recreate_dialogs_from_state(), select_object_link(), and Inkscape::UI::Toolbar::SprayToolbar::toggle_picker().
void Inkscape::UI::Dialog::DialogContainer::new_dialog | ( | const Glib::ustring & | dialog_type, |
DialogNotebook * | notebook | ||
) |
Overloaded new_dialog.
Definition at line 225 of file dialog-container.cpp.
References _columns, Inkscape::UI::Dialog::DialogNotebook::add_page(), create_column(), dialog_factory(), find_existing_dialog(), Inkscape::Preferences::get(), Inkscape::UI::Dialog::get_dialog_parent(), Inkscape::Preferences::getInt(), new_floating_dialog(), PREFS_DIALOGS_BEHAVIOR_DOCKABLE, PREFS_DIALOGS_BEHAVIOR_FLOATING, Inkscape::UI::Dialog::DialogManager::should_open_floating(), and Inkscape::UI::Dialog::DialogManager::singleton().
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().
|
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().
|
private |
Definition at line 982 of file dialog-container.cpp.
References Inkscape::UI::Dialog::find_dialog_page(), page, and Inkscape::UI::Widget::TabStrip::unpack_drop_source().
|
staticprivate |
Definition at line 297 of file dialog-container.cpp.
References Inkscape::UI::Dialog::DialogMultipaned::append(), create_column(), dialogs, Inkscape::UI::Dialog::dm_restore_window_position(), Inkscape::UI::Dialog::DialogManager::find_floating_dialog(), Inkscape::Preferences::get(), get_columns(), Inkscape::UI::Dialog::DialogWindow::get_container(), get_dialog_data(), Inkscape::UI::Dialog::get_key(), Inkscape::Preferences::getInt(), Inkscape::UI::Dialog::window_position_t::height, key, new_dialog(), PREFS_DIALOGS_BEHAVIOR_DOCKABLE, PREFS_DIALOGS_BEHAVIOR_FLOATING, PREFS_DIALOGS_STATE_NONE, PREFS_DIALOGS_STATE_SAVE, Inkscape::UI::Dialog::DialogMultipaned::prepend(), Inkscape::UI::Dialog::DialogManager::singleton(), Inkscape::UI::Dialog::DialogWindow::update_window_size_to_fit_children(), Inkscape::UI::Dialog::window_position_t::width, Inkscape::UI::Dialog::window_position_t::x, and Inkscape::UI::Dialog::window_position_t::y.
Referenced by create_new_floating_dialog().
void Inkscape::UI::Dialog::DialogContainer::restore_window_position | ( | DialogWindow * | window | ) |
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().
void Inkscape::UI::Dialog::DialogContainer::set_inkscape_window | ( | InkscapeWindow * | inkscape_window | ) |
Definition at line 538 of file dialog-container.cpp.
References _inkscape_window, desktop, dialogs, and InkscapeWindow::get_desktop().
Referenced by Inkscape::UI::Dialog::DialogWindow::update_dialogs(), and SPDesktop::updateDialogs().
|
private |
Definition at line 101 of file dialog-container.cpp.
References _connections, _drop_gtypes, page, Inkscape::UI::Dialog::DialogMultipaned::set_drop_gtypes(), Inkscape::UI::Dialog::DialogMultipaned::signal_dock_dialog(), and Inkscape::UI::Dialog::DialogMultipaned::signal_float_dialog().
Referenced by create_column(), and DialogContainer().
void Inkscape::UI::Dialog::DialogContainer::store_window_position | ( | DialogWindow * | window | ) |
void Inkscape::UI::Dialog::DialogContainer::toggle_dialogs | ( | ) |
Definition at line 484 of file dialog-container.cpp.
References _columns, child, Inkscape::UI::Dialog::DialogManager::get_all_floating_dialog_windows(), Inkscape::UI::Dialog::DialogManager::set_floating_dialog_visibility(), Inkscape::UI::Dialog::DialogManager::singleton(), and visible.
Referenced by dialog_toggle().
void Inkscape::UI::Dialog::DialogContainer::unlink_dialog | ( | DialogBase * | dialog | ) |
Definition at line 577 of file dialog-container.cpp.
References dialogs, Inkscape::UI::Dialog::DialogBase::get_type(), and Inkscape::UI::Dialog::DialogWindow::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().
|
private |
Definition at line 95 of file dialog-container.h.
Referenced by create_multipaned(), DialogContainer(), dock_dialog(), get_columns(), get_container_state(), get_create_multipaned(), load_container_state(), new_dialog(), on_unrealize(), save_container_state(), and toggle_dialogs().
|
private |
Definition at line 118 of file dialog-container.h.
Referenced by create_column(), on_unrealize(), and setup_drag_and_drop().
|
private |
Definition at line 96 of file dialog-container.h.
Referenced by setup_drag_and_drop().
|
private |
Definition at line 94 of file dialog-container.h.
Referenced by create_new_floating_dialog(), DialogContainer(), get_inkscape_window(), load_container_state(), and set_inkscape_window().
|
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().