VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "PlugIn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
' New Astronomy Press DeBloomer plug-in for MaxIm DL 3.07 or later.
' Copyright (c) 2002 Multimedia Madness, Inc.
'

Option Explicit

' MaxIm DL gives you a pointer to the currently selected MaxIm.Document
Public Sub DoModal(ByVal Doc As Maxim.Document)
    Randomize
    boolSaveSettings = False
    ' Call up the dialog box to get input
    On Error GoTo errHandler
    Set myDoc = Doc
    On Error GoTo 0
    DoEvents
    frmBloomRemoval.Show 1
    Exit Sub

errHandler:
    MsgBox "Could not receive image document from MaxIm DL" & vbCrLf & "Error " & Err.Number & ": " & Err.Description
    Exit Sub
End Sub

' Return the name which will appear on the MaxIm DL PlugIn menu
Public Property Get Name() As String
    Name = "New Astro DeBloomer"
End Property

Public Property Get saveSettings() As Boolean
    saveSettings = boolSaveSettings
End Property

Public Property Let saveSettings(inValue As Boolean)
    boolSaveSettings = inValue
End Property

Public Property Get bloomLimit() As Double
    bloomLimit = frmBloomRemoval.txtBloomLimit
End Property

Public Property Let bloomLimit(inValue As Double)
    frmBloomRemoval.txtBloomLimit = CStr(inValue)
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "txtBloomLimit", frmBloomRemoval.txtBloomLimit
    End If
End Property

Public Property Get starLimit() As Double
    starLimit = frmBloomRemoval.txtStarLimit
End Property

Public Property Let starLimit(inValue As Double)
    frmBloomRemoval.txtStarLimit = CStr(inValue)
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "txtStarLimit", frmBloomRemoval.txtStarLimit
    End If
End Property

Public Property Get fuzzyDistance() As Double
    fuzzyDistance = frmBloomRemoval.txtFillDistance
End Property

Public Property Let fuzzyDistance(inValue As Double)
    frmBloomRemoval.txtFillDistance = CStr(inValue)
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "txtFillDistance", frmBloomRemoval.txtFillDistance
    End If
End Property

Public Property Get iterations() As Double
    iterations = frmBloomRemoval.txtBloomIterations
End Property

Public Property Let iterations(inValue As Double)
    frmBloomRemoval.txtBloomIterations = CStr(inValue)
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "txtBloomIterations", frmBloomRemoval.txtBloomIterations
    End If
End Property

Public Property Get noiseFactor() As Double
    noiseFactor = frmBloomRemoval.txtNoiseFactor
End Property

Public Property Let noiseFactor(inValue As Double)
    frmBloomRemoval.txtNoiseFactor = CStr(inValue)
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "txtNoiseFactor", frmBloomRemoval.txtNoiseFactor
    End If
End Property

Public Property Get starFactor() As Double
    starFactor = frmOptions.txtStarFactor
End Property

Public Property Let starFactor(inValue As Double)
    frmOptions.txtStarFactor = CStr(inValue)
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "txtStarFactor", frmOptions.txtStarFactor
    End If
End Property

Public Property Get applyAll() As Integer
    applyAll = frmBloomRemoval.chkDoAll
End Property

Public Property Let applyAll(inValue As Integer)
    frmBloomRemoval.chkDoAll.Value = inValue
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "chkDoAll", frmBloomRemoval.chkDoAll.Value
    End If
End Property

Public Property Get fixByRotation() As Integer
    applyAll = frmOptions.chkRotate
End Property

Public Property Let fixByRotation(inValue As Integer)
    frmOptions.chkRotate.Value = inValue
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "chkRotate", frmOptions.chkRotate.Value
    End If
End Property

Public Property Get starRounding() As Integer
    starRounding = frmBloomRemoval.chkFixTopBottom
End Property

Public Property Let starRounding(inValue As Integer)
    frmBloomRemoval.chkFixTopBottom.Value = inValue
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "chkFixTopBottom", frmBloomRemoval.chkFixTopBottom.Value
    End If
End Property

Public Property Get fuzzyActive() As Integer
    fuzzyActive = frmBloomRemoval.chkFuzzy
End Property

Public Property Let fuzzyActive(inValue As Integer)
    frmBloomRemoval.chkFuzzy.Value = inValue
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "chkFuzzy", frmBloomRemoval.chkFuzzy.Value
    End If
End Property

Public Property Get autoLimits() As Integer
    autoLimits = frmBloomRemoval.chkAuto
End Property

Public Property Let autoLimits(inValue As Integer)
    frmBloomRemoval.chkAuto.Value = inValue
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "chkAuto", frmBloomRemoval.chkAuto.Value
    End If
End Property

Public Property Get starAdjustment() As Double
    starAdjustment = frmOptions.txtStarAdjust
End Property

Public Property Let starAdjustment(inValue As Double)
    frmOptions.txtStarAdjust = CStr(inValue)
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "txtStarAdjust", frmOptions.txtStarAdjust
    End If
End Property

Public Property Get displayRotatedStars() As Integer
    starAdjustment = frmOptions.chkNoStars.Value
End Property

Public Property Let displayRotatedStars(inValue As Integer)
    frmOptions.chkNoStars.Value = CStr(inValue)
    If boolSaveSettings Then
        SaveSetting "New Astro DeBloomer", "Resume", "chkNoStars", frmOptions.chkNoStars.Value
    End If
End Property

Public Property Get leftAdjustment() As Double
    leftAdjustment = frmOptions.txtLeftAdjust
End Property

Public Property Let leftAdjustment(inValue As Double)
    frmOptions.txtLeftAdjust = CStr(inValue)
End Property

Public Property Get rightAdjustment() As Double
    rightAdjustment = frmOptions.txtRightAdjust
End Property

Public Property Let rightAdjustment(inValue As Double)
    frmOptions.txtRightAdjust = CStr(inValue)
End Property

Public Property Get starSize() As Double
    starSize = frmOptions.txtStarSize
End Property

Public Property Let starSize(inValue As Double)
    frmOptions.txtStarSize = CStr(inValue)
End Property

Public Property Get autoIncrement() As Double
    autoIncrement = frmOptions.txtBloomIncrement
End Property

Public Property Let autoIncrement(inValue As Double)
    frmOptions.txtBloomIncrement = CStr(inValue)
End Property

Public Property Get minStarSize() As Double
    minStarSize = frmOptions.txtMinStarSize
End Property

Public Property Let minStarSize(inValue As Double)
    frmOptions.txtMinStarSize = CStr(inValue)
End Property

Public Sub deBloom(inDoc As Object)
    Set myDoc = inDoc
    deBloomValid = True
    frmBloomRemoval.checkNumeric frmBloomRemoval.txtBloomLimit, frmBloomRemoval.Label14
    frmBloomRemoval.checkNumeric frmBloomRemoval.txtStarLimit, frmBloomRemoval.Label17
    frmBloomRemoval.checkNumeric frmBloomRemoval.txtFillDistance, frmBloomRemoval.Label15
    frmBloomRemoval.checkNumeric frmBloomRemoval.txtBloomIterations, frmBloomRemoval.Label14
    frmBloomRemoval.checkNumeric frmBloomRemoval.txtNoiseFactor, frmBloomRemoval.Label18
    frmBloomRemoval.checkNumeric frmOptions.txtStarSize, frmOptions.Label16
    frmBloomRemoval.checkNumeric frmOptions.txtStarAggressiveness, frmOptions.Label4
    frmBloomRemoval.checkNumeric frmOptions.txtBloomIncrement, frmOptions.Label19
    If Not deBloomValid Then
        Exit Sub
    End If
    scriptingOn = True
    Set msgForm = frmMsg
    msgForm.Show 1
End Sub

