Skip to content

Commit

Permalink
Update 1.21
Browse files Browse the repository at this point in the history
Updated settings dialog, taking locale settings into account. Added cleanup function: Remove hidden slides
  • Loading branch information
iappyx committed Jul 28, 2022
1 parent 3930f98 commit 5e712e8
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 55 deletions.
Binary file modified bin/InstrumentaPowerpointToolbar.ppam
Binary file not shown.
7 changes: 4 additions & 3 deletions src/CustomUI/CustomUI.xml
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,11 @@
<button id="cleaning3" label="Remove speaker notes from all slides" imageMso="Clear" onAction="CleanUpRemoveSpeakerNotesFromAllSlides" />
<button id="cleaning4" label="Remove comments from all slides" imageMso="Clear" onAction="CleanUpRemoveCommentsFromAllSlides" />
<button id="cleaning5" label="Remove unused master slides" imageMso="Clear" onAction="CleanUpRemoveUnusedMasterSlides" />
<button id="cleaning6" label="Remove hidden slides" imageMso="Clear" onAction="CleanUpRemoveHiddenSlides" />
<menuSeparator id="separatorConvertAnonymize" />
<button id="cleaning6" label="Convert slides to pictures (readonly)" imageMso="Clear" onAction="ConvertSlidesToPictures" />
<button id="cleaning7" label="Watermark and then convert slides to pictures (readonly)" imageMso="WatermarkCustomDialog" onAction="InsertWatermarkAndConvertSlidesToPictures" />
<button id="cleaning8" label="Anonymize slides with Lorem Ipsum" imageMso="Clear" onAction="AnonymizeWithLoremIpsum" />
<button id="cleaning7" label="Convert slides to pictures (readonly)" imageMso="Clear" onAction="ConvertSlidesToPictures" />
<button id="cleaning8" label="Watermark and then convert slides to pictures (readonly)" imageMso="WatermarkCustomDialog" onAction="InsertWatermarkAndConvertSlidesToPictures" />
<button id="cleaning9" label="Anonymize slides with Lorem Ipsum" imageMso="Clear" onAction="AnonymizeWithLoremIpsum" />
</menu>
<toggleButton idMso="SelectionPane" showLabel="false" />
<splitButton id="TagsSplitButton" size="normal" showLabel="false" tag="P" getVisible="InstrumentaGetVisible">
Expand Down
32 changes: 20 additions & 12 deletions src/Forms/SettingsForm.frm
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ Attribute VB_Exposed = False

Private Sub UserForm_Activate()

ShapeStepSizeMargin = GetSetting("Instrumenta", "Shapes", "ShapeStepSizeMargin", "0.2")
TableStepSizeMargin = GetSetting("Instrumenta", "Tables", "TableStepSizeMargin", "0.2")
TableStepSizeColumnGaps = GetSetting("Instrumenta", "Tables", "TableStepSizeColumnGaps", "1.0")
TableStepSizeRowGaps = GetSetting("Instrumenta", "Tables", "TableStepSizeRowGaps", "1.0")
ShapeStepSizeMargin = GetSetting("Instrumenta", "Shapes", "ShapeStepSizeMargin", "0" + GetDecimalSeperator() + "2")
TableStepSizeMargin = GetSetting("Instrumenta", "Tables", "TableStepSizeMargin", "0" + GetDecimalSeperator() + "2")
TableStepSizeColumnGaps = GetSetting("Instrumenta", "Tables", "TableStepSizeColumnGaps", "1" + GetDecimalSeperator() + "0")
TableStepSizeRowGaps = GetSetting("Instrumenta", "Tables", "TableStepSizeRowGaps", "1" + GetDecimalSeperator() + "0")
StickyNotesDefaultText = GetSetting("Instrumenta", "StickyNotes", "StickyNotesDefaultText", "Note")

If GetSetting("Instrumenta", "General", "OperatingMode", "pro") = "pro" Then
Expand All @@ -63,26 +63,26 @@ End Sub

Private Sub SaveSettingsButton_Click()

If ShapeStepSizeMargin = "" Or ShapeStepSizeMargin Like "*[!0-9.]*" Then
MsgBox ("Please enter data in the following format ###.#")
If ShapeStepSizeMargin = "" Or ShapeStepSizeMargin Like "*[!0-9" + GetDecimalSeperator() + "]*" Then
MsgBox ("Please enter data in the following format #" + GetDecimalSeperator() + "#")
ShapeStepSizeMargin.SetFocus
Exit Sub
End If

If TableStepSizeMargin = "" Or TableStepSizeMargin Like "*[!0-9.]*" Then
MsgBox ("Please enter data in the following format ###.#")
If TableStepSizeMargin = "" Or TableStepSizeMargin Like "*[!0-9" + GetDecimalSeperator() + "]*" Then
MsgBox ("Please enter data in the following format #" + GetDecimalSeperator() + "#")
TableStepSizeMargin.SetFocus
Exit Sub
End If

If TableStepSizeColumnGaps = "" Or TableStepSizeColumnGaps Like "*[!0-9.]*" Then
MsgBox ("Please enter data in the following format ###.#")
If TableStepSizeColumnGaps = "" Or TableStepSizeColumnGaps Like "*[!0-9" + GetDecimalSeperator() + "]*" Then
MsgBox ("Please enter data in the following format #" + GetDecimalSeperator() + "#")
TableStepSizeColumnGaps.SetFocus
Exit Sub
End If

If TableStepSizeRowGaps = "" Or TableStepSizeRowGaps Like "*[!0-9.]*" Then
MsgBox ("Please enter data in the following format ###.#")
If TableStepSizeRowGaps = "" Or TableStepSizeRowGaps Like "*[!0-9" + GetDecimalSeperator() + "]*" Then
MsgBox ("Please enter data in the following format #" + GetDecimalSeperator() + "#")
TableStepSizeRowGaps.SetFocus
Exit Sub
End If
Expand All @@ -109,6 +109,8 @@ Private Sub ShapeStepSizeMargin_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger

If KeyAscii = 46 Then
KeyAscii = 46
ElseIf KeyAscii = 44 Then
KeyAscii = 44
ElseIf KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
Expand All @@ -118,6 +120,8 @@ End Sub
Private Sub TableStepSizeMargin_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 46 Then
KeyAscii = 46
ElseIf KeyAscii = 44 Then
KeyAscii = 44
ElseIf KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
Expand All @@ -127,6 +131,8 @@ End Sub
Private Sub TableStepSizeColumnGaps_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 46 Then
KeyAscii = 46
ElseIf KeyAscii = 44 Then
KeyAscii = 44
ElseIf KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
Expand All @@ -136,6 +142,8 @@ End Sub
Private Sub TableStepSizeRowGaps_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 46 Then
KeyAscii = 46
ElseIf KeyAscii = 44 Then
KeyAscii = 44
ElseIf KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
Expand Down
Binary file modified src/Forms/SettingsForm.frx
Binary file not shown.
Binary file modified src/InstrumentaPowerpointToolbar.pptm
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Modules/ModuleAbout.bas
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Attribute VB_Name = "ModuleAbout"
Public InstrumentaVersion As String

Sub ShowAboutDialog()
InstrumentaVersion = "1.2"
InstrumentaVersion = "1.21"
AboutDialog.Label1.Caption = "Instrumenta Powerpoint Toolbar v" & InstrumentaVersion
AboutDialog.Show
End Sub
47 changes: 33 additions & 14 deletions src/Modules/ModuleCleanUp.bas
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Sub CleanUpRemoveUnusedMasterSlides()
On Error Resume Next

DesignsCount = ActivePresentation.Designs.Count

For NumberOfDesigns = ActivePresentation.Designs.Count To 1 Step -1

SetProgress ((DesignsCount - NumberOfDesigns) / DesignsCount * 100)
Expand All @@ -44,9 +44,9 @@ Sub CleanUpRemoveUnusedMasterSlides()
Next NumberOfDesigns

On Error GoTo 0

ProgressForm.Hide

End Sub

Sub CleanUpRemoveAnimationsFromAllSlides()
Expand All @@ -56,9 +56,9 @@ Sub CleanUpRemoveAnimationsFromAllSlides()
ProgressForm.Show

For Each PresentationSlide In ActivePresentation.Slides

SetProgress (PresentationSlide.SlideNumber / ActivePresentation.Slides.Count * 100)

SetProgress (PresentationSlide.SlideNumber / ActivePresentation.Slides.Count * 100)
For AnimationCount = PresentationSlide.TimeLine.MainSequence.Count To 1 Step -1
PresentationSlide.TimeLine.MainSequence.Item(AnimationCount).Delete
Next AnimationCount
Expand All @@ -75,9 +75,9 @@ Sub CleanUpRemoveSpeakerNotesFromAllSlides()
ProgressForm.Show

For Each PresentationSlide In ActivePresentation.Slides

SetProgress (PresentationSlide.SlideNumber / ActivePresentation.Slides.Count * 100)

SetProgress (PresentationSlide.SlideNumber / ActivePresentation.Slides.Count * 100)
For Each SlideShape In PresentationSlide.NotesPage.Shapes
If SlideShape.TextFrame.HasText Then
SlideShape.TextFrame.TextRange = ""
Expand All @@ -96,9 +96,9 @@ Sub CleanUpRemoveCommentsFromAllSlides()
ProgressForm.Show

For Each PresentationSlide In ActivePresentation.Slides

SetProgress (PresentationSlide.SlideNumber / ActivePresentation.Slides.Count * 100)

SetProgress (PresentationSlide.SlideNumber / ActivePresentation.Slides.Count * 100)
For CommentsCount = PresentationSlide.Comments.Count To 1 Step -1
PresentationSlide.Comments(1).Delete
Next
Expand All @@ -108,7 +108,6 @@ Sub CleanUpRemoveCommentsFromAllSlides()

End Sub


Sub CleanUpRemoveSlideShowTransitionsFromAllSlides()
Dim PresentationSlide As Slide

Expand All @@ -123,4 +122,24 @@ Sub CleanUpRemoveSlideShowTransitionsFromAllSlides()

End Sub


Sub CleanUpRemoveHiddenSlides()

ProgressForm.Show

NumberOfSlides = ActivePresentation.Slides.Count

For SlideLoop = ActivePresentation.Slides.Count To 1 Step -1

SetProgress ((NumberOfSlides - SlideLoop) / NumberOfSlides * 100)

If ActivePresentation.Slides(SlideLoop).SlideShowTransition.Hidden = msoTrue Then

ActivePresentation.Slides(SlideLoop).Delete

End If

Next

ProgressForm.Hide

End Sub
33 changes: 16 additions & 17 deletions src/Modules/ModuleFunctions.bas
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ Private Declare PtrSafe Function WindowsColorDialog Lib "comdlg32.dll" Alias "Ch
Private Const CC_SOLIDCOLOR = &H80
#End If


Function GetDecimalSeperator() As String

GetDecimalSeperator = Mid(CStr(1 / 2), 2, 1)

End Function

Function RemoveDuplicates(InputArray) As Variant

Dim OutputArray, InputValue, OutputValue As Variant
Expand Down Expand Up @@ -127,15 +134,6 @@ CheckIfAppleScriptPluginIsInstalled = 0

End Function

'This does not work well in all cases
'Function MacSendMailViaOutlook(subject As String, filepath As String)
'MacSendMailViaOutlookMacScript = "tell application ""Microsoft Outlook""" & vbNewLine & "set NewMail to (make new outgoing message with properties {subject:""" & subject & """})" & vbNewLine & _
'"tell NewMail" & vbNewLine & "set AttachmentPath to POSIX file """ & filepath & """" & vbNewLine & "make new attachment with properties {file:AttachmentPath as alias}" & vbNewLine & "Delay 0.5" & vbNewLine & _
'"end tell" & vbNewLine & "open NewMail" & vbNewLine & "Activate NewMail" & vbNewLine & "end tell" & vbNewLine & "return ""Done"""
'MacSendMailViaOutlook = MacScript(MacSendMailViaOutlookMacScript)
'End Function


#If Mac Then

Function ColorDialog(StandardColor As Variant) As Variant
Expand Down Expand Up @@ -172,13 +170,15 @@ Function ColorDialog(StandardColor As Variant) As Variant
PredefinedColors(ExtraColorCount - 1) = ActivePresentation.ExtraColors(ExtraColorCount)
Next
End If

PredefinedColors(10) = ActivePresentation.SlideMaster.Theme.ThemeColorScheme(msoThemeAccent1).RGB
PredefinedColors(11) = ActivePresentation.SlideMaster.Theme.ThemeColorScheme(msoThemeAccent2).RGB
PredefinedColors(12) = ActivePresentation.SlideMaster.Theme.ThemeColorScheme(msoThemeAccent3).RGB
PredefinedColors(13) = ActivePresentation.SlideMaster.Theme.ThemeColorScheme(msoThemeAccent4).RGB
PredefinedColors(14) = ActivePresentation.SlideMaster.Theme.ThemeColorScheme(msoThemeAccent5).RGB
PredefinedColors(15) = ActivePresentation.SlideMaster.Theme.ThemeColorScheme(msoThemeAccent6).RGB

With ActivePresentation.SlideMaster.Theme
PredefinedColors(10) = .ThemeColorScheme(msoThemeAccent1).RGB
PredefinedColors(11) = .ThemeColorScheme(msoThemeAccent2).RGB
PredefinedColors(12) = .ThemeColorScheme(msoThemeAccent3).RGB
PredefinedColors(13) = .ThemeColorScheme(msoThemeAccent4).RGB
PredefinedColors(14) = .ThemeColorScheme(msoThemeAccent5).RGB
PredefinedColors(15) = .ThemeColorScheme(msoThemeAccent6).RGB
End With

With ChooseColorType
.lStructSize = Len(ChooseColorType)
Expand All @@ -199,4 +199,3 @@ End Function

#End If


4 changes: 2 additions & 2 deletions src/Modules/ModuleObjectsText.bas
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ Sub ObjectsMarginsIncrease()
Else

Dim ShapeMarginSetting As Double
ShapeMarginSetting = CDbl(GetSetting("Instrumenta", "Shapes", "ShapeStepSizeMargin", "0.2"))
ShapeMarginSetting = CDbl(GetSetting("Instrumenta", "Shapes", "ShapeStepSizeMargin", "0" + GetDecimalSeperator() + "2"))


If myDocument.Selection.HasChildShapeRange Then
Expand Down Expand Up @@ -369,7 +369,7 @@ Sub ObjectsMarginsDecrease()
Else

Dim ShapeMarginSetting As Double
ShapeMarginSetting = CDbl(GetSetting("Instrumenta", "Shapes", "ShapeStepSizeMargin", "0.2"))
ShapeMarginSetting = CDbl(GetSetting("Instrumenta", "Shapes", "ShapeStepSizeMargin", "0" + GetDecimalSeperator() + "2"))

If myDocument.Selection.HasChildShapeRange Then

Expand Down
28 changes: 28 additions & 0 deletions src/Modules/ModuleSettings.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Attribute VB_Name = "ModuleSettings"
'MIT License

'Copyright (c) 2021 iappyx

'Permission is hereby granted, free of charge, to any person obtaining a copy
'of this software and associated documentation files (the "Software"), to deal
'in the Software without restriction, including without limitation the rights
'to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
'copies of the Software, and to permit persons to whom the Software is
'furnished to do so, subject to the following conditions:

'The above copyright notice and this permission notice shall be included in all
'copies or substantial portions of the Software.

'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
'IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
'FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
'AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
'LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
'OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
'SOFTWARE.

Sub DeleteAllInstrumentaSettings()
SaveSetting "Instrumenta", "temp", "temp", "temp"
DeleteSetting ("Instrumenta")
SettingsForm.Hide
End Sub
4 changes: 2 additions & 2 deletions src/Modules/ModuleTableMargins.bas
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Sub TablesMarginsIncrease()
If Application.ActiveWindow.Selection.ShapeRange.HasTable Then

Dim TableMarginSetting As Double
TableMarginSetting = CDbl(GetSetting("Instrumenta", "Tables", "TableStepSizeMargin", "0.2"))
TableMarginSetting = CDbl(GetSetting("Instrumenta", "Tables", "TableStepSizeMargin", "0" + GetDecimalSeperator() + "2"))

With Application.ActiveWindow.Selection.ShapeRange.Table

Expand Down Expand Up @@ -122,7 +122,7 @@ Sub TablesMarginsDecrease()
If Application.ActiveWindow.Selection.ShapeRange.HasTable Then

Dim TableMarginSetting As Double
TableMarginSetting = CDbl(GetSetting("Instrumenta", "Tables", "TableStepSizeMargin", "0.2"))
TableMarginSetting = CDbl(GetSetting("Instrumenta", "Tables", "TableStepSizeMargin", "0" + GetDecimalSeperator() + "2"))

With Application.ActiveWindow.Selection.ShapeRange.Table

Expand Down
8 changes: 4 additions & 4 deletions v/1.2.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## You are using the latest version of Instrumenta!
## There is a new version available!

If you want to re-download it:
- Direct download: https://github.com/iappyx/Instrumenta/raw/main/bin/InstrumentaPowerpointToolbar.ppam
- More info: https://github.com/iappyx/Instrumenta/
You can download it here: https://github.com/iappyx/Instrumenta/raw/main/bin/InstrumentaPowerpointToolbar.ppam

More info: https://github.com/iappyx/Instrumenta/
5 changes: 5 additions & 0 deletions v/1.21.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## You are using the latest version of Instrumenta!

If you want to re-download it:
- Direct download: https://github.com/iappyx/Instrumenta/raw/main/bin/InstrumentaPowerpointToolbar.ppam
- More info: https://github.com/iappyx/Instrumenta/

0 comments on commit 5e712e8

Please sign in to comment.