I have started work on a settings mod for this script, and would like some input from the users on where to go from here.
This script is still in an early development stage, so you may want to back up your RM settings.ini file before running this script.
As is, it hasn't messed up my INI file, but I have not had much time to test it yet.
Currently you can view all items and add new items only.
The add items dialog retrieves any Images in their appropriate sub-folder for easy selection.
What I would like to know is which settings that are currently available should be seen as "General" or "Advanced", or if I should make separate tabs for other items.
Also, handling of setting the show hotkey is looking a bit tricky due to limitations on the Hotkey GUI control (does not allow mouse/joystick or win buttons). Any ideas on a workaround for that would be nice.
A third issue is the listing of items themselves, as they are just shown as Item1, Item2, Item3, etc. I would like to use the Name attribute of an item in the list, but if you set that, then you get text over your icons, so most people probably wouldn't like that.
I already have plans to allow editing, removing and sorting of items, and implementing all of the current options in their respective tabs once I have an idea of what should be considered general or advanced.
Please note that my version system is based off of the current version of RM to ease in compatibility tracking.
RMSettings.ahk:
Code:
;==================================================================================================
;
; RMSettings Mod
; By Elesar (brain.harder@gmail.com)
;
; Sections of this script are pulled from Radial Menu by Learning One (boris-mudrinic@net.hr)
;
;==================================================================================================
;
; Version History:
; 3.12a:
; Initial GUI complete
; LV lists all items found in INI, selecting an item displays its attributes
; Item additions and saving complete.
;
; Version Goals:
; 3.12b:
; Implement removal of items from listing
; Implement editing of existing items
; Implement re-ordering of items
; Implement General options
; Implement Advanced options
;
; 3.12:
; Initial testing release to AHK forums
;
; Future versions to follow official releases of Radial Menu
;
;===== System Setup =============================================================================
#SingleInstance Force
#NoEnv
SetBatchLines -1
#Include %A_ScriptDir%\RMdata\Gdip.ahk
Version := "3.12a" ; Use RM version number to ease compatability, letters indicate testing or coding phases.
INIFile := "RM settings.ini" ; For testing only, normally would be the same file
INIFile1 := "RM settings.ini"
;===== INI Read =================================================================================
INIRead, HKey, %INIFile%, General, RMShowHotkey, RButton
INIRead, ShowDelay, %INIFile%, General, ShowDelay, 220
INIRead, MenuBG, %INIFile%, General, MenuBackground, RMbackground.png
INIRead, MenuTrans, %INIFile%, General, MenuBackgroundTrans, 255
INIRead, ButtonBG, %INIFile%, General, ButtonBackground, black.png
INIRead, UseSound, %INIFile%, General, Sounds, 1
INIRead, ShowSound, %INIFile%, General, SoundOnShow, show.wav
INIRead, HoverSound, %INIFile%, General, SoundOnHover, hover.wav
INIRead, SelectSound, %INIFile%, General, SoundOnSelect, select.wav
INIRead, HideSound, %INIFile%, General, SoundOnHide, hide.wav
INIRead, SelectEffect, %INIFile%, General, SelectEffect, shake
INIRead, DestDelay, %INIFile%, General, DestroyDelay, 0
INIRead, Font, %INIFile%, General, Font, Arial
INIRead, TextSize, %INIFile%, General, TextSize, 12
INIRead, TextColor, %INIFile%, General, TextColor, FFFFFF
INIRead, TextAA, %INIFile%, General, TextAntialias, 1
INIRead, TextTrans, %INIFile%, General, TextTrans, DE
INIRead, Shadow, %INIFile%, General, Shadow, 1
INIRead, ShadowColor, %INIFile%, General, ShadowColor, 222222
INIRead, ButtonSize, %INIFile%, General, ButtonSize, 55
INIRead, MinWheelRadius, %INIFile%, General, MinWheelRadius, 50
INIRead, Licence, %INIFile%, General, LicenceAgreement, 0
;===== Gui ======================================================================================
Gui, Add, Button, x220 y265 w100 h20, OK
Gui, Add, Button, x320 y265 w100 h20, Cancel
Gui, Add, Tab2,x5 y5 w415 h255, Items|General|Advanced
Gui, Tab, Items
Gui, Add, Button, x10 y30 w100 h20 gAddItem Disabled vAddItem, Add Item
Gui, Add, ListView, x10 y50 w100 h200 gLVHandler -Hdr, INum|ItemName|Action|YPos|Icon|IconShrink|ToolTip|Background
Gui, Add, GroupBox, x115 y30 w300 h220, Item Attributes
Gui, Add, Text, x125 y50 w100 h20, Name:
Gui, Add, Edit, x210 y50 w195 h20 ReadOnly vIName,
Gui, Add, Text, x125 y70 w100 h20, Action:
Gui, Add, Edit, x210 y70 w195 h20 ReadOnly vIAction,
Gui, Add, Text, x125 y90 w100 h20, Y Pos:
Gui, Add, Edit, x210 y90 w195 h20 ReadOnly vIYPos,
Gui, Add, Text, x125 y110 w100 h20, Icon:
Gui, Add, Edit, x210 y110 w195 h20 ReadOnly vIIcon,
Gui, Add, Text, x125 y130 w100 h20, Icon Shrink:
Gui, Add, Edit, x210 y130 w195 h20 ReadOnly vIIShrink,
Gui, Add, Text, x125 y150 w100 h20, ToolTip:
Gui, Add, Edit, x210 y150 w195 h20 ReadOnly vITTip,
Gui, Add, Text, x125 y170 w100 h20, Background:
Gui, Add, Edit, x210 y170 w195 h20 ReadOnly vIBackground,
Gui, Tab, General
Gui, Add, Text, x10 y30 w405 h20 +Center, Still to come...
;Gui, Add, Text, x10 y30 w100 h20, Hotkey:
;Gui, Add, Hotkey, x110 y30 w100 h20 vHKey,%HKey% ; Needs workaround to allow mouse input and use of Win keys.
;Gui, Add, CheckBox, x10 y50 w200 h20 Checked%Sound% vSound, Use animation sounds.
Gui, Tab, Advanced
Gui, Add, Text, x10 y30 w405 h20 +Center, Still to come...
LV_ModifyCol(1, 75)
LV_ModifyCol(2, 0)
LV_ModifyCol(3, 0)
LV_ModifyCol(4, 0)
LV_ModifyCol(5, 0)
LV_ModifyCol(6, 0)
LV_ModifyCol(7, 0)
LV_ModifyCol(8, 0)
RefreshList()
Gui, Show, xCenter yCenter w425 h290, RMSettings v%Version%
Return
;===== Labels ===================================================================================
ButtonOK: ; Check all file operation commands, I used RM settings1.ini for testing
Gui, Submit, NoHide ; Get all options from General and Advanced tabs
IfExist, %INIFile1%
FileDelete, %INIFile1% ; Easiest way I could see of properly handling removal of items
FileAppend, ; Maintaining current INI file format :P
(
`;---------------------------------------------------------------------------------------------------
`;Items
`;---------------------------------------------------------------------------------------------------
), %INIFile1%
ItemCount := LV_GetCount()
Loop, %ItemCount%
{
LV_GetText(INum, A_Index, 1)
LV_GetText(IName, A_Index, 2)
LV_GetText(IAction, A_Index, 3)
LV_GetText(IYPos, A_Index, 4)
LV_GetText(IIcon, A_Index, 5)
LV_GetText(IIShrink, A_Index, 6)
LV_GetText(ITTip, A_Index, 7)
LV_GetText(IBGround, A_Index, 8)
ItemString := "`n[" . INum . "]`nName = " . IName . "`nAction = " . IAction . "`nYPosition = " . IYPos . "`nIcon = " . IIcon . "`nIconShrink = " . IIShrink . "`nTooltip = " . ITTip . "`nSpecialButtonBack = " . IBGround . "`n"
FileAppend, %ItemString%, %INIFile1%
}
FileAppend, ; Header for general tab settings
(
`;---------------------------------------------------------------------------------------------------
`;General
`;---------------------------------------------------------------------------------------------------
), %INIFile1%
INIWrite, %HKey%, %INIFile1%, General, RMShowHotkey
INIWrite, %ShowDelay%, %INIFile1%, General, ShowDelay
INIWrite, %MenuBG%, %INIFile1%, General, MenuBackground
INIWrite, %MenuTrans%, %INIFile1%, General, MenuBackgroundTrans
INIWrite, %ButtonBG%, %INIFile1%, General, ButtonBackground
INIWrite, %UseSound%, %INIFile1%, General, Sounds
INIWrite, %ShowSound%, %INIFile1%, General, SoundOnShow
INIWrite, %HoverSound%, %INIFile1%, General, SoundOnHover
INIWrite, %SelectSound%, %INIFile1%, General, SoundOnSelect
INIWrite, %HideSound%, %INIFile1%, General, SoundOnHide
INIWrite, %SelectEffect%, %INIFile1%, General, SelectEffect
INIWrite, %DestDelay%, %INIFile1%, General, DestroyDelay
INIWrite, %Font%, %INIFile1%, General, Font
INIWrite, %TextSize%, %INIFile1%, General, TextSize
INIWrite, %TextColor%, %INIFile1%, General, TextColor
INIWrite, %TextAA%, %INIFile1%, General, TextAntialias
INIWrite, %TextTrans%, %INIFile1%, General, TextTrans
INIWrite, %Shadow%, %INIFile1%, General, Shadow
INIWrite, %ShadowColor%, %INIFile1%, General, ShadowColor
INIWrite, %ButtonSize%, %INIFile1%, General, ButtonSize
INIWrite, %MinWheelRadius%, %INIFile1%, General, MinWheelRadius
INIWrite, %Licence%, %INIFile1%, General, LicenceAgreement
; FileAppend, ; Header for advanced tab settings
;(
;
;`;---------------------------------------------------------------------------------------------------
;`;Advanced
;`;---------------------------------------------------------------------------------------------------
;
;), %INIFile1%
ExitApp
Return
LVHandler: ; Populates Item Attributes fields when an item is selected in the LV
rowNum := LV_GetNext(0, "F")
LV_GetText(IName, rowNum, 2)
LV_GetText(IAction, rowNum, 3)
LV_GetText(IYPos, rowNum, 4)
LV_GetText(IIcon, rowNum, 5)
LV_GetText(IIShrink, rowNum, 6)
LV_GetText(ITTip, rowNum, 7)
LV_GetText(IBackground, rowNum, 8)
GuiControl,, IName, %IName%
GuiControl,, IAction, %IAction%
GuiControl,, IYPos, %IYPos%
GuiControl,, IIcon, %IIcon%
GuiControl,, IIShrink, %IIShrink%
GuiControl,, ITTip, %ITTip%
GuiControl,, IBackground, %IBackground%
Return
AddItem: ; Adds an item to the LV by displaying a form for the user to fill out
Gui, 1:+Disabled
IconList := "None|"
BBackList := "None|"
Loop, %A_ScriptDir%\Images\Icons\*.* ; get all images in the Icons folder for the user to select from
IconList := IconList . "|" . A_LoopFileName
Loop, %A_ScriptDir%\Images\Item backgrounds\*.* ; get all images in the Item backgrounds folder for the user to select from
BBackList := BBackList . "|" . A_LoopFileName
Gui, 2:+Toolwindow
Gui, 2:Add, Text, x5 y7 w70 h20, Name:
Gui, 2:Add, Edit, x75 y5 w150 h20 vNName,
Gui, 2:Add, Text, x5 y32 w70 h20, Action:
Gui, 2:Add, Edit, x75 y30 w130 h20 vNAction,
Gui, 2:Add, Button, x205 y30 w20 h20 gActionBrowse, ...
Gui, 2:Add, Text, x5 y57 w70 h20, Y Position:
Gui, 2:Add, Edit, x75 y55 w150 h20,
Gui, 2:Add, UpDown, vNYPos Range0-55, 20
Gui, 2:Add, Text, x5 y82 w70 h20, Icon:
Gui, 2:Add, DropDownList, x75 y80 w150 h20 r5 vNIcon, %IconList%
Gui, 2:Add, Text, x5 y107 w70 h20, Icon Shrink:
Gui, 2:Add, Edit, x75 y105 w150 h20,
Gui, 2:Add, UpDown, vNIShrink Range0-30, 10
Gui, 2:Add, Text, x5 y132 w70 h20, Tooltip:
Gui, 2:Add, Edit, x75 y130 w150 h20 vNTTip,
Gui, 2:Add, Text, x5 y157 w70 h20, Background:
Gui, 2:Add, DropDownList, x75 y155 w150 h20 r5 vNBBack, %BBackList%
Gui, 2:Add, Button, x5 y180 w110 h20 gAddOK, OK
Gui, 2:Add, Button, x115 y180 w110 h20 gAddCancel, Cancel
Gui, 2:Show, xCenter yCenter w230 h205, Add Item
Return
ActionBrowse:
FileSelectFile, NAction, 3, ::{20d04fe0-3aea-1069-a2d8-08002b30309d}, Select action to perform
GuiControl, 2:, NAction, %NAction%
Return
AddOK:
Gui, 1:-Disabled
Gui, Submit, NoHide
Gui, 1:Default
INum := "Item" . (LV_GetCount() + 1)
If (NIcon == "None")
NIcon :=
If (NBBack := "None")
NBBack :=
LV_Add("", INum, NName, NAction, NYPos, NIcon, NIShrink, NTTip, NBBack)
Gui, 2:Destroy
Return
ButtonCancel:
GuiClose:
ExitApp
AddCancel:
2GuiClose:
Gui, 1:-Disabled
Gui, 2:Destroy
Return
;===== Functions ================================================================================
RefreshList()
{
Global
;=== Count Items === This section mostly from Radial menu script, writen by Learning One
Loop, 49
{
INIRead, I%A_Index%Name, %INIFile%, Item%A_Index%, Name
If I%A_Index%Name = ERROR ; item Section and Key does not exist at all
{
TotalButtons := A_Index - 1
Break
}
Else If (I%A_Index%Name = "" ) ; Blank name
{
INIRead, I%A_Index%Icon, %INIFile%, Item%A_Index%, Icon
If I%A_Index%Icon = ; Blank Icon
{
TotalButtons := A_Index - 1 ; Auto set TotalButtons
Break
}
}
}
If TotalButtons =
TotalButtons = 48
;=== End Count Items ===
Loop, %TotalButtons%
{
INum := "Item" . A_Index
INIRead, IName, %INIFile%, Item%A_Index%, Name
INIRead, IAction, %INIFile%, Item%A_Index%, Action
INIRead, IYPos, %INIFile%, Item%A_Index%, YPosition
INIRead, IIcon, %INIFile%, Item%A_Index%, Icon
INIRead, IIShrink, %INIFile%, Item%A_Index%, IconShrink
INIRead, ITTip, %INIFile%, Item%A_Index%, ToolTip
INIRead, IBackground, %INIFile%, Item%A_Index%, SpecialButtonBack
LV_Add("", INum, IName, IAction, IYPos, IIcon, IIShrink, ITTip,IBackground)
}
If (TotalButtons < 48)
GuiControl, Enable, AddItem
}