Thread Locked This thread is locked - replies are not allowed.



Permlink Replies: 356 - Pages: 24 [ Previous | 1 ... 18 19 20 21 22 23 24 | Next ] - Last Post: 18-Nov-2017 16:56 Last Post By: davidekholm
AndreWolff

Posts: 1,714
Registered: 14-Dec-2007
Re: jAlbum 14.2 beta for testing
Posted: 14-Nov-2017 15:47   in response to: davidekholm in response to: davidekholm
Attachment Minimal.jaskin (79.0 KB)
davidekholm wrote:
To get the best behavior from the user's point of view, use a StateMonitor to update that hidden UI component, then call engine.setThemeImageDim, passing the same dimension as you fed into the UI component, but as a Dimension object of course. This setup should ensure that the crop focus selector updates as soon as the skin changes this dimension. (It's the call to engine.setThemeImageDim() that triggers the UI update)
I have a rather complicated StateMonitor for that:
		new StateMonitor() {
		  public void onChange() {	
		    if (imgThemeHeight.getText().length()>0) {
			folderImageSize.setText(maxImageWidth + "x" + imgThemeHeight.getText());
			engine.setThemeImageDim(new Dimension(maxImageWidth, Integer.parseInt(imgThemeHeight.getText())));
		    } else {
			folderImageSize.setText(maxImageWidth + "x" + maxImageHeight);
			engine.setThemeImageDim(new Dimension(maxImageWidth, maxImageHeight));
		    }
		  }
		}.add(imgThemeHeight).done();
See attached Minimal.jaskin file.
davidekholm

Posts: 3,564
Registered: 18-Oct-2002
Re: jAlbum 14.2 beta for testing
Posted: 14-Nov-2017 16:10   in response to: AndreWolff in response to: AndreWolff
AndreWolff wrote:

I have a rather complicated StateMonitor for that:
		new StateMonitor() {
		  public void onChange() {	
		    if (imgThemeHeight.getText().length()>0) {
			folderImageSize.setText(maxImageWidth + "x" + imgThemeHeight.getText());
			engine.setThemeImageDim(new Dimension(maxImageWidth, Integer.parseInt(imgThemeHeight.getText())));
		    } else {
			folderImageSize.setText(maxImageWidth + "x" + maxImageHeight);
			engine.setThemeImageDim(new Dimension(maxImageWidth, maxImageHeight));
		    }
		  }
		}.add(imgThemeHeight).done();
See attached Minimal.jaskin file.

Try writing the core logic (inside the StateMonitor) like this:
Dimension dim = new Dimension(maxImageWidth, maxImageHeight);
if (imgThemeHeight.getText().length()>0) {
  dim.height = Integer.parseInt(imgThemeHeight.getText());
}
folderImageSize.setText(dim.width + "x" + dim.height);
engine.setThemeImageDim(dim);
AndreWolff

Posts: 1,714
Registered: 14-Dec-2007
Re: jAlbum 14.2 beta for testing
Posted: 14-Nov-2017 16:42   in response to: davidekholm in response to: davidekholm
Attachment Minimal.jaskin (79.0 KB)
davidekholm wrote:
Try writing the core logic (inside the StateMonitor) like this:
Dimension dim = new Dimension(maxImageWidth, maxImageHeight);
if (imgThemeHeight.getText().length()>0) {
  dim.height = Integer.parseInt(imgThemeHeight.getText());
}
folderImageSize.setText(dim.width + "x" + dim.height);
engine.setThemeImageDim(dim);
Yes that is more simple, the code is in the attached Minimal.jaskin file.
Nothing is better as code reviews!

But I was in fact looking for a more simple expression of
Integer.parseInt(imgThemeHeight.getText())
, so I guess there is no simple expression for his.
I tried initially just imgThemeHeight and next imgThemeHeight.getValue() without success!

BTW the Object Folder problem reported by me above is also solved, see here. The Theme Image box on the Folder panel is now empty with the new core update.

Edit:

Although I still think it is a pity that you did not implement a full core implementation of the Theme Image with Theme image size fields on the new Folder panel, I think your current implementation will make it easy to implement a theme image in every skin. So as far as I can see, you can release it.

It would have saved me a lot of time if you had implemented the Theme image as example code in your Minimal skin, so I would advice you to release in jAlbum 15 a Minimal skin with Theme mage support.

Edited by: AndreWolff on 14-Nov-2017 18:40
davidekholm

Posts: 3,564
Registered: 18-Oct-2002
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 11:08   in response to: AndreWolff in response to: AndreWolff
Enjoy b16 by doing another update to the beta file .

This beta actually has a core implementation of theme image generation too (generating a "folderimage.jpg" to the output folder just like Turtle and Tiger does). To use the default theme image generation, add the following to your skin's init file:
engine.setThemeImageProcessor(new ThemeImageProcessor());
Apart from that, you need to add the relevant code to index.htt. To simplify this, I've added 3 new variables: themePath (analogous to thumbPath and imagePath), themeWidth and themeHeight (analogous to their thumb* and image* counterparts):

index.htt:
<ja:if exists="themePath">
<div class="themeImage">
      <img src="${themePath}" width="${themeWidth}" height="${themeHeight}">
</div>
</ja:if>
I've attached an updated version of Andrés mod to Minimal, where I simply stripped out "postdir.bsh" and removed stuff from index.htt. I've kept his onload.bsh untouched.

Those who really want other names or locations for the generated theme images can subclass the ThemeImageProcessor and tweak its behavior, for instance
// init.bsh
ThemeImageProcessor custom = new ThemeImageProcessor() {
 
  public String getThemePath(AlbumObject folder) {
    return engine.getSlideDirectory() + "/ja_theme.jpg";
  }
};
 
engine.setThemeImageProcessor(custom);

André, I don't plan to include this update to Minimal at this stage. I want to be a bit conservative and think through the UI of Minimal too before updating it.

davidekholm

Posts: 3,564
Registered: 18-Oct-2002
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 11:31   in response to: davidekholm in response to: davidekholm
See updated Javadoc API here .

I've also attached the source code for the theme image processor, in case you want to make your own subclass variants (perhaps adjust it so it doesn't generate theme images for ALL folders?)
AndreWolff

Posts: 1,714
Registered: 14-Dec-2007
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 11:32   in response to: davidekholm in response to: davidekholm
davidekholm wrote:
André, I don't plan to include this update to Minimal at this stage. I want to be a bit conservative and think through the UI of Minimal too before updating it.
Well David, my problem is that after a few months I can’t find the back the essential code for the theme image in this thread, because this thread is far too long. If it is in your Minimal skin, distributed with the last release, it is easy to find and to test.

You could also start a Thread “Coding hints”, where only you have write access (to keep it short) and copy/put the essential code and information in that thread. You can update the code later in that thread too.
AndreWolff

Posts: 1,714
Registered: 14-Dec-2007
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 11:35   in response to: davidekholm in response to: davidekholm
davidekholm wrote:
See updated Javadoc API here .
Sorry David, I hardly understand the automatically generated API documentation, because it does not contain any example code.
davidekholm

Posts: 3,564
Registered: 18-Oct-2002
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 11:37   in response to: AndreWolff in response to: AndreWolff
AndreWolff wrote:
davidekholm wrote:
See updated Javadoc API here .
Sorry David, I hardly understand the automatically generated API documentation, because it does not contain any example code.

Therefore, see my examples earlier in this thread.
AndreWolff

Posts: 1,714
Registered: 14-Dec-2007
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 11:43   in response to: davidekholm in response to: davidekholm
davidekholm wrote:
Therefore, see my examples earlier in this thread.
Yes I know that and I appreciate that, but due to the length of this thread it is later not easy to find.
So please add the essental code to a “Coding hints”, thread and replace in that code "ja_theme.jpg" by "folderimage.jpg".
davidekholm

Posts: 3,564
Registered: 18-Oct-2002
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 11:47   in response to: AndreWolff in response to: AndreWolff
Good idea. I can post this tweak example in "Skin development", but I'll do it after the release of the new version.
AndreWolff

Posts: 1,714
Registered: 14-Dec-2007
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 12:02   in response to: davidekholm in response to: davidekholm
davidekholm wrote:
Good idea. I can post this tweak example in "Skin development", but I'll do it after the release of the new version.
Great!
Thanks!
jGromit

Posts: 7,502
Registered: 31-Jan-2006
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 13:54   in response to: davidekholm in response to: davidekholm
davidekholm wrote:
...I don't plan to include this update to Minimal at this stage. I want to be a bit conservative and think through the UI of Minimal too before updating it.

We've been down this road before, of course. Minimal is "neither fish nor fowl." It was intended to be just a little skeletal demo skin that illustrates a few things, a basis for skin development. So some argue for keeping it very stripped-down, with just a smattering of features.

As you know, I'm sort of in the other camp. I think the days of developing a new skin from Minimal are probably gone. Instead, Minimal is a fairly popular skin, a way to produce very lean albums with minimal HTML/CSS. So maybe it should be made more functional. But then, of course, we get into the problem of the baby with several fathers.

But yeah, draggable lists for the captioning, not just for the thumbnails, would make sense. Some sort of support for theme images - maybe not full-width of the viewport (like Tiger), but a responsive banner that's 105% the width of the thumbnail table, for example (that's one of the options in my skins).

Lots to think about.
jGromit

Posts: 7,502
Registered: 31-Jan-2006
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 14:02   in response to: jGromit in response to: jGromit
Attachment imgTag.png (340.8 KB)
Attachment divBackground.png (1,006.3 KB)
And BTW, if you're producing a responsive page, putting your theme image in as a regular <img> is the road to heartache. There's a good reason why most skins that support theme images use them as background images on a <div>. The attached two screenshots tell the tale.

In short, as the viewport narrows, you want the theme image to remain the same height, but get narrower, actually changing its aspect ratio, rather than shrinking in both dimensions, and keeping its aspect ratio. Doing that with a regular <img> tag is theoretically possible, but very messy, because CSS doesn't provide a handy, built-in way of pulling it off.
jimberry

Posts: 516
Registered: 30-Aug-2004
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 14:08   in response to: jGromit in response to: jGromit
jGromit wrote:
davidekholm wrote:
...I don't plan to include this update to Minimal at this stage. I want to be a bit conservative and think through the UI of Minimal too before updating it.

We've been down this road before, of course. Minimal is "neither fish nor fowl." It was intended to be just a little skeletal demo skin that illustrates a few things, a basis for skin development. So some argue for keeping it very stripped-down, with just a smattering of features.

.... So maybe it should be made more functional. But then, of course, we get into the problem of the baby with several fathers.


I am in the "conservative" camp that thinks that if the purpose of Minimal is no longer to be "minimal", then the suggested "non-minimal" version should have a different name that reflects its new purpose.
I don't see any downside to keeping the old Minimal as a truly "minimal" (or is it already too late for that? ?:| )
jGromit

Posts: 7,502
Registered: 31-Jan-2006
Re: jAlbum 14.2 beta for testing
Posted: 15-Nov-2017 14:25   in response to: jimberry in response to: jimberry
Attachment Absolute.jaskin (1.3 KB)
jimberry wrote:
I don't see any downside to keeping the old Minimal as a truly "minimal" (or is it already too late for that? ?:| )

Yes, I think that train has already sailed. That ship has left the station.

Someday, I'm going to release my Absolute skin, which is truly minimal. No navigation - after all, that's what the browser's "back" button is for - no options, skeletal code. I'm not sure, however - there may still be some "fluff" in there. ;)

Edit: I already see the "fluff" - there are tooltips on the thumbnails. Next release, we'll get rid of those!
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums