Abdelrazak Younes wrote:
> Bo Peng wrote:
>> The show function now accepts a full structure that contains various
>> toolbar information. How to make use of them is supposed to be
>> frontend-specific.
>
> Well, I don't want to minimize your work Bo but for the toolbar
> positioning, maybe we could use Qt own session management and call that
> from your own session class?
As Bo, I also think we should do it completely within lyx
so we have all at one place.
And it is the usual way of doing it fronted-independent.
>
>> +void QLToolbar::show(bool, ToolbarSection::ToolbarInfo const & info)
>> {
>> - QToolBar::show();
>> + // FIXME: info should contain information about toolbar location
>> + // etc. This function should make use of them to restore toolbar
>> + // position etc.
>> + // FIXME: the following seems to be appropriate, but toolbars are
>> shown
>> + // even with the following commented out???
>> +// if (info.visible)
>> +// QToolBar::show();
>
> I think this is overriden by the Toolbar backend show() and hide(). We
> maybe have to rethink this backend.
Yes, in void Toolbars::update(..)
>> }
>>
>> This is where Peter should move toolbars around when lyx starts. This
>> does not work now since all toolbars are displayed even when I comment
>> out QToolBar::show(). I do not know what is going on here.
>
> See above.
>
>>
>> +void QLToolbar::saveInfo(ToolbarSection::ToolbarInfo & info)
>> +{
>> + // update Toolbar info with current toolbar status
>> + // FIXME: there are more information can be saved here
>> + info.visible = QLToolbar::isVisible();
>> +}
>>
>> This is where Peter should save toolbar information when lyx ends.
>>
>>
>> +class ToolbarSection : SessionSection
>> +{
>> +public:
>> + /// information about a toolbar, not all information can be
>> + /// saved/restored by all frontends, but this class provides
>> + /// a superset of things that can be managed by session.
>> + class ToolbarInfo
>> + {
>> + public:
>> + ///
>> + ToolbarInfo() :
>> + empty(true), visible(false), posX(-1), posY(-1),
>> location(-1) { }
>> + ///
>> + ToolbarInfo(bool v, int x, int y) :
>> + empty(false), visible(v), posX(x), posY(y), location(-1) { }
>> +
>> + public:
>> + /// true means no information is available (so ignore visible
>> settings)
>> + bool empty;
>> + /// on/off
>> + bool visible;
>> + /// position
>> + int posX;
>> + ///
>> + int posY;
>
> We don't need posX and posY. There is no floating toolbar and we should
> not support that.
>
>> + /// location: this can be intepreted differently.
>> + int location;
>
> Make that an enum:
>
> enum Location {
> top,
> bottom,
> left,
> right
> }
>
>
>> + /// potentially, icons
>> + };
>
> I'd say not for 1.5.
>
>>
>> This is where Toolbar info is handled. Peter, what information do you
>> want to save? Maybe toolbar orders as well?
>
> Ordering would be nice but strictly necessary for now.
>
>> Index: src/frontends/LyXView.h
>> ===================================================================
>> --- src/frontends/LyXView.h (revision 15649)
>> +++ src/frontends/LyXView.h (working copy)
>> @@ -136,6 +136,8 @@
>>
>> /// update the toolbar
>> void updateToolbars();
>> + /// save the status of toolbars
>> + void saveToolbarInfo();
>
> Why do you need this saveToolbarInfo()? toolbars()->saveSession() is as
> good.
>
> By the way, instead of using the global session object maybe it would be
> better to make the session object retrieve the version itself and save
> them as desired. I mean inside Session::save(LyXView & lv)
>
> ToolbarInfo const & ti = lv.toolbars().info();
> string lv_id = convert<string>(lv.id()); // Where to save this id?
>
> session.sessionInfo().save("ToolbarLocation",
> convert<string>(ti.location()));
>
> What do you think?
I need more time.
--
Peter Kümmel