Skip to content

Commit

Permalink
Works
Browse files Browse the repository at this point in the history
  • Loading branch information
goga authored and goga committed Jun 17, 2023
1 parent 4faca45 commit 6b755df
Show file tree
Hide file tree
Showing 99 changed files with 1,262 additions and 238 deletions.
11 changes: 10 additions & 1 deletion com.hazard157.prisex24/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,24 @@ Export-Package: com.hazard157.prisex24,
com.hazard157.prisex24.devel,
com.hazard157.prisex24.e4.addons,
com.hazard157.prisex24.e4.services.currep,
com.hazard157.prisex24.e4.services.psx,
com.hazard157.prisex24.e4.services.selsvins,
com.hazard157.prisex24.e4.uiparts,
com.hazard157.prisex24.e4.uiparts.episodes,
com.hazard157.prisex24.e4.uiparts.refbooks,
com.hazard157.prisex24.glib.dialogs,
com.hazard157.prisex24.glib.epframes,
com.hazard157.prisex24.glib.frasel,
com.hazard157.prisex24.glib.frview,
com.hazard157.prisex24.glib.frview.impl,
com.hazard157.prisex24.m5,
com.hazard157.prisex24.m5.episodes,
com.hazard157.prisex24.m5.frames,
com.hazard157.prisex24.m5.std,
com.hazard157.prisex24.m5.tags,
com.hazard157.prisex24.m5.todos
com.hazard157.prisex24.m5.todos,
com.hazard157.prisex24.utils,
com.hazard157.prisex24.valeds.frames
Bundle-Activator: com.hazard157.prisex24.Activator
Bundle-Vendor: HAZARD157
Require-Bundle: javax.annotation,
Expand Down
10 changes: 9 additions & 1 deletion com.hazard157.prisex24/fragment.e4xmi
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@
<elements xsi:type="application:Addon" xmi:id="_lW7SYAioEe6RgN0UorbIgw" elementId="com.hazard157.prisex24.addon.0" contributionURI="bundleclass://com.hazard157.prisex24/com.hazard157.prisex24.e4.addons.AddonPrisex24Core"/>
<elements xsi:type="application:Addon" xmi:id="_mmvUcAioEe6RgN0UorbIgw" elementId="com.hazard157.prisex24.addon.1" contributionURI="bundleclass://com.hazard157.common/com.hazard157.common.e4.addons.AddonMainWindowDebugSize"/>
<elements xsi:type="application:Addon" xmi:id="_fG-BkAqoEe6kmvIYOJ1hbQ" elementId="com.hazard157.prisex24.addon.2" contributionURI="bundleclass://com.hazard157.common/com.hazard157.common.e4.addons.AddonInitialPerspectiveChooser"/>
<elements xsi:type="application:Addon" xmi:id="_t7Ba0A0QEe6MCt0KJQBWiw" elementId="com.hazard157.prisex24.addon.3" contributionURI="bundleclass://com.hazard157.prisex24/com.hazard157.prisex24.e4.addons.AddonPrisex24Behaviour"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_19JvIAqoEe6kmvIYOJ1hbQ" featurename="children" parentElementId="org.toxsoft.mws.perspectivestack.main">
<elements xsi:type="advanced:Perspective" xmi:id="_e3nAsAw5Ee6bKYfEj3FUUA" elementId="com.hazard157.prisex24.persp.episodes" label="%Persp_Episodes" iconURI="platform:/plugin/com.hazard157.psx.proj3/icons/is24x24/incidents-list-episode.png" tooltip="%Persp_Episodes_D">
<children xsi:type="basic:PartSashContainer" xmi:id="_4Q6yUAw5Ee6bKYfEj3FUUA" elementId="com.hazard157.prisex24.partsashcontainer.0" horizontal="true">
<children xsi:type="basic:PartStack" xmi:id="_B6AMcAw6Ee6bKYfEj3FUUA" elementId="com.hazard157.prisex24.partstack.0">
<children xsi:type="basic:PartStack" xmi:id="_B6AMcAw6Ee6bKYfEj3FUUA" elementId="com.hazard157.prisex24.partstack.0" containerData="1500">
<children xsi:type="basic:Part" xmi:id="_DsZ-MAw6Ee6bKYfEj3FUUA" elementId="com.hazard157.prisex24.part.uipart_episodes_list" contributionURI="bundleclass://com.hazard157.prisex24/com.hazard157.prisex24.e4.uiparts.episodes.UipartEpisodesList" label="%Uipart_Episodes_List" iconURI="platform:/plugin/com.hazard157.psx.proj3/icons/is24x24/incidents-list-episode.png" tooltip="%Uipart_Episodes_List_D"/>
</children>
<children xsi:type="basic:PartStack" xmi:id="_fBuI4AyPEe61qMlfL3-t4w" elementId="com.hazard157.prisex24.partstack.1" containerData="2500"/>
<children xsi:type="basic:PartStack" xmi:id="_fXLbgAyPEe61qMlfL3-t4w" elementId="com.hazard157.prisex24.partstack.2" containerData="6000">
<children xsi:type="advanced:Placeholder" xmi:id="_a9lTsA0AEe6MCt0KJQBWiw" elementId="com.hazard157.prisex24.placeholder.0" ref="_2Coq4Az_Ee6MCt0KJQBWiw"/>
</children>
</children>
</elements>
<elements xsi:type="advanced:Perspective" xmi:id="_3hJRcAqoEe6kmvIYOJ1hbQ" elementId="com.hazard157.prisex24.persp.refbooks" label="%Persp_Refbooks" iconURI="platform:/plugin/com.hazard157.common/icons/is24x24/refbooks-list.png" tooltip="%Persp_Refbooks_D">
Expand All @@ -40,4 +45,7 @@
<parameters xmi:id="_kUtm4AqqEe6kmvIYOJ1hbQ" elementId="com.hazard157.prisex24.parameter.1" name="org.toxsoft.mws.cmd.switch_persp.arg.perspId" value="com.hazard157.prisex24.persp.refbooks"/>
</elements>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_yU7DAAz_Ee6MCt0KJQBWiw" featurename="sharedElements" parentElementId="org.toxsoft.mws.window.main">
<elements xsi:type="basic:Part" xmi:id="_2Coq4Az_Ee6MCt0KJQBWiw" elementId="com.hazard157.prisex24.part.uipart_svins_frames" contributionURI="bundleclass://com.hazard157.prisex24/com.hazard157.prisex24.e4.uiparts.UipartSharedSvinsFramesViewer" label="%Uipart_Svins_Frames" iconURI="platform:/plugin/com.hazard157.prisex24/icons/is24x24/pornicon.png" tooltip="%Uipart_Svins_Frames_D"/>
</fragments>
</fragment:ModelFragments>
Binary file added com.hazard157.prisex24/icons/gif-create.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added com.hazard157.prisex24/icons/gif-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added com.hazard157.prisex24/icons/gif-recreate-all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added com.hazard157.prisex24/icons/gif-remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added com.hazard157.prisex24/icons/gif-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added com.hazard157.prisex24/icons/is16x16/gif-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added com.hazard157.prisex24/icons/is16x16/gif-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added com.hazard157.prisex24/icons/is24x24/gif-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added com.hazard157.prisex24/icons/is24x24/gif-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added com.hazard157.prisex24/icons/is32x32/gif-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added com.hazard157.prisex24/icons/is32x32/gif-test.png
Binary file added com.hazard157.prisex24/icons/is48x48/gif-info.png
Binary file added com.hazard157.prisex24/icons/is64x64/gif-info.png
Binary file added com.hazard157.prisex24/icons/is64x64/gif-test.png
Binary file added com.hazard157.prisex24/icons/is96x96/gif-info.png
Binary file added com.hazard157.prisex24/icons/is96x96/gif-test.png
Binary file added com.hazard157.prisex24/icons/work-with-frames.png
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
package com.hazard157.prisex24;

import static com.hazard157.prisex24.IPsxResources.*;
import static org.toxsoft.core.tslib.av.EAtomicType.*;
import static org.toxsoft.core.tslib.av.impl.AvUtils.*;
import static org.toxsoft.core.tslib.av.metainfo.IAvMetaConstants.*;

import java.time.*;

import org.eclipse.e4.core.contexts.*;
import org.toxsoft.core.tsgui.bricks.actions.*;
import org.toxsoft.core.tsgui.graphics.icons.*;
import org.toxsoft.core.tsgui.graphics.image.*;
import org.toxsoft.core.tsgui.mws.appinf.*;
import org.toxsoft.core.tslib.av.impl.*;
import org.toxsoft.core.tslib.av.metainfo.*;
import org.toxsoft.core.tslib.av.opset.impl.*;
import org.toxsoft.core.tslib.bricks.apprefs.*;
import org.toxsoft.core.tslib.bricks.strid.coll.*;
import org.toxsoft.core.tslib.bricks.strid.coll.impl.*;
import org.toxsoft.core.tslib.utils.*;

/**
Expand Down Expand Up @@ -56,6 +67,64 @@ public interface IPrisex24CoreConstants {
String ICONID_FRAMES_PER_SVIN_FORCE_ONE = "frames_per_svin_force-one"; //$NON-NLS-1$
String ICONID_FRAMES_PER_SVIN_ONE_NO_MORE = "frames_per_svin_one-no-more"; //$NON-NLS-1$
String ICONID_FRAMES_PER_SVIN_SELECTED = "frames_per_svin_selected"; //$NON-NLS-1$
String ICONID_GIF_CREATE = "gif-create"; //$NON-NLS-1$
String ICONID_GIF_INFO = "gif-info"; //$NON-NLS-1$
String ICONID_GIF_RECREATE_ALL = "gif-recreate-all"; //$NON-NLS-1$
String ICONID_GIF_REMOVE = "gif-remove"; //$NON-NLS-1$
String ICONID_GIF_TEST = "gif-test"; //$NON-NLS-1$
String ICONID_WORK_WITH_FRAMES = "work-with-frames"; //$NON-NLS-1$

// ------------------------------------------------------------------------------------
// Actions

String ACTID_GIF_CREATE = PSX_ACT_ID + ".gif_create"; //$NON-NLS-1$
String ACTID_GIF_INFO = PSX_ACT_ID + ".gif_info"; //$NON-NLS-1$
String ACTID_GIF_RECREATE_ALL = PSX_ACT_ID + ".gif_recreate_all"; //$NON-NLS-1$
String ACTID_GIF_REMOVE = PSX_ACT_ID + ".gif_remove"; //$NON-NLS-1$
String ACTID_GIF_TEST = PSX_ACT_ID + ".gif_test"; //$NON-NLS-1$
String ACTID_WORK_WITH_FRAMES = PSX_ACT_ID + ".work_with_frames"; //$NON-NLS-1$

ITsActionDef ACDEF_GIF_CREATE = TsActionDef.ofPush2( ACTID_GIF_CREATE, //
STR_GIF_CREATE, STR_GIF_CREATE_D, ICONID_GIF_CREATE );

ITsActionDef ACDEF_GIF_CREATE_MENU = TsActionDef.ofMenu2( ACTID_GIF_CREATE, //
STR_GIF_CREATE, STR_GIF_CREATE_D, ICONID_GIF_CREATE );

ITsActionDef ACDEF_GIF_INFO = TsActionDef.ofPush2( ACTID_GIF_INFO, //
STR_GIF_INFO, STR_GIF_INFO_D, ICONID_GIF_INFO );

ITsActionDef ACDEF_GIF_RECREATE_ALL = TsActionDef.ofPush2( ACTID_GIF_RECREATE_ALL, //
STR_GIF_RECREATE_ALL, STR_GIF_RECREATE_ALL_D, ICONID_GIF_RECREATE_ALL );

ITsActionDef ACDEF_GIF_REMOVE = TsActionDef.ofPush2( ACTID_GIF_REMOVE, //
STR_GIF_REMOVE, STR_GIF_REMOVE_D, ICONID_GIF_REMOVE );

ITsActionDef ACDEF_GIF_TEST = TsActionDef.ofPush2( ACTID_GIF_TEST, //
STR_GIF_TEST, STR_GIF_TEST_D, ICONID_GIF_TEST );

ITsActionDef ACDEF_WORK_WITH_FRAMES = TsActionDef.ofPush2( ACTID_WORK_WITH_FRAMES, //
STR_WORK_WITH_FRAMES, STR_WORK_WITH_FRAMES_D, ICONID_WORK_WITH_FRAMES );

// ------------------------------------------------------------------------------------
// Application preferences

/**
* Preferences bundle specific for HZ library.
*/
String PBID_PSX24_COMMON = PSX_FULL_ID + ".Common"; //$NON-NLS-1$

String APREFID_THUMB_SIZE_IN_MENUS = "ThumbSizeInMenus"; //$NON-NLS-1$

IDataDef APPREF_THUMB_SIZE_IN_MENUS = DataDef.create( APREFID_THUMB_SIZE_IN_MENUS, VALOBJ, //
TSID_NAME, STR_THUMB_SIZE_IN_MENUS, //
TSID_DESCRIPTION, STR_THUMB_SIZE_IN_MENUS_D, //
TSID_KEEPER_ID, EThumbSize.KEEPER_ID, //
TSID_DEFAULT_VALUE, avValobj( EThumbSize.SZ180 ) //
);

IStridablesList<IDataDef> ALL_APPREFS = new StridablesList<>( //
APPREF_THUMB_SIZE_IN_MENUS //
);

/**
* Constants registration.
Expand All @@ -66,6 +135,15 @@ static void init( IEclipseContext aWinContext ) {
ITsIconManager iconManager = aWinContext.get( ITsIconManager.class );
iconManager.registerStdIconByIds( Activator.PLUGIN_ID, IPrisex24CoreConstants.class, PREFIX_OF_ICON_FIELD_NAME );
//
IAppPreferences aprefs = aWinContext.get( IAppPreferences.class );
IPrefBundle pb = aprefs.defineBundle( PBID_PSX24_COMMON, OptionSetUtils.createOpSet( //
TSID_NAME, STR_PB_PSX24_COMMON, //
TSID_DESCRIPTION, STR_PB_PSX24_COMMON_D, //
TSID_ICON_ID, ICONID_APP_ICON //
) );
for( IDataDef dd : ALL_APPREFS ) {
pb.defineOption( dd );
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,25 @@
*/
interface IPsxResources {

/**
* {@link IPrisex24CoreConstants}
*/
String STR_APP_INFO = Messages.getString( "STR_APP_INFO" ); //$NON-NLS-1$
String STR_APP_INFO_D = Messages.getString( "STR_APP_INFO_D" ); //$NON-NLS-1$

String STR_GIF_CREATE = Messages.getString( "STR_GIF_CREATE" ); //$NON-NLS-1$
String STR_GIF_CREATE_D = Messages.getString( "STR_GIF_CREATE_D" ); //$NON-NLS-1$
String STR_GIF_INFO = Messages.getString( "STR_GIF_INFO" ); //$NON-NLS-1$
String STR_GIF_INFO_D = Messages.getString( "STR_GIF_INFO_D" ); //$NON-NLS-1$
String STR_GIF_RECREATE_ALL = Messages.getString( "STR_GIF_RECREATE_ALL" ); //$NON-NLS-1$
String STR_GIF_RECREATE_ALL_D = Messages.getString( "STR_GIF_RECREATE_ALL_D" ); //$NON-NLS-1$
String STR_GIF_REMOVE = Messages.getString( "STR_GIF_REMOVE" ); //$NON-NLS-1$
String STR_GIF_REMOVE_D = Messages.getString( "STR_GIF_REMOVE_D" ); //$NON-NLS-1$
String STR_GIF_TEST = Messages.getString( "STR_GIF_TEST" ); //$NON-NLS-1$
String STR_GIF_TEST_D = Messages.getString( "STR_GIF_TEST_D" ); //$NON-NLS-1$
String STR_WORK_WITH_FRAMES = Messages.getString( "STR_WORK_WITH_FRAMES" ); //$NON-NLS-1$
String STR_WORK_WITH_FRAMES_D = Messages.getString( "STR_WORK_WITH_FRAMES_D" ); //$NON-NLS-1$

String STR_THUMB_SIZE_IN_MENUS = Messages.getString( "STR_THUMB_SIZE_IN_MENUS" ); //$NON-NLS-1$
String STR_THUMB_SIZE_IN_MENUS_D = Messages.getString( "STR_THUMB_SIZE_IN_MENUS_D" ); //$NON-NLS-1$
String STR_PB_PSX24_COMMON = Messages.getString( "STR_PB_PSX24_COMMON" ); //$NON-NLS-1$
String STR_PB_PSX24_COMMON_D = Messages.getString( "STR_PB_PSX24_COMMON_D" ); //$NON-NLS-1$

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
* <li>second-aligned JPGs - are files names HH-MM-SS_<b>00</b>.jpg;</li>
* <li>all frame JPGs - are files names HH-MM-SS_<b>FF</b>.jpg, where FF have value 00..24.</li>
* </ol>
* COFS contains only frames of kind 1 and 2. Kind 3 (all frames) contains too many files and are outside of COFS. So
* this interface works only with GIFs and second aligned JPGs.
* <p>
* Note: when application asks for frames of kind 3 the warning is logged.
* COFS contains only frames of kind 1 and 2. Kind 3 (all frames) contains too many files and are outside of COFS.
* However this interface <b><i>partially</i></b> works only with GIFs and second aligned JPGs. Each method includes
* notes on whether the method supports non-second-aligned frames.
*
* @author hazard157
*/
Expand All @@ -30,6 +29,8 @@ public interface ICofsFrames {
* Returns frame file if exists.
* <p>
* For {@link IFrame#NONE} returns special file with unknown episode meaning.
* <p>
* Supports non-seconds aligned frames they will be found by this method.
*
* @param aFrame {@link IFrame} - the frame
* @return {@link File} - existing frame image file or <code>null</code>
Expand All @@ -39,6 +40,8 @@ public interface ICofsFrames {

/**
* Returns all frames with images files.
* <p>
* Does not supports non-seconds aligned frames, they are not included in the returned set.
*
* @param aEpisodeId String - the requested episode ID
* @return {@link IList}&lt;{@link IFrame}&gt; - the list of all frames of the episode
Expand All @@ -47,6 +50,4 @@ public interface ICofsFrames {
*/
IFramesSet listEpisodeFrames( String aEpisodeId );

// TODO add non-sec-alignes frames management

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
class CofsFrames
implements ICofsFrames {

// FIXME move to settings? argument of this service?
private static final File NONSECS_ROOT = new File( "/home/.psx/episodes/frames-nonsec/" ); //$NON-NLS-1$

/**
* Episodes resources root directory or <code>null</code> is specified one is not accessible.
*/
Expand Down Expand Up @@ -116,41 +119,75 @@ private void ensureEpisodeFrames( LocalDate aEpisodeDate ) {
cachedEpFrames.put( epId, new FramesSet( llCacheAllFrames ) );
}

// ------------------------------------------------------------------------------------
// ICofsFrames
//

@Override
public File findFrameFile( IFrame aFrame ) {
TsNullArgumentRtException.checkNull( aFrame );
if( epsRoot == null ) {
private File internalFindSecAlignedStillFrame( IFrame aFrame ) {
LocalDate ld = EPsxIncidentKind.EPISODE.id2date( aFrame.episodeId() );
File epDir = new File( epsRoot, ld.toString() );
File epFramesDir = new File( epDir, SUBDIR_EP_STILL_IMAGES );
File epCamDir = new File( epFramesDir, aFrame.cameraId() );
if( !TsFileUtils.isDirReadable( epCamDir ) ) {
return null;
}
if( aFrame.frameNo() < 0 || !aFrame.isDefined() ) {
return null;
String bareName = PsxCofsUtils.bareSourceFrameFileName( aFrame.frameNo() );
File frameFile = new File( epCamDir, bareName + '.' + STILL_IMAGE_FILE_EXT );
if( frameFile.exists() ) {
return frameFile;
}
return null;
}

private File internalFindGifFrame( IFrame aFrame ) {
LocalDate ld = EPsxIncidentKind.EPISODE.id2date( aFrame.episodeId() );
File epDir = new File( epsRoot, ld.toString() );
File epFramesDir;
if( aFrame.isAnimated() ) {
epFramesDir = new File( epDir, SUBDIR_EP_ANIM_IMAGES );
File epFramesDir = new File( epDir, SUBDIR_EP_ANIM_IMAGES );
File epCamDir = new File( epFramesDir, aFrame.cameraId() );
if( !TsFileUtils.isDirReadable( epCamDir ) ) {
return null;
}
else {
epFramesDir = new File( epDir, SUBDIR_EP_STILL_IMAGES );
String bareName = PsxCofsUtils.bareSourceFrameFileName( aFrame.frameNo() );
File frameFile = new File( epCamDir, bareName + '.' + ANIM_IMAGE_FILE_EXT );
if( frameFile.exists() ) {
return frameFile;
}
return null;
}

private static File internalFindNonSecFrame( IFrame aFrame ) {
LocalDate ld = EPsxIncidentKind.EPISODE.id2date( aFrame.episodeId() );
File epFramesDir = new File( NONSECS_ROOT, ld.toString() );
File epCamDir = new File( epFramesDir, aFrame.cameraId() );
if( !TsFileUtils.isDirReadable( epCamDir ) ) {
return null;
}
String bareName = PsxCofsUtils.bareSourceFrameFileName( aFrame.frameNo() );
String ext = aFrame.isAnimated() ? ANIM_IMAGE_FILE_EXT : STILL_IMAGE_FILE_EXT;
File frameFile = new File( epCamDir, bareName + '.' + ext );
File frameFile = new File( epCamDir, bareName + '.' + STILL_IMAGE_FILE_EXT );
if( frameFile.exists() ) {
return frameFile;
}
return null;
}

// ------------------------------------------------------------------------------------
// ICofsFrames
//

@Override
public File findFrameFile( IFrame aFrame ) {
TsNullArgumentRtException.checkNull( aFrame );
if( epsRoot == null ) {
return null;
}
if( aFrame.frameNo() < 0 || !aFrame.isDefined() ) {
return null;
}
if( aFrame.isAnimated() ) {
return internalFindGifFrame( aFrame );
}
if( aFrame.isSecAligned() ) {
return internalFindSecAlignedStillFrame( aFrame );
}
return internalFindNonSecFrame( aFrame );
}

@Override
public IFramesSet listEpisodeFrames( String aEpisodeId ) {
LocalDate epDate = EPsxIncidentKind.EPISODE.id2date( aEpisodeId );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.hazard157.prisex24.e4.addons;

import org.eclipse.e4.core.contexts.*;
import org.toxsoft.core.tsgui.mws.bases.*;
import org.toxsoft.core.tslib.coll.primtypes.*;

import com.hazard157.lib.core.utils.animkind.*;
import com.hazard157.prisex24.e4.services.currep.*;
import com.hazard157.prisex24.e4.services.selsvins.*;
import com.hazard157.prisex24.glib.frasel.*;
import com.hazard157.psx.common.stuff.svin.*;
import com.hazard157.psx.proj3.episodes.*;

/**
* Sets up application common behaviour.
*
* @author hazard157
*/
public class AddonPrisex24Behaviour
extends MwsAbstractAddon {

/**
* Constructor.
*/
public AddonPrisex24Behaviour() {
super( AddonPrisex24Behaviour.class.getSimpleName() );
}

// ------------------------------------------------------------------------------------
// implementation
//

// ------------------------------------------------------------------------------------
// MwsAbstractAddon
//

@Override
protected void initApp( IEclipseContext aAppContext ) {
// nop
}

@Override
protected void initWin( IEclipseContext aWinContext ) {
// on current episode change displays it's animated frames in the shared view
ICurrentEpisodeService currEpService = aWinContext.get( ICurrentEpisodeService.class );
IPsxSelectedSvinsService selSvinsService = aWinContext.get( IPsxSelectedSvinsService.class );
currEpService.addCurrentEntityChangeListener( aCurrent -> {
IEpisode currEpisode = currEpService.current();
Svin svin = null;
if( currEpisode != null ) {
svin = new Svin( currEpisode.id() );
}
selSvinsService.framesSelectionParams().setParams( EAnimationKind.ANIMATED, Boolean.FALSE, IStringList.EMPTY,
EFramesPerSvin.SELECTED );
selSvinsService.setSvin( svin );
} );
}

}
Loading

0 comments on commit 6b755df

Please sign in to comment.