# HG changeset patch # User Santeri Piippo # Date 1373068374 -10800 # Node ID 75487752f3e6f3c60f4135607383f1b209cb54d6 # Parent 7af989362d4c40403cef7aaab202d6f0e3ae8b07 Completed Edger 2 interface diff -r 7af989362d4c -r 75487752f3e6 src/configDialog.cpp --- a/src/configDialog.cpp Sat Jul 06 02:30:48 2013 +0300 +++ b/src/configDialog.cpp Sat Jul 06 02:52:54 2013 +0300 @@ -24,6 +24,7 @@ #include #include #include +#include #include "common.h" #include "configDialog.h" @@ -203,11 +204,13 @@ extern_cfg( str, prog_intersector ); extern_cfg( str, prog_coverer ); extern_cfg( str, prog_isecalc ); +extern_cfg( str, prog_edger2 ); extern_cfg( bool, prog_ytruder_wine ); extern_cfg( bool, prog_rectifier_wine ); extern_cfg( bool, prog_intersector_wine ); extern_cfg( bool, prog_coverer_wine ); extern_cfg( bool, prog_isecalc_wine ); +extern_cfg( bool, prog_edger2_wine ); static const struct extProgInfo { @@ -221,15 +224,16 @@ #endif // _WIN32 } g_extProgInfo[] = { #ifndef _WIN32 -# define EXTPROG(NAME, LOWNAME) { #NAME, #LOWNAME, &prog_##LOWNAME, null, null, &prog_##LOWNAME##_wine, null }, +# define EXTPROG( NAME, LOWNAME ) { #NAME, #LOWNAME, &prog_##LOWNAME, null, null, &prog_##LOWNAME##_wine, null }, #else -# define EXTPROG(NAME, LOWNAME) { #NAME, #LOWNAME, &prog_##LOWNAME, null, null }, +# define EXTPROG( NAME, LOWNAME ) { #NAME, #LOWNAME, &prog_##LOWNAME, null, null }, #endif EXTPROG( Ytruder, ytruder ) EXTPROG( Rectifier, rectifier ) EXTPROG( Intersector, intersector ) EXTPROG( Isecalc, isecalc ) EXTPROG( Coverer, coverer ) + EXTPROG( Edger2, edger2 ) #undef EXTPROG }; diff -r 7af989362d4c -r 75487752f3e6 src/extprogs.cpp --- a/src/extprogs.cpp Sat Jul 06 02:30:48 2013 +0300 +++ b/src/extprogs.cpp Sat Jul 06 02:52:54 2013 +0300 @@ -597,14 +597,48 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -MAKE_ACTION( edger2, "Edger 2", "edger2", "Compute edgelines", 0 ) { - QDialog* form = new QDialog; +MAKE_ACTION( edger2, "Edger 2", "edger2", "Compute edgelines", 0 ) +{ + setlocale (LC_ALL, "C"); + + if( !checkProgPath( prog_edger2, Edger2 )) + return; + + QDialog* dlg = new QDialog; Ui::Edger2Dialog ui; - ui.setupUi( form ); + ui.setupUi( dlg ); + + if( !dlg->exec() ) + return; -exec: - if( !form->exec() ) + QTemporaryFile in, out; + str inName, outName; + + if( !mkTempFile( in, inName ) || !mkTempFile( out, outName )) return; + int unmatched = ui.unmatched->currentIndex(); + str argv = join({ + fmt( "-p %1", ui.precision->value() ), + fmt( "-af %1", ui.flatAngle->value() ), + fmt( "-ac %1", ui.condAngle->value() ), + fmt( "-ae %1", ui.edgeAngle->value() ), + ui.delLines->isChecked() ? "-de" : "", + ui.delCondLines->isChecked() ? "-dc" : "", + ui.colored->isChecked() ? "-c" : "", + ui.bfc->isChecked() ? "-b" : "", + ui.convex->isChecked() ? "-cx" : "", + ui.concave->isChecked() ? "-cv" : "", + unmatched == 0 ? "-u+" : ( unmatched == 2 ? "-u-" : "" ), + inName, + outName, + }); + + writeSelection( inName ); + + if( !runUtilityProcess( Edger2, prog_edger2, argv )) + return; + + insertOutput( outName, true, {} ); } \ No newline at end of file diff -r 7af989362d4c -r 75487752f3e6 src/ui/edger2.ui --- a/src/ui/edger2.ui Sat Jul 06 02:30:48 2013 +0300 +++ b/src/ui/edger2.ui Sat Jul 06 02:52:54 2013 +0300 @@ -6,7 +6,7 @@ 0 0 - 418 + 357 257 @@ -16,220 +16,216 @@ 1.000000000000000 - - - - 30 - 220 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 10 - 0 - 401 - 220 - - - - - - - - - Color-coded - - - - - - - Delete existing lines - - - - - - - Delete existing cond. lines - - - - - - - - - ° - - - 4 - - - 360.000000000000000 - - - 0.100000000000000 - - - 60.000000000000000 - - - - - - - Conditional line angle - - - - - - - ° - - - 4 - - - 360.000000000000000 - - - 0.100000000000000 - - - 60.000000000000000 - - - - - - - Flat angle - - - - - - - Edge line angle - - - - - - - - - - 4 - - - 0.001000000000000 - - - - - - - 1 - - - - Only - - - - - Normally - - - - - Never - - - - - - - - Precision - - - - - - - ° - - - 4 - - - 0.000000000000000 - - - 360.000000000000000 - - - 0.100000000000000 - - - 0.100000000000000 - - - - - - - Create unmatched edges - - - - - - - - - File is BFCd - - - - - - - false - - - Convex cond. lines only - - - - - - - false - - - Concave cond. lines only - - - - - - - + + + + + + + + + Precision + + + + + + + + + + 4 + + + 0.001000000000000 + + + + + + + ° + + + 4 + + + 0.000000000000000 + + + 360.000000000000000 + + + 0.100000000000000 + + + 0.100000000000000 + + + + + + + Flat angle + + + + + + + Conditional line angle + + + + + + + ° + + + 4 + + + 360.000000000000000 + + + 0.100000000000000 + + + 60.000000000000000 + + + + + + + ° + + + 4 + + + 360.000000000000000 + + + 0.100000000000000 + + + 60.000000000000000 + + + + + + + Edge line angle + + + + + + + 1 + + + + Only + + + + + Normally + + + + + Never + + + + + + + + Create unmatched edges + + + + + + + + + + + + + Color-coded result + + + + + + + Delete existing lines + + + + + + + Delete existing cond. lines + + + + + + + + + + + File is BFCd + + + + + + + false + + + Convex cond. lines only + + + + + + + false + + + Concave cond. lines only + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + @@ -240,12 +236,12 @@ accept() - 248 - 254 + 254 + 250 157 - 274 + 256 @@ -256,12 +252,44 @@ reject() - 316 - 260 + 322 + 250 286 - 274 + 256 + + + + + bfc + clicked(bool) + convex + setEnabled(bool) + + + 249 + 157 + + + 248 + 185 + + + + + bfc + clicked(bool) + concave + setEnabled(bool) + + + 283 + 154 + + + 283 + 205