GuiDocument::GuiDocument(GuiView & lv)
- : GuiDialog(lv, "document", qt_("Document Settings")), current_id_(0)
+ : GuiDialog(lv, "document", qt_("Document Settings"))
{
setupUi(this);
applyView();
}
bp_.useClassDefaults();
- forceUpdate();
+ paramsToDialog(bp_);
}
}
}
-void GuiDocument::updateParams()
-{
- updateParams(bp_);
-}
-
-
-void GuiDocument::updateParams(BufferParams const & params)
+void GuiDocument::paramsToDialog(BufferParams const & params)
{
// set the default unit
Length::UNIT defaultUnit = Length::CM;
void GuiDocument::updateContents()
{
- if (id() == current_id_)
- return;
-
- updateAvailableModules();
- updateSelectedModules();
-
- //FIXME It'd be nice to make sure here that the selected
- //modules are consistent: That required modules are actually
- //selected, and that we don't have conflicts. If so, we could
- //at least pop up a warning.
- updateParams(bp_);
- current_id_ = id();
-}
-
-
-void GuiDocument::forceUpdate()
-{
- // reset to force dialog update
- current_id_ = 0;
- updateContents();
+ // Nothing to do here as the document settings is not cursor dependant.
+ return;
}
return;
}
bp_.useClassDefaults();
- forceUpdate();
+ paramsToDialog(bp_);
}
bool GuiDocument::initialiseParams(string const &)
{
- bp_ = buffer().params();
- // Force update on next updateContent() round.
- current_id_ = 0;
+ BufferView * view = bufferview();
+ if (!view) {
+ bp_ = BufferParams();
+ paramsToDialog(bp_);
+ return true;
+ }
+ bp_ = view->buffer().params();
loadModuleInfo();
+ updateAvailableModules();
+ updateSelectedModules();
+ //FIXME It'd be nice to make sure here that the selected
+ //modules are consistent: That required modules are actually
+ //selected, and that we don't have conflicts. If so, we could
+ //at least pop up a warning.
+ paramsToDialog(bp_);
return true;
}
BufferId GuiDocument::id() const
{
- return &buffer();
+ BufferView const * const view = bufferview();
+ return view? &view->buffer() : 0;
}
public:
GuiDocument(GuiView & lv);
- void updateParams(BufferParams const & params);
+ void paramsToDialog(BufferParams const & params);
void apply(BufferParams & params);
void updateFontsize(std::string const &, std::string const &);
/// validate listings parameters and return an error message, if any
docstring validate_listings_params();
-public Q_SLOTS:
+private Q_SLOTS:
void updateNumbering();
void change_adaptor();
void set_listings_msg();
void saveDefaultClicked();
void useDefaultsClicked();
-
-private Q_SLOTS:
- void updateParams();
void setLSpacing(int);
void setMargins(bool);
void setCustomPapersize(int);
GuiIdListModel * availableModel() { return &modules_av_model_; }
/// Selected modules
GuiIdListModel * selectedModel() { return &modules_sel_model_; }
-private:
+
/// Apply changes
void applyView();
/// update
void updateContents();
- /// force content update
- void forceUpdate();
///
void updateAvailableModules();
///