lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: [lmi] Generating screenshots automatically


From: Vadim Zeitlin
Subject: Re[2]: [lmi] Generating screenshots automatically
Date: Mon, 23 Feb 2009 13:34:24 +0100

On Mon, 23 Feb 2009 01:47:08 +0000 Greg Chicares <address@hidden> wrote:

GC> I expressed it that way because I'm not sure what "top level" means.

 Sorry for not defining it: it means the top-level child of <resource> tag
in XRC file. So plan_panel is top-level but wxFlexGridSizer inside it is
not top-level.

GC> All these panels, for every skin:
GC>   grep wxPanel skin*.xrc |less -S
GC> are siblings. They're in one-to-one correspondence with wxBookCtrl
GC> pages. Those are exactly the objects for which we want screenshots.
GC> No panel has any embedded child panel.

 The last one could however change, which is why I think it unwise to take
all wxPanels. But then we're not going to iterate over XRC nodes anyhow
because of:

GC> Every "skin" file has exactly one book control. You can access it
GC> by calling MvcController::BookControl(). Iterating over the panels
GC> is the same as iterating over the book pages. I would suppose that
GC> iterating over the pages is easier,

 Yes, I didn't realize that we could use BookControl() here. Indeed, using
it is much simpler and requires no changes to wxXmlResource.

GC> as long as that lets us access "custom" tags like '<lmi:annotation>'.

 This will work as long as all objects have unique names. BTW, I called
this tag <lmi:help_link> and currently the code considers that the tag
contents is just the link target because this is much more convenient to
write in XML than the entire HTML fragment. I.e. consider:

<lmi:annotation>&lt;a href="link_target"&gt;link_text&lt;/a&gt;</lmi:annotation>

vs

<lmi:help_link>link_target</lmi:help_link>

Of course, the latter doesn't allow specifying the link text but I
currently use the name of the control as it which IMO is good enough. And
if it isn't we can always add <lmi:help_link_text>.


GC> At the insertion point, the dialog has just been loaded, so IIRC
GC> the first page is selected by default. I suppose I'd approach it
GC> like this:
GC> 
GC>   some_integral_type number_of_pages = /* get number of pages */;
GC>   for(int j = 0; j < number_of_pages; ++j)
GC>       {
GC>       BookControl().ChangeSelection(j);
GC>       // produce a screenshot of MvcController::CurrentPage() here
GC>       }

 So far I instantiated each panel inside a separate wxFrame but it doesn't
make sense to do this if the panels are already created so I'll use your
approach. One question however: would you like the screenshot include the
entire dialog, just the notebook or just the notebook page?

GC> I'm not sure how to get the number of pages in a wxBookCtrlBase.

 GetPageCount() works correctly even for wxTreebook.


GC> To me, this suggests generating screenshots only for whatever
GC> "skin" is currently loaded. We can even do that at run time: on
GC> demand, for example, or perhaps the first time the program is
GC> run.

 All I can say is that we definitely should do it every time the dialog is
opened because it's a time-consuming process. Right now it's also a very
ugly one because the pages must be visually shown on screen but I hope to
work around this, at least for MSW.


GC> We can't yet see every profitable use for this facility. Probably
GC> we'll discover new uses later. But we can specify the interface for
GC> the first part now, and I hope this message completes any part of
GC> that specification that was missing.

 I think so. Just one last question: would you still like me to finish
xrcshot tool which would generate the HTML files (and accompanying PNGs)
for all the panels in skin.xrc or is this unnecessary now? The worry I have
is that integrating the changes in LMI can take some time and so you might
not be able to generate these screenshots yourself sufficiently soon.

 Thanks,
VZ

reply via email to

[Prev in Thread] Current Thread [Next in Thread]