Subversion Repositories filter_foundry

Compare Revisions

Regard whitespace Rev 77 → Rev 78

/trunk/ui.c
1,6 → 1,6
/*
This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop
Copyright (C) 2003-5 Toby Thain, toby@telegraphics.com.au
Copyright (C) 2003-7 Toby Thain, toby@telegraphics.com.au
 
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
71,12 → 71,14
}
 
for( i=0 ; i<4 ; ++i ){
if(!gdata->standalone) SETCTLTEXT(dp,FIRSTEXPRITEM+i,expr[i] ? expr[i] : "oups! expr[i] is nil!");
if(!gdata->standalone)
SETCTLTEXT(dp,FIRSTEXPRITEM+i,expr[i] ? expr[i] : "");
if(i<nplanes)
updateexpr(dp,FIRSTEXPRITEM+i);
}
 
if(!gdata->standalone) SELECTCTLTEXT(dp,FIRSTEXPRITEM,0,-1);
if(!gdata->standalone)
SELECTCTLTEXT(dp,FIRSTEXPRITEM,0,-1);
 
doupdates = true;
}
141,8 → 143,14
*q++ = '%';
*q = 0;
SETCTLTEXT(dp,ZOOMLEVELITEM,s);
zoomfactor > 1. ? ShowDialogItem(dp,ZOOMINITEM) : HideDialogItem(dp,ZOOMINITEM);
zoomfactor < fitzoom ? ShowDialogItem(dp,ZOOMOUTITEM) : HideDialogItem(dp,ZOOMOUTITEM);
if(zoomfactor > 1.)
ShowDialogItem(dp,ZOOMINITEM);
else
HideDialogItem(dp,ZOOMINITEM);
if(zoomfactor < fitzoom)
ShowDialogItem(dp,ZOOMOUTITEM);
else
HideDialogItem(dp,ZOOMOUTITEM);
}
 
/* traverse expression tree, looking for constant references to sliders */
149,8 → 157,9
 
int checksl(struct node*p,int ctlflags[],int mapflags[]);
int checksl(struct node*p,int ctlflags[],int mapflags[]){
int s;
 
if(p){
int s;
if( (p->kind==TOK_FN1 && p->v.sym->fn == (pfunc_type)ff_ctl)
|| (p->kind==TOK_FN3 && p->v.sym->fn == (pfunc_type)ff_val) ){
if(p->child[0]->kind == TOK_NUM){
254,18 → 263,22
 
/* hide unused expression items */
if(gdata->standalone){
myp2cstrcpy(s,gdata->parm.author); SetDlgItemText(dp,PARAMAUTHORITEM,s);
myp2cstrcpy(s,gdata->parm.copyright); SetDlgItemText(dp,PARAMCOPYITEM,s);
myp2cstrcpy(s,gdata->parm.author);
SetDlgItemText(dp,PARAMAUTHORITEM,s);
myp2cstrcpy(s,gdata->parm.copyright);
SetDlgItemText(dp,PARAMCOPYITEM,s);
// update labels for map() or ctl() sliders
for(i=0;i<8;++i){
if(gdata->parm.ctl_used[i]){
myp2cstrcpy(s,gdata->parm.ctl[i]); SetDlgItemText(dp,FIRSTCTLLABELITEM+i,s);
myp2cstrcpy(s,gdata->parm.ctl[i]);
SetDlgItemText(dp,FIRSTCTLLABELITEM+i,s);
}else if(gdata->parm.map_used[i/2]){
if(i&1)
HideDialogItem(dp,FIRSTCTLLABELITEM+i);
else{
myp2cstrcpy(s,gdata->parm.map[i/2]); SetDlgItemText(dp,FIRSTCTLLABELITEM+i,s);
myp2cstrcpy(s,gdata->parm.map[i/2]);
SetDlgItemText(dp,FIRSTCTLLABELITEM+i,s);
}
}else{
HideDialogItem(dp,FIRSTCTLITEM+i);
283,7 → 296,8
if(setup_preview(gpb)){
extern int preview_w,preview_h;
double zh = (gpb->filterRect.right-gpb->filterRect.left)/(double)preview_w,
zv = (gpb->filterRect.bottom-gpb->filterRect.top)/(double)preview_h,k;
zv = (gpb->filterRect.bottom-gpb->filterRect.top)/(double)preview_h,
k;
fitzoom = zh > zv ? zh : zv;
// On very large images, processing a fully zoomed out preview (the initial default)
329,24 → 343,23
 
switch(item){
case IDOK:
// updateglobals(dp);
case IDCANCEL:
dispose_preview();
return false; // end dialog
case OPENITEM:
if(!gdata->standalone && choosefiletypes("\pChoose filter settings",&sfr,&reply,types,2,
"All supported files (.AFS, .8BF, .TXT)\0*.AFS;*.8BF;*.TXT\0All files (*.*)\0*.*\0\0")){
"All supported files (.afs, .8bf, .txt)\0*.afs;*.8bf;*.txt\0All files (*.*)\0*.*\0\0")){
if(loadfile(&sfr,&reason)){
updatedialog(dp);
maindlgupdate(dp);
}else alertuser("Cannot load settings.",reason);
}else
alertuser("Cannot load settings.",reason);
}
break;
case SAVEITEM:
if(!gdata->standalone && putfile("\pSave filter settings",(StringPtr)"",
TEXT_FILETYPE,SIG_SIMPLETEXT,&reply,&sfr,
"AFS","Settings file (.AFS, .TXT)\0*.AFS;*.TXT\0\0",1)){
// updateglobals(dp);
"afs","Settings file (.afs, .txt)\0*.afs;*.txt\0\0",1)){
if(savefile(&sfr))
completesave(&reply);
}
359,7 → 372,7
#endif
if( putfile("\pMake standalone filter",fname,
PS_FILTER_FILETYPE,kPhotoshopSignature,&reply,&sfr,
"8BF","Filter plugin file (.8BF)\0*.8BF\0\0",1) )
"8bf","Filter plugin file (.8bf)\0*.8bf\0\0",1) )
make_standalone(&sfr);
}
break;
417,7 → 430,6
case FIRSTEXPRITEM+1:
case FIRSTEXPRITEM+2:
case FIRSTEXPRITEM+3:
// dbg("expritem hit");
if( (item-FIRSTEXPRITEM)<nplanes ){
updateexpr(dp,item);
maindlgupdate(dp);