On 10/28/2010 01:07 PM, Abdelrazak Younes wrote:
On 10/28/2010 06:31 PM, Richard Heck wrote:
On 10/28/2010 12:04 PM, Richard Heck wrote:
The changeover to InsetParamsWidget has borked the label dialog in
ways I cannot seem to understand. Try this: Create a new section
heading, and give it the title "Hello". Now Insert>Label. You ought
to get a dialog with "sec:Hello", but you get an empty dialog.
Worse problem: If you had something in the dialog previously, you
get it back again. I.e., LyX invites you to create a duplicate label.
The source of this is that InsetParamsDialog::initializeParams()
ignores its argument and restores the previous state of the dialog.
I don't see how this could be over-ridden.
OK, I think I've fixed this at r35886, but please check.
Yes thanks, that's what I wanted to do. But it can be generalized into
InsetParamsWidget, no need to implement it in each class:
bool InsetParamsWidget::initialiseParams(std::string const& data)
{
InsetCommandParams p(insetCode());
if (!InsetCommand::string2params(insetName(), data, p))
return false;
paramsToDialog(params);
return true;
}
The insetName() bit could go once Vincent has committed his change
about string2params().
Of course this also means that a new virtual method needs to be created:
InsetParamsWidget::paramsToDialog(InsetCommandParams const&)
I resisted doing this because I thought not all InsetParamsWidget
based class would use InsetCommandParams.
Perhaps that is a reason to keep it as it is. There's going to be some
virtual method here that gets overridden in the base classes. In my
code, it's initialiseParams(); your proposal has it being
paramsToDialog(ICP). But that has the cost you just mentioned. And
InsetGraphics and InsetListings are possible candidates.
Andre has occasionally suggested getting rid of the whole ICP business
in favor of some sort of inheritance. I'm becoming sympathetic and have
been thinking about doing this early in the 2.1 cycle. So maybe that's
another reason.
rh