Skip to content

Commit

Permalink
Merge pull request #6 from martinsmith1968/feature/tabbed-options-dialog
Browse files Browse the repository at this point in the history
Feature/tabbed options dialog
  • Loading branch information
martinsmith1968 authored Jan 7, 2020
2 parents 5d672a3 + 3f926fb commit 64619cd
Show file tree
Hide file tree
Showing 16 changed files with 490 additions and 153 deletions.
Binary file removed Docs/ConfigurationDialog.png
Binary file not shown.
Binary file added Docs/ConfigurationDialog1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/ConfigurationDialog2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/ConfigurationDialog3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/ConfigurationDialog4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions Docs/releasenotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes

## v1.6.2 - 2020-01-05

- Redesigned Configuration dialog to tabbed dialog
- Reformatted user options data file to have values in appropriate sections

## v1.6.1 - 2020-01-04

- Fixed issue with Restore Window Positions which would position Windows Settings screen when it wasn't visible before
Expand Down
1 change: 0 additions & 1 deletion Docs/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
- History list of Saved Window Positions
- History list of Saved Desktop Icon Positions
- Add icons to other context menu items
- Convert Configuration dialog to use Tabbed controls
- Auto-Save Window Positions on a schedule
- Auto-Save Desktop Icons on a schedule

Expand Down
173 changes: 173 additions & 0 deletions GuiSpike.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
cascadeGutterSize := 25
columnGutterSize := 10
gridGutterSize := 15
spanMonitorGutterSize := 20
restoreDesktopIconsOnStartup := true
restoreWindowPositionsOnStartup := true
windowPositionsIncludeOffScreenWindows := false
windowPositionsFilesToKeep := 19
desktopIconsFilesToKeep := 21

shit := "This.iscrap"

crap := Instr(shit, ".") ? StrSplit(shit, ".")[2] : shit

MsgBox,,, %crap%


ShowConfigGui()

return

BuildGui()
{
global cascadeGutterSize
global columnGutterSize
global gridGutterSize
global spanMonitorGutterSize
global restoreDesktopIconsOnStartup
global restoreWindowPositionsOnStartup
global MenuLocationValues
global windowPositionsIncludeOffScreenWindows
global windowPositionsFilesToKeep
global desktopIconsFilesToKeep

menuLocationItemsText := "None|Window Menu|Tray Menu|Both"

col1 := 20
col2 := 220
tabHeight := 40
rowHeight := 30
textOffSet := 3

row1 := tabHeight + (rowHeight * 0)
row2 := tabHeight + (rowHeight * 1)
row3 := tabHeight + (rowHeight * 2)
row4 := tabHeight + (rowHeight * 3)

row1t := row1 + textOffset
row2t := row2 + textOffset
row3t := row3 + textOffset
row4t := row4 + textOffset

Gui, Config:New, -SysMenu, Configuration
Gui, Config:Margin, 5, 5
Gui, Config:Add, Tab3, -Wrap w370 h230, General|Startup|Menu Control|Window Positions|Desktop Icons

; Tab 1 - General
Gui, Config:Tab, 1
; Row 1
Gui, Config:Add, Text, x%col1% y%row1t%, C&ascade Gutter Size:
Gui, Config:Add, Edit, x%col2% y%row1% w80 x%col2%
Gui, Config:Add, UpDown, vcascadeGutterSize Range0-100, %cascadeGutterSize%
; Row 2
Gui, Config:Add, Text, x%col1% y%row2t%, C&olumn Gutter Size:
Gui, Config:Add, Edit, w80 x%col2% y%row2%
Gui, Config:Add, UpDown, vcolumnGutterSize Range0-100, %columnGutterSize%
; Row 3
Gui, Config:Add, Text, x%col1% y%row3t%, &Grid Gutter Size:
Gui, Config:Add, Edit, w80 x%col2% y%row3%
Gui, Config:Add, UpDown, vgridGutterSize Range0-100, %gridGutterSize%
; Row 4
Gui, Config:Add, Text, x%col1% y%row4t%, Span &Monitor Gutter Size:
Gui, Config:Add, Edit, w80 x%col2% y%row4%
Gui, Config:Add, UpDown, vspanMonitorGutterSize Range0-100, %spanMonitorGutterSize%

; Tab 2 - Startup
Gui, Config:Tab, 2
; Row 1
Gui, Config:Add, Checkbox, x%col1% y%row1t% vrestoreWindowPositionsOnStartup Checked%restoreWindowPositionsOnStartup%, Restore Window &Positions on Startup
; Row 2
Gui, Config:Add, Checkbox, x%col1% y%row2t% vrestoreDesktopIconsOnStartup Checked%restoreDesktopIconsOnStartup%, Restore Desktop &Icons on Startup

; Tab 3 - Menu Control
Gui, Config:Tab, 3
; Row 1
Gui, Config:Add, Text, x%col1% y%row1t%, Window &Positions Menu Location:
Gui, Config:Add, DropDownList, x%col2% y%row1% vwindowPositionsMenuLocation AltSubmit Choose%windowPositionsMenuLocationChoice%, %menuLocationItemsText%
; Row 2
Gui, Config:Add, Text, x%col1% y%row2t%, Desktop &Icons Menu Location:
Gui, Config:Add, DropDownList, x%col2% y%row2% vdesktopIconsMenuLocation AltSubmit Choose%desktopIconsMenuLocationChoice%, %menuLocationItemsText%

; Tab 4 - Window Positions
Gui, Config:Tab, 4
; Row 1
Gui, Config:Add, Text, x%col1% y%row1t%, Number of saved files to &keep :
Gui, Config:Add, Edit, w80 x%col2% y%row1%
Gui, Config:Add, UpDown, vwindowPositionsFilesToKeep Range0-100, %windowPositionsFilesToKeep%
; Row 2
Gui, Config:Add, Checkbox, x%col1% y%row2t% vwindowPositionsIncludeOffScreenWindows Checked%windowPositionsIncludeOffScreenWindows%, Include Off-Screen Windows

; Tab 5 - Desktop Icons
Gui, Config:Tab, 5
; Row 1
Gui, Config:Add, Text, x%col1% y%row1t%, Number of saved files to &keep :
Gui, Config:Add, Edit, w80 x%col2% y%row1%
Gui, Config:Add, UpDown, vdesktopIconsFilesToKeep Range0-100, %desktopIconsFilesToKeep%

; Button Bar
Gui, Config:Tab
Gui, Config:Add, Button, default x205 y240 w80, OK ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Config:Add, Button, x295 y240 w80, Cancel ; The label ButtonCancel (if it exists) will be run when the button is pressed.
}

DestroyUserConfigGui()
{
Gui, Config:Destroy
}

ShowConfigGui()
{
global G_UserConfig

BuildGui()

Gui, Config:Show
}

ConfigGuiEscape:
{
DestroyUserConfigGui()
ExitApp
}

ConfigGuiClose:
{
DestroyUserConfigGui()
ExitApp
}

ConfigButtonCancel:
{
DestroyUserConfigGui()
ExitApp
}

ConfigButtonOK:
{
global cascadeGutterSize
global columnGutterSize
global gridGutterSize
global spanMonitorGutterSize
global restoreDesktopIconsOnStartup
global restoreWindowPositionsOnStartup
global MenuLocationValues
global windowPositionsIncludeOffScreenWindows

Gui, Config:Submit

G_UserConfig.CascadeGutterSize := cascadeGutterSize
G_UserConfig.ColumnGutterSize := columnGutterSize
G_UserConfig.GridGutterSize := gridGutterSize
G_UserConfig.SpanMonitorGutterSize := spanMonitorGutterSize
G_UserConfig.RestoreDesktopIconsOnStartup := restoreDesktopIconsOnStartup
G_UserConfig.RestoreWindowPositionsOnStartup := restoreWindowPositionsOnStartup
G_UserConfig.DesktopIconsMenuLocation := MenuLocationValues[desktopIconsMenuLocation]
G_UserConfig.WindowPositionsMenuLocation := MenuLocationValues[windowPositionsMenuLocation]
G_UserConfig.WindowPositions_IncludeOffScreenWindows := windowPositionsIncludeOffScreenWindows
G_UserConfig.Save()

DestroyUserConfigGui()

ExitApp
}
25 changes: 17 additions & 8 deletions Lib/UserConfig.ahk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Include Lib\UserDataUtils.ahk
#Include Lib\Logging.ahk
#Include Lib\UserDataUtils.ahk
#Include Lib\WindowPositions.ahk

;--------------------------------------------------------------------------------
Expand All @@ -13,8 +13,9 @@ UserConfig_OnInit()
; UserConfig base class
class UserConfig
{
Properties := []
DataFileName :=
Properties := []
ObsoleteProperties := []

__New(fileName)
{
Expand Down Expand Up @@ -60,9 +61,7 @@ class UserConfig

GetSectionNameFromFunc(func, defaultName := "General")
{
bits := StrSplit(func, ".")

sectionName := bits[2]
sectionName := Instr(func, ".") ? StrSplit(func, ".")[2] : func

if (sectionName =)
sectionName := func
Expand All @@ -78,9 +77,7 @@ class UserConfig

GetPropertyNameFromFunc(func)
{
bits := StrSplit(func, ".")

propertyName := bits[2]
propertyName := Instr(func, ".") ? StrSplit(func, ".")[2] : func

if (propertyName =)
propertyName := func
Expand All @@ -92,12 +89,24 @@ class UserConfig
return propertyName
}

RemoveProperty(section, propertyName)
{
dataFileName := this.DataFileName

LogText("Removing: [" . section . "]." . propertyName)
IniDelete, %dataFileName%, %section%, %propertyName%
}

Save()
{
for index, propertyName in this.Properties
{
value := this[propertyName]
this[propertyName] := value
}
for index, propertyName in this.ObsoleteProperties
{
this.RemoveProperty(this.GetSectionNameFromFunc(propertyName), this.GetPropertyNameFromFunc(propertyName))
}
}
}
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ Selecting any of the entries applies to the target window, shown at the top of t

A Configuration dialog, available from the tray icon, allows controlling some aspects of the functionality.

![Configuration Dialog](Docs/ConfigurationDialog.png)
![Configuration Dialog Tab 1](Docs/ConfigurationDialog1.png)

![Configuration Dialog Tab 2](Docs/ConfigurationDialog2.png)

![Configuration Dialog Tab 3](Docs/ConfigurationDialog3.png)

![Configuration Dialog Tab 4](Docs/ConfigurationDialog4.png)

## Features

Expand Down
2 changes: 1 addition & 1 deletion Setup/WindowMenu_Setup.iss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define AppName "WindowExtensions"
#define AppTitle "Window Extensions"
#define AppVersion "1.6.1"
#define AppVersion "1.6.2"

[Setup]
AppName={#AppName}
Expand Down
6 changes: 3 additions & 3 deletions TrayMenu.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ BuildTrayMenu()
menuIndex := AddMenuItemWithIcon(TrayMenuName, "Con&figure...", "TrayConfigureHandler", A_ScriptFullPath, 0, menuIndex)

; Window Positions
if (ContainsFlag(G_UserConfig.WindowPositionsMenuLocation, MenuLocationTrayMenu))
if (ContainsFlag(G_UserConfig.MenuControl_WindowPositionsMenuLocation, MenuLocationTrayMenu))
{
menuIndex := AddMenuItemSeparator(TrayMenuName, menuIndex)

Expand All @@ -58,7 +58,7 @@ BuildTrayMenu()
}

; Desktop Icons
if (ContainsFlag(G_UserConfig.DesktopIconsMenuLocation, MenuLocationTrayMenu))
if (ContainsFlag(G_UserConfig.MenuControl_DesktopIconsMenuLocation, MenuLocationTrayMenu))
{
menuIndex := AddMenuItemSeparator(TrayMenuName, menuIndex)

Expand All @@ -81,7 +81,7 @@ BuildTrayMenu()

;--------------------------------------------------------------------------------
TrayConfigureHandler:
ShowUserConfigGui()
ShowConfigGui()
return

;--------------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions WindowExtensions.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AppDescription := "Window Extensions Menu and HotKeys"
AppCopyright := "Copyright © 2020 Martin Smith"
AppNotes := "Concise and consistent control over Window Positions. Right-click right half of Window Caption bar to invoke, or hit WinKey-W"
AppURL := "https://github.com/martinsmith1968/WindowExtensions"
AppVersion := "1.6.1.0"
AppVersion := "1.6.2.0"

;--------------------------------------------------------------------------------
; Includes
Expand Down Expand Up @@ -54,7 +54,7 @@ OnExit, ExitHandler

;--------------------------------------------------------------------------------
; Auto-Execute section
OnInit() ; Perform module initialisation - not reliant on other modules
OnInit() ; Perform module initialisation - not reliant on other modules or globals
InitGlobals() ;
OnStartup() ; Perform module startup - may rely on other modules Init

Expand All @@ -64,7 +64,9 @@ return ; End of script's auto-execute section.
;--------------------------------------------------------------------------------
; Exit Handler
ExitHandler:
LogText("Raising OnExit...")
OnExit()
LogText("Exiting...")
; Must do this for the OnExit subroutine to actually Exit the script.
ExitApp

Expand Down
Loading

0 comments on commit 64619cd

Please sign in to comment.