"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "f.select.cc" between
fotoxx-22.41.tar.gz and fotoxx-22.50.tar.gz

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

f.select.cc  (fotoxx-22.41):f.select.cc  (fotoxx-22.50)
skipping to change at line 254 skipping to change at line 254
} }
// dialog event and completion callback function // dialog event and completion callback function
int select_dialog_event(zdialog *zd, cchar *event) int select_dialog_event(zdialog *zd, cchar *event)
{ {
int Nckevents = 8, ii, kk, cc; int Nckevents = 8, ii, kk, cc;
cchar *ckevents[8] = { "ckrect", "ckelips", "ckdraw", "ckfollow", "ckrepl" , cchar *ckevents[8] = { "ckrect", "ckelips", "ckdraw", "ckfollow", "ckrepl" ,
"ckmouse", "ckonecolor", "ckallcolors" }; "ckmouse", "ckonecolor", "ckallcolors" };
if (sa_edgecalc_busy) return 1; if (strmatch(event,"escape")) {
// block until done // escape key
if (sa_edgecalc_busy) Fescape = 2;
// kill edge calc. if busy
else zd->zstat = -2;
// kill dialog
}
if (strmatch(event,"escape")) zd->zstat = -2; // escape key if (sa_edgecalc_busy) return 1; // block until done
if (! curr_file) event = "done"; // image went away if (! curr_file) event = "done"; // image went away
if (FGWM != 'F') event = "done"; if (FGWM != 'F') event = "done";
if (strmatch(event,"done") || zd->zstat) // done or cancel if (strmatch(event,"done") || zd->zstat) // done or cancel
{ {
freeMouse(); // disconnect mouse function freeMouse(); // disconnect mouse function
zdialog_free(zd); // kill dialog zdialog_free(zd); // kill dialog
zd_sela = 0; zd_sela = 0;
if (sa_stat) { if (sa_stat) {
skipping to change at line 1986 skipping to change at line 1989
if (++nn > 2) goto break2; // > 2 edge neighbors, reject if (++nn > 2) goto break2; // > 2 edge neighbors, reject
if (! np1) np1 = jj; // edge neighbor 1 if (! np1) np1 = jj; // edge neighbor 1
else if (! np2) np2 = jj; // edge neighbor 2 else if (! np2) np2 = jj; // edge neighbor 2
} }
} }
break2: break2:
if (nn == 2) break; // found suitable edge pixel if (nn == 2) break; // found suitable edge pixel
} }
if (nn != 2 || np1 == 0 || np2 == 0) { // no edge pixel with 2 neighbor if (nn != 2 || np1 == 0 || np2 == 0) { // no edge pixel with 2 neighbor
zmessage_post(Mwin,"20/20",3,"cannot find area outline"); // edge pixels was found zmessage_post_bold(Mwin,"20/20",3,"cannot find area outline"); // edge pixels was found
goto cleanup; goto cleanup;
} }
sa_show(0,0); // hide area sa_show(0,0); // hide area
Fpaintnow(); Fpaintnow();
cr = draw_context_create(gdkwin,draw_context); cr = draw_context_create(gdkwin,draw_context);
pixmark = (char *) zmalloc(cc,"select_area"); // create pixel mark map pixmark = (char *) zmalloc(cc,"select_area"); // create pixel mark map
for (ff = 0; ff < 2; ff++) for (ff = 0; ff < 2; ff++)
skipping to change at line 3073 skipping to change at line 3076
int ii, nn, cc, px, py; int ii, nn, cc, px, py;
zdialog *zdp; zdialog *zdp;
if (! sa_stat) return; // area gone? if (! sa_stat) return; // area gone?
if (sa_edgecalc_done) return; // done already if (sa_edgecalc_done) return; // done already
if (sa_stat < 3) return; // area must be finished if (sa_stat < 3) return; // area must be finished
if (sa_stat != 3) return; // failed or canceled if (sa_stat != 3) return; // failed or canceled
if (sa_edgecalc_busy) return; // stop re-entry if (sa_edgecalc_busy) return; // stop re-entry
zdp = zmessage_post(Mwin,"mouse",0,"edge distance calculation"); zdp = zmessage_post_bold(Mwin,"mouse",0,"edge distance calculation");
sa_edgecalc_busy = 1; sa_edgecalc_busy = 1;
cc = Fpxb->ww * Fpxb->hh * sizeof(uint16); // allocate memory for calculations cc = Fpxb->ww * Fpxb->hh * sizeof(uint16); // allocate memory for calculations
sa_edgedist = (uint16 *) zmalloc(cc,"select_area"); sa_edgedist = (uint16 *) zmalloc(cc,"select_area");
for (ii = nn = 0; ii < Fpxb->ww * Fpxb->hh; ii++) // count edge pixels in select area for (ii = nn = 0; ii < Fpxb->ww * Fpxb->hh; ii++) // count edge pixels in select area
if (sa_pixmap[ii] == 1) nn++; if (sa_pixmap[ii] == 1) nn++;
cc = nn * sizeof(uint16); cc = nn * sizeof(uint16);
skipping to change at line 3118 skipping to change at line 3121
sa_edgepx[nn] = px; sa_edgepx[nn] = px;
sa_edgepy[nn] = py; sa_edgepy[nn] = py;
nn++; nn++;
} }
sa_Nedge = nn; sa_Nedge = nn;
progress_reset(sa_Npixel); // progress counter goal progress_reset(sa_Npixel); // progress counter goal
Fescape = 1; // escapable function 22.50
edgecalc_thread_busy = 1; edgecalc_thread_busy = 1;
start_detached_thread(edgecalc_thread,0); start_detached_thread(edgecalc_thread,0);
while (edgecalc_thread_busy) zmainsleep(0.1); // keep GTK alive while (edgecalc_thread_busy) zmainsleep(0.1); // keep GTK alive
progress_reset(0); progress_reset(0);
for (int ii = 0; ii < Fpxb->ww * Fpxb->hh; ii++) { // copy sa_edgedist[] to sa_pixmap[] for (int ii = 0; ii < Fpxb->ww * Fpxb->hh; ii++) { // copy sa_edgedist[] to sa_pixmap[]
if (sa_pixmap[ii] <= 1) continue; // skip outside and edge pixels if (sa_pixmap[ii] <= 1) continue; // skip outside and edge pixels
sa_pixmap[ii] = sa_edgedist[ii]; // interior pixel edge distance sa_pixmap[ii] = sa_edgedist[ii]; // interior pixel edge distance
} }
zdialog_free(zdp); zdialog_free(zdp);
zfree(sa_edgedist); // free memory zfree(sa_edgedist); // free memory
zfree(sa_edgepx); zfree(sa_edgepx);
zfree(sa_edgepy); zfree(sa_edgepy);
sa_edgecalc_done = 1; // edge calculation available sa_edgecalc_done = 1; // edge calculation available
if (Fescape > 1) sa_edgecalc_done = 0;
// canceled 22.50
Fescape = 0;
sa_edgecalc_busy = 0; sa_edgecalc_busy = 0;
return; return;
} }
void * edgecalc_thread(void *arg) // edgecalc thread function void * edgecalc_thread(void *arg) // edgecalc thread function
{ {
using namespace sa_edgecalc_names; using namespace sa_edgecalc_names;
void * edgecalc_wthread(void *arg); void * edgecalc_wthread(void *arg);
do_wthreads(edgecalc_wthread,NWT); // start worker threads do_wthreads(edgecalc_wthread,NWT); // do worker threads
edgecalc_thread_busy = 0; edgecalc_thread_busy = 0;
return 0; return 0;
} }
void * edgecalc_wthread(void *arg) // edgecalc worker thread function void * edgecalc_wthread(void *arg) // edgecalc worker thread function
{ {
using namespace sa_edgecalc_names; using namespace sa_edgecalc_names;
void edgecalc_func(int px, int py); void edgecalc_func(int px, int py);
 End of changes. 7 change blocks. 
6 lines changed or deleted 16 lines changed or added

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