"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "f.albums.cc" between
fotoxx-23.0.tar.gz and fotoxx-23.1.tar.gz

About: fotoxx is a program for photo editing and collection management.

f.albums.cc  (fotoxx-23.0):f.albums.cc  (fotoxx-23.1)
/******************************************************************************* * /******************************************************************************* *
Fotoxx edit photos and manage collections Fotoxx - edit photos and manage collections
Copyright 2007-2023 Michael Cornelison Copyright 2007-2023 Michael Cornelison
source code URL: https://kornelix.net source code URL: https://kornelix.net
contact: mkornelix@gmail.com contact: mkornelix@gmail.com
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. See https://www.gnu.org/licenses (at your option) any later version. See https://www.gnu.org/licenses
skipping to change at line 59 skipping to change at line 59
#define EX extern // disable extern declarations #define EX extern // disable extern declarations
#include "fotoxx.h" // (variables in fotoxx.h are refs) #include "fotoxx.h" // (variables in fotoxx.h are refs)
/******************************************************************************* */ /******************************************************************************* */
// Manage Albums - create, view, edit named albums of image files // Manage Albums - create, view, edit named albums of image files
// albums created by search and report functions - omit from album update funct ions // albums created by search and report functions - omit from album update funct ions
int NXalbums = 6; int NXalbums = 7;
cchar *Xalbums[6] = { "/selected_files", "/search_results", "/screen_results" cch *Xalbums[7] = { "/current_set", "/duplicate_images", "/gallery_screen",
, "/places_dates", "/search_results", "/selected_files",
"/places_dates", "/timeline", "/duplicate_images" }; "/timeline" };
/******************************************************************************* */ /******************************************************************************* */
// menu function // menu function
void m_manage_albums(GtkWidget *, cchar *) void m_manage_albums(GtkWidget *, ch *)
{ {
int manage_albums_dialog_event(zdialog *zd, cchar *event); // manage albumd dialog event func int manage_albums_dialog_event(zdialog *zd, ch *event); // manage albumd dialog event func
cchar *helptext1 = "Right-click album thumbnail for edits: \n" ch *helptext1 = "Right-click album thumbnail for edits: \n"
" - add selected files at this position \n" " - add selected files at this position \n"
" - remove this file from the album"; " - remove this file from the album";
cchar *helptext2 = "Arrange files with thumbnail drag and drop"; ch *helptext2 = "Arrange files with thumbnail drag and drop";
F1_help_topic = "manage albums"; F1_help_topic = "manage albums";
if (FGWM != 'F' && FGWM != 'G') return; if (FGWM != 'F' && FGWM != 'G') return;
if (Fblock("manage_albums","block edits")) return; // check pending, block if (Fblock("manage_albums","block edits")) return; // check pending, block
/*** /***
_______________________________________________ _______________________________________________
| | | |
| Manage Albums | | Manage Albums |
skipping to change at line 134 skipping to change at line 135
zdialog_add_widget(zd,"label","labhelp1","hbhelp1",helptext1,"space=5"); zdialog_add_widget(zd,"label","labhelp1","hbhelp1",helptext1,"space=5");
zdialog_add_widget(zd,"hbox","hbhelp2","dialog",0,"space=5"); zdialog_add_widget(zd,"hbox","hbhelp2","dialog",0,"space=5");
zdialog_add_widget(zd,"label","labhelp2","hbhelp2",helptext2,"space=5"); zdialog_add_widget(zd,"label","labhelp2","hbhelp2",helptext2,"space=5");
zdialog_run(zd,manage_albums_dialog_event,"save"); // run dialog zdialog_run(zd,manage_albums_dialog_event,"save"); // run dialog
return; return;
} }
// manage albums dialog event and completion function // manage albums dialog event and completion function
int manage_albums_dialog_event(zdialog *zd, cchar *event) int manage_albums_dialog_event(zdialog *zd, ch *event)
{ {
void album_create(); void album_create();
void album_rename(); void album_rename();
void album_delete(); void album_delete();
char mess[200], albumname[ANCC], *pp; ch mess[200], albumname[ANCC], *pp;
if (strmatch(event,"escape")) zd->zstat = -2; // escape key if (strmatch(event,"escape")) zd->zstat = -2; // escape key
if (zd->zstat) // [ OK ] or [x] if (zd->zstat) // [ OK ] or [x]
{ {
zdialog_free(zd); zdialog_free(zd);
Fblock("manage_albums",0); Fblock("manage_albums",0);
return 1; return 1;
} }
skipping to change at line 201 skipping to change at line 202
return 1; return 1;
} }
/******************************************************************************* */ /******************************************************************************* */
// create a new album // create a new album
void album_create() void album_create()
{ {
int album_create_dialog_event(zdialog *zd, cchar *event); int album_create_dialog_event(zdialog *zd, ch *event);
char **flist; ch **flist;
int NF; int NF;
char patt[200]; ch patt[200];
snprintf(patt,200,"%s/*",albums_folder); // get current album count snprintf(patt,200,"%s/*",albums_folder); // get current album count
zfind(patt,flist,NF); zfind(patt,flist,NF);
for (int ii = 0; ii < NF; ii++) for (int ii = 0; ii < NF; ii++)
zfree(flist[ii]); zfree(flist[ii]);
zfree(flist); zfree(flist);
if (NF >= maxalbums) { // cannot create more if (NF >= maxalbums) { // cannot create more
zmessageACK(Mwin,"max. album count exceeded: %d",maxalbums); zmessageACK(Mwin,"max. album count exceeded: %d",maxalbums);
skipping to change at line 260 skipping to change at line 261
zdialog_stuff(zd,"select",0); zdialog_stuff(zd,"select",0);
zdialog_run(zd,album_create_dialog_event,"parent"); zdialog_run(zd,album_create_dialog_event,"parent");
zdialog_wait(zd); zdialog_wait(zd);
zdialog_free(zd); zdialog_free(zd);
return; return;
} }
// dialog event and completion function // dialog event and completion function
int album_create_dialog_event(zdialog *zd, cchar *event) int album_create_dialog_event(zdialog *zd, ch *event)
{ {
int Fempty, Fselected, Fgallery, Fselect; int Fempty, Fselected, Fgallery, Fselect;
int yn; int yn;
char albumname[ANCC], newalbumfile[AFCC]; ch albumname[ANCC], newalbumfile[AFCC];
char *cfile, *pp; ch *cfile, *pp;
FILE *fid; FILE *fid;
if (strmatch(event,"escape")) zd->zstat = -2; // escape key if (strmatch(event,"escape")) zd->zstat = -2; // escape key
if (strmatch(event,"browse")) if (strmatch(event,"browse"))
{ {
cfile = zgetfile("Album Name",MWIN,"file",albums_folder); // choose file name cfile = zgetfile("Album Name",MWIN,"file",albums_folder); // choose file name
if (! cfile) return 1; if (! cfile) return 1;
pp = strrchr(cfile,'/'); pp = strrchr(cfile,'/');
if (! pp) return 1; if (! pp) return 1;
skipping to change at line 335 skipping to change at line 336
} }
album_show(); album_show();
zmessage_post_bold(Mwin,"20/20",3,"new album created"); zmessage_post_bold(Mwin,"20/20",3,"new album created");
return 1; return 1;
} }
// make an album from the current gallery // make an album from the current gallery
// return 0 = OK, +N = error // return 0 = OK, +N = error
int album_create_from_gallery(cchar *newalbumfile) int album_create_from_gallery(ch *newalbumfile)
{ {
char *pp; ch *pp;
int Nth; int Nth;
FILE *fid; FILE *fid;
FTYPE ftype; FTYPE ftype;
if (navi::Gimages == 0) { if (navi::Gimages == 0) {
zmessageACK(Mwin,"gallery is empty"); zmessageACK(Mwin,"gallery is empty");
return 1; return 1;
} }
if (navi::Gfiles > maxalbumfiles) { if (navi::Gfiles > maxalbumfiles) {
skipping to change at line 360 skipping to change at line 361
} }
fid = fopen(newalbumfile,"w"); // open/write album file fid = fopen(newalbumfile,"w"); // open/write album file
if (! fid) { if (! fid) {
zmessageACK(Mwin,strerror(errno)); zmessageACK(Mwin,strerror(errno));
return 1; return 1;
} }
for (Nth = 0; Nth < navi::Gfiles; Nth++) // add gallery images to album file for (Nth = 0; Nth < navi::Gfiles; Nth++) // add gallery images to album file
{ {
pp = gallery(0,"get",Nth); pp = gallery(0,"getR",Nth); // 23.1
if (! pp) break; if (! pp) break;
ftype = image_file_type(pp); // must be image type file ftype = image_file_type(pp); // must be image type file
if (ftype != IMAGE && ftype != RAW && ftype != VIDEO) { if (ftype != IMAGE && ftype != RAW && ftype != VIDEO) continue;
zfree(pp);
continue;
}
fprintf(fid,"%s\n",pp); fprintf(fid,"%s\n",pp);
zfree(pp);
} }
fclose(fid); fclose(fid);
return 0; return 0;
} }
/******************************************************************************* */ /******************************************************************************* */
// rename an album // rename an album
void album_rename() void album_rename()
{ {
cchar *renalbum = "Rename an album"; ch *renalbum = "Rename an album";
char *cfile, *dfile, *cpp, *dpp; ch *cfile, *dfile, *cpp, *dpp;
int err; int err;
cfile = zgetfile(renalbum,MWIN,"file",albums_folder); // choose album file cfile = zgetfile(renalbum,MWIN,"file",albums_folder); // choose album file
if (! cfile) return; if (! cfile) return;
cpp = strrchr(cfile,'/'); cpp = strrchr(cfile,'/');
if (! cpp) { // should not happen if (! cpp) { // should not happen
Plog(0,"invalid file: %s \n",cfile); Plog(0,"invalid file: %s \n",cfile);
zfree(cfile); zfree(cfile);
return; return;
} }
skipping to change at line 448 skipping to change at line 445
return; return;
} }
/******************************************************************************* */ /******************************************************************************* */
// delete an album // delete an album
void album_delete() void album_delete()
{ {
cchar *delalbum = "Delete an album"; ch *delalbum = "Delete an album";
char *afile, *pp; ch *afile, *pp;
afile = zgetfile(delalbum,MWIN,"file",albums_folder); // choose album file afile = zgetfile(delalbum,MWIN,"file",albums_folder); // choose album file
if (! afile) return; if (! afile) return;
pp = strrchr(afile,'/'); pp = strrchr(afile,'/');
if (! pp) return; // should not happen if (! pp) return; // should not happen
int yn = zmessageYN(Mwin,"delete %s ?",pp+1); int yn = zmessageYN(Mwin,"delete %s ?",pp+1);
if (! yn) { if (! yn) {
zfree(afile); zfree(afile);
return; return;
skipping to change at line 482 skipping to change at line 479
zfree(afile); zfree(afile);
return; return;
} }
/******************************************************************************* */ /******************************************************************************* */
// initz. gallery from current album, show gallery // initz. gallery from current album, show gallery
// if albumfile is null, show current album // if albumfile is null, show current album
// if not null, set current album from albumfile // if not null, set current album from albumfile
void album_show(cchar *albumfile) void album_show(ch *albumfile)
{ {
zlist_t *ZLfiles; zlist_t *ZLfiles;
int ii, Nf; int ii, Nf;
char *afile; ch *afile;
if (! albumfile && ! curr_album) return; if (! albumfile && ! curr_album) return;
if (! albumfile) albumfile = curr_album; if (! albumfile) albumfile = curr_album;
zstrcopy(curr_album,albumfile,"albums"); zstrcopy(curr_album,albumfile,"albums");
ZLfiles = zlist_from_file(albumfile); // get image files in album ZLfiles = zlist_from_file(albumfile); // get image files in album
if (! ZLfiles) return; if (! ZLfiles) return;
Nf = zlist_count(ZLfiles); Nf = zlist_count(ZLfiles);
skipping to change at line 532 skipping to change at line 529
/******************************************************************************* */ /******************************************************************************* */
// insert selected files into album at designated position // insert selected files into album at designated position
// mode: 1 = add at position 0 // mode: 1 = add at position 0
// 2 = use clicked_posn and clicked_width // 2 = use clicked_posn and clicked_width
void album_add_selfiles(int mode) // use zlist funcs void album_add_selfiles(int mode) // use zlist funcs
{ {
zlist_t *ZLalbum, *ZLfiles, *ZLtemp; zlist_t *ZLalbum, *ZLfiles, *ZLtemp;
char selfiles[AFCC]; ch selfiles[AFCC];
int posn; int posn;
if (! curr_album) return; if (! curr_album) return;
if (mode == 1) posn = 0; // insert at album start if (mode == 1) posn = 0; // insert at album start
else if (mode == 2) { else if (mode == 2) {
posn = clicked_posn; // insert at clicked thumb position posn = clicked_posn; // insert at clicked thumb position
if (clicked_width > 50) posn++; // right side of thumbnail clicked if (clicked_width > 50) posn++; // right side of thumbnail clicked
} }
else return; else return;
skipping to change at line 598 skipping to change at line 595
zlist_delete(ZLalbum); zlist_delete(ZLalbum);
album_show(); // (will alarm maxalbumfiles) album_show(); // (will alarm maxalbumfiles)
return; return;
} }
/******************************************************************************* */ /******************************************************************************* */
// insert single file into album at position (drag/drop from gallery window) // insert single file into album at position (drag/drop from gallery window)
void album_add_file(cchar *file, int posn) // use zlist void album_add_file(ch *file, int posn) // use zlist
{ {
zlist_t *ZLalbum; zlist_t *ZLalbum;
if (! curr_album) return; if (! curr_album) return;
ZLalbum = zlist_from_file(curr_album); ZLalbum = zlist_from_file(curr_album);
if (! ZLalbum) return; if (! ZLalbum) return;
zlist_insert(ZLalbum,file,posn); zlist_insert(ZLalbum,file,posn);
zlist_to_file(ZLalbum,curr_album); zlist_to_file(ZLalbum,curr_album);
skipping to change at line 643 skipping to change at line 640
return; return;
} }
/******************************************************************************* */ /******************************************************************************* */
// move an album file from pos1 to pos2 (for drag and drop) // move an album file from pos1 to pos2 (for drag and drop)
void album_move_file(int pos1, int pos2) // use zlist void album_move_file(int pos1, int pos2) // use zlist
{ {
zlist_t *ZLalbum; zlist_t *ZLalbum;
char *file; ch *file;
if (! curr_album) return; if (! curr_album) return;
if (pos1 == pos2) return; if (pos1 == pos2) return;
ZLalbum = zlist_from_file(curr_album); ZLalbum = zlist_from_file(curr_album);
if (! ZLalbum) return; if (! ZLalbum) return;
file = zstrdup(zlist_get(ZLalbum,pos1),"albums"); file = zstrdup(zlist_get(ZLalbum,pos1),"albums");
zlist_remove(ZLalbum,pos1); zlist_remove(ZLalbum,pos1);
skipping to change at line 670 skipping to change at line 667
album_show(); album_show();
return; return;
} }
/******************************************************************************* */ /******************************************************************************* */
// Replace file names in all albums after a folder rename. // Replace file names in all albums after a folder rename.
// Input args are the old and new folder full path names. // Input args are the old and new folder full path names.
void album_folder_rename(cchar *oldname, cchar *newname) // 22.15 void album_folder_rename(ch *oldname, ch *newname) // 22.15
{ {
int ii, jj, Fchange, Nalbums = 0; int ii, jj, Fchange, Nalbums = 0;
char findcomm[300]; ch findcomm[300];
char *pp, **albumfiles = 0; ch *pp, **albumfiles = 0;
int oldcc, newcc; int oldcc, newcc;
char newfile[XFCC]; ch newfile[XFCC];
zlist_t *ZL1, *ZL2; zlist_t *ZL1, *ZL2;
Plog(1,"album folder rename \n"); Plog(1,"album folder rename \n");
oldcc = strlen(oldname); oldcc = strlen(oldname);
newcc = strlen(newname); newcc = strlen(newname);
strncpy0(newfile,newname,newcc); strncpy0(newfile,newname,newcc);
snprintf(findcomm,300,"%s/*",albums_folder); // find all albums (files) snprintf(findcomm,300,"%s/*",albums_folder); // find all albums (files)
zfind(findcomm,albumfiles,Nalbums); zfind(findcomm,albumfiles,Nalbums);
skipping to change at line 730 skipping to change at line 727
zfree(albumfiles); zfree(albumfiles);
return; return;
} }
/******************************************************************************* */ /******************************************************************************* */
// Purge missing album files, delete and optionally replace target files. // Purge missing album files, delete and optionally replace target files.
// 'album' is an album name or "ALL" to process all albums. // 'album' is an album name or "ALL" to process all albums.
void album_purge_replace(cchar *album, int Nt, char **targfile, char **repfile) void album_purge_replace(ch *album, int Nt, ch **targfile, ch **repfile)
{ {
char findcomm[300], *pp; ch findcomm[300], *pp;
char **albfiles, *afile; ch **albfiles, *afile;
int ii, jj, kk; int ii, jj, kk;
int Na, Nf; int Na, Nf;
zlist_t *ZLfiles; zlist_t *ZLfiles;
Plog(1,"update album %s \n",album); Plog(1,"update album %s \n",album);
for (ii = 0; ii < Nt; ii++) for (ii = 0; ii < Nt; ii++)
{ {
if (repfile) if (repfile)
Plog(1," replace: %s \n with: %s \n",targfile[ii], repfile[ii]); Plog(1," replace: %s \n with: %s \n",targfile[ii], repfile[ii]);
else if (targfile) else if (targfile)
Plog(1," delete: %s \n",targfile[ii]); Plog(1," delete: %s \n",targfile[ii]);
} }
if (strmatch(album,"ALL")) { if (strmatch(album,"ALL")) {
snprintf(findcomm,300,"%s/*",albums_folder); // find all albums (files) snprintf(findcomm,300,"%s/*",albums_folder); // find all albums (files)
zfind(findcomm,albfiles,Na); zfind(findcomm,albfiles,Na);
} }
else { else {
albfiles = (char **) zmalloc(sizeof(char *),"albums"); // single album albfiles = (ch **) zmalloc(sizeof(ch *),"albums"); // single album
albfiles[0] = zstrdup(album,"albums"); albfiles[0] = zstrdup(album,"albums");
Na = 1; Na = 1;
} }
for (ii = 0; ii < Na; ii++) // loop albums for (ii = 0; ii < Na; ii++) // loop albums
{ {
pp = strrchr(albfiles[ii],'/'); // /album_name pp = strrchr(albfiles[ii],'/'); // /album_name
if (! pp) continue; if (! pp) continue;
for (jj = 0; jj < NXalbums; jj++) // if excluded album, skip it for (jj = 0; jj < NXalbums; jj++) // if excluded album, skip it
if (strmatch(pp,Xalbums[jj])) break; if (strmatch(pp,Xalbums[jj])) break;
skipping to change at line 805 skipping to change at line 802
zfree(albfiles); zfree(albfiles);
if (curr_album && strmatch(navi::galleryname,curr_album)) if (curr_album && strmatch(navi::galleryname,curr_album))
album_show(); album_show();
return; return;
} }
// version for a single file and optional replacement // version for a single file and optional replacement
void album_purge_replace(cchar *album, char *targfile, char *repfile) void album_purge_replace(ch *album, ch *targfile, ch *repfile)
{ {
char **tfile = 0, **rfile = 0; ch **tfile = 0, **rfile = 0;
if (targfile) tfile = &targfile; if (targfile) tfile = &targfile;
if (repfile) rfile = &repfile; if (repfile) rfile = &repfile;
album_purge_replace(album, 1, tfile, rfile); album_purge_replace(album, 1, tfile, rfile);
return; return;
} }
/******************************************************************************* */ /******************************************************************************* */
// Replace an old file with a designated new file in selected albums, // Replace an old file with a designated new file in selected albums,
// or add the new file after the old file. // or add the new file after the old file.
namespace update_albums_names namespace update_albums_names
{ {
char **albumfiles = 0; ch **albumfiles = 0;
char oldfile[XFCC], newfile[XFCC]; ch oldfile[XFCC], newfile[XFCC];
// albums and replace option kept // albums and replace option kept
int Nalbums = 0; // to initialize next run int Nalbums = 0; // to initialize next run
int Freplace = 1; int Freplace = 1;
cchar *selectformat = "%d albums selected"; ch *selectformat = "%d albums selected";
char selectmess[60]; ch selectmess[60];
}; };
// menu function // menu function
void m_update_albums(GtkWidget *, cchar *) void m_update_albums(GtkWidget *, ch *)
{ {
using namespace update_albums_names; using namespace update_albums_names;
int update_albums_dialog_event(zdialog *zd, cchar *event); int update_albums_dialog_event(zdialog *zd, ch *event);
zdialog *zd; zdialog *zd;
int ii, jj, kk, zstat, Fchange; int ii, jj, kk, zstat, Fchange;
char *pp; ch *pp;
zlist_t *ZL1, *ZL2; zlist_t *ZL1, *ZL2;
F1_help_topic = "update albums"; F1_help_topic = "update albums";
if (FGWM != 'F' && FGWM != 'G') return; if (FGWM != 'F' && FGWM != 'G') return;
if (Fblock("update_albums","block edits")) return; // check pending, block if (Fblock("update_albums","block edits")) return; // check pending, block
/*** /***
__________________________________________________ __________________________________________________
| Replace Album File | | Replace Album File |
skipping to change at line 976 skipping to change at line 973
m_update_albums(0,0); // repeat until canceled m_update_albums(0,0); // repeat until canceled
return; return;
returnx: returnx:
Fblock("update_albums",0); Fblock("update_albums",0);
return; return;
} }
// dialog event and completion callback function // dialog event and completion callback function
int update_albums_dialog_event(zdialog *zd, cchar *event) int update_albums_dialog_event(zdialog *zd, ch *event)
{ {
using namespace update_albums_names; using namespace update_albums_names;
char **pp; ch **pp;
int ii,cc; int ii,cc;
char findcomm[300]; ch findcomm[300];
if (strmatch(event,"escape")) zd->zstat = -2; // escape key if (strmatch(event,"escape")) zd->zstat = -2; // escape key
if (zd->zstat < 0) { if (zd->zstat < 0) {
zd_album_update = 0; // escape or [x] 22.1 zd_album_update = 0; // escape or [x] 22.1
return 1; return 1;
} }
if (zd->zstat == 1) { // [clear] if (zd->zstat == 1) { // [clear]
zd->zstat = 0; // keep dialog active zd->zstat = 0; // keep dialog active
skipping to change at line 1009 skipping to change at line 1006
{ {
for (ii = 0; ii < Nalbums; ii++) // free prior album names, if any for (ii = 0; ii < Nalbums; ii++) // free prior album names, if any
zfree(albumfiles[ii]); zfree(albumfiles[ii]);
if (albumfiles) zfree(albumfiles); if (albumfiles) zfree(albumfiles);
albumfiles = 0; albumfiles = 0;
Nalbums = 0; Nalbums = 0;
pp = zgetfiles("Choose Albums",MWIN,"files",albums_folder); // choose album files pp = zgetfiles("Choose Albums",MWIN,"files",albums_folder); // choose album files
if (pp) if (pp)
{ {
cc = maxalbums * sizeof(char *); cc = maxalbums * sizeof(ch *);
albumfiles = (char **) zmalloc(cc,"albums"); albumfiles = (ch **) zmalloc(cc,"albums");
for (ii = 0; ii < maxalbums && pp[ii]; ii++) for (ii = 0; ii < maxalbums && pp[ii]; ii++)
albumfiles[ii] = pp[ii]; albumfiles[ii] = pp[ii];
Nalbums = ii; // album count selected Nalbums = ii; // album count selected
zfree(pp); zfree(pp);
} }
snprintf(selectmess,60,selectformat,Nalbums); // update dialog album count snprintf(selectmess,60,selectformat,Nalbums); // update dialog album count
zdialog_stuff(zd,"labselect",selectmess); zdialog_stuff(zd,"labselect",selectmess);
} }
skipping to change at line 1045 skipping to change at line 1042
return 1; return 1;
} }
// mouse click function // mouse click function
void update_albums_Lclick_func(int Nth) void update_albums_Lclick_func(int Nth)
{ {
using namespace update_albums_names; using namespace update_albums_names;
char *imagefile = 0; ch *imagefile = 0;
char filename[100]; ch filename[100];
int ftype; int ftype;
zdialog *zd = zd_album_update; zdialog *zd = zd_album_update;
if (! zd) return; // should not happen if (! zd) return; // should not happen
if (Nth < 0) return; if (Nth < 0) return;
imagefile = gallery(0,"get",Nth); // get file at clicked position imagefile = gallery(0,"getR",Nth); // get file at clicked position 23.1
if (! imagefile) return; if (! imagefile) return;
ftype = image_file_type(imagefile); // must be image or RAW file ftype = image_file_type(imagefile); // must be image or RAW file
if (ftype != IMAGE && ftype != RAW && ftype != VIDEO) { if (ftype != IMAGE && ftype != RAW && ftype != VIDEO) return;
zfree(imagefile);
return;
}
zdialog_fetch(zd,"oldfile",filename,100); // stuff oldfile or newfile zdialog_fetch(zd,"oldfile",filename,100); // stuff oldfile or newfile
if (filename[0] <= ' ') zdialog_stuff(zd,"oldfile",imagefile); // if currently blank if (filename[0] <= ' ') zdialog_stuff(zd,"oldfile",imagefile); // if currently blank
else { else {
zdialog_fetch(zd,"newfile",filename,100); zdialog_fetch(zd,"newfile",filename,100);
if (filename[0] <= ' ') zdialog_stuff(zd,"newfile",imagefile); if (filename[0] <= ' ') zdialog_stuff(zd,"newfile",imagefile);
} }
zfree(imagefile);
return; return;
} }
/******************************************************************************* */ /******************************************************************************* */
// make current gallery into an album with chosen or given name // make current gallery into an album with chosen or given name
void m_gallery2album(GtkWidget *, cchar *) void m_gallery2album(GtkWidget *, ch *)
{ {
int gallery_album_dialog_event(zdialog *zd, cchar *event); int gallery_album_dialog_event(zdialog *zd, ch *event);
char albumname[ANCC], albumfile[AFCC]; ch albumname[ANCC], albumfile[AFCC];
int yn, zstat; int yn, zstat;
/*** /***
_________________________________________ _________________________________________
| Save Gallery as Album | | Save Gallery as Album |
| | | |
| Album Name [_________________] [Browse] | | Album Name [_________________] [Browse] |
| | | |
| [ OK ] | | [ OK ] |
|_________________________________________| |_________________________________________|
skipping to change at line 1131 skipping to change at line 1124
} }
album_create_from_gallery(albumfile); // create album album_create_from_gallery(albumfile); // create album
album_show(albumfile); album_show(albumfile);
return; return;
} }
// dialog event and completion function // dialog event and completion function
int gallery_album_dialog_event(zdialog *zd, cchar *event) int gallery_album_dialog_event(zdialog *zd, ch *event)
{ {
char *cfile, *pp, albumname[ANCC]; ch *cfile, *pp, albumname[ANCC];
if (strmatch(event,"escape")) zd->zstat = -2; // escape key if (strmatch(event,"escape")) zd->zstat = -2; // escape key
if (strmatch(event,"browse")) if (strmatch(event,"browse"))
{ {
cfile = zgetfile("Album Name",MWIN,"file",albums_folder); // choose file name cfile = zgetfile("Album Name",MWIN,"file",albums_folder); // choose file name
if (! cfile) return 1; if (! cfile) return 1;
pp = strrchr(cfile,'/'); pp = strrchr(cfile,'/');
if (! pp) return 1; if (! pp) return 1;
zdialog_stuff(zd,"albumname",pp+1); zdialog_stuff(zd,"albumname",pp+1);
skipping to change at line 1165 skipping to change at line 1158
return 1; return 1;
} }
/******************************************************************************* */ /******************************************************************************* */
// mass update of album files // mass update of album files
namespace album_mass_update_names namespace album_mass_update_names
{ {
cchar *selectformat = "%d albums selected"; ch *selectformat = "%d albums selected";
char selectmess[60]; ch selectmess[60];
char massoption = 0; ch massoption = 0;
char *albumfiles[maxalbums]; ch *albumfiles[maxalbums];
// albums to process // albums to process
zlist_t *ZLoldfs, *ZLnewfs; // old and new album files list zlist_t *ZLoldfs, *ZLnewfs; // old and new album files list
int Nalbums = 0, Nold, Nnew; // corresp. counts int Nalbums = 0, Nold, Nnew; // corresp. counts
zdialog *zdreport = 0; zdialog *zdpop = 0;
} }
// menu function // menu function
void m_album_mass_update(GtkWidget *, cchar *) void m_album_mass_update(GtkWidget *, ch *)
{ {
using namespace album_mass_update_names; using namespace album_mass_update_names;
int album_mass_update_dialog_event(zdialog *zd, cchar *event); int album_mass_update_dialog_event(zdialog *zd, ch *event);
void album_mass_update_process(cchar *albumname); void album_mass_update_process(ch *albumname);
int ii, jj; int ii, jj;
cchar *albumname; ch *albumname;
F1_help_topic = "album mass update"; F1_help_topic = "album mass update";
if (FGWM != 'F' && FGWM != 'G') return; if (FGWM != 'F' && FGWM != 'G') return;
if (Fblock("album_mass_update","block edits")) return; // check pending, block if (Fblock("album_mass_update","block edits")) return; // check pending, block
Plog(1,"m_album_mass_update \n"); Plog(1,"m_album_mass_update \n");
/*** /***
______________________________________________________ ______________________________________________________
skipping to change at line 1219 skipping to change at line 1212
| (o) Add selected versions to existing versions | | (o) Add selected versions to existing versions |
| (o) Replace all with original + selected versions | | (o) Replace all with original + selected versions |
| | | |
| [proceed] [cancel] | | [proceed] [cancel] |
|______________________________________________________| |______________________________________________________|
***/ ***/
massoption = 0; massoption = 0;
Nalbums = 0; Nalbums = 0;
zdreport = 0; zdpop = 0;
zdialog *zd = zdialog_new("Album Mass Update",Mwin,"Proceed","Cancel",0); zdialog *zd = zdialog_new("Album Mass Update",Mwin,"Proceed","Cancel",0);
zdialog_add_widget(zd,"hbox","hbselect","dialog",0,"space=5"); zdialog_add_widget(zd,"hbox","hbselect","dialog",0,"space=5");
zdialog_add_widget(zd,"button","select","hbselect","Select","space=3"); zdialog_add_widget(zd,"button","select","hbselect","Select","space=3");
zdialog_add_widget(zd,"label","labselect","hbselect","0 albums selected","spa ce=5"); zdialog_add_widget(zd,"label","labselect","hbselect","0 albums selected","spa ce=5");
zdialog_add_widget(zd,"vbox","space","dialog",0,"space=5"); zdialog_add_widget(zd,"vbox","space","dialog",0,"space=5");
zdialog_add_widget(zd,"hbox","hball","dialog"); zdialog_add_widget(zd,"hbox","hball","dialog");
zdialog_add_widget(zd,"label","laball","hball","Process all album files:","sp ace=3"); zdialog_add_widget(zd,"label","laball","hball","Process all album files:","sp ace=3");
skipping to change at line 1259 skipping to change at line 1252
zdialog_add_widget(zd,"check","optN","hbN","Replace all versions with selecte d versions","space=12"); zdialog_add_widget(zd,"check","optN","hbN","Replace all versions with selecte d versions","space=12");
zdialog_add_widget(zd,"hbox","hbO","vb2"); zdialog_add_widget(zd,"hbox","hbO","vb2");
zdialog_add_widget(zd,"check","optO","hbO","Add selected versions to existing versions","space=12"); zdialog_add_widget(zd,"check","optO","hbO","Add selected versions to existing versions","space=12");
zdialog_add_widget(zd,"hbox","hbP","vb2"); zdialog_add_widget(zd,"hbox","hbP","vb2");
zdialog_add_widget(zd,"check","optP","hbP","Replace all with original + selec ted versions","space=12"); zdialog_add_widget(zd,"check","optP","hbP","Replace all with original + selec ted versions","space=12");
zdialog_run(zd,album_mass_update_dialog_event,"parent"); // run dialog zdialog_run(zd,album_mass_update_dialog_event,"parent"); // run dialog
zdialog_wait(zd); // wait for completion zdialog_wait(zd); // wait for completion
if (! Nalbums || ! massoption) goto returnx; // canceled if (! Nalbums || ! massoption) goto returnx; // canceled
if (zdreport) zdialog_free(zdreport); if (zdpop) zdialog_free(zdpop);
// open log report 22.1 // open log report 22.1
zdreport = popup_report_open("album mass update",Mwin,800,600,0,0, zdpop = popup_report_open("album mass update",Mwin,
"Save","OK",0); 800,600,0,0,"Save","OK",0);
// 22.15
for (ii = 0; ii < Nalbums; ii++) // loop selected albums for (ii = 0; ii < Nalbums; ii++) // loop selected albums
{ {
if (! zdialog_valid(zdpop)) break;
// report canceled 23.1
albumname = strrchr(albumfiles[ii],'/'); // /album_name albumname = strrchr(albumfiles[ii],'/'); // /album_name
if (! albumname) continue; if (! albumname) continue;
for (jj = 0; jj < NXalbums; jj++) // if excluded album, skip it for (jj = 0; jj < NXalbums; jj++) // if excluded album, skip it
if (strmatch(albumname,Xalbums[jj])) break; if (strmatch(albumname,Xalbums[jj])) break;
if (jj < NXalbums) continue; if (jj < NXalbums) continue;
ZLoldfs = zlist_from_file(albumfiles[ii]); // album file list ZLoldfs = zlist_from_file(albumfiles[ii]); // album file list
if (! ZLoldfs) continue; if (! ZLoldfs) continue;
Nold = zlist_count(ZLoldfs); Nold = zlist_count(ZLoldfs);
ZLnewfs = zlist_new(maxalbumfiles); // container, new file list ZLnewfs = zlist_new(maxalbumfiles); // container, new file list
album_mass_update_process(albumname); // ZLoldfs --> ZLnewfs album_mass_update_process(albumname); // ZLoldfs --> ZLnewfs
zlist_to_file(ZLnewfs,albumfiles[ii]); // replace album file zlist_to_file(ZLnewfs,albumfiles[ii]); // replace album file
zlist_delete(ZLoldfs); // free memory zlist_delete(ZLoldfs); // free memory
zlist_delete(ZLnewfs); zlist_delete(ZLnewfs);
} }
if (! zdialog_valid(zdpop))
// 23.1
Plog(0,"*** report cancelled \n");
album_show(albumfiles[0]); // show first album processed album_show(albumfiles[0]); // show first album processed
for (ii = 0; ii < Nalbums; ii++) // free memory for (ii = 0; ii < Nalbums; ii++) // free memory
zfree(albumfiles[ii]); zfree(albumfiles[ii]);
returnx: returnx:
Fblock("album_mass_update",0); Fblock("album_mass_update",0);
return; return;
} }
// dialog event and completion function // dialog event and completion function
int album_mass_update_dialog_event(zdialog *zd, cchar *event) int album_mass_update_dialog_event(zdialog *zd, ch *event)
{ {
using namespace album_mass_update_names; using namespace album_mass_update_names;
int ii; int ii;
char **pp; ch **pp;
if (strmatch(event,"escape")) zd->zstat = -2; // escape key if (strmatch(event,"escape")) zd->zstat = -2; // escape key
if (zd->zstat) if (zd->zstat)
{ {
if (zd->zstat == 1) // proceed if (zd->zstat == 1) // proceed
{ {
if (Nalbums == 0) { if (Nalbums == 0) {
zd->zstat = 0; zd->zstat = 0;
zmessageACK(Mwin,"no albums selected"); zmessageACK(Mwin,"no albums selected");
skipping to change at line 1370 skipping to change at line 1368
zdialog_stuff(zd,event,1); zdialog_stuff(zd,event,1);
massoption = event[3]; massoption = event[3];
} }
return 1; return 1;
} }
// process the list of Nold album files in ZLoldfs // process the list of Nold album files in ZLoldfs
// output list of Nnew new album files in ZLnewfs // output list of Nnew new album files in ZLnewfs
void album_mass_update_process(cchar *albumname) void album_mass_update_process(ch *albumname)
{ {
using namespace album_mass_update_names; using namespace album_mass_update_names;
int ii, ii1, ii2, jj, kk, kk1, kk2; int ii, ii1, ii2, jj, kk, kk1, kk2;
int ll, nf, nc, Fchanged; int ll, nf, nc, Fchanged;
int Nself = 0; int Nself = 0;
char selfiles[AFCC]; ch selfiles[AFCC];
char *rootname, *basename, *pp; ch *rootname, *basename, *pp;
char **fileversions, *ppselect[100]; ch **fileversions, *ppselect[100];
zlist_t *ZLselfs = 0; zlist_t *ZLselfs = 0;
popup_report_write(zdreport,0,"\n"); popup_report_write(zdpop,0,"\n");
// report album name 22.1 // report album name 22.1
popup_report_write(zdreport,1,"%s \n",albumname); popup_report_write(zdpop,1,"%s \n",albumname);
if (massoption >= 'M') // if 'selected files' option if (massoption >= 'M') // if 'selected files' option
{ {
snprintf(selfiles,AFCC,"%s/%s",albums_folder,"selected_files"); // get selected_files snprintf(selfiles,AFCC,"%s/%s",albums_folder,"selected_files"); // get selected_files
ZLselfs = zlist_from_file(selfiles); ZLselfs = zlist_from_file(selfiles);
if (ZLselfs) Nself = zlist_count(ZLselfs); if (ZLselfs) Nself = zlist_count(ZLselfs);
if (! Nself) { if (! Nself) {
zmessageACK(Mwin,"no files selected"); zmessageACK(Mwin,"no files selected");
return; return;
} }
skipping to change at line 1554 skipping to change at line 1552
} }
if (! Fchanged) { if (! Fchanged) {
for (jj = kk1; jj <= kk2; jj++) for (jj = kk1; jj <= kk2; jj++)
if (zlist_find(ZLoldfs,zlist_get(ZLnewfs,jj),0) < 0) break; if (zlist_find(ZLoldfs,zlist_get(ZLnewfs,jj),0) < 0) break;
if (jj < kk2) Fchanged = 1; if (jj < kk2) Fchanged = 1;
} }
if (! Fchanged) continue; if (! Fchanged) continue;
popup_report_write(zdreport,0,"old files: "); // report old files group popup_report_write(zdpop,0,"old files: "); // report old files group
for (jj = ii1; jj <= ii2; jj++) { for (jj = ii1; jj <= ii2; jj++) {
pp = zlist_get(ZLoldfs,jj); pp = zlist_get(ZLoldfs,jj);
pp = strrchr(pp,'/'); pp = strrchr(pp,'/');
popup_report_write(zdreport,0,"%s ",pp+1); popup_report_write(zdpop,0,"%s ",pp+1);
} }
popup_report_write(zdreport,0,"\n"); popup_report_write(zdpop,0,"\n");
popup_report_write(zdreport,0,"new files: "); // report corresp. new files group popup_report_write(zdpop,0,"new files: "); // report corresp. new files group
for (jj = kk1; jj <= kk2; jj++) { for (jj = kk1; jj <= kk2; jj++) {
pp = zlist_get(ZLnewfs,jj); pp = zlist_get(ZLnewfs,jj);
pp = strrchr(pp,'/'); pp = strrchr(pp,'/');
popup_report_write(zdreport,0,"%s ",pp+1); popup_report_write(zdpop,0,"%s ",pp+1);
} }
popup_report_write(zdreport,0,"\n"); popup_report_write(zdpop,0,"\n");
} }
Nnew = kk; // new file count in ZLnewfs Nnew = kk; // new file count in ZLnewfs
if (ZLselfs) zlist_delete(ZLselfs); if (ZLselfs) zlist_delete(ZLselfs);
return; return;
} }
/******************************************************************************* * /******************************************************************************* *
skipping to change at line 1596 skipping to change at line 1594
using Fotoxx album name or any folder containing image files. using Fotoxx album name or any folder containing image files.
Called via Fotoxx command line: $ fotoxx -cwp NNN container Called via Fotoxx command line: $ fotoxx -cwp NNN container
NNN update interval in seconds NNN update interval in seconds
container a Fotoxx album name or folder pathname container a Fotoxx album name or folder pathname
if NNN = 0, make one wallpaper update and exit if NNN = 0, make one wallpaper update and exit
******************************************************************************** */ ******************************************************************************** */
void m_cycle_wallpaper(int argc, char **argv) void m_cycle_wallpaper(int argc, ch **argv)
{ {
zlist_t *ZLfiles = 0; zlist_t *ZLfiles = 0;
int ii, err, Nfiles, secs, nextF; int ii, err, Nfiles, secs, nextF;
char *pp, *container, **imagefiles, **wprecs; ch *pp, *container, **imagefiles, **wprecs;
char albumfile[500], wpfile[500]; ch albumfile[500], wpfile[500];
FILE *fid; FILE *fid;
Plog(1,"m_cycle_wallpaper \n"); Plog(1,"m_cycle_wallpaper \n");
Plog(1,"cycle wallpaper: secs: %s container: %s \n",argv[2],argv[3]); Plog(1,"cycle wallpaper: secs: %s container: %s \n",argv[2],argv[3]);
if (argc < 4) { if (argc < 4) {
Plog(0,"missing command parameters \n"); Plog(0,"missing command parameters \n");
zexit(0,"cycle wallpaper exit"); zexit(0,"cycle wallpaper exit");
} }
skipping to change at line 1647 skipping to change at line 1645
else // container is a fotoxx album name else // container is a fotoxx album name
{ {
snprintf(albumfile,500,"%s/%s",albums_folder,container); // album file name snprintf(albumfile,500,"%s/%s",albums_folder,container); // album file name
ZLfiles = zlist_from_file(albumfile); // get contained files ZLfiles = zlist_from_file(albumfile); // get contained files
if (! ZLfiles) goto filerr; if (! ZLfiles) goto filerr;
Nfiles = zlist_count(ZLfiles); Nfiles = zlist_count(ZLfiles);
if (! Nfiles) goto filerr; if (! Nfiles) goto filerr;
imagefiles = (char **) zmalloc(Nfiles * sizeof(char *),"wallpaper"); // allocate memory for file list imagefiles = (ch **) zmalloc(Nfiles * sizeof(ch *),"wallpaper"); // allocate memory for file list
for (ii = Nfiles = 0; ii < zlist_count(ZLfiles); ii++) { // screen for image files for (ii = Nfiles = 0; ii < zlist_count(ZLfiles); ii++) { // screen for image files
imagefiles[Nfiles] = zlist_get(ZLfiles,ii); imagefiles[Nfiles] = zlist_get(ZLfiles,ii);
if (image_file_type(imagefiles[Nfiles]) == IMAGE) Nfiles++; if (image_file_type(imagefiles[Nfiles]) == IMAGE) Nfiles++;
} }
Plog(1,"album contains %d image files \n",Nfiles); // keep ZLfiles in memory Plog(1,"album contains %d image files \n",Nfiles); // keep ZLfiles in memory
if (Nfiles == 0) zexit(0,"cycle wallpaper exit"); if (Nfiles == 0) zexit(0,"cycle wallpaper exit");
} }
snprintf(wpfile,500,"%s/wallpaper",get_zhomedir()); // get last wallpaper file used snprintf(wpfile,500,"%s/wallpaper",get_zhomedir()); // get last wallpaper file used
ii = zreadfile(wpfile,wprecs); ii = zreadfile(wpfile,wprecs);
if (ii < 1) pp = (char *) "no wallpaper file"; if (ii < 1) pp = "no wallpaper file";
else pp = wprecs[0]; else pp = wprecs[0];
for (ii = 0; ii < Nfiles; ii++) // find in file list for (ii = 0; ii < Nfiles; ii++) // find in file list
if (strmatch(pp,imagefiles[ii])) break; if (strmatch(pp,imagefiles[ii])) break;
if (ii < Nfiles) nextF = ii; // found if (ii < Nfiles) nextF = ii; // found
else nextF = -1; // not found, set first file - 1 else nextF = -1; // not found, set first file - 1
while (true) // loop forever while (true) // loop forever
{ {
nextF++; // next file nextF++; // next file
skipping to change at line 1692 skipping to change at line 1690
} }
filerr: filerr:
zexit(0,"cycle wallpaper file error: %s",strerror(errno)); zexit(0,"cycle wallpaper file error: %s",strerror(errno));
} }
/******************************************************************************* */ /******************************************************************************* */
// slide show function // slide show function
int ss_dialog_event(zdialog *zd, cchar *event); // main dialog int ss_dialog_event(zdialog *zd, ch *event); // main dialog
void ss_KBprefs_dialog(); // edit KB control key preferences void ss_KBprefs_dialog(); // edit KB control key preferences
int ss_timerfunc(void *); // timer function int ss_timerfunc(void *); // timer function
int ss_nextrans(); // select next transition to use int ss_nextrans(); // select next transition to use
void ss_blankwindow(); // blank the window void ss_blankwindow(); // blank the window
int ss_showtext(int, int, int); // show filename/title/description int ss_showtext(int, int, int); // show filename/title/description
void ss_transprefs_dialog(); // edit transition preferences void ss_transprefs_dialog(); // edit transition preferences
void ss_imageprefs_dialog(); // edit image preferences void ss_imageprefs_dialog(); // edit image preferences
void ss_loadprefs(); // load preferences from file void ss_loadprefs(); // load preferences from file
void ss_saveprefs(); // write preferences to file void ss_saveprefs(); // write preferences to file
PXB *ss_loadpxb(char *file); PXB *ss_loadpxb(ch *file);
// load image as PXB pixmap // load image as PXB pixmap
PXB *ss_zoom_posn(char *file, int mode, float zoom); PXB *ss_zoom_posn(ch *file, int mode, float zoom);
// position zoomed image in PXB // position zoomed image in PXB
void ss_instant(); // transition functions void ss_instant(); // transition functions
void ss_fadein(); void ss_fadein();
void ss_rollright(); void ss_rollright();
void ss_slidefadein(); void ss_slidefadein();
void ss_stretch(); void ss_stretch_right();
void ss_stretch_down();
void ss_rolldown(); void ss_rolldown();
void ss_venetian(); void ss_venetian();
void ss_grate(); void ss_grate();
void ss_rectangle(); void ss_rectangle();
void ss_implode(); void ss_implode();
void ss_explode(); void ss_explode();
void ss_radar(); void ss_radar();
void ss_japfan(); void ss_japfan();
void ss_spiral(); void ss_spiral();
void ss_ellipse(); void ss_ellipse();
void ss_raindrops(); void ss_raindrops();
void ss_doubledoor(); void ss_doubledoor();
void ss_rotate(); void ss_rotate();
void ss_fallover(); void ss_fallover();
void ss_spheroid(); void ss_spheroid();
void ss_turnpage(); void ss_turnpage();
void ss_frenchdoor(); void ss_frenchdoor();
void ss_squishright();
void ss_squishdown();
void ss_windmill(); void ss_windmill();
void ss_pixelize(); void ss_pixelize();
void ss_twist(); void ss_twist();
void ss_Xopen(); void ss_Xopen();
void ss_squishout(); void ss_squishout();
void ss_disintegrate(); void ss_disintegrate();
void ss_interleave(); void ss_interleave();
void ss_fliptiles(); void ss_fliptiles();
void ss_zoom_setup(char *file); void ss_zoom_setup(ch *file);
void ss_zoom_start(float zoom); void ss_zoom_start(float zoom);
PXB * ss_zoom_wait(); PXB * ss_zoom_wait();
void ss_zoomin(); void ss_zoomin();
void ss_zoomout(); void ss_zoomout();
char *ss_albumfile = 0; ch *ss_albumfile = 0;
// slide show album file // slide show album file
char *ss_albumname = 0; ch *ss_albumname = 0;
// album name (ss_albumfile tail) // album name (ss_albumfile tail)
int ss_Nfiles = 0; // album file count int ss_Nfiles = 0; // album file count
int ss_imagetime = 0; // image display default time int ss_imagetime = 0; // image display default time
int ss_texttime = 0; // show text time int ss_texttime = 0; // show text time
int ss_cliplimit = 10; // image clipping limit from user int ss_cliplimit = 10; // image clipping limit from user
char ss_musicfile[500] = "none"; // /folder.../musicfile.ogg ch ss_musicfile[500] = "none"; // /folder.../musicfile.ogg
int ss_vlcnotify = 0; // flag, missing VLC notified int ss_vlcnotify = 0; // flag, missing VLC notified
int ss_playmusic = 0; // flag, play given music file int ss_playmusic = 0; // flag, play given music file
int ss_randomimage = 0; // use random image order int ss_randomimage = 0; // use random image order
int ss_randomtrans = 0; // use random transition order int ss_randomtrans = 0; // use random transition order
int ss_fullscreen = 0; // flag, full screen mode int ss_fullscreen = 0; // flag, full screen mode
int ss_replay = 0; // flag, start over when done int ss_replay = 0; // flag, start over when done
float ss_trantime = 2.0; // transition time, seconds float ss_trantime = 2.0; // transition time, seconds
float ss_zoomsize = 1.0; // zoom size, 1-3.0 = 3x float ss_zoomsize = 1.0; // zoom size, 1-3.0 = 3x
int ss_zoomtype = 0; // 0/1/2 = none/zoomin/zoomout int ss_zoomtype = 0; // 0/1/2 = none/zoomin/zoomout
int ss_zoomtime = 2; // zoom time, seconds int ss_zoomtime = 2; // zoom time, seconds
int ss_zoomlocx, ss_zoomlocy; // zoom target (50/50 = image midpoint) int ss_zoomlocx, ss_zoomlocy; // zoom target (50/50 = image midpoint)
int ss_setzloc; // 1-shot flag for image prefs dialog int ss_setzloc; // 1-shot flag for image prefs dialog
int ss_ww, ss_hh, ss_rs; // slide show image size, rowstride int ss_ww, ss_hh, ss_rs; // slide show image size, rowstride
char *ss_oldfile, *ss_newfile; // image files for transition ch *ss_oldfile, *ss_newfile; // image files for transition
PXB *ss_pxbold, *ss_pxbnew; // PXB pixmap images: old, new PXB *ss_pxbold, *ss_pxbnew; // PXB pixmap images: old, new
double ss_timer = 0; // slide show timer double ss_timer = 0; // slide show timer
cchar *ss_event; // slide show event ch *ss_event; // slide show event
int ss_escape; // flag, kill running slide show int ss_escape; // flag, kill running slide show
int ss_paused; // slide show paused status int ss_paused; // slide show paused status
int ss_Fcurrent = 0; // current image file int ss_Fcurrent = 0; // current image file
int ss_isblank = 0; // window is blank int ss_isblank = 0; // window is blank
int ss_nwt; // threads for transition funcs int ss_nwt; // threads for transition funcs
char ss_KBkeyB; ch ss_KBkeyB;
// KB key: blank screen // KB key: blank screen
char ss_KBkeyN; ch ss_KBkeyN;
// KB key: transition to next image // KB key: transition to next image
char ss_KBkeyP; ch ss_KBkeyP;
// KB key: pause /resume // KB key: pause /resume
char ss_KBkeyX; ch ss_KBkeyX;
// KB key: magnify image // KB key: magnify image
#define SSNT 32 // slide show transition types #define SSNT 31 // slide show transition types
#define SSMAXI 10000 // max. slide show images #define SSMAXI 10000 // max. slide show images
struct ss_trantab_t { // transition table struct ss_trantab_t { // transition table
char tranname[32]; // transition name ch tranname[32]; // transition name
int enabled; // enabled or not int enabled; // enabled or not
float trantime; // duration, seconds float trantime; // duration, seconds
int preference; // relative preference, 0-99 int preference; // relative preference, 0-99
void (*func)(); // function to perform transition void (*func)(); // function to perform transition
}; };
ss_trantab_t ss_trantab[SSNT]; // specific slide show transition prefs ss_trantab_t ss_trantab[SSNT]; // specific slide show transition prefs
int ss_Tused[SSNT]; // list of transition types enabled int ss_Tused[SSNT]; // list of transition types enabled
int ss_Tlast[SSNT]; // last transitions used, in order int ss_Tlast[SSNT]; // last transitions used, in order
int ss_Nused; // count of enabled transitions, 0-SSNT int ss_Nused; // count of enabled transitions, 0-SSNT
int ss_Tnext; // next transition to use >> last one used int ss_Tnext; // next transition to use >> last one used
ss_trantab_t ss_trantab_default[SSNT] = // transition defaults ss_trantab_t ss_trantab_default[SSNT] = // transition defaults
{ // name enab time pref function // (enabled, trantime, preference) { // name enab time pref function // (enabled, trantime, preference)
{ "instant", 1, 0.0, 10, ss_instant }, { "instant", 1, 0.0, 10, ss_instant },
{ "fade-in", 1, 2.0, 10, ss_fadein }, { "fade-in", 1, 2.0, 10, ss_fadein },
{ "roll-right", 1, 2.0, 10, ss_rollright }, // NO BLANKS IN TRANSITION NAMES { "roll-right", 1, 2.0, 10, ss_rollright }, // NO BLANKS IN TRANSITION NAMES
{ "slide-fade-in", 1, 2.0, 10, ss_slidefadein }, { "slide-fade-in", 1, 2.0, 10, ss_slidefadein },
{ "stretch", 1, 2.0, 19, ss_stretch }, { "stretch-right", 1, 2.0, 10, ss_stretch_right },
{ "stretch-down", 1, 2.0, 10, ss_stretch_down },
{ "roll-down", 1, 2.0, 10, ss_rolldown }, { "roll-down", 1, 2.0, 10, ss_rolldown },
{ "venetian", 1, 2.0, 10, ss_venetian }, { "venetian", 1, 2.0, 10, ss_venetian },
{ "grate", 1, 2.0, 10, ss_grate }, { "grate", 1, 2.0, 10, ss_grate },
{ "rectangle", 1, 2.0, 10, ss_rectangle }, { "rectangle", 1, 2.0, 10, ss_rectangle },
{ "implode", 1, 2.0, 10, ss_implode }, { "implode", 1, 2.0, 10, ss_implode },
{ "explode", 1, 2.0, 10, ss_explode }, { "explode", 1, 2.0, 10, ss_explode },
{ "radar", 1, 2.0, 10, ss_radar }, { "radar", 1, 2.0, 10, ss_radar },
{ "Japan-fan", 1, 2.0, 10, ss_japfan }, { "Japan-fan", 1, 2.0, 10, ss_japfan },
{ "Spiral", 1, 2.0, 10, ss_spiral }, { "Spiral", 1, 2.0, 10, ss_spiral },
{ "ellipse", 1, 2.0, 10, ss_ellipse }, { "ellipse", 1, 2.0, 10, ss_ellipse },
{ "raindrops", 1, 2.0, 10, ss_raindrops }, { "raindrops", 1, 2.0, 10, ss_raindrops },
{ "doubledoor", 1, 2.0, 10, ss_doubledoor }, { "doubledoor", 1, 2.0, 10, ss_doubledoor },
{ "rotate", 1, 2.0, 10, ss_rotate }, { "rotate", 1, 2.0, 10, ss_rotate },
{ "fallover", 1, 2.0, 10, ss_fallover }, { "fallover", 1, 2.0, 10, ss_fallover },
{ "spheroid", 1, 2.0, 10, ss_spheroid }, { "spheroid", 1, 2.0, 10, ss_spheroid },
{ "turn-page", 1, 2.0, 10, ss_turnpage }, { "turn-page", 1, 2.0, 10, ss_turnpage },
{ "french-door", 1, 2.0, 10, ss_frenchdoor }, { "french-door", 1, 2.0, 10, ss_frenchdoor },
{ "squish-right", 1, 2.0, 10, ss_squishright },
{ "squish-down", 1, 2.0, 10, ss_squishdown },
{ "windmill", 1, 2.0, 10, ss_windmill }, { "windmill", 1, 2.0, 10, ss_windmill },
{ "pixelize", 1, 2.0, 10, ss_pixelize }, { "pixelize", 1, 2.0, 10, ss_pixelize },
{ "twist", 1, 2.0, 10, ss_twist }, { "twist", 1, 2.0, 10, ss_twist },
{ "Xopen", 1, 2.0, 10, ss_Xopen }, { "Xopen", 1, 2.0, 10, ss_Xopen },
{ "squish-out", 1, 2.0, 10, ss_squishout }, { "squish-out", 1, 2.0, 10, ss_squishout },
{ "disintegrate", 1, 2.0, 10, ss_disintegrate }, { "disintegrate", 1, 2.0, 10, ss_disintegrate },
{ "flip-tiles", 1, 2.0, 10, ss_fliptiles }, { "flip-tiles", 1, 2.0, 10, ss_fliptiles },
{ "interleave", 1, 2.0, 10, ss_interleave } { "interleave", 1, 2.0, 10, ss_interleave }
}; };
struct ss_imagetab_t { // image table struct ss_imagetab_t { // image table
char *imagefile; // image file ch *imagefile; // image file
int tone; // flag, play tone when shown int tone; // flag, play tone when shown
int wait0; // seconds to wait int wait0; // seconds to wait
int filesecs; // seconds to show file name int filesecs; // seconds to show file name
int titlesecs; // seconds to show title int titlesecs; // seconds to show title
int descsecs; // seconds to show description int descsecs; // seconds to show description
int wait1; // seconds to wait int wait1; // seconds to wait
int zoomtype; // 0/1/2 = none/zoomin/zoomout int zoomtype; // 0/1/2 = none/zoomin/zoomout
float zoomsize; // zoom size, 1-3.0 = 3x float zoomsize; // zoom size, 1-3.0 = 3x
int zoomtime; // zoom time, seconds int zoomtime; // zoom time, seconds
int zoomlocx, zoomlocy; // zoom target (50/50 = image midpoint) int zoomlocx, zoomlocy; // zoom target (50/50 = image midpoint)
int wait2; // seconds to wait int wait2; // seconds to wait
char tranname[32]; // transition type to use ch tranname[32]; // transition type to use
}; };
ss_imagetab_t ss_imagetab[SSMAXI]; // specific slide show image table ss_imagetab_t ss_imagetab[SSMAXI]; // specific slide show image table
// menu function - start or stop a slide show // menu function - start or stop a slide show
void m_slideshow(GtkWidget *, cchar *) void m_slideshow(GtkWidget *, ch *)
{ {
zdialog *zd; zdialog *zd;
int zstat, ii; int zstat, ii;
char *pp; ch *pp;
F1_help_topic = "slide show"; F1_help_topic = "slide show";
if (Fblock(0,"blocked edits") || Fslideshow) return; // check nothing pending if (Fblock(0,"blocked edits") || Fslideshow) return; // check nothing pending
if (FGWM != 'F' && FGWM != 'G') return; if (FGWM != 'F' && FGWM != 'G') return;
Plog(1,"m_slideshow \n"); Plog(1,"m_slideshow \n");
ss_nwt = NWT - 2; // leave 2 SMPs free for GTK ss_nwt = NWT - 2; // leave 2 SMPs free for GTK
if (ss_nwt < 1) ss_nwt = 1; if (ss_nwt < 1) ss_nwt = 1;
skipping to change at line 2027 skipping to change at line 2023
ss_ww = gdk_window_get_width(gdkwin); // window size ss_ww = gdk_window_get_width(gdkwin); // window size
ss_hh = gdk_window_get_height(gdkwin); ss_hh = gdk_window_get_height(gdkwin);
g_timeout_add(100,ss_timerfunc,0); // start timer for image changes g_timeout_add(100,ss_timerfunc,0); // start timer for image changes
// when done: unblock, restart slide show // when done: unblock, restart slide show
return; return;
} }
// dialog event function - file chooser for images to show and music file // dialog event function - file chooser for images to show and music file
int ss_dialog_event(zdialog *zd, cchar *event) int ss_dialog_event(zdialog *zd, ch *event)
{ {
char *file, *pp; ch *file, *pp;
char countmess[50]; ch countmess[50];
int err; int err;
if (strmatch(event,"escape")) zd->zstat = -2; // escape key if (strmatch(event,"escape")) zd->zstat = -2; // escape key
if (zd->zstat == 1) { // [proceed] if (zd->zstat == 1) { // [proceed]
if (ss_Nfiles) return 1; if (ss_Nfiles) return 1;
zmessageACK(Mwin,"invalid album"); // diagnose and keep dialog open zmessageACK(Mwin,"invalid album"); // diagnose and keep dialog open
zd->zstat = 0; zd->zstat = 0;
return 1; return 1;
} }
skipping to change at line 2133 skipping to change at line 2129
album_show(ss_albumfile); // open slide show album album_show(ss_albumfile); // open slide show album
return 1; return 1;
} }
// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- -
// set preferences for keyboard control keys (blank screen, next image, pause/r esume, magnify) // set preferences for keyboard control keys (blank screen, next image, pause/r esume, magnify)
void ss_KBprefs_dialog() void ss_KBprefs_dialog()
{ {
int KBprefs_dialog_event(zdialog *zd, cchar *event); int KBprefs_dialog_event(zdialog *zd, ch *event);
zdialog *zd; zdialog *zd;
int zstat; int zstat;
char keyx[4] = "X"; ch keyx[4];
cchar *tip = "arrow keys show previous or next image instantly \n" ch *tip = "arrow keys show previous or next image instantly \n"
"space bar (blank) is allowed and shows as '-'"; "space bar (blank) is allowed and shows as '-'";
/*** /***
___________________________________________________ ___________________________________________________
| Keyboard Preferences | | Keyboard Preferences |
| | | |
| [ B ] blank or unblank window | | [ B ] blank or unblank window |
| [ N ] show next image, with transition | | [ N ] show next image, with transition |
| [ P ] pause or resume slide show | | [ P ] pause or resume slide show |
| [ X ] magnify image (loupe tool) | | [ X ] magnify image (loupe tool) |
skipping to change at line 2218 skipping to change at line 2214
if (*keyx == '-') *keyx = ' '; if (*keyx == '-') *keyx = ' ';
ss_KBkeyX = ss_KBkeys[3] = keyx[0]; ss_KBkeyX = ss_KBkeys[3] = keyx[0];
save_params(); save_params();
return; return;
} }
// dialog event and completion function // dialog event and completion function
int KBprefs_dialog_event(zdialog *zd, cchar *event) int KBprefs_dialog_event(zdialog *zd, ch *event)
{ {
char keyx[4]; ch keyx[4];
if (strmatch(event,"escape")) zd->zstat = -2; // escape key if (strmatch(event,"escape")) zd->zstat = -2; // escape key
if (zd->zstat) { if (zd->zstat) {
zdialog_free(zd); zdialog_free(zd);
return 1; return 1;
} }
if (zstrstr("B N P X",event)) { if (zstrstr("B N P X",event)) {
zdialog_fetch(zd,event,keyx,2); zdialog_fetch(zd,event,keyx,2);
skipping to change at line 2251 skipping to change at line 2247
// Show next slide when time is up or user navigates with arrow keys. // Show next slide when time is up or user navigates with arrow keys.
// Cycles every 0.1 seconds when slide show is active. // Cycles every 0.1 seconds when slide show is active.
int ss_timerfunc(void *) int ss_timerfunc(void *)
{ {
int ss_timerfunc_sleep(int sleepsecs); int ss_timerfunc_sleep(int sleepsecs);
int img, jj; int img, jj;
int filesecs, titlesecs, descsecs, sleepsecs; int filesecs, titlesecs, descsecs, sleepsecs;
cchar *keynames[2] = { iptc_title_key, iptc_description_key }; ch *keynames[2] = { meta_title_key, meta_description_key };
char *keyvals[2], *pp; ch *keyvals[2], *pp;
char tonefile[200]; ch tonefile[200];
if (zd_magnify) return 1; // exit magnify before event processing if (zd_magnify) return 1; // exit magnify before event processing
if (ss_escape) ss_event = "escape"; // KB event from main() if (ss_escape) ss_event = "escape"; // KB event from main()
if (Fkillfunc) ss_event = "escape"; // window kill button [x] 22.30
if (! Fslideshow) ss_event = "escape"; // from m_quit() if (! Fslideshow) ss_event = "escape"; // from m_quit()
if (FGWM != 'F') ss_event = "escape"; // must be F-view mode if (FGWM != 'F') ss_event = "escape"; // must be F-view mode
if (strmatch(ss_event,"")) return 1; // no event, loop and wait if (strmatch(ss_event,"")) return 1; // no event, loop and wait
if (strmatch(ss_event,"escape")) goto escape; if (strmatch(ss_event,"escape")) goto escape;
if (strmatch(ss_event,"blank")) goto blank; if (strmatch(ss_event,"blank")) goto blank;
if (strmatch(ss_event,"first")) goto first; if (strmatch(ss_event,"first")) goto first;
if (strmatch(ss_event,"EOL")) goto EOL; if (strmatch(ss_event,"EOL")) goto EOL;
if (strmatch(ss_event,"show")) goto show; if (strmatch(ss_event,"show")) goto show;
if (strmatch(ss_event,"next")) goto next; if (strmatch(ss_event,"next")) goto next;
if (strmatch(ss_event,"tran next")) goto tran_next; if (strmatch(ss_event,"tran next")) goto tran_next;
skipping to change at line 2400 skipping to change at line 2395
sleepsecs = ss_imagetab[img].wait0; // show image specified time sleepsecs = ss_imagetab[img].wait0; // show image specified time
jj = ss_timerfunc_sleep(sleepsecs); // before filename/titles/description jj = ss_timerfunc_sleep(sleepsecs); // before filename/titles/description
if (jj) return 1; if (jj) return 1;
filesecs = ss_imagetab[img].filesecs; // time to show file name filesecs = ss_imagetab[img].filesecs; // time to show file name
titlesecs = ss_imagetab[img].titlesecs; // time to show title titlesecs = ss_imagetab[img].titlesecs; // time to show title
descsecs = ss_imagetab[img].descsecs; // time to show description descsecs = ss_imagetab[img].descsecs; // time to show description
if (filesecs + titlesecs + descsecs == 0) // if not specified, use default if (filesecs + titlesecs + descsecs == 0) // if not specified, use default
filesecs = titlesecs = descsecs = ss_texttime; filesecs = titlesecs = descsecs = ss_texttime;
exif_get(ss_newfile,keynames,keyvals,2); // get image titles and description meta_get1(ss_newfile,keynames,keyvals,2); // get image titles and description
if (! keyvals[0]) titlesecs = 0; // zero time if no title if (! keyvals[0]) titlesecs = 0; // zero time if no title
else zfree(keyvals[0]); else zfree(keyvals[0]);
if (! keyvals[1]) descsecs = 0; // zero time if no description if (! keyvals[1]) descsecs = 0; // zero time if no description
else zfree(keyvals[1]); else zfree(keyvals[1]);
while (filesecs + titlesecs + descsecs) while (filesecs + titlesecs + descsecs)
{ {
ss_showtext(filesecs,titlesecs,descsecs); // show items with remaining time ss_showtext(filesecs,titlesecs,descsecs); // show items with remaining time
jj = ss_timerfunc_sleep(1.0); // wait 1 second jj = ss_timerfunc_sleep(1.0); // wait 1 second
if (jj) return 1; // new event if (jj) return 1; // new event
skipping to change at line 2579 skipping to change at line 2574
return next; return next;
} }
// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- -
// write file name, title and description at the top of the image // write file name, title and description at the top of the image
// show only those items with time > 0 // show only those items with time > 0
int ss_showtext(int filesecs, int titlesecs, int descsecs) int ss_showtext(int filesecs, int titlesecs, int descsecs)
{ {
cchar *keynames[2] = { iptc_title_key, iptc_description_key }; ch *keynames[2] = { meta_title_key, meta_description_key };
char *keyvals[2], *pp; ch *keyvals[2], *pp;
char filename[200], title[1000], description[1000]; ch filename[200], title[1000], description[1000];
static char text1[1000]; static ch text1[1000];
char **text2 = 0; ch **text2 = 0;
int ii, nn; int ii, nn;
PIXBUF *pixbuf; PIXBUF *pixbuf;
static PangoFontDescription *pangofont = null; static PangoFontDescription *pangofont = null;
static PangoLayout *pangolayout = null; static PangoLayout *pangolayout = null;
static int plww, plhh, pline; static int plww, plhh, pline;
if (plww) { // clear previous text if (plww) { // clear previous text
pixbuf = gdk_pixbuf_new_subpixbuf(ss_pxbnew->pixbuf,0,0,plww+10,plhh+10); pixbuf = gdk_pixbuf_new_subpixbuf(ss_pxbnew->pixbuf,0,0,plww+10,plhh+10);
cairo_t *cr = draw_context_create(gdkwin,draw_context); cairo_t *cr = draw_context_create(gdkwin,draw_context);
gdk_cairo_set_source_pixbuf(cr,pixbuf,0,0); gdk_cairo_set_source_pixbuf(cr,pixbuf,0,0);
cairo_paint(cr); cairo_paint(cr);
skipping to change at line 2609 skipping to change at line 2604
} }
if (filesecs + titlesecs + descsecs == 0) return 0; if (filesecs + titlesecs + descsecs == 0) return 0;
pp = strrchr(ss_newfile,'/'); // get base file name pp = strrchr(ss_newfile,'/'); // get base file name
if (pp) pp++; if (pp) pp++;
else pp = ss_newfile; else pp = ss_newfile;
strncpy0(filename,pp,200); strncpy0(filename,pp,200);
*title = *description = 0; *title = *description = 0;
exif_get(ss_newfile,keynames,keyvals,2); // get title and description metadata meta_get1(ss_newfile,(ch **) keynames,keyvals,2); // get title and description metadata
if (keyvals[0]) { if (keyvals[0]) {
strncpy0(title,keyvals[0],1000); strncpy0(title,keyvals[0],1000);
zfree(keyvals[0]); zfree(keyvals[0]);
} }
if (keyvals[1]) { if (keyvals[1]) {
strncpy0(description,keyvals[1],1000); strncpy0(description,keyvals[1],1000);
zfree(keyvals[1]); zfree(keyvals[1]);
} }
skipping to change at line 2673 skipping to change at line 2668
return 1; return 1;
} }
// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- -
// Load image and rescale to fit in window size. // Load image and rescale to fit in window size.
// If image aspect ratio is close enough to window ratio, // If image aspect ratio is close enough to window ratio,
// truncate to avoid having margins around around the image. // truncate to avoid having margins around around the image.
PXB * ss_loadpxb(char *file) PXB * ss_loadpxb(ch *file)
{ {
PXB *pxbin, *pxbtemp, *pxbout; PXB *pxbin, *pxbtemp, *pxbout;
int ww1, hh1, ww2, hh2; int ww1, hh1, ww2, hh2;
int Iorgx, Iorgy, Worgx, Worgy; int Iorgx, Iorgy, Worgx, Worgy;
float Rm, Rw, dR; float Rm, Rw, dR;
Dww = gdk_window_get_width(gdkwin); // refresh drawing window size Dww = gdk_window_get_width(gdkwin); // refresh drawing window size
Dhh = gdk_window_get_height(gdkwin); Dhh = gdk_window_get_height(gdkwin);
pxbin = PXB_load(file,1); // load image pxbin = PXB_load(file,1); // load image
skipping to change at line 2752 skipping to change at line 2747
ss_rs = pxbout->rs; // set image row stride ss_rs = pxbout->rs; // set image row stride
return pxbout; return pxbout;
} }
// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- -
// set transitions preferences for specific slide show // set transitions preferences for specific slide show
void ss_transprefs_dialog() void ss_transprefs_dialog()
{ {
int transprefs_dialog_event(zdialog *zd, cchar *event); int transprefs_dialog_event(zdialog *zd, ch *event);
zdialog *zd; zdialog *zd;
int ii, jj, zstat; int ii, jj, zstat;
char nameii[32], enabii[8], timeii[8], prefii[8]; ch nameii[32], enabii[8], timeii[8], prefii[8];
/*** /***
_________________________________________________________________________ _ _________________________________________________________________________ _
| | | |
| Transitions File [load] [save] transition filename | | Transitions File [load] [save] transition filename |
| | | |
| Select [all] [none] [x] random time [___] [set all] | | Select [all] [none] [x] random time [___] [set all] |
| | | |
| transition use time pref | transition use time pref | | transition use time pref | transition use time pref |
| instant [ ] [ 1.0 ] [ 10 ] | raindrops [x] [ 1.3 ] [ 10 ] | | instant [ ] [ 1.0 ] [ 10 ] | raindrops [x] [ 1.3 ] [ 10 ] |
skipping to change at line 2796 skipping to change at line 2791
zdialog_add_widget(zd,"label","tranfile","hbfile",0,"space=5"); zdialog_add_widget(zd,"label","tranfile","hbfile",0,"space=5");
zdialog_add_widget(zd,"hbox","hbopts","dialog",0,"space=3"); zdialog_add_widget(zd,"hbox","hbopts","dialog",0,"space=3");
zdialog_add_widget(zd,"label","labtran","hbopts","Select","space=3"); zdialog_add_widget(zd,"label","labtran","hbopts","Select","space=3");
zdialog_add_widget(zd,"button","all","hbopts","All","space=3"); zdialog_add_widget(zd,"button","all","hbopts","All","space=3");
zdialog_add_widget(zd,"button","none","hbopts","None","space=3"); zdialog_add_widget(zd,"button","none","hbopts","None","space=3");
zdialog_add_widget(zd,"check","randomtrans","hbopts","random","space=3"); zdialog_add_widget(zd,"check","randomtrans","hbopts","random","space=3");
zdialog_add_widget(zd,"label","space","hbopts","","space=10"); zdialog_add_widget(zd,"label","space","hbopts","","space=10");
zdialog_add_widget(zd,"label","labtime","hbopts","time","space=3"); zdialog_add_widget(zd,"label","labtime","hbopts","time","space=3");
zdialog_add_widget(zd,"zspin","alltime","hbopts","0.1|10|0.1|2","size=4"); zdialog_add_widget(zd,"zspin","alltime","hbopts","0.1|10|0.1|4","size=4");
zdialog_add_widget(zd,"button","setalltime","hbopts","set all"); zdialog_add_widget(zd,"button","setalltime","hbopts","set all");
zdialog_add_widget(zd,"hbox","hb1","dialog"); zdialog_add_widget(zd,"hbox","hb1","dialog");
zdialog_add_widget(zd,"vbox","vb1","hb1",0,"space=5|homog"); zdialog_add_widget(zd,"vbox","vb1","hb1",0,"space=5|homog");
zdialog_add_widget(zd,"vbox","vb2","hb1",0,"space=5|homog"); zdialog_add_widget(zd,"vbox","vb2","hb1",0,"space=5|homog");
zdialog_add_widget(zd,"vbox","vb3","hb1",0,"space=5|homog"); zdialog_add_widget(zd,"vbox","vb3","hb1",0,"space=5|homog");
zdialog_add_widget(zd,"vbox","vb4","hb1",0,"space=5|homog"); zdialog_add_widget(zd,"vbox","vb4","hb1",0,"space=5|homog");
zdialog_add_widget(zd,"vsep","vs1","hb1",0,"space=5"); // two columns of transition poop zdialog_add_widget(zd,"vsep","vs1","hb1",0,"space=5"); // two columns of transition poop
zdialog_add_widget(zd,"vbox","vb5","hb1",0,"space=5|homog"); zdialog_add_widget(zd,"vbox","vb5","hb1",0,"space=5|homog");
zdialog_add_widget(zd,"vbox","vb6","hb1",0,"space=5|homog"); zdialog_add_widget(zd,"vbox","vb6","hb1",0,"space=5|homog");
skipping to change at line 2882 skipping to change at line 2877
} }
ss_Nused = jj; // no. enabled transition types ss_Nused = jj; // no. enabled transition types
ss_Tnext = 0; // next one to use (first) ss_Tnext = 0; // next one to use (first)
return; return;
} }
// transition prefs dialog event and completion function // transition prefs dialog event and completion function
int transprefs_dialog_event(zdialog *zd, cchar *event) int transprefs_dialog_event(zdialog *zd, ch *event)
{ {
int transprefs_load(cchar *file); int transprefs_load(ch *file);
int transprefs_save(cchar *file); int transprefs_save(ch *file);
int err, ii; int err, ii;
float time; float time;
char *file, *pp; ch *file, *pp;
char nameii[32], enabii[8], timeii[8], prefii[8]; ch nameii[32], enabii[8], timeii[8], prefii[8];
if (strmatch(event,"escape")) zd->zstat = -1; // escape key if (strmatch(event,"escape")) zd->zstat = -1; // escape key
if (strmatch(event,"all")) // enable all transitions if (strmatch(event,"all")) // enable all transitions
{ {
for (ii = 0; ii < SSNT; ii++) { for (ii = 0; ii < SSNT; ii++) {
snprintf(enabii,8,"enab_%d",ii); snprintf(enabii,8,"enab_%d",ii);
zdialog_stuff(zd,enabii,1); zdialog_stuff(zd,enabii,1);
} }
} }
skipping to change at line 2971 skipping to change at line 2966
zdialog_stuff(zd,timeii,time); zdialog_stuff(zd,timeii,time);
} }
} }
return 1; return 1;
} }
// load transition prefs from a file // load transition prefs from a file
// returns 0 = OK, +N = error // returns 0 = OK, +N = error
int transprefs_load(cchar *file) int transprefs_load(ch *file)
{ {
FILE *fid; FILE *fid;
char *pp, buff[XFCC]; ch *pp, buff[XFCC];
int ii, jj, nn; int ii, jj, nn;
char tranname[32]; ch tranname[32];
int n1, n2; int n1, n2;
float ff; float ff;
fid = fopen(file,"r"); fid = fopen(file,"r");
if (! fid) { if (! fid) {
zmessageACK(Mwin,"invalid file"); zmessageACK(Mwin,"invalid file");
return 1; return 1;
} }
pp = fgets_trim(buff,XFCC,fid,1); pp = fgets_trim(buff,XFCC,fid,1);
skipping to change at line 3032 skipping to change at line 3027
return 0; return 0;
format_error: format_error:
zmessageACK(Mwin,"file format error: \n %s",buff); zmessageACK(Mwin,"file format error: \n %s",buff);
fclose(fid); fclose(fid);
return 1; return 1;
} }
// save transition prefs to a file // save transition prefs to a file
int transprefs_save(cchar *file) int transprefs_save(ch *file)
{ {
FILE *fid; FILE *fid;
fid = fopen(file,"w"); fid = fopen(file,"w");
if (! fid) { if (! fid) {
zmessageACK(Mwin,"invalid file"); zmessageACK(Mwin,"invalid file");
return 1; return 1;
} }
fprintf(fid,"randomtrans %d \n",ss_randomtrans); fprintf(fid,"randomtrans %d \n",ss_randomtrans);
skipping to change at line 3059 skipping to change at line 3054
fclose(fid); fclose(fid);
return 0; return 0;
} }
// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- -
// set image preferences for specific slide show // set image preferences for specific slide show
void ss_imageprefs_dialog() void ss_imageprefs_dialog()
{ {
int ss_imageprefs_dialog_event(zdialog *zd, cchar *event); int ss_imageprefs_dialog_event(zdialog *zd, ch *event);
zdialog *zd; zdialog *zd;
int ii, kk; int ii, kk;
char *pp, zoomloc[40]; ch *pp, zoomloc[40];
/*** /***
__________________________________________________ __________________________________________________
| Image Preferences | | Image Preferences |
| | | |
| Image File: [________________________________] | | Image File: [________________________________] |
| | | |
| Action seconds | | Action seconds |
| --------------------------------------------- | | --------------------------------------------- |
| Play tone when image shows [x] | | Play tone when image shows [x] |
skipping to change at line 3211 skipping to change at line 3206
zdialog_wait(zd); // wait for completion zdialog_wait(zd); // wait for completion
zdialog_free(zd); zdialog_free(zd);
zd_ss_imageprefs = 0; zd_ss_imageprefs = 0;
ss_saveprefs(); // save updated preferences file ss_saveprefs(); // save updated preferences file
return; return;
} }
// image prefs dialog event and completion function // image prefs dialog event and completion function
int ss_imageprefs_dialog_event(zdialog *zd, cchar *event) int ss_imageprefs_dialog_event(zdialog *zd, ch *event)
{ {
int ii, jj; int ii, jj;
float ff; float ff;
char tranname[32]; ch tranname[32];
GdkWindow *gdkwin; GdkWindow *gdkwin;
if (strmatch(event,"escape")) zd->zstat = -1; // escape key if (strmatch(event,"escape")) zd->zstat = -1; // escape key
if (zd->zstat) { // [x] or [OK] 22.1 if (zd->zstat) { // [x] or [OK] 22.1
zd_ss_imageprefs = 0; zd_ss_imageprefs = 0;
return 1; return 1;
} }
ii = ss_Fcurrent; // from mouse click on thumbnail ii = ss_Fcurrent; // from mouse click on thumbnail
skipping to change at line 3319 skipping to change at line 3314
return 1; return 1;
} }
// response function for gallery thumbnail left-click // response function for gallery thumbnail left-click
// stuff image prefs dialog with data for clicked image // stuff image prefs dialog with data for clicked image
void ss_imageprefs_Lclick_func(int Nth) void ss_imageprefs_Lclick_func(int Nth)
{ {
zdialog *zd; zdialog *zd;
int ii, kk; int ii, kk;
char *pp, zoomloc[40]; ch *pp, zoomloc[40];
GdkWindow *gdkwin; GdkWindow *gdkwin;
if (! clicked_file) return; if (! clicked_file) return;
zd = zd_ss_imageprefs; // should not happen zd = zd_ss_imageprefs; // should not happen
if (! zd) { if (! zd) {
zfree(clicked_file); zfree(clicked_file);
clicked_file = 0; clicked_file = 0;
return; return;
} }
skipping to change at line 3414 skipping to change at line 3409
... ...
******************************************************************************** */ ******************************************************************************** */
// Load all data for a specific slide show from a slide show preferences file. // Load all data for a specific slide show from a slide show preferences file.
// Set defaults if no data previously defined. // Set defaults if no data previously defined.
void ss_loadprefs() void ss_loadprefs()
{ {
FILE *fid; FILE *fid;
char buff[XFCC]; ch buff[XFCC];
char prefsfile[200], *pp; ch prefsfile[200], *pp;
int ii, jj, nn, format; int ii, jj, nn, format;
FTYPE ftype; FTYPE ftype;
char tranname[32]; ch tranname[32];
int n1, n2; int n1, n2;
float ff; float ff;
for (ii = 0; ii < ss_Nfiles; ii++) { // free prior image data if any for (ii = 0; ii < ss_Nfiles; ii++) { // free prior image data if any
pp = ss_imagetab[ii].imagefile; pp = ss_imagetab[ii].imagefile;
if (pp) zfree(pp); if (pp) zfree(pp);
ss_imagetab[ii].imagefile = 0; ss_imagetab[ii].imagefile = 0;
} }
ss_Nfiles = 0; ss_Nfiles = 0;
skipping to change at line 3686 skipping to change at line 3681
ss_Nused = jj; // no. enabled transition types ss_Nused = jj; // no. enabled transition types
return; return;
} }
// Save all data for a specific slide show to a slide show preferences file. // Save all data for a specific slide show to a slide show preferences file.
void ss_saveprefs() void ss_saveprefs()
{ {
FILE *fid; FILE *fid;
char prefsfile[200]; ch prefsfile[200];
int ii; int ii;
if (! ss_Nfiles) { if (! ss_Nfiles) {
zmessageACK(Mwin,"invalid album"); zmessageACK(Mwin,"invalid album");
return; return;
} }
snprintf(prefsfile,200,"%s/%s",slideshow_folder,ss_albumname); snprintf(prefsfile,200,"%s/%s",slideshow_folder,ss_albumname);
fid = fopen(prefsfile,"w"); // open slide show prefs file fid = fopen(prefsfile,"w"); // open slide show prefs file
if (! fid) { if (! fid) {
skipping to change at line 3951 skipping to change at line 3946
gdk_cairo_set_source_pixbuf(cr,ss_pxbnew->pixbuf,0,0); // final image gdk_cairo_set_source_pixbuf(cr,ss_pxbnew->pixbuf,0,0); // final image
cairo_paint(cr); cairo_paint(cr);
draw_context_destroy(draw_context); draw_context_destroy(draw_context);
return; return;
} }
// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- -
// new image stretches over prior image from left to right // new image stretches over prior image from left to right
// width expands as right edge moves from left to right side (jitters) // width expands as right edge moves from left to right side
void ss_stretch() void ss_stretch_right()
{ {
PXB *pxb_new; PXB *pxb_new;
int ww; int ww;
double T0, Te, Tz; double T0, Te, Tz;
cairo_t *cr = draw_context_create(gdkwin,draw_context); cairo_t *cr = draw_context_create(gdkwin,draw_context);
T0 = get_seconds(); // transition start time T0 = get_seconds(); // transition start time
Tz = ss_trantime; // transition time (goal) Tz = ss_trantime; // transition time (goal)
skipping to change at line 3989 skipping to change at line 3984
gdk_cairo_set_source_pixbuf(cr,ss_pxbnew->pixbuf,0,0); // final image gdk_cairo_set_source_pixbuf(cr,ss_pxbnew->pixbuf,0,0); // final image
cairo_paint(cr); cairo_paint(cr);
draw_context_destroy(draw_context); draw_context_destroy(draw_context);
return; return;
} }
// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- -
// new image stretches over prior image from top to bottom
// height expands as bottom edge moves from top to bottom
void ss_stretch_down()
// 23.1
{
PXB *pxb_new;
int hh;
double T0, Te, Tz;
cairo_t *cr = draw_context_create(gdkwin,draw_context);
T0 = get_seconds();
// transition start time
Tz = ss_trantime;
// transition time (goal)
while (true)
{
Te = get_seconds() - T0;
// elapsed transition time
if (Te >= Tz) break;
// done
hh = Te / Tz * ss_hh;
// height to paint, 0 > ss_hh
if (hh > ss_hh - 10) break;
if (hh < 5) hh = 5;
pxb_new = PXB_rescale_fast(ss_pxbnew,ss_ww,hh);
// rescale width to ww
gdk_cairo_set_source_pixbuf(cr,pxb_new->pixbuf,0,0);
cairo_paint(cr);
PXB_free(pxb_new);
zmainloop();
if (ss_escape) break;
}
gdk_cairo_set_source_pixbuf(cr,ss_pxbnew->pixbuf,0,0);
// final image
cairo_paint(cr);
draw_context_destroy(draw_context);
return;
}
// -----------------------------------------------------------------------------
-
// new image rolls over prior image from top down // new image rolls over prior image from top down
void ss_rolldown() void ss_rolldown()
{ {
PIXBUF *pixbuf; PIXBUF *pixbuf;
int py, ppy, hh; int py, ppy, hh;
double T0, Te, Tz; double T0, Te, Tz;
cairo_t *cr = draw_context_create(gdkwin,draw_context); cairo_t *cr = draw_context_create(gdkwin,draw_context);
skipping to change at line 5489 skipping to change at line 5523
memcpy(pix3,pix1,3); memcpy(pix3,pix1,3);
memcpy(pix3 + ss_rs, pix1 + ss_rs, 3); memcpy(pix3 + ss_rs, pix1 + ss_rs, 3);
} }
} }
return 0; return 0;
} }
// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- -
// new image expands from the left to squish old image to the right
(jitters)
void ss_squishright()
{
PXB *pxbnew, *pxbold, *pxbmix;
float To, Te, Tz;
// start, elapsed, goal times
float F;
int wwnew, wwold;
pxbmix = PXB_copy(ss_pxbold);
cairo_t *cr = draw_context_create(gdkwin,draw_context);
Tz = ss_trantime;
// transition goal time
To = get_seconds() - 0.001;
// transition start time
while (true)
{
Te = get_seconds() - To;
// elapsed time
F = Te / Tz;
// transition status 0 >> 1
if (F >= 1) break;
wwnew = ss_ww * (0.98 * F + 0.01);
// 0.01 to 0.99 * width
wwold = ss_ww - wwnew;
// 0.99 to 0.01 * width
pxbnew = PXB_rescale(ss_pxbnew,wwnew,ss_hh);
// squished new image, 2-98%
pxbold = PXB_rescale(ss_pxbold,wwold,ss_hh);
// squished old image, 98-2%
PXB_copy_area(pxbnew,0,0,wwnew,ss_hh,pxbmix,0,0);
// squished new image -> output image
PXB_copy_area(pxbold,0,0,wwold,ss_hh,pxbmix,wwnew,0);
// squished old image -> output image
PXB_free(pxbnew);
PXB_free(pxbold);
gdk_cairo_set_source_pixbuf(cr,pxbmix->pixbuf,0,0);
// output image
cairo_paint(cr);
zmainloop();
if (ss_escape) break;
}
gdk_cairo_set_source_pixbuf(cr,ss_pxbnew->pixbuf,0,0);
// output final image
cairo_paint(cr);
draw_context_destroy(draw_context);
PXB_free(pxbmix);
return;
}
// -----------------------------------------------------------------------------
-
// new image expands from the top to squish old image to the bottom
(jitters)
void ss_squishdown()
{
PXB *pxbnew, *pxbold, *pxbmix;
float To, Te, Tz;
// start, elapsed, goal times
float F;
int hhold, hhnew;
pxbmix = PXB_copy(ss_pxbold);
cairo_t *cr = draw_context_create(gdkwin,draw_context);
Tz = ss_trantime;
// transition goal time
To = get_seconds() - 0.001;
// transition start time
while (true)
{
Te = get_seconds() - To;
// elapsed time
F = Te / Tz;
// transition status 0 >> 1
if (F >= 1) break;
hhnew = ss_hh * (0.98 * F + 0.01);
// 0.01 to 0.99 * height
hhold = ss_hh - hhnew;
// 0.99 to 0.01 * height
pxbnew = PXB_rescale(ss_pxbnew,ss_ww,hhnew);
// squished new image, 2-98%
pxbold = PXB_rescale(ss_pxbold,ss_ww,hhold);
// squished old image, 98-2%
PXB_copy_area(pxbnew,0,0,ss_ww,hhnew,pxbmix,0,0);
// squished new image -> output image
PXB_copy_area(pxbold,0,0,ss_ww,hhold,pxbmix,0,hhnew);
// squished old image -> output image
PXB_free(pxbnew);
PXB_free(pxbold);
gdk_cairo_set_source_pixbuf(cr,pxbmix->pixbuf,0,0);
// output image
cairo_paint(cr);
zmainloop();
if (ss_escape) break;
}
gdk_cairo_set_source_pixbuf(cr,ss_pxbnew->pixbuf,0,0);
// output final image
cairo_paint(cr);
draw_context_destroy(draw_context);
PXB_free(pxbmix);
return;
}
// -----------------------------------------------------------------------------
-
// new image rotates over old image in many radial segments // new image rotates over old image in many radial segments
void ss_windmill() void ss_windmill()
{ {
int px, py; int px, py;
int ww2 = ss_ww/2, hh2 = ss_hh/2; int ww2 = ss_ww/2, hh2 = ss_hh/2;
float R, Rmax, T1, T2, T; float R, Rmax, T1, T2, T;
float cosT, sinT; float cosT, sinT;
uint8 *pixels1, *pixels3, *pix1, *pix3; uint8 *pixels1, *pixels3, *pix1, *pix3;
double T0, Te, Tz; double T0, Te, Tz;
skipping to change at line 6318 skipping to change at line 6248
return; return;
} }
// ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- -
// old image is divided into tiles. // old image is divided into tiles.
// tiles rotate in place to reveal new image on flip side. // tiles rotate in place to reveal new image on flip side.
void ss_fliptiles() // 22.30 void ss_fliptiles() // 22.30
{ {
int row, col, Nrows = 10, Ncols = 15; int row, col, Nrows = 10, Ncols = 15;
// rows and nominal columns // rows and nominal columns
int px, py, ww, hh, rw, rh; int px, py, ww, hh, rw, rh;
int nt1, nt2; int nt1, nt2;
char hv; ch hv;
struct tile_t { // tile data struct tile_t { // tile data
int px, py; int px, py;
// position // position
int ww, hh; int ww, hh;
// size // size
char hv; ch hv;
// horz or vert flip mode // horz or vert flip mode
}; };
tile_t tile1[200], tile2[200]; // Nrows * Ncols + extra tile_t tile1[200], tile2[200]; // Nrows * Ncols + extra
nt1 = 0; // tile1 count nt1 = 0; // tile1 count
for (row = 0; row < Nrows; row++) // generate tiles for (row = 0; row < Nrows; row++) // generate tiles
for (col = 0; ; col++) for (col = 0; ; col++)
{ {
if (col == 0) px = 0; // first tile in row at left edge if (col == 0) px = 0; // first tile in row at left edge
skipping to change at line 6564 skipping to change at line 6494
int cropw, croph, margw, margh, dm; int cropw, croph, margw, margh, dm;
float R1, R2, zoomnow; float R1, R2, zoomnow;
int orgx1, orgy1, orgx2, orgy2; int orgx1, orgy1, orgx2, orgy2;
int zcx1, zcy1, zcx2, zcy2; int zcx1, zcy1, zcx2, zcy2;
pthread_t tid; pthread_t tid;
} }
// initialize for image zoom out or zoom in // initialize for image zoom out or zoom in
// prepare 1x image, cropped or with added margins for window width/height rati o // prepare 1x image, cropped or with added margins for window width/height rati o
void ss_zoom_setup(char *file) void ss_zoom_setup(ch *file)
{ {
using namespace ss_zoom_names; using namespace ss_zoom_names;
if (pxb1) PXB_free(pxb1); if (pxb1) PXB_free(pxb1);
pxb1 = PXB_load(file,1); // load 1x image file pxb1 = PXB_load(file,1); // load 1x image file
if (! pxb1) return; if (! pxb1) return;
PXB_subalpha(pxb1); // strip alpha channel if present PXB_subalpha(pxb1); // strip alpha channel if present
 End of changes. 130 change blocks. 
331 lines changed or deleted 240 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)