mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-01 10:27:53 +02:00
Fixed issue #2221 (restoring 'save' behavior on 'save all')
'save all' now behaves like 'save' on all layouts by respecting the application-wide writer options. In addition, a weird feature was fixed: when using 'save' for the first time, old versions were freezing the writer options and changing the application-wide options did not have an effect on views after they were saved the first time. Now, this behavior only applies to "save as" and a popup is shown in the top of the layout view indicating that from now on the special options apply. This way, special options can be picked in "save as" and they will remain valid during the next "save".
This commit is contained in:
@@ -305,8 +305,6 @@ LayoutHandle::save_as (const std::string &fn, tl::OutputStream::OutputStreamMode
|
||||
{
|
||||
if (update) {
|
||||
|
||||
m_save_options = options;
|
||||
m_save_options_valid = true;
|
||||
// We must not load with the original options after we have saved the file - hence we reset the
|
||||
// reader options.
|
||||
m_load_options = db::LoadLayoutOptions ();
|
||||
|
||||
@@ -149,6 +149,70 @@ struct LAYBASIC_PUBLIC LayerDisplayProperties
|
||||
std::string name;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Descriptor for a notification inside the layout view
|
||||
*
|
||||
* Notifications are popups added at the top of the view to indicate need for reloading for example.
|
||||
* Notifications have a name, a title, optional actions (id, title) and a parameter (e.g. file path to reload).
|
||||
* Actions are mapped to QPushButtons.
|
||||
*/
|
||||
class LAYBASIC_PUBLIC LayoutViewNotification
|
||||
{
|
||||
public:
|
||||
LayoutViewNotification (const std::string &name, const std::string &title, const tl::Variant ¶meter = tl::Variant ())
|
||||
: m_name (name), m_title (title), m_parameter (parameter)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void add_action (const std::string &name, const std::string &title)
|
||||
{
|
||||
m_actions.push_back (std::make_pair (name, title));
|
||||
}
|
||||
|
||||
const std::vector<std::pair<std::string, std::string> > &actions () const
|
||||
{
|
||||
return m_actions;
|
||||
}
|
||||
|
||||
const std::string &name () const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
const std::string &title () const
|
||||
{
|
||||
return m_title;
|
||||
}
|
||||
|
||||
const tl::Variant ¶meter () const
|
||||
{
|
||||
return m_parameter;
|
||||
}
|
||||
|
||||
bool operator<(const LayoutViewNotification &other) const
|
||||
{
|
||||
if (m_name != other.name ()) {
|
||||
return m_name < other.name ();
|
||||
}
|
||||
return m_parameter < other.parameter ();
|
||||
}
|
||||
|
||||
bool operator==(const LayoutViewNotification &other) const
|
||||
{
|
||||
if (m_name != other.name ()) {
|
||||
return false;
|
||||
}
|
||||
return m_parameter == other.parameter ();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
std::string m_title;
|
||||
tl::Variant m_parameter;
|
||||
std::vector<std::pair<std::string, std::string> > m_actions;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The layout view object
|
||||
*
|
||||
@@ -279,6 +343,14 @@ public:
|
||||
*/
|
||||
virtual void cut ();
|
||||
|
||||
/**
|
||||
* @brief Adds a notification
|
||||
*/
|
||||
virtual void add_notification (const LayoutViewNotification & /*notification*/)
|
||||
{
|
||||
// the base implementation does nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the explicit title string of the view
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user