summaryrefslogtreecommitdiff
path: root/app/bin/dease.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/bin/dease.c')
-rw-r--r--app/bin/dease.c97
1 files changed, 55 insertions, 42 deletions
diff --git a/app/bin/dease.c b/app/bin/dease.c
index 2b393db..4112c61 100644
--- a/app/bin/dease.c
+++ b/app/bin/dease.c
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "common.h"
@@ -29,6 +29,10 @@
#include "param.h"
#include "track.h"
+EXPORT DIST_T easementVal = 0.0;
+EXPORT DIST_T easeR = 0.0;
+EXPORT DIST_T easeL = 0.0;
+
static wButton_p easementB;
static DIST_T easeX = 0.0;
@@ -74,13 +78,14 @@ static paramData_t easementPLs[] = {
{ PD_FLOAT, &easeX, "x", PDO_DIM|PDO_DLGHORZ, &r0_10, N_("X"), BO_READONLY },
{ PD_FLOAT, &easeL, "l", PDO_DIM|PDO_DLGHORZ, &r0_100, N_("L"), BO_READONLY },
#define I_EASESEL (4)
- { PD_RADIO, &easeM, "radio", PDO_DIM|PDO_NORECORD|PDO_NOPREF|PDO_DLGRESETMARGIN, easementChoiceLabels, NULL, BC_HORZ|BC_NONE } };
+ { PD_RADIO, &easeM, "radio", PDO_DIM|PDO_NORECORD|PDO_NOPREF|PDO_DLGRESETMARGIN, easementChoiceLabels, NULL, BC_HORZ|BC_NONE }
+};
static paramGroup_t easementPG = { "easement", PGO_RECORD, easementPLs, COUNT( easementPLs ) };
static void SetEasement(
- DIST_T val,
- void * update )
+ DIST_T val,
+ void * update )
/*
* Set transition-curve parameters (R and L).
*/
@@ -101,14 +106,15 @@ static void SetEasement(
val = 0;
bm = enone_bm;
} else if (val <= 1.0) {
- if (val < 0.21) val = 0.21; //Eliminate values that give negative radii
+ if (val < 0.21) { val = 0.21; } //Eliminate values that give negative radii
z = 1.0/val - 1.0;
easeR = Rvalues[1] - z * (Rvalues[1] - Rvalues[0]);
easeL = Lvalues[1] - z * (Lvalues[1] - Lvalues[0]);
- if (easeR != 0.0)
+ if (easeR != 0.0) {
easeX = easeL*easeL/(24*easeR);
- else
+ } else {
easeX = 0.0;
+ }
if (val == 1.0) {
selVal = 2;
bm = enormal_bm;
@@ -126,10 +132,11 @@ static void SetEasement(
z = val - 1.0;
easeR = Rvalues[1] + z * (Rvalues[2] - Rvalues[1]);
easeL = Lvalues[1] + z * (Lvalues[2] - Lvalues[1]);
- if (easeR != 0.0)
+ if (easeR != 0.0) {
easeX = easeL*easeL/(24*easeR);
- else
+ } else {
easeX = 0.0;
+ }
if (val == 2.0) {
selVal = 3;
bm = ebroad_bm;
@@ -154,8 +161,9 @@ static void SetEasement(
}
/*ParamChange( &easeValPD );*/
- if (easementB)
+ if (easementB) {
wButtonSetLabel( easementB, (char*)bm );
+ }
}
@@ -175,7 +183,7 @@ static void EasementCancel( void )
static void EasementSel(
- long arg )
+ long arg )
/*
* Handle transition-curve parameter selection.
*/
@@ -198,7 +206,7 @@ static void EasementSel(
val = -1.0;
break;
default:
- AbortProg( "easementSel: bad value %ld", arg);
+ CHECKMSG( FALSE, ( "easementSel: bad value %ld", arg) );
val = 0.0;
break;
}
@@ -207,9 +215,9 @@ static void EasementSel(
static void EasementDlgUpdate(
- paramGroup_p pg,
- int inx,
- void * valueP )
+ paramGroup_p pg,
+ int inx,
+ void * valueP )
{
switch (inx) {
case I_EASEVAL:
@@ -223,21 +231,25 @@ static void EasementDlgUpdate(
static void LayoutEasementW(
- paramData_t * pd,
- int inx,
- wWinPix_t colX,
- wWinPix_t * x,
- wWinPix_t * y )
+ paramData_t * pd,
+ int inx,
+ wWinPix_t colX,
+ wWinPix_t * x,
+ wWinPix_t * y )
{
- if ( inx == 2 )
- wControlSetPos( easementPLs[0].control, *x, wControlGetPosY(easementPLs[0].control) );
+ if ( inx == 2 ) {
+ wControlSetPos( easementPLs[0].control, *x,
+ wControlGetPosY(easementPLs[0].control) );
+ }
}
static void DoEasement( void * unused )
{
if (easementW == NULL) {
- easementW = ParamCreateDialog( &easementPG, MakeWindowTitle(_("Easement")), _("Ok"), (paramActionOkProc)EasementOk, (paramActionCancelProc)EasementCancel, TRUE, LayoutEasementW, 0, EasementDlgUpdate );
+ easementW = ParamCreateDialog( &easementPG, MakeWindowTitle(_("Easement")),
+ _("Ok"), (paramActionOkProc)EasementOk, (paramActionCancelProc)EasementCancel,
+ TRUE, LayoutEasementW, 0, EasementDlgUpdate );
SetEasement( easementVal, I2VP(TRUE) );
}
oldEasementVal = easementVal;
@@ -258,31 +270,32 @@ static void EasementChange( long changes )
}
-#include "bitmaps/ease-none.xpm"
-#include "bitmaps/ease-sharp.xpm"
-#include "bitmaps/ease-gt-sharp.xpm"
-#include "bitmaps/ease-lt-sharp.xpm"
-#include "bitmaps/ease-normal.xpm"
-#include "bitmaps/ease-broad.xpm"
-#include "bitmaps/ease-gt-broad.xpm"
-#include "bitmaps/ease-lt-broad.xpm"
-#include "bitmaps/ease-cornu.xpm"
+#include "bitmaps/ease-none.xpm3"
+#include "bitmaps/ease-sharp.xpm3"
+#include "bitmaps/ease-gt-sharp.xpm3"
+#include "bitmaps/ease-lt-sharp.xpm3"
+#include "bitmaps/ease-normal.xpm3"
+#include "bitmaps/ease-broad.xpm3"
+#include "bitmaps/ease-gt-broad.xpm3"
+#include "bitmaps/ease-lt-broad.xpm3"
+#include "bitmaps/ease-cornu.xpm3"
EXPORT addButtonCallBack_t EasementInit( void )
{
ParamRegister( &easementPG );
- enone_bm = wIconCreatePixMap( ease_none_xpm[iconSize] );
- eltsharp_bm = wIconCreatePixMap( ease_ltsharp_xpm[iconSize] );
- esharp_bm = wIconCreatePixMap( ease_sharp_xpm[iconSize] );
- egtsharp_bm = wIconCreatePixMap( ease_gtsharp_xpm[iconSize] );
- enormal_bm = wIconCreatePixMap( ease_normal_xpm[iconSize] );
- eltbroad_bm = wIconCreatePixMap( ease_ltbroad_xpm[iconSize] );
- ebroad_bm = wIconCreatePixMap( ease_broad_xpm[iconSize] );
- egtbroad_bm = wIconCreatePixMap( ease_gtbroad_xpm[iconSize] );
- ecornu_bm = wIconCreatePixMap( ease_cornu_xpm[iconSize] );
- easementB = AddToolbarButton( "cmdEasement", enone_bm, 0, DoEasementRedir, NULL );
+ enone_bm = wIconCreatePixMap( ease_none_xpm3[iconSize] );
+ eltsharp_bm = wIconCreatePixMap( ease_lt_sharp_xpm3[iconSize] );
+ esharp_bm = wIconCreatePixMap( ease_sharp_xpm3[iconSize] );
+ egtsharp_bm = wIconCreatePixMap( ease_gt_sharp_xpm3[iconSize] );
+ enormal_bm = wIconCreatePixMap( ease_normal_xpm3[iconSize] );
+ eltbroad_bm = wIconCreatePixMap( ease_lt_broad_xpm3[iconSize] );
+ ebroad_bm = wIconCreatePixMap( ease_broad_xpm3[iconSize] );
+ egtbroad_bm = wIconCreatePixMap( ease_gt_broad_xpm3[iconSize] );
+ ecornu_bm = wIconCreatePixMap( ease_cornu_xpm3[iconSize] );
+ easementB = AddToolbarButton( "cmdEasement", enone_bm, 0, DoEasementRedir,
+ NULL );
RegisterChangeNotification( EasementChange );
return &DoEasement;