Skip to content

Commit

Permalink
A lot of little quality of life fixes and polish. See Notes.c for mor…
Browse files Browse the repository at this point in the history
…e details.
  • Loading branch information
fstark committed Feb 13, 2022
1 parent be05922 commit 447b66f
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 87 deletions.
10 changes: 5 additions & 5 deletions macsrc/Library.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ struct LibraryRecord
#define INTER_X 8
#define INTER_Y 8
#define MARGIN_X 15
#define MARGIN_Y 15 // Suspects it should be removed for better key scroll behavior in first and last line
#define MARGIN_Y 8 // Suspects it should be removed for better key scroll behavior in first and last line

// outer border, white border, inner border, pict, inner border, white border, outer border
#define POLAROID_WIDTH (2+POLAROID_BORDER+PICT_WIDTH+POLAROID_BORDER+2)
Expand Down Expand Up @@ -310,7 +310,7 @@ LibraryPtr LibraryOpenDefault( void )

if (resFile==-1)
{
Create( LIBRARY_FILE, 0, 'FLIM', 'FLIB' );
Create( LIBRARY_FILE, 0, 'FLPL', 'FLIB' );
CreateResFile( LIBRARY_FILE );
resFile = OpenResFile( LIBRARY_FILE );
if (resFile==-1)
Expand Down Expand Up @@ -345,14 +345,14 @@ LibraryPtr LibraryOpenDefault( void )
lib->entries[i].needsUpdate = FALSE;
}

lib->visibleHeight = 271; // This is *just* the right size for the initial window
lib->visibleHeight = 295;
lib->offsetHeight = 0;
LibrarySetColumnCount( lib, LIBRARY_COLUMNS );

lib->window = GetNewWindow( kWindowLibraryID, NULL, (WindowPtr)-1 );

SizeWindow( lib->window, lib->contentWidth, lib->visibleHeight, FALSE );
UtilPlaceWindow( lib->window, 0.3 );
UtilPlaceWindow( lib->window, 0.5 );

{
Rect r;
Expand Down Expand Up @@ -984,7 +984,7 @@ FlimPtr LibraryOpenFlim( LibraryPtr lib, int index )

ParamText( lef->fName, errStr, vRefNumStr, dirIDStr );

Alert( kAlertOpenFlimErrorID, NULL );
UtilDialog( kDLOGOpenFlimError );
return NULL;
}
return flim;
Expand Down
13 changes: 11 additions & 2 deletions macsrc/MacFlim_Player.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ static Boolean AutoPlayFlims( void )
AppFile theAppFile;
int i;
Ptr savePtr;
Boolean played = FALSE; // Will be TRUE if we played one flim

CountAppFiles(&doWhat,&fileCnt);

// No files, nothing to do
if (fileCnt==0)
return FALSE;

HideCursor();
SaveScreen( &savePtr );

for (;;)
Expand All @@ -71,7 +73,10 @@ static Boolean AutoPlayFlims( void )
// (note: this means that a bad file will abort the looping too)

theResult = PlayFlimFile( theAppFile.fName, theAppFile.vRefNum, kNoDirID, kHFS, FALSE );
if (theResult==kError || theResult==kAbort)
if (theResult==kError || theResult==kFileError || theResult==kScreenError)
continue;
played = TRUE;
if (theResult==kAbort)
goto end;
if (theResult==kRestart)
i = i-1;
Expand All @@ -82,12 +87,16 @@ static Boolean AutoPlayFlims( void )
if (i==-2)
i = fileCnt-2;
}
ClrAppFiles( i+1 );
}

// If we failed at every flim, we abort
if (!played)
break;
}

end:
RestoreScreen( &savePtr );
ShowCursor();

return TRUE;
}
Expand Down
23 changes: 13 additions & 10 deletions macsrc/Notes.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,37 @@
#if 0

TODO:
Loop single flim [DONE]
Create autoplay
Magically set type
Handle 'SELF' flim
PREF for SELF?
VERSION for SELF?


#### Use Command-C during playback to copy the current frame in the Clipboard. You can print it and put it on your wall!



A974 : Button

* Add back the Help
* Play commands (restart/prev/next/etc) in ApplyPlay
* Manage play commands (at least) abort (Button) from VBL
* Mouse selection is a bit off (click on right border of polaroid)
* Check all resource IDs in Resources.h
* Don't add duplicate
* Do not show flim already in the Library in SFPGetFile
* Sort flims
* Drag/drop reorder
* When selected, play should indicates the number of selected flims
* When a single one, play indicates the name
* When a single one, play indicates the name in the Play Menu
* Add a "Restore Default" in preference dialog.
* Changing flim types should not remove auto play
* Select all (and other menus) should not work when Library window not front
* "Cannot open flim" : dialog uncentererd + no mouse

* Empty state for Library

* [DONE] Remove VBL from preferences
* [DONE] Adds for type/creator when opening flim files
* [DONE] Put "Show all flims" into the SFPGetFile dialog itself (remove option trick), or add it in preferences
* [DONE] Poster should use flim filter
* [DONE] Double-clic on library crashes
* [DONE] Select directory of SFPGetFile is wrong
* [DONE] Better handling of keys when multiple windows
* [DONE] "Cannot open flim" : dialog uncentererd + no mouse
* [DONE] Incomprehensible crash if buffers too small
* [DONE] Flim 'A' makes MacFlim crash
* [DONE] Escape deselects all.
Expand Down
82 changes: 56 additions & 26 deletions macsrc/Preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@
// The preference data structure
// -------------------------------------------------------------------

#define kPrefVersion 0x02 // Bumped at every incompatible change of data structure
#define kPrefVersion 0x03 // Bumped at every incompatible change of data structure

typedef struct
{
short version;

Boolean playbackVBL;
Size maxBufferSize;
Boolean showAll;
Boolean setTypeCreator;
Boolean showTipsStartup;
Boolean loop;
char filler0;
Boolean showTips;

char filler1;

Size maxBufferSize;
short nextTipIndex;
short nextTipBtnIndex;
Boolean showTipsStartup;
char filler2;
} PreferenceRecord;

typedef PreferenceRecord *PreferencePtr;
Expand Down Expand Up @@ -117,6 +118,34 @@ Boolean PreferenceGetIsPlaybackVBL( void )

// -------------------------------------------------------------------

Boolean PreferenceGetShowAll( void )
{
return sPreferences->showAll;
}

// -------------------------------------------------------------------

void PreferenceSetShowAll( Boolean b )
{
sPreferences->showAll = b;
}

// -------------------------------------------------------------------

Boolean PreferenceGetSetTypeCreator( void )
{
return sPreferences->setTypeCreator;
}

// -------------------------------------------------------------------

void PreferenceSetSetTypeCreator( Boolean b )
{
sPreferences->setTypeCreator = b;
}

// -------------------------------------------------------------------

Size PreferenceGetMaxBufferSize( void )
{
return sPreferences->maxBufferSize;
Expand Down Expand Up @@ -160,7 +189,7 @@ void PreferenceInit( void )
if (sRefNum==-1)
{
// Creates initial preference file
Create( PREF_FILE, 0, 'FLIM', 'PREF' );
Create( PREF_FILE, 0, 'FLPL', 'PREF' );
CreateResFile( PREF_FILE );
sRefNum = OpenResFile( PREF_FILE );
if (sRefNum!=-1)
Expand Down Expand Up @@ -272,16 +301,6 @@ void PreferencesSetNextTipBtnIndex( short nextTipBtnIndex )
sPreferences->nextTipBtnIndex = nextTipBtnIndex;
}

Boolean PreferencesGetShowTips( void )
{
return sPreferences->showTips;
}

void PreferencesSetShowTips( Boolean showTips )
{
sPreferences->showTips = showTips;
}

Boolean PreferencesGetShowTipsStartup( void )
{
return sPreferences->showTipsStartup;
Expand All @@ -299,7 +318,8 @@ void PreferenceDialog( void )
{
DialogPtr preferences;
short itemHit;
Handle iCheckVBL;
Handle iCheckShowAll;
Handle iCheckSetTypeCreator;
Handle iMaxBufferSize;
short iType;
short iRect;
Expand All @@ -308,28 +328,36 @@ void PreferenceDialog( void )

// Getthe dialog and fill it
preferences = GetNewDialog( kDialogPreferenceID, NULL, (WindowPtr)-1 );
GetDItem( preferences, kPreferenceCheckVBL, &iType, &iCheckVBL, &iRect );
SetCtlValue( iCheckVBL, PreferenceGetIsPlaybackVBL() );
GetDItem( preferences, kPreferenceShowAll, &iType, &iCheckShowAll, &iRect );
SetCtlValue( iCheckShowAll, PreferenceGetShowAll() );
GetDItem( preferences, kPreferenceSetTypeCreator, &iType, &iCheckSetTypeCreator, &iRect );
SetCtlValue( iCheckSetTypeCreator, PreferenceGetSetTypeCreator() );

GetDItem( preferences, kPreferenceMaxBufferSize, &iType, &iMaxBufferSize, &iRect );
if (PreferenceGetMaxBufferSize()!=0)
NumToString( PreferenceGetMaxBufferSize(), iText );
else
iText[0] = 0;
SetIText( iMaxBufferSize, iText );

if (MachineIsMinimal())
HiliteControl( iCheckVBL, 255 );
HiliteControl( iCheckSetTypeCreator, PreferenceGetShowAll()?0:255 );

UtilPlaceWindow( preferences, 0.2 );
ShowWindow( preferences );
DrawDialog( preferences );
do
{
ModalDialog( NULL, &itemHit );
if (itemHit==kPreferenceCheckVBL)
if (itemHit==kPreferenceShowAll)
{
PreferenceSetShowAll( !PreferenceGetShowAll() );
SetCtlValue( iCheckShowAll, PreferenceGetShowAll() );
HiliteControl( iCheckSetTypeCreator, PreferenceGetShowAll()?0:255 );
}
if (itemHit==kPreferenceSetTypeCreator)
{
PreferenceSetIsPlaybackVBL( !PreferenceGetIsPlaybackVBL() );
SetCtlValue( iCheckVBL, PreferenceGetIsPlaybackVBL() );
PreferenceSetSetTypeCreator( !PreferenceGetSetTypeCreator() );
SetCtlValue( iCheckSetTypeCreator, PreferenceGetSetTypeCreator() );
}
} while (itemHit!=kPreferenceButtonOk);

Expand All @@ -340,7 +368,9 @@ void PreferenceDialog( void )
StringToNum( iText, &maxBufferSize );
if (maxBufferSize!=PreferenceGetMaxBufferSize())
{
UtilDialog( kALRTPreferencesRestart );
HideCursor(); // #### Hideous
UtilDialog( kDLOGPreferencesRestart );
ShowCursor();
PreferenceSetMaxBufferSize( maxBufferSize );
}
}
Expand Down
16 changes: 14 additions & 2 deletions macsrc/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ void PreferenceSetIsPlaybackVBL( Boolean b );
Boolean PreferenceGetLoop( void );
void PreferenceSetLoop( Boolean b );

// -------------------------------------------------------------------
// Show all flims in SFPGetFile
// -------------------------------------------------------------------

Boolean PreferenceGetShowAll( void );
void PreferenceSetShowAll( Boolean b );

// -------------------------------------------------------------------
// Set type/creator on open
// -------------------------------------------------------------------

Boolean PreferenceGetSetTypeCreator( void );
void PreferenceSetSetTypeCreator( Boolean b );

// -------------------------------------------------------------------
// Size of buffers (0 if no size set). Can be used from mini player
// -------------------------------------------------------------------
Expand All @@ -48,8 +62,6 @@ short PreferencesGetNextTipIndex( void );
void PreferencesSetNextTipIndex( short nextTipIndex );
short PreferencesGetNextTipBtnIndex( void );
void PreferencesSetNextTipBtnIndex( short nextTipBtnIndex );
Boolean PreferencesGetShowTips( void );
void PreferencesSetShowTips( Boolean showTips );
Boolean PreferencesGetShowTipsStartup( void );
void PreferencesSetShowTipsStartup( Boolean showTipsStartup );

Expand Down
14 changes: 7 additions & 7 deletions macsrc/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ enum { kMenuItemAddFlimID = 1,
// ALRT
// -------------------------------------------------------------------

#define kAlertOpenFlimErrorID 137
#define kALRTErrorNonFatal 140
#define kALRTErrorNoBWScreen 142 // No BW screen present
#define kALRTPreferencesRestart 143 // Need to restart to apply prefs

// -------------------------------------------------------------------
// Dialogs
Expand All @@ -74,11 +72,15 @@ enum { kMenuItemAddFlimID = 1,

#define kDialogPreferenceID 135
#define kPreferenceButtonOk 1
#define kPreferenceCheckVBL 2
#define kPreferenceMaxBufferSize 3
#define kPreferenceShowAll 2
#define kPreferenceSetTypeCreator 3
#define kPreferenceMaxBufferSize 4

#define kDLOGFatal 136

#define kDLOGOpenFlimError 137

#define kDLOGPreferencesRestart 143
#define kDLOGProgress 144

// -------------------------------------------------------------------
Expand Down Expand Up @@ -109,10 +111,8 @@ enum { kMenuItemAddFlimID = 1,
// -------------------------------------------------------------------

#define kSFAddFlimDialogID 2000
#define kSFAddFlimHelpTextID 11

#define kSFAddFolderDialogID 2001
#define kSFAddFolderHelpTextID 11
#define kSFAddFolderChooseDirectoryID 12
#define kSFAddFolderChooseDirectoryID 11

#endif
2 changes: 1 addition & 1 deletion macsrc/Self_Player.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Boolean SelfInstallPlayer( Str255 fName, short vRefNum, short dirID )

HUnlock( sCopyHdl );

UtilSetFileTypeCreator( fName, vRefNum, dirID, 'APPL', 'AFLM' );
UtilSetFileTypeCreator( fName, vRefNum, dirID, 'APPL', 'MMFL' );

done1:
CloseResFile( dest );
Expand Down
Loading

0 comments on commit 447b66f

Please sign in to comment.