File size: 11,541 Bytes
7e970d3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// Rename a button // ///////////////////////////////////////////////////////////////////////////// // Rename a button // @buttonPath: the path of the button to be renamed // @str: the new button name [RoutineDef, ZFU_RenameButton, [If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]] [MemWriteString, ZFU_Mem_Temp, str] [FileExecute, [Var, dllPath], RenameButton, buttonPath,, ZFU_Mem_Temp] [MemDelete, ZFU_Mem_Temp] , buttonPath, str] /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// Dropdowns // ///////////////////////////////////////////////////////////////////////////// // Create a new Dropdown data (Dropdown is not shown, it's only the data) // @resultDropdown: the resulting dropdown (or more exactly dropdown id represented as an integer value) [RoutineDef, ZFU_DropdownNew, [VarSet, resDropdown, [FileExecute, [Var, dllPath], DropdownNew]] , resDropdown] // Delete a Dropdown (the Dropdown doesn't exist anymore after deletion) // @dropdown: the dropdown to delete [RoutineDef, ZFU_DropdownDelete, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownDelete] ] , dropdown] // Clear a Dropdown (the Dropdown still exists after clearing it, but it's empty) // @dropdown: the dropdown to clear [RoutineDef, ZFU_DropdownClear, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownClear] ] , dropdown] // Get the strings count in a Dropdown // @dropdown: the dropdown // @resCount: the resulting count [RoutineDef, ZFU_DropdownGetCount, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown], [VarSet, resCount, 0] , [VarSet, resCount, [FileExecute, [Var, dllPath], DropdownGetCount]] ] , dropdown, resCount] // Get a string in a Dropdown // @dropdown: the dropdown // @index2: the index2 in the dropdown list // @resStr: the resulting string [RoutineDef, ZFU_DropdownGet, [VarSet, str, ""] [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]] [If, [FileExecute, [Var, dllPath], DropdownGet,, index2, ZFU_Mem_Temp],, [MemReadString, ZFU_Mem_Temp, str] ] [MemDelete, ZFU_Mem_Temp] ] [VarSet, resStr, str] , dropdown, index2, resStr] // Set a string in a Dropdown // @dropdown: the dropdown // @index2: the index2 in the dropdown list // @str: the new string value [RoutineDef, ZFU_DropdownSet, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownSet, str, index2] ] , dropdown, index2, str] // Search for a string in a Dropdown // @dropdown: the dropdown // @str: the string to search for // @resIndex: the resulting index2 (-1 if not found) [RoutineDef, ZFU_DropdownFind, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown], [VarSet, resIndex, -1] , [VarSet, resIndex, [FileExecute, [Var, dllPath], DropdownFind, str]] ] , dropdown, str, resIndex] // Append a string at the end of a Dropdown // @dropdown: the dropdown // @str: the string to add [RoutineDef, ZFU_DropdownAdd, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownAdd, str] ] , dropdown, str] // Insert a string in a Dropdown // @dropdown: the dropdown // @index2: the index2 where to insert the string in the dropdown list (if index2 = list count, then the string is appended at the end) // @str: the string to insert [RoutineDef, ZFU_DropdownInsert, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownInsert, str, index2] ] , dropdown, index2, str] // Remove a string from the Dropdown // @dropdown: the dropdown // @index2: the index2 in the dropdown list [RoutineDef, ZFU_DropdownRemove, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownRemove,, index2] ] , dropdown, index2] // Set the selected string in a Dropdown // @dropdown: the dropdown // @index2: the index2 in the dropdown list [RoutineDef, ZFU_DropdownSelect, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [FileExecute, [Var, dllPath], DropdownSelect,, index2] ] , dropdown, index2] // Get the selected string in a Dropdown // @dropdown: the dropdown // @resIndex: the resulting index2 of the selected string in the dropdown list [RoutineDef, ZFU_DropdownGetSelected, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown], [VarSet, resIndex, -1] , [VarSet, resIndex, [FileExecute, [Var, dllPath], DropdownGetSelected]] ] , dropdown, resIndex] // Show/open a Dropdown and let the user selecting one of its strings // @dropdown: the dropdown // @buttonPath: the path to the button where to open the dropdown // @resIndex: the resulting index2 of the string selected by the user [RoutineDef, ZFU_DropdownShow, [If, [FileExecute, [Var, dllPath], DropdownLoad,, dropdown],, [VarSet, resIndex, [FileExecute, [Var, dllPath], DropdownShow, buttonPath]] ] , dropdown, buttonPath, resIndex] /////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////// Bypass renaming user input box // ///////////////////////////////////////////////////////////////////////////// // Set the name to use instead of asking to the user // @str: the text/string that will be substituted to the user input [RoutineDef, ZFU_RenameSetNext, [FileExecute, [Var, dllPath], RenameSetNext, str] , str] // Rename "something" by giving the path to the button that ask for the rename box // @buttonPath: the path of the button that asks the user to rename "something" // @str: the text/string that will be substituted to the user input [RoutineDef, ZFU_RenameFromButtonPath, [If, (([IExists, buttonPath]) && ([IsEnabled, buttonPath])), [FileExecute, [Var, dllPath], RenameSetNext, str] [IPress, buttonPath] ] , buttonPath, str] // Rename current SubTool // @str: the new SubTool name [RoutineDef, ZFU_RenameCurrentSubTool, [RoutineCall, ZFU_RenameFromButtonPath, "Tool:SubTool:Rename", str] , str] // Rename current Layer // @str: the new Layer name [RoutineDef, ZFU_RenameCurrentLayer, [RoutineCall, ZFU_RenameFromButtonPath, "Tool:Layers:Rename", str] , str] // Rename Transpose Units // @str: the new Transpose Units [RoutineDef, ZFU_RenameTransposeUnits, [RoutineCall, ZFU_RenameFromButtonPath, "Preferences:Transpose Units:Set Units", str] , str] /////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////// Create blank SubTool // ///////////////////////////////////////////////////////////////////////////// [RoutineDef, ZFU_AppendNewSubTool, [VarSet, resIndex, [FileExecute, [Var, dllPath], AppendNewSubTool, name]] , name, resIndex] /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////// Manage localization // ///////////////////////////////////////////////////////////////////////////// // Get current language // @returns the current language index2 [RoutineDef, ZFU_GetCurrentLanguage, [VarSet, lang, [FileExecute, [Var, dllPath], GetCurrentLanguage]] , lang] // Register localization files for the plugin // @enFilePath: path to the english xml localization file, must be formated "[name]en.xml" // other languages are deduced as being "[name]fr.xml", "[name]jp.xml", etc... [RoutineDef, ZFU_RegisterLocalizationFile, [FileExecute, [Var, dllPath], RegisterLocalizationFile, enFilePath] , enFilePath] // Localize a given text, tag or UI path // @text is in/out: // - as an input, it is used to search for the localized item // - as an output, it is replaced by the localized string // @text can refer to a tag, a UI path or be any untranslated text: // - a tag: if it's formated "#[tagname]" // - a path: if it's a valid path to a UI item // - any text: if it's not a tag nor a UI path, then it's considered as an untranslated text [RoutineDef, ZFU_LocalizeText, [If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]] [If, [FileExecute, [Var, dllPath], GetLocalizedText, text,, ZFU_Mem_Temp],, [MemReadString, ZFU_Mem_Temp, text] ] [MemDelete, ZFU_Mem_Temp] , text] // Localize a given title // @text is in/out: // - as an input, it is used to search for the localized item // - as an output, it is replaced by the localized string // @text can refer to a tag, a UI path or be any untranslated title: // - a tag: if it's formated "#[tagname]" // - a path: if it's a valid path to a UI item // - a title: if it's not a tag nor a UI path, then it's considered as an untranslated title [RoutineDef, ZFU_LocalizeTitle, [If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]] [If, [FileExecute, [Var, dllPath], GetLocalizedTitle, text,, ZFU_Mem_Temp],, [MemReadString, ZFU_Mem_Temp, text] ] [MemDelete, ZFU_Mem_Temp] , text] // Localize a given info // @text is in/out: // - as an input, it is used to search for the localized item // - as an output, it is replaced by the localized string // @text can refer to a tag, a UI path or be any untranslated info: // - a tag: if it's formated "#[tagname]" // - a path: if it's a valid path to a UI item // - a info: if it's not a tag nor a UI path, then it's considered as an untranslated info [RoutineDef, ZFU_LocalizeInfo, [If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]] [If, [FileExecute, [Var, dllPath], GetLocalizedInfo, text,, ZFU_Mem_Temp],, [MemReadString, ZFU_Mem_Temp, text] ] [MemDelete, ZFU_Mem_Temp] , text] // Localize a given descr // @text is in/out: // - as an input, it is used to search for the localized item // - as an output, it is replaced by the localized string // @text can refer to a tag, a UI path or be any untranslated descr: // - a tag: if it's formated "#[tagname]" // - a path: if it's a valid path to a UI item // - a descr: if it's not a tag nor a UI path, then it's considered as an untranslated description [RoutineDef, ZFU_LocalizeDescr, [If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]] [If, [FileExecute, [Var, dllPath], GetLocalizedDescr, text,, ZFU_Mem_Temp],, [MemReadString, ZFU_Mem_Temp, text] ] [MemDelete, ZFU_Mem_Temp] , text] // Localize a given descr // @text is in/out: // - as an input, it is used to search for the localized item // - as an output, it is replaced by the localized string // @text can refer to a tag, a UI path or be any untranslated descr: // - a tag: if it's formated "#[tagname]" // - a path: if it's a valid path to a UI item // - a descr: if it's not a tag nor a UI path, then it's considered as an untranslated description [RoutineDef, ZFU_StrReplaceArg, [If, [MemGetSize, ZFU_Mem_Temp],, [MemCreate, ZFU_Mem_Temp, 256]] [MemWriteString, ZFU_Mem_Temp, text] [If, [FileExecute, [Var, dllPath], StrReplaceArg, argText, argIndex, ZFU_Mem_Temp],, [MemReadString, ZFU_Mem_Temp, text] ] [MemDelete, ZFU_Mem_Temp] , text, argIndex, argText] |