Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::UI::Dialog::SingleExport Class Reference

#include <export-single.h>

Inheritance diagram for Inkscape::UI::Dialog::SingleExport:

Public Member Functions

 SingleExport (BaseObjectType *cobject, const Glib::RefPtr< Gtk::Builder > &refGlade)
 
 ~SingleExport () override
 
void setApp (InkscapeApplication *app)
 
void setDocument (SPDocument *document)
 
void setDesktop (SPDesktop *desktop)
 
void selectionChanged (Inkscape::Selection *selection)
 
void selectionModified (Inkscape::Selection *selection, guint flags)
 
void refresh ()
 

Private Types

enum  sb_type {
  SPIN_X0 = 0 , SPIN_X1 , SPIN_Y0 , SPIN_Y1 ,
  SPIN_WIDTH , SPIN_HEIGHT , SPIN_BMWIDTH , SPIN_BMHEIGHT ,
  SPIN_DPI
}
 
enum  selection_mode { SELECTION_PAGE = 0 , SELECTION_SELECTION , SELECTION_DRAWING , SELECTION_CUSTOM }
 

Private Member Functions

void setup ()
 
void setupUnits ()
 
void setupSpinButtons ()
 
void toggleSpinButtonVisibility ()
 
void refreshPreview ()
 
template<typename T >
void setupSpinButton (Gtk::SpinButton *sb, double val, double min, double max, double step, double page, int digits, bool sensitive, void(SingleExport::*cb)(T), T param)
 
void setDefaultSelectionMode ()
 
void onAreaXChange (sb_type type)
 
void onAreaYChange (sb_type type)
 
void onDpiChange (sb_type type)
 
void onAreaTypeToggle (selection_mode key)
 
void onUnitChanged ()
 
void onFilenameModified ()
 Filename in filename entry field was changed.
 
void onExtensionChanged ()
 
void onExport ()
 
void onCancel ()
 
void onBrowse ()
 
void refreshArea ()
 
void refreshPage ()
 
void loadExportHints ()
 Update suggested DPI and filename when the selection has changed.
 
void setFilename (std::string filename, bool modified_by_user)
 Set filename and update filename entry box.
 
void saveExportHints (SPObject *target)
 
void areaXChange (sb_type type)
 
void areaYChange (sb_type type)
 
void dpiChange (sb_type type)
 
void setArea (double x0, double y0, double x1, double y1)
 
void blockSpinConns (bool status)
 
void setExporting (bool exporting, Glib::ustring const &text="")
 
void onPagesChanged ()
 Page functions.
 
void onPagesModified (SPPage *page)
 
void onPagesSelected (SPPage *page)
 
void setPagesMode (bool multi)
 
void selectPage (SPPage *page)
 
std::vector< SPPage const * > getSelectedPages () const
 

Static Private Member Functions

static unsigned int onProgressCallback (float value, void *data)
 Callback to be used in for loop to update the progress bar.
 

Private Attributes

InkscapeApplication_app = nullptr
 
SPDesktop_desktop = nullptr
 
SPDocument_document = nullptr
 
std::shared_ptr< PreviewDrawing_preview_drawing
 
bool setupDone = false
 
std::map< sb_type, Gtk::SpinButton * > spin_buttons
 
std::map< sb_type, Gtk::Label * > spin_labels
 
std::map< selection_mode, Gtk::ToggleButton * > selection_buttons
 
Gtk::CheckButton * show_export_area = nullptr
 
BatchItems current_items
 
Gtk::FlowBox & pages_list
 
Gtk::ScrolledWindow & pages_list_box
 
Gtk::Grid & size_box
 
Inkscape::UI::Widget::UnitMenuunits
 
Gtk::Box & si_units_row
 
Gtk::CheckButton & si_hide_all
 
Gtk::CheckButton & si_show_preview
 
ExportPreviewpreview
 
Gtk::Box & preview_box
 
ExtensionListsi_extension_cb
 
Gtk::Entry & si_filename_entry
 
Gtk::Button & si_filename_button
 
Gtk::Button & si_export
 
Gtk::ProgressBar & progress_bar
 
Gtk::Widget & progress_box
 
Gtk::Button & cancel_button
 
UI::Widget::ColorPicker_background_color
 
bool filename_modified_by_user = false
 True if the value of the selected filename was changed by the user since the last export.
 
Glib::ustring filename_entry_original_value
 Last value of filename entry field that was set programmatically. Used to detect modification by the user.
 
Glib::ustring doc_export_name
 
std::string filepath_native
 File path as returned by the file chooser.
 
Inkscape::Preferencesprefs = nullptr
 
std::map< selection_mode, Glib::ustring > selection_names
 
selection_mode current_key = (selection_mode)0
 
bool interrupted
 
std::vector< sigc::scoped_connection > spinButtonConns
 
sigc::scoped_connection filenameConn
 
sigc::scoped_connection extensionConn
 
sigc::scoped_connection exportConn
 
sigc::scoped_connection cancelConn
 
sigc::scoped_connection browseConn
 
sigc::scoped_connection _pages_list_changed
 
sigc::scoped_connection _page_selected_connection
 
sigc::scoped_connection _page_modified_connection
 
sigc::scoped_connection _page_changed_connection
 

Detailed Description

Definition at line 56 of file export-single.h.

Member Enumeration Documentation

◆ sb_type

Enumerator
SPIN_X0 
SPIN_X1 
SPIN_Y0 
SPIN_Y1 
SPIN_WIDTH 
SPIN_HEIGHT 
SPIN_BMWIDTH 
SPIN_BMHEIGHT 
SPIN_DPI 

Definition at line 75 of file export-single.h.

◆ selection_mode

Enumerator
SELECTION_PAGE 
SELECTION_SELECTION 
SELECTION_DRAWING 
SELECTION_CUSTOM 

Definition at line 88 of file export-single.h.

Constructor & Destructor Documentation

◆ SingleExport()

◆ ~SingleExport()

Inkscape::UI::Dialog::SingleExport::~SingleExport ( )
overridedefault

Member Function Documentation

◆ areaXChange()

void Inkscape::UI::Dialog::SingleExport::areaXChange ( sb_type  type)
private

◆ areaYChange()

void Inkscape::UI::Dialog::SingleExport::areaYChange ( sb_type  type)
private

◆ blockSpinConns()

void Inkscape::UI::Dialog::SingleExport::blockSpinConns ( bool  status = true)
private

Definition at line 827 of file export-single.cpp.

References spinButtonConns.

Referenced by onAreaXChange(), onAreaYChange(), onDpiChange(), and setArea().

◆ dpiChange()

◆ getSelectedPages()

std::vector< SPPage const * > Inkscape::UI::Dialog::SingleExport::getSelectedPages ( ) const
private

Definition at line 349 of file export-single.cpp.

References child, item, and pages_list.

Referenced by loadExportHints(), onExport(), and refreshArea().

◆ loadExportHints()

◆ onAreaTypeToggle()

void Inkscape::UI::Dialog::SingleExport::onAreaTypeToggle ( selection_mode  key)
private

◆ onAreaXChange()

void Inkscape::UI::Dialog::SingleExport::onAreaXChange ( sb_type  type)
private

◆ onAreaYChange()

void Inkscape::UI::Dialog::SingleExport::onAreaYChange ( sb_type  type)
private

◆ onBrowse()

◆ onCancel()

void Inkscape::UI::Dialog::SingleExport::onCancel ( )
private

Definition at line 659 of file export-single.cpp.

References interrupted, and setExporting().

Referenced by setup().

◆ onDpiChange()

void Inkscape::UI::Dialog::SingleExport::onDpiChange ( sb_type  type)
private

Definition at line 622 of file export-single.cpp.

References blockSpinConns(), and dpiChange().

Referenced by setupSpinButtons().

◆ onExport()

◆ onExtensionChanged()

void Inkscape::UI::Dialog::SingleExport::onExtensionChanged ( )
private

◆ onFilenameModified()

void Inkscape::UI::Dialog::SingleExport::onFilenameModified ( )
private

Filename in filename entry field was changed.

Definition at line 632 of file export-single.cpp.

References extensionConn, filename_entry_original_value, Inkscape::UI::Dialog::ExtensionList::setExtensionFromFilename(), setFilename(), si_extension_cb, and si_filename_entry.

Referenced by setup().

◆ onPagesChanged()

◆ onPagesModified()

void Inkscape::UI::Dialog::SingleExport::onPagesModified ( SPPage page)
private

Definition at line 383 of file export-single.cpp.

References refreshArea().

Referenced by setDocument().

◆ onPagesSelected()

void Inkscape::UI::Dialog::SingleExport::onPagesSelected ( SPPage page)
private

Definition at line 388 of file export-single.cpp.

References page, pages_list, refreshArea(), and selectPage().

Referenced by setDocument().

◆ onProgressCallback()

unsigned int Inkscape::UI::Dialog::SingleExport::onProgressCallback ( float  value,
void *  data 
)
staticprivate

Callback to be used in for loop to update the progress bar.

Parameters
valuenumber between 0 and 1 indicating the fraction of progress (0.17 = 17 % progress)

Definition at line 1032 of file export-single.cpp.

References data.

Referenced by onExport().

◆ onUnitChanged()

void Inkscape::UI::Dialog::SingleExport::onUnitChanged ( )
private

Definition at line 564 of file export-single.cpp.

References refreshArea().

Referenced by setup().

◆ refresh()

void Inkscape::UI::Dialog::SingleExport::refresh ( )
inline

Definition at line 67 of file export-single.h.

References loadExportHints(), refreshArea(), and refreshPage().

◆ refreshArea()

◆ refreshPage()

◆ refreshPreview()

◆ saveExportHints()

void Inkscape::UI::Dialog::SingleExport::saveExportHints ( SPObject target)
private

◆ selectionChanged()

◆ selectionModified()

void Inkscape::UI::Dialog::SingleExport::selectionModified ( Inkscape::Selection selection,
guint  flags 
)

◆ selectPage()

void Inkscape::UI::Dialog::SingleExport::selectPage ( SPPage page)
private

Definition at line 337 of file export-single.cpp.

References Inkscape::UI::_continue, Inkscape::UI::for_each_child(), item, page, and pages_list.

Referenced by onPagesSelected().

◆ setApp()

void Inkscape::UI::Dialog::SingleExport::setApp ( InkscapeApplication app)
inline

Definition at line 62 of file export-single.h.

References _app.

Referenced by Inkscape::UI::Dialog::Export::desktopReplaced().

◆ setArea()

void Inkscape::UI::Dialog::SingleExport::setArea ( double  x0,
double  y0,
double  x1,
double  y1 
)
private

◆ setDefaultSelectionMode()

◆ setDesktop()

void Inkscape::UI::Dialog::SingleExport::setDesktop ( SPDesktop desktop)

◆ setDocument()

◆ setExporting()

void Inkscape::UI::Dialog::SingleExport::setExporting ( bool  exporting,
Glib::ustring const &  text = "" 
)
private

Definition at line 1012 of file export-single.cpp.

References progress_bar, progress_box, and Inkscape::UI::Dialog::set_sensitive().

Referenced by onCancel(), onExport(), and setup().

◆ setFilename()

void Inkscape::UI::Dialog::SingleExport::setFilename ( std::string  filename,
bool  is_user_input 
)
private

Set filename and update filename entry box.

The value of filename_modified_by_user will be updated.

Parameters
filenameRaw file path. Value is in platform-native encoding (see Glib::filename_to_utf8).
is_user_inputTrue if the new filename comes from user input (by file chooser, editing the text box, or by pushing the Export button). False if the new value is auto-generated.

Definition at line 493 of file export-single.cpp.

References filename_entry_original_value, filename_modified_by_user, filenameConn, filepath_native, Inkscape::IO::Sandbox::filesystem_get_display_path(), Inkscape::IO::Sandbox::filesystem_is_sandboxed(), and si_filename_entry.

Referenced by loadExportHints(), and onFilenameModified().

◆ setPagesMode()

void Inkscape::UI::Dialog::SingleExport::setPagesMode ( bool  multi)
private

◆ setup()

◆ setupSpinButton()

template<typename T >
void Inkscape::UI::Dialog::SingleExport::setupSpinButton ( Gtk::SpinButton *  sb,
double  val,
double  min,
double  max,
double  step,
double  page,
int  digits,
bool  sensitive,
void(SingleExport::*)(T)  cb,
param 
)
private

Definition at line 248 of file export-single.cpp.

References page, and spinButtonConns.

◆ setupSpinButtons()

◆ setupUnits()

◆ toggleSpinButtonVisibility()

void Inkscape::UI::Dialog::SingleExport::toggleSpinButtonVisibility ( )
private

Member Data Documentation

◆ _app

InkscapeApplication* Inkscape::UI::Dialog::SingleExport::_app = nullptr
private

Definition at line 96 of file export-single.h.

Referenced by onBrowse(), and setApp().

◆ _background_color

UI::Widget::ColorPicker& Inkscape::UI::Dialog::SingleExport::_background_color
private

Definition at line 131 of file export-single.h.

Referenced by onExport(), refreshPreview(), setDocument(), and setup().

◆ _desktop

SPDesktop* Inkscape::UI::Dialog::SingleExport::_desktop = nullptr
private

◆ _document

SPDocument* Inkscape::UI::Dialog::SingleExport::_document = nullptr
private

◆ _page_changed_connection

sigc::scoped_connection Inkscape::UI::Dialog::SingleExport::_page_changed_connection
private

Definition at line 213 of file export-single.h.

Referenced by setDocument().

◆ _page_modified_connection

sigc::scoped_connection Inkscape::UI::Dialog::SingleExport::_page_modified_connection
private

Definition at line 212 of file export-single.h.

Referenced by setDocument().

◆ _page_selected_connection

sigc::scoped_connection Inkscape::UI::Dialog::SingleExport::_page_selected_connection
private

Definition at line 211 of file export-single.h.

Referenced by setDesktop(), and setDocument().

◆ _pages_list_changed

sigc::scoped_connection Inkscape::UI::Dialog::SingleExport::_pages_list_changed
private

Definition at line 209 of file export-single.h.

Referenced by onPagesChanged(), and setup().

◆ _preview_drawing

std::shared_ptr<PreviewDrawing> Inkscape::UI::Dialog::SingleExport::_preview_drawing
private

Definition at line 99 of file export-single.h.

Referenced by onPagesChanged(), refreshPreview(), and setDocument().

◆ browseConn

sigc::scoped_connection Inkscape::UI::Dialog::SingleExport::browseConn
private

Definition at line 208 of file export-single.h.

Referenced by onBrowse(), and setup().

◆ cancel_button

Gtk::Button& Inkscape::UI::Dialog::SingleExport::cancel_button
private

Definition at line 130 of file export-single.h.

Referenced by setup().

◆ cancelConn

sigc::scoped_connection Inkscape::UI::Dialog::SingleExport::cancelConn
private

Definition at line 207 of file export-single.h.

Referenced by setup().

◆ current_items

BatchItems Inkscape::UI::Dialog::SingleExport::current_items
private

Definition at line 109 of file export-single.h.

Referenced by onPagesChanged().

◆ current_key

◆ doc_export_name

Glib::ustring Inkscape::UI::Dialog::SingleExport::doc_export_name
private

Definition at line 139 of file export-single.h.

◆ exportConn

sigc::scoped_connection Inkscape::UI::Dialog::SingleExport::exportConn
private

Definition at line 206 of file export-single.h.

Referenced by setup().

◆ extensionConn

sigc::scoped_connection Inkscape::UI::Dialog::SingleExport::extensionConn
private

Definition at line 205 of file export-single.h.

Referenced by onFilenameModified(), and setup().

◆ filename_entry_original_value

Glib::ustring Inkscape::UI::Dialog::SingleExport::filename_entry_original_value
private

Last value of filename entry field that was set programmatically. Used to detect modification by the user.

Definition at line 137 of file export-single.h.

Referenced by onFilenameModified(), and setFilename().

◆ filename_modified_by_user

bool Inkscape::UI::Dialog::SingleExport::filename_modified_by_user = false
private

True if the value of the selected filename was changed by the user since the last export.

False when the filename is e.g. an auto-generated suggestion or remembered in the document attributes.

Definition at line 135 of file export-single.h.

Referenced by loadExportHints(), onExport(), setDocument(), and setFilename().

◆ filenameConn

sigc::scoped_connection Inkscape::UI::Dialog::SingleExport::filenameConn
private

Definition at line 204 of file export-single.h.

Referenced by setFilename(), and setup().

◆ filepath_native

std::string Inkscape::UI::Dialog::SingleExport::filepath_native
private

File path as returned by the file chooser.

Value is in platform-native encoding (see Glib::filename_to_utf8).

Definition at line 142 of file export-single.h.

Referenced by loadExportHints(), onExport(), saveExportHints(), and setFilename().

◆ interrupted

bool Inkscape::UI::Dialog::SingleExport::interrupted
private

Definition at line 200 of file export-single.h.

Referenced by onCancel(), and onExport().

◆ pages_list

Gtk::FlowBox& Inkscape::UI::Dialog::SingleExport::pages_list
private

◆ pages_list_box

Gtk::ScrolledWindow& Inkscape::UI::Dialog::SingleExport::pages_list_box
private

Definition at line 113 of file export-single.h.

Referenced by refreshPage().

◆ prefs

Inkscape::Preferences* Inkscape::UI::Dialog::SingleExport::prefs = nullptr
private

◆ preview

ExportPreview& Inkscape::UI::Dialog::SingleExport::preview
private

Definition at line 120 of file export-single.h.

Referenced by refreshPreview(), and setDocument().

◆ preview_box

Gtk::Box& Inkscape::UI::Dialog::SingleExport::preview_box
private

Definition at line 121 of file export-single.h.

Referenced by refreshPage().

◆ progress_bar

Gtk::ProgressBar& Inkscape::UI::Dialog::SingleExport::progress_bar
private

Definition at line 128 of file export-single.h.

Referenced by setExporting().

◆ progress_box

Gtk::Widget& Inkscape::UI::Dialog::SingleExport::progress_box
private

Definition at line 129 of file export-single.h.

Referenced by setExporting().

◆ selection_buttons

std::map<selection_mode, Gtk::ToggleButton *> Inkscape::UI::Dialog::SingleExport::selection_buttons
private

◆ selection_names

std::map<selection_mode, Glib::ustring> Inkscape::UI::Dialog::SingleExport::selection_names
private

◆ setupDone

bool Inkscape::UI::Dialog::SingleExport::setupDone = false
private

Definition at line 101 of file export-single.h.

Referenced by setup().

◆ show_export_area

Gtk::CheckButton* Inkscape::UI::Dialog::SingleExport::show_export_area = nullptr
private

Definition at line 107 of file export-single.h.

◆ si_export

Gtk::Button& Inkscape::UI::Dialog::SingleExport::si_export
private

Definition at line 127 of file export-single.h.

Referenced by setup().

◆ si_extension_cb

ExtensionList& Inkscape::UI::Dialog::SingleExport::si_extension_cb
private

◆ si_filename_button

Gtk::Button& Inkscape::UI::Dialog::SingleExport::si_filename_button
private

Definition at line 126 of file export-single.h.

Referenced by setup().

◆ si_filename_entry

Gtk::Entry& Inkscape::UI::Dialog::SingleExport::si_filename_entry
private

Definition at line 125 of file export-single.h.

Referenced by onBrowse(), onFilenameModified(), setFilename(), and setup().

◆ si_hide_all

Gtk::CheckButton& Inkscape::UI::Dialog::SingleExport::si_hide_all
private

Definition at line 117 of file export-single.h.

Referenced by onExport(), refreshPreview(), and setup().

◆ si_show_preview

Gtk::CheckButton& Inkscape::UI::Dialog::SingleExport::si_show_preview
private

Definition at line 118 of file export-single.h.

Referenced by refreshPreview(), and setup().

◆ si_units_row

Gtk::Box& Inkscape::UI::Dialog::SingleExport::si_units_row
private

Definition at line 116 of file export-single.h.

Referenced by toggleSpinButtonVisibility().

◆ size_box

Gtk::Grid& Inkscape::UI::Dialog::SingleExport::size_box
private

Definition at line 114 of file export-single.h.

Referenced by refreshPage().

◆ spin_buttons

std::map<sb_type, Gtk::SpinButton *> Inkscape::UI::Dialog::SingleExport::spin_buttons
private

◆ spin_labels

std::map<sb_type, Gtk::Label *> Inkscape::UI::Dialog::SingleExport::spin_labels
private

Definition at line 104 of file export-single.h.

Referenced by SingleExport(), and toggleSpinButtonVisibility().

◆ spinButtonConns

std::vector<sigc::scoped_connection> Inkscape::UI::Dialog::SingleExport::spinButtonConns
private

Definition at line 203 of file export-single.h.

Referenced by blockSpinConns(), and setupSpinButton().

◆ units

Inkscape::UI::Widget::UnitMenu& Inkscape::UI::Dialog::SingleExport::units
private

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