Andreas Klostermann wrote:

> Hi all,
> This is my first contribution to lyx. I wrote a Ref dialog for the GTK
> frontend. One issue that remains is, that my code still sets the buffer
> combobox to the first entry, though I tried to find the correct index
> via the current buffer's name...
> Other than that, it seems to work quite fine. I made it an instant apply
> dialog to keep in touch with the gnome way of doing things. Now I think
> it would be better to have a "revert changes" button...
> What do you think?

Nice try but not quite there yet. The LyX dialogs aren't "instant apply". 
Instead, you press the Ok or Apply buttons.

The Gtk View shouldn't do the applying, it should tell the Controller that 
the Apply button has been pressed. The Controller then calls GRef::apply, 
expecting it to populate the controller().params() variable.

Witness the QRef equivalent:

void QRef::apply()
{
    InsetCommandParams & params = controller().params();
    params.setCmdName(InsetRef::getName(dialog_->typeCO->currentItem()));
    params.setContents(fromqstr(dialog_->referenceED->text()));
    params.setOptions(fromqstr(dialog_->nameED->text()));

    restored_buffer_ = dialog_->bufferCO->currentItem();
}

Regards,
Angus

Incidentally, if you're going to contribute something to LyX, can I have 
your permission to add your name to www.lyx.org/blanket-permission.txt

The following people hereby grant permission to licence their contributions
to LyX under the Gnu General Public Licence, version 2 or later.
http://www.opensource.org/licenses/gpl-license.php


-- 
Angus

Reply via email to