2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Copyright ( c ) 2007 Pascal vd Heiden
/ *
* Copyright ( c ) 2007 Pascal vd Heiden , www . codeimp . com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* /
#endregion
#region = = = = = = = = = = = = = = = = = = Namespaces
using System.Windows.Forms ;
2014-03-19 13:03:47 +00:00
using CodeImp.DoomBuilder.Map ;
2009-04-19 18:07:22 +00:00
using CodeImp.DoomBuilder.Windows ;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
2014-10-22 13:07:17 +00:00
public partial class PreferencesForm : DelayedForm
2009-04-19 18:07:22 +00:00
{
#region = = = = = = = = = = = = = = = = = = Variables
#endregion
#region = = = = = = = = = = = = = = = = = = Properties
#endregion
#region = = = = = = = = = = = = = = = = = = Constructor / Disposer
// Contrustor
public PreferencesForm ( )
{
InitializeComponent ( ) ;
// Apply current settings to interface
heightbysidedef . SelectedIndex = General . Settings . ReadPluginSetting ( "changeheightbysidedef" , 0 ) ;
editnewthing . Checked = General . Settings . ReadPluginSetting ( "editnewthing" , true ) ;
editnewsector . Checked = General . Settings . ReadPluginSetting ( "editnewsector" , false ) ;
additiveselect . Checked = General . Settings . ReadPluginSetting ( "additiveselect" , false ) ;
2019-06-20 13:38:41 +00:00
additivepaintselect . Checked = General . Settings . ReadPluginSetting ( "additivepaintselect" , additiveselect . Checked ) ; // Use the same settign as additive select by default
2009-05-20 15:03:08 +00:00
stitchrange . Text = General . Settings . ReadPluginSetting ( "stitchrange" , 20 ) . ToString ( ) ;
highlightrange . Text = General . Settings . ReadPluginSetting ( "highlightrange" , 20 ) . ToString ( ) ;
highlightthingsrange . Text = General . Settings . ReadPluginSetting ( "highlightthingsrange" , 10 ) . ToString ( ) ;
splitlinedefsrange . Text = General . Settings . ReadPluginSetting ( "splitlinedefsrange" , 10 ) . ToString ( ) ;
2017-08-24 13:24:03 +00:00
mouseselectionthreshold . Text = General . Settings . ReadPluginSetting ( "mouseselectionthreshold" , 2 ) . ToString ( ) ;
2014-03-19 13:03:47 +00:00
splitbehavior . SelectedIndex = ( int ) General . Settings . SplitLineBehavior ; //mxd
2009-07-07 11:29:56 +00:00
autoclearselection . Checked = BuilderPlug . Me . AutoClearSelection ;
visualmodeclearselection . Checked = BuilderPlug . Me . VisualModeClearSelection ;
2009-07-12 11:14:34 +00:00
autodragonpaste . Checked = BuilderPlug . Me . AutoDragOnPaste ;
2013-03-18 13:52:27 +00:00
autoaligntexturesoncreate . Checked = BuilderPlug . Me . AutoAlignTextureOffsetsOnCreate ; //mxd
dontMoveGeometryOutsideBounds . Checked = BuilderPlug . Me . DontMoveGeometryOutsideMapBoundary ; //mxd
syncSelection . Checked = BuilderPlug . Me . SyncSelection ; //mxd
2016-06-06 21:06:01 +00:00
switchviewmodes . Checked = General . Settings . SwitchViewModes ; //mxd
2013-12-05 09:24:55 +00:00
autodrawonedit . Checked = BuilderPlug . Me . AutoDrawOnEdit ;
2013-11-22 09:35:25 +00:00
defaultbrightness . Text = General . Settings . DefaultBrightness . ToString ( ) ; //mxd
defaultceilheight . Text = General . Settings . DefaultCeilingHeight . ToString ( ) ; //mxd
defaultfloorheight . Text = General . Settings . DefaultFloorHeight . ToString ( ) ; //mxd
2020-04-04 16:03:40 +00:00
scaletexturesonslopes . SelectedIndex = General . Settings . ReadPluginSetting ( "scaletexturesonslopes" , 0 ) ;
2009-04-19 18:07:22 +00:00
}
#endregion
#region = = = = = = = = = = = = = = = = = = Events
// When OK is pressed on the preferences dialog
public void OnAccept ( PreferencesController controller )
{
// Write preferred settings
General . Settings . WritePluginSetting ( "changeheightbysidedef" , heightbysidedef . SelectedIndex ) ;
General . Settings . WritePluginSetting ( "editnewthing" , editnewthing . Checked ) ;
General . Settings . WritePluginSetting ( "editnewsector" , editnewsector . Checked ) ;
General . Settings . WritePluginSetting ( "additiveselect" , additiveselect . Checked ) ;
2019-06-20 13:38:41 +00:00
General . Settings . WritePluginSetting ( "additivepaintselect" , additivepaintselect . Checked ) ;
2009-05-20 15:03:08 +00:00
General . Settings . WritePluginSetting ( "stitchrange" , stitchrange . GetResult ( 0 ) ) ;
General . Settings . WritePluginSetting ( "highlightrange" , highlightrange . GetResult ( 0 ) ) ;
General . Settings . WritePluginSetting ( "highlightthingsrange" , highlightthingsrange . GetResult ( 0 ) ) ;
General . Settings . WritePluginSetting ( "splitlinedefsrange" , splitlinedefsrange . GetResult ( 0 ) ) ;
2017-08-24 13:24:03 +00:00
General . Settings . WritePluginSetting ( "mouseselectionthreshold" , mouseselectionthreshold . GetResult ( 0 ) ) ;
2009-07-07 11:29:56 +00:00
General . Settings . WritePluginSetting ( "autoclearselection" , autoclearselection . Checked ) ;
General . Settings . WritePluginSetting ( "visualmodeclearselection" , visualmodeclearselection . Checked ) ;
2009-07-12 11:14:34 +00:00
General . Settings . WritePluginSetting ( "autodragonpaste" , autodragonpaste . Checked ) ;
2013-12-05 09:24:55 +00:00
General . Settings . WritePluginSetting ( "autodrawonedit" , autodrawonedit . Checked ) ; //mxd
2013-03-18 13:52:27 +00:00
General . Settings . WritePluginSetting ( "autoaligntextureoffsetsoncreate" , autoaligntexturesoncreate . Checked ) ; //mxd
General . Settings . WritePluginSetting ( "dontmovegeometryoutsidemapboundary" , dontMoveGeometryOutsideBounds . Checked ) ; //mxd
General . Settings . WritePluginSetting ( "syncselection" , syncSelection . Checked ) ; //mxd
2020-04-04 16:03:40 +00:00
General . Settings . WritePluginSetting ( "scaletexturesonslopes" , scaletexturesonslopes . SelectedIndex ) ;
2016-06-06 21:06:01 +00:00
General . Settings . SwitchViewModes = switchviewmodes . Checked ; //mxd
2014-03-19 13:03:47 +00:00
General . Settings . SplitLineBehavior = ( SplitLineBehavior ) splitbehavior . SelectedIndex ; //mxd
2020-04-04 16:03:40 +00:00
2013-11-22 09:35:25 +00:00
//default sector values
General . Settings . DefaultBrightness = General . Clamp ( defaultbrightness . GetResult ( 192 ) , 0 , 255 ) ;
int ceilHeight = defaultceilheight . GetResult ( 128 ) ;
int floorHeight = defaultfloorheight . GetResult ( 0 ) ;
if ( ceilHeight < floorHeight ) General . Swap ( ref ceilHeight , ref floorHeight ) ;
General . Settings . DefaultCeilingHeight = ceilHeight ;
General . Settings . DefaultFloorHeight = floorHeight ;
2009-04-19 18:07:22 +00:00
}
2009-05-20 15:03:08 +00:00
2009-04-19 18:07:22 +00:00
// When Cancel is pressed on the preferences dialog
public void OnCancel ( PreferencesController controller )
{
}
#endregion
#region = = = = = = = = = = = = = = = = = = Methods
// This sets up the form with the preferences controller
public void Setup ( PreferencesController controller )
{
// Add tab pages
foreach ( TabPage p in tabs . TabPages )
{
controller . AddTab ( p ) ;
}
// Bind events
controller . OnAccept + = OnAccept ;
controller . OnCancel + = OnCancel ;
}
#endregion
2017-08-24 13:24:03 +00:00
2009-04-19 18:07:22 +00:00
}
}