├── .gitattributes ├── .github └── FUNDING.yml ├── .gitignore ├── .vs └── config │ └── applicationhost.config ├── Changelog.txt ├── GameData └── 000_Toolbar │ ├── CHANGES.txt │ ├── LICENSE.txt │ ├── Localization │ ├── de_de.cfg │ ├── en-us.cfg │ ├── es-es.cfg │ ├── jp.cfg │ ├── pt-br.cfg │ ├── ru.cfg │ └── zh-cn.cfg │ ├── README.md │ ├── Toolbar.version │ ├── folder.png │ ├── move-cursor.png │ ├── new-button-available.png │ ├── resize-cursor.png │ ├── stockLeftButton.png │ ├── stockNormal.png │ ├── stockRightButton.png │ ├── toolbar-dropdown.png │ └── update-available.png ├── LICENSE.txt ├── README.md ├── TestButtons ├── BoxDrawable.cs ├── FlightMapVisibility.cs ├── Properties │ └── AssemblyInfo.cs ├── TestButtons.cs ├── TestButtons.csproj ├── TestButtons.csproj.173 ├── TestButtons.csproj.orig └── etc │ ├── icon.png │ └── img_buttonTypeMNode.png ├── Toolbar.sln ├── Toolbar.version ├── Toolbar.version.1-12-3 ├── Toolbar ├── API │ ├── ClickEvent.cs │ ├── ClickHandler.cs │ ├── FunctionDrawable.cs │ ├── FunctionVisibility.cs │ ├── GameScenesVisibility.cs │ ├── IButton.cs │ ├── IDrawable.cs │ ├── IToolbarManager.cs │ ├── IVisibility.cs │ ├── MouseEnterEvent.cs │ ├── MouseLeaveEvent.cs │ ├── MouseMoveEvent.cs │ ├── MouseMoveHandler.cs │ ├── PopupMenuDrawable.cs │ └── ToolbarManager.cs ├── AssemblyVersion.cs ├── AssemblyVersion.tt ├── CHANGES.txt ├── Internal │ ├── Extensions.cs │ ├── FloatCurveXY.cs │ ├── GUI │ │ ├── AbstractWindow.cs │ │ ├── ConfirmDialog.cs │ │ ├── CursorGrabbing.cs │ │ ├── DragEvent.cs │ │ ├── DragHandler.cs │ │ ├── Draggable.cs │ │ ├── DropMarker.cs │ │ ├── EditorLock.cs │ │ ├── IPopupMenuOption.cs │ │ ├── IconPickerDialog.cs │ │ ├── PopupMenu.cs │ │ ├── Rectangle.cs │ │ ├── Resizable.cs │ │ ├── Separator.cs │ │ ├── TextureMenuOption.cs │ │ └── WindowList.cs │ ├── InstallChecker.cs │ ├── KSPAddonFixed.cs │ ├── Log.cs │ ├── TextureScale.cs │ ├── Toolbar │ │ ├── Button.cs │ │ ├── ClickEvent.cs │ │ ├── Command.cs │ │ ├── CommandCreationCounter.cs │ │ ├── DestroyEvent.cs │ │ ├── DestroyHandler.cs │ │ ├── FolderSettings.cs │ │ ├── FolderSettingsDialog.cs │ │ ├── MouseEnterEvent.cs │ │ ├── MouseLeaveEvent.cs │ │ ├── MouseMoveEvent.cs │ │ ├── PopupMenuDrawable.cs │ │ ├── ScaleButtons.cs │ │ ├── Toolbar.cs │ │ ├── ToolbarGameScene.cs │ │ ├── ToolbarManager.cs │ │ ├── VisibleButtons.cs │ │ └── VisibleButtonsSelector.cs │ └── Utils.cs ├── LICENSE.txt ├── Properties │ └── AssemblyInfo.cs ├── Toolbar.csproj ├── Toolbar.csproj.173 ├── Toolbar.csproj.orig └── etc │ ├── folder.png │ ├── folder.psd │ ├── move-cursor.png │ ├── move-cursor.psd │ ├── new-button-available.png │ ├── new-button-available.psd │ ├── resize-cursor.png │ ├── resize-cursor.psd │ ├── toolbar-dropdown.png │ ├── toolbar-dropdown.psd │ ├── update-available.png │ └── update-available.psd ├── Wrapper ├── Properties │ └── AssemblyInfo.cs ├── ToolbarWrapper.cs ├── Wrapper.csproj ├── Wrapper.csproj.173 └── Wrapper.csproj.orig ├── buildRelease.bat ├── deploy.bat └── jenkins.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: linuxgurugamer 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | bld/ 16 | [Bb]in/ 17 | [Oo]bj/ 18 | 19 | # MSTest test Results 20 | [Tt]est[Rr]esult*/ 21 | [Bb]uild[Ll]og.* 22 | 23 | #NUNIT 24 | *.VisualState.xml 25 | TestResult.xml 26 | 27 | # Build Results of an ATL Project 28 | [Dd]ebugPS/ 29 | [Rr]eleasePS/ 30 | dlldata.c 31 | 32 | *_i.c 33 | *_p.c 34 | *_i.h 35 | *.ilk 36 | *.meta 37 | *.obj 38 | *.pch 39 | *.pdb 40 | *.pgc 41 | *.pgd 42 | *.rsp 43 | *.sbr 44 | *.tlb 45 | *.tli 46 | *.tlh 47 | *.tmp 48 | *.tmp_proj 49 | *.log 50 | *.vspscc 51 | *.vssscc 52 | .builds 53 | *.pidb 54 | *.svclog 55 | *.scc 56 | 57 | # Chutzpah Test files 58 | _Chutzpah* 59 | 60 | # Visual C++ cache files 61 | ipch/ 62 | *.aps 63 | *.ncb 64 | *.opensdf 65 | *.sdf 66 | *.cachefile 67 | 68 | # Visual Studio profiler 69 | *.psess 70 | *.vsp 71 | *.vspx 72 | 73 | # TFS 2012 Local Workspace 74 | $tf/ 75 | 76 | # Guidance Automation Toolkit 77 | *.gpState 78 | 79 | # ReSharper is a .NET coding add-in 80 | _ReSharper*/ 81 | *.[Rr]e[Ss]harper 82 | *.DotSettings.user 83 | 84 | # JustCode is a .NET coding addin-in 85 | .JustCode 86 | 87 | # TeamCity is a build add-in 88 | _TeamCity* 89 | 90 | # DotCover is a Code Coverage Tool 91 | *.dotCover 92 | 93 | # NCrunch 94 | *.ncrunch* 95 | _NCrunch_* 96 | .*crunch*.local.xml 97 | 98 | # MightyMoose 99 | *.mm.* 100 | AutoTest.Net/ 101 | 102 | # Web workbench (sass) 103 | .sass-cache/ 104 | 105 | # Installshield output folder 106 | [Ee]xpress/ 107 | 108 | # DocProject is a documentation generator add-in 109 | DocProject/buildhelp/ 110 | DocProject/Help/*.HxT 111 | DocProject/Help/*.HxC 112 | DocProject/Help/*.hhc 113 | DocProject/Help/*.hhk 114 | DocProject/Help/*.hhp 115 | DocProject/Help/Html2 116 | DocProject/Help/html 117 | 118 | # Click-Once directory 119 | publish/ 120 | 121 | # Publish Web Output 122 | *.[Pp]ublish.xml 123 | *.azurePubxml 124 | 125 | # NuGet Packages Directory 126 | packages/ 127 | ## TODO: If the tool you use requires repositories.config uncomment the next line 128 | #!packages/repositories.config 129 | 130 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 131 | # This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented) 132 | !packages/build/ 133 | 134 | # Windows Azure Build Output 135 | csx/ 136 | *.build.csdef 137 | 138 | # Windows Store app package directory 139 | AppPackages/ 140 | 141 | # Others 142 | sql/ 143 | *.Cache 144 | ClientBin/ 145 | [Ss]tyle[Cc]op.* 146 | ~$* 147 | *~ 148 | *.dbmdl 149 | *.dbproj.schemaview 150 | *.pfx 151 | *.publishsettings 152 | node_modules/ 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | *.mdf 166 | *.ldf 167 | 168 | # Business Intelligence projects 169 | *.rdl.data 170 | *.bim.layout 171 | *.bim_*.settings 172 | 173 | # Microsoft Fakes 174 | FakesAssemblies/ 175 | 176 | # ========================= 177 | # Operating System Files 178 | # ========================= 179 | 180 | # OSX 181 | # ========================= 182 | 183 | .DS_Store 184 | .AppleDouble 185 | .LSOverride 186 | 187 | # Icon must ends with two \r. 188 | Icon 189 | 190 | 191 | # Thumbnails 192 | ._* 193 | 194 | # Files that might appear on external disk 195 | .Spotlight-V100 196 | .Trashes 197 | 198 | # Windows 199 | # ========================= 200 | 201 | # Windows image file caches 202 | Thumbs.db 203 | ehthumbs.db 204 | 205 | # Folder config file 206 | Desktop.ini 207 | 208 | # Recycle Bin used on file shares 209 | $RECYCLE.BIN/ 210 | 211 | # Windows Installer files 212 | *.cab 213 | *.msi 214 | *.msm 215 | *.msp 216 | 217 | # 218 | # Vim files 219 | # 220 | *~ 221 | *.swp 222 | *.dll 223 | *.pdb 224 | .idea/ksp_toolbar.iml 225 | .idea/misc.xml 226 | .idea/modules.xml 227 | .idea/vcs.xml 228 | .idea/workspace.xml 229 | .vs 230 | -------------------------------------------------------------------------------- /Changelog.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.7.15 4 | Adoption by LGG 5 | Rebuild for 1.3.1 6 | 7 | 1.7.16 8 | Localization beta, thanks to forum user @CN_Warren 9 | Updated build scripts 10 | Added jenkins config 11 | Moved dll into Plugins folder 12 | 13 | 1.7.16.1 14 | Localization files were missing 15 | 16 | 1.7.16.2 17 | Updated localization file 18 | Split localizations into individual files 19 | Updated About url 20 | Updated check for correct path 21 | 22 | 1.7.16.3 23 | Added german translation, by github user @mwerle 24 | 25 | 1.7.16.4 26 | Added spanish translation, thanks to forum user @fitiales 27 | 28 | 1.7.16.5 29 | Updated spanish translated, release 30 | 31 | 1.7.17 32 | Updated for 1.4.1 33 | 34 | 1.7.17.1 35 | Added code to load textures manually, since Unity tries to compress them in the db 36 | 37 | 1.7.17.2 38 | Disabled cursor switching on Linux only 39 | 40 | 1.7.17.3 41 | Added dds to the file types to look for in icon image files 42 | Fixed fuzzy buttons 43 | 44 | 1.7.17.4 45 | Added back support for textures loaded by mods and not from a file 46 | 47 | 48 | 1.7.17.5 49 | Thanks to forum user @Jebs_SY, fixed an old, annoying but essentially harmless exception in the logs 50 | where the layout was changed between Layout and Repaint 51 | 52 | 1.7.17.6 53 | Removed log spam when textures are loaded by mod and not from a file 54 | 55 | 1.7.17.7 56 | Updated .version info for 1.4.* 57 | 58 | 1.7.17.8 59 | Fixed texture when file exists 60 | 61 | 1.7.17.9 62 | Fixed path check for texture 63 | 64 | 1.7.17.10 65 | Fixed nullref when in the MissionBuilder 66 | 67 | 1.7.17.11 68 | Added Portugese trnaslation, thanks @Brendo102x 69 | 70 | 1.7.17.12 71 | Version bump for 1.5 rebuild 72 | 73 | 1.7.17.13 74 | Version bump to fix .version file 75 | 76 | 1.7.17.14 77 | Thanks to github user @PiezPiedPy, fixes an exception which occurred before the MainMenu 78 | 79 | 1.7.18 80 | Minor change to add the ClickThroughBlocker 81 | 82 | 1.7.19 83 | Added unblur as a hard dependency 84 | Thanks to (github: @Cake-Pie, KSP: cakepie) for changes to both fix blurring and needless reading of the disk 85 | Removed the version check 86 | 87 | 1.7.19.1 88 | Minor update to version file 89 | 90 | 1.7.20 91 | Re-enabled the InstallChecker 92 | Added button scaling (currently on a per-screen basis) 93 | Added BigTexturePath for larger icons (better resolution) 94 | Added window to control scaling 95 | Added scaling to go along with the stock UI and stock UI APP scaling 96 | Removed the hard dependency on the unBlur mod. It will use the unBlur if it's here, otherwise will read the file 97 | 98 | 1.7.21 99 | Removed UnBlur entirely 100 | Fixes purple buttons 101 | 102 | 1.7.22 103 | Fixed purple buttons from mods which add textures to the game database at runtime without a file (looking at [x]Science!) 104 | Optimized the Texture code a bit to eliminate duplicated code 105 | Changed resize from Bilinear to Point 106 | Added check for textures being resized to same size and returns if so without doing anything 107 | Added check for small icon (24x24) when bigtexture is available, if it is and a small texture is available, use that instead 108 | 109 | 1.7.22.1 110 | Fixed nullref when loading buttons 111 | Fixed check for file existance 112 | 113 | 1.7.22.2 114 | Fixed issue with ScienceAlert & X-Science buttons on the toolbar being purple 115 | 116 | 1.8.0.0 117 | Updated for 1.8 118 | Added Startup class 119 | 120 | 1.8.0.1 121 | Fixed buttons not displaying due to a change in the way floats are compared 122 | 123 | 1.8.0.2 124 | Updated MiniAVC to 1.4.0 125 | 126 | 1.8.0.3 127 | Fixed buttons disappearing, related to previoius issue with buttons not displaying 128 | Replaced "initted" flag with a nullable variable in Button.cs 129 | 130 | 1.8.0.4 131 | Updated MiniAVC.dll to 1.4.0.2 to fix a nasty CTD 132 | 133 | 1.8.0.5 134 | Really did the MiniAVC update 135 | 136 | 1.8.0.6 137 | Created new constant Utils.RootPath to replace the KSPUtil.ApplicationRootPath 138 | Renamed DLL for CKAN compatibility 139 | Added AssemblyFileVersion 140 | Updated version file for 1.12 141 | 142 | 1.8.0.7 143 | Reverted DLL renaming 144 | 145 | 1.8.0.8 146 | Thanks to github user @KvaNTy for this: 147 | On loading settings, code was checking wrong file-path for texture. 148 | And when dragging buttons into folder, code for saving folder's icon been forgotten. 149 | 150 | 1.8.1 151 | Thanks to github user @radj307 for this: 152 | Completely rewrote the image loading and path resolution functions used by Utils.cs 153 | 154 | 1.8.1.1 155 | Disabled log spam of unnecessary warning and info messages 156 | 157 | 1.8.1.2 158 | Fix version file to use github for version updates 159 | Copy webpage to README.md 160 | -------------------------------------------------------------------------------- /GameData/000_Toolbar/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014, Maik Schreiber 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /GameData/000_Toolbar/Localization/de_de.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/GameData/000_Toolbar/Localization/de_de.cfg -------------------------------------------------------------------------------- /GameData/000_Toolbar/Localization/en-us.cfg: -------------------------------------------------------------------------------- 1 | Localization 2 | { 3 | 4 | en-us 5 | { 6 | #TOOLBAR_UI_OK = OK 7 | #TOOLBAR_UI_CANCEL = Cancel 8 | #TOOLBAR_UI_FOLDER_SETTINGS = Folder Settings 9 | #TOOLBAR_UI_BUTTON_ICON = Button icon: 10 | #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= Button tooltip text: 11 | #TOOLBAR_UI_SELECT_ICON = Select Icon 12 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = Configure Visible Buttons... 13 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS_HINT = Configure Visible Toolbar Buttons 14 | 15 | #TOOLBAR_UI_CONFIGURE_SCALE = Configure Scaling... 16 | #TOOLBAR_UI_CONFIGURE_SCALE_HINT = Configure Button Size 17 | #TOOLBAR_UI_SCALE_VISIBLE_TITLE = Adjust Button Scaling 18 | #TOOLBAR_UI_SCALE_FOLLOW_APP_SCALE = Follow KSP App scale 19 | #TOOLBAR_UI_SCALE_FOLLOW_UI_SCALE = Follow KSP UI Scale 20 | #TOOLBAR_UI_SCALE_USE_SLIDER = Use slider to adjust scale 21 | 22 | #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = Unlock Position and Size 23 | #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = Lock Position and Size 24 | #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = Unlock Button Order 25 | #TOOLBAR_UI_LOCK_BUTTON_ORDER = Lock Button Order 26 | #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = Deactivate Auto-Hide at Screen Edge 27 | #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = Activate Auto-Hide at Screen Edge 28 | #TOOLBAR_UI_HIDE_BORDER = Hide Border 29 | #TOOLBAR_UI_SHOW_BORDER = Show Border 30 | #TOOLBAR_UI_UNITY_SKIN = Use Unity 'Smoke' Skin 31 | #TOOLBAR_UI_KSP_SKIN = Use KSP Skin 32 | #TOOLBAR_UI_CREATE_NEW_FOLDER = Create New Folder... 33 | #TOOLBAR_UI_CREATE_NEW_TOOLBAR = Create New Toolbar 34 | #TOOLBAR_UI_DELETE_TOOLBAR = Delete Toolbar... 35 | #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = Delete Toolbar 36 | #TOOLBAR_UI_DELETE_TOOLBAR_HINT = Delete this toolbar? 37 | #TOOLBAR_UI_ABOUT = About the Toolbar Plugin... 38 | #TOOLBAR_UI_NEW_FOLDER = New Folder 39 | #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = Edit Folder Settings 40 | #TOOLBAR_UI_DELETE_FOLDER = Delete Folder 41 | #TOOLBAR_UI_DELETE_FOLDER_HINT = Delete this folder? Buttons inside the folder will be moved to the main toolbar. 42 | #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = Toolbar Button Visibility 43 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = Configure which buttons should be visible in the current game scene. 44 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = Note: Plugins may still decide to hide buttons from any game scene even if those buttons are active here. 45 | #TOOLBAR_UI_CLOSE = Close 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /GameData/000_Toolbar/Localization/es-es.cfg: -------------------------------------------------------------------------------- 1 | Localization 2 | { 3 | 4 | es-es 5 | { 6 | #TOOLBAR_UI_OK = OK 7 | #TOOLBAR_UI_CANCEL = Cancelar 8 | #TOOLBAR_UI_FOLDER_SETTINGS = Configuración de carpeta 9 | #TOOLBAR_UI_BUTTON_ICON = Icono del botón: 10 | #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= Texto informativo sobre herramientas del botón: 11 | #TOOLBAR_UI_SELECT_ICON = Seleccionar Icono 12 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = Configurar botones visibles... 13 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS_HINT = Configurar botones en barra de herramientas visibles 14 | 15 | #TOOLBAR_UI_CONFIGURE_SCALE = Configure Scaling... 16 | #TOOLBAR_UI_CONFIGURE_SCALE_HINT = Configure Button Size 17 | #TOOLBAR_UI_SCALE_VISIBLE_TITLE = Adjust Button Scaling 18 | #TOOLBAR_UI_SCALE_FOLLOW_APP_SCALE = Follow KSP App scale 19 | #TOOLBAR_UI_SCALE_FOLLOW_UI_SCALE = Follow KSP UI Scale 20 | #TOOLBAR_UI_SCALE_USE_SLIDER = Use slider to adjust scale 21 | 22 | #TOOLBAR_UI_CONFIGURE_SCALE_HINT = Configure Button Size 23 | #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = Desbloquear posición y tamaño 24 | #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = Bloquear posición y tamaño 25 | #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = Desbloquear orden de botones 26 | #TOOLBAR_UI_LOCK_BUTTON_ORDER = Bloquear orden de botones 27 | #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = Desactivar auto-ocultar en borde de pantalla 28 | #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = Activar auto-ocultar en borde de pantalla 29 | #TOOLBAR_UI_HIDE_BORDER = Ocultar borde 30 | #TOOLBAR_UI_SHOW_BORDER = Mostrar borde 31 | #TOOLBAR_UI_UNITY_SKIN = Use el fondo Unity 'Smoke' 32 | #TOOLBAR_UI_KSP_SKIN = Use fondo KSP 33 | #TOOLBAR_UI_CREATE_NEW_FOLDER = Crear nueva carpeta... 34 | #TOOLBAR_UI_CREATE_NEW_TOOLBAR = Crear nueva barra de herramientas 35 | #TOOLBAR_UI_DELETE_TOOLBAR = Eliminar barra de herramientas... 36 | #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = Eliminar barra de herramientas 37 | #TOOLBAR_UI_DELETE_TOOLBAR_HINT = ¿Eliminar barra de herramientas? 38 | #TOOLBAR_UI_ABOUT = Acerca del complemento de barra de herramientas... 39 | #TOOLBAR_UI_NEW_FOLDER = Nueva carpeta 40 | #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = Editar configuración de carpeta 41 | #TOOLBAR_UI_DELETE_FOLDER = Eliminar carpeta 42 | #TOOLBAR_UI_DELETE_FOLDER_HINT = Eliminar esta carpeta? Los botones dentro de la carpeta se moverán a la barra de herramientas principal. 43 | #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = Visibilidad del botón de la barra de herramientas 44 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = Configure qué botones deberían estar visibles en la escena del juego actual. 45 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = Nota: Los complementos aún pueden decidir ocultar botones de cualquier escena del juego, incluso si esos botones están activos aquí. 46 | #TOOLBAR_UI_CLOSE = Cerrar 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /GameData/000_Toolbar/Localization/jp.cfg: -------------------------------------------------------------------------------- 1 | Localization 2 | { 3 | 4 | // Requires Japanese translation 5 | // 日本語の翻訳が必要 6 | 7 | jp 8 | { 9 | #TOOLBAR_UI_OK = OK 10 | #TOOLBAR_UI_CANCEL = Cancel 11 | #TOOLBAR_UI_FOLDER_SETTINGS = Folder Settings 12 | #TOOLBAR_UI_BUTTON_ICON = Button icon: 13 | #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= Button tooltip text: 14 | #TOOLBAR_UI_SELECT_ICON = Select Icon 15 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = Configure Visible Buttons... 16 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS_HINT = Configure Visible Toolbar Buttons 17 | 18 | #TOOLBAR_UI_CONFIGURE_SCALE = Configure Scaling... 19 | #TOOLBAR_UI_CONFIGURE_SCALE_HINT = Configure Button Size 20 | #TOOLBAR_UI_SCALE_VISIBLE_TITLE = Adjust Button Scaling 21 | #TOOLBAR_UI_SCALE_FOLLOW_APP_SCALE = Follow KSP App scale 22 | #TOOLBAR_UI_SCALE_FOLLOW_UI_SCALE = Follow KSP UI Scale 23 | #TOOLBAR_UI_SCALE_USE_SLIDER = Use slider to adjust scale 24 | 25 | #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = Unlock Position and Size 26 | #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = Lock Position and Size 27 | #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = Unlock Button Order 28 | #TOOLBAR_UI_LOCK_BUTTON_ORDER = Lock Button Order 29 | #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = Deactivate Auto-Hide at Screen Edge 30 | #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = Activate Auto-Hide at Screen Edge 31 | #TOOLBAR_UI_HIDE_BORDER = Hide Border 32 | #TOOLBAR_UI_SHOW_BORDER = Show Border 33 | #TOOLBAR_UI_UNITY_SKIN = Use Unity 'Smoke' Skin 34 | #TOOLBAR_UI_KSP_SKIN = Use KSP Skin 35 | #TOOLBAR_UI_CREATE_NEW_FOLDER = Create New Folder... 36 | #TOOLBAR_UI_CREATE_NEW_TOOLBAR = Create New Toolbar 37 | #TOOLBAR_UI_DELETE_TOOLBAR = Delete Toolbar... 38 | #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = Delete Toolbar 39 | #TOOLBAR_UI_DELETE_TOOLBAR_HINT = Delete this toolbar? 40 | #TOOLBAR_UI_ABOUT = About the Toolbar Plugin... 41 | #TOOLBAR_UI_NEW_FOLDER = New Folder 42 | #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = Edit Folder Settings 43 | #TOOLBAR_UI_DELETE_FOLDER = Delete Folder 44 | #TOOLBAR_UI_DELETE_FOLDER_HINT = Delete this folder? Buttons inside the folder will be moved to the main toolbar. 45 | #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = Toolbar Button Visibility 46 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = Configure which buttons should be visible in the current game scene. 47 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = Note: Plugins may still decide to hide buttons from any game scene even if those buttons are active here. 48 | #TOOLBAR_UI_CLOSE = Close 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /GameData/000_Toolbar/Localization/pt-br.cfg: -------------------------------------------------------------------------------- 1 | Localization 2 | { 3 | 4 | pt-br 5 | { 6 | #TOOLBAR_UI_OK = OK 7 | #TOOLBAR_UI_CANCEL = Cancelar 8 | #TOOLBAR_UI_FOLDER_SETTINGS = Configurações de pasta 9 | #TOOLBAR_UI_BUTTON_ICON = Ícone do botão: 10 | #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= Texto informativo sobre ferramentas do botão: 11 | #TOOLBAR_UI_SELECT_ICON = Selecionar ícone 12 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = Configurar botões visíveis... 13 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS_HINT = Configurar botões visíveis na barra de ferramentas 14 | 15 | #TOOLBAR_UI_CONFIGURE_SCALE = Configure Scaling... 16 | #TOOLBAR_UI_CONFIGURE_SCALE_HINT = Configure Button Size 17 | #TOOLBAR_UI_SCALE_VISIBLE_TITLE = Adjust Button Scaling 18 | #TOOLBAR_UI_SCALE_FOLLOW_APP_SCALE = Follow KSP App scale 19 | #TOOLBAR_UI_SCALE_FOLLOW_UI_SCALE = Follow KSP UI Scale 20 | #TOOLBAR_UI_SCALE_USE_SLIDER = Use slider to adjust scale 21 | 22 | #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = Desbloquear posição e tamanho 23 | #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = Bloquear posição e tamanho 24 | #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = Desbloquear ordem dos botões 25 | #TOOLBAR_UI_LOCK_BUTTON_ORDER = Bloquear ordem dos botões 26 | #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = Desativar auto-ocultação na borda da tela 27 | #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = Ativar auto-ocultação na borda da tela 28 | #TOOLBAR_UI_HIDE_BORDER = Ocultar borda 29 | #TOOLBAR_UI_SHOW_BORDER = Exibir borda 30 | #TOOLBAR_UI_UNITY_SKIN = Utilizar tema 'Smoke' do Unity 31 | #TOOLBAR_UI_KSP_SKIN = Utilizar tema do KSP 32 | #TOOLBAR_UI_CREATE_NEW_FOLDER = Criar nova pasta... 33 | #TOOLBAR_UI_CREATE_NEW_TOOLBAR = Criar nova barra de ferramentas 34 | #TOOLBAR_UI_DELETE_TOOLBAR = Excluir barra de ferramentas... 35 | #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = Excluir barra de ferramentas 36 | #TOOLBAR_UI_DELETE_TOOLBAR_HINT = Deseja excluir esta barra de ferramentas? 37 | #TOOLBAR_UI_ABOUT = Informações sobre o plugin Toolbar... 38 | #TOOLBAR_UI_NEW_FOLDER = Nova pasta 39 | #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = Editar configurações de pasta 40 | #TOOLBAR_UI_DELETE_FOLDER = Exluir pasta 41 | #TOOLBAR_UI_DELETE_FOLDER_HINT = Deseja excluir esta pasta? Botões dentro desta pasta serão realocados na barra de ferramentas principal. 42 | #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = Visibilidade do botão da barra de ferramentas 43 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = Configurar quais botões devem estar visíveis na cena do jogo atual. 44 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = Nota: Outros plugins podem decidir ocultar botões de qualquer cena do jogo, inclusive esses botões que estão ativos aqui. 45 | #TOOLBAR_UI_CLOSE = Fechar 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /GameData/000_Toolbar/Localization/ru.cfg: -------------------------------------------------------------------------------- 1 | Localization 2 | { 3 | 4 | ru 5 | { 6 | #TOOLBAR_UI_OK = ОК 7 | #TOOLBAR_UI_CANCEL = Отмена 8 | #TOOLBAR_UI_FOLDER_SETTINGS = Настройка папки 9 | #TOOLBAR_UI_BUTTON_ICON = Иконка: 10 | #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= Название папки: 11 | #TOOLBAR_UI_SELECT_ICON = Выбрать иконку 12 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = Настроить отображение кнопок... 13 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS_HINT = Настроить отображение кнопок 14 | 15 | #TOOLBAR_UI_CONFIGURE_SCALE = Configure Scaling... 16 | #TOOLBAR_UI_CONFIGURE_SCALE_HINT = Configure Button Size 17 | #TOOLBAR_UI_SCALE_VISIBLE_TITLE = Adjust Button Scaling 18 | #TOOLBAR_UI_SCALE_FOLLOW_APP_SCALE = Follow KSP App scale 19 | #TOOLBAR_UI_SCALE_FOLLOW_UI_SCALE = Follow KSP UI Scale 20 | #TOOLBAR_UI_SCALE_USE_SLIDER = Use slider to adjust scale 21 | 22 | #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = Разблокировать позицию и размер 23 | #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = Заблокировать позицию и размер 24 | #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = Разблокировать порядок кнопок 25 | #TOOLBAR_UI_LOCK_BUTTON_ORDER = Заблокировать пор кнопок 26 | #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = Отключить Автоскрытие 27 | #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = Включить Автоскрытие 28 | #TOOLBAR_UI_HIDE_BORDER = Скрыть рамку 29 | #TOOLBAR_UI_SHOW_BORDER = Показать рамку 30 | #TOOLBAR_UI_UNITY_SKIN = Использовать Unity скин 31 | #TOOLBAR_UI_KSP_SKIN = Использовать KSP скин 32 | #TOOLBAR_UI_CREATE_NEW_FOLDER = Создать новую папку... 33 | #TOOLBAR_UI_CREATE_NEW_TOOLBAR = Создать новую панель 34 | #TOOLBAR_UI_DELETE_TOOLBAR = Удалить панель... 35 | #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = Удалить панель 36 | #TOOLBAR_UI_DELETE_TOOLBAR_HINT = Удалить эту панель? 37 | #TOOLBAR_UI_ABOUT = О приложении... 38 | #TOOLBAR_UI_NEW_FOLDER = Новая Папка 39 | #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = Настройка папки 40 | #TOOLBAR_UI_DELETE_FOLDER = Удалить папку 41 | #TOOLBAR_UI_DELETE_FOLDER_HINT = Удалить эту папку? Кнопки внутри этой папки будут перемещены в основную панель. 42 | #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = Отображение кнопок на тулбаре 43 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = Выбрать какие кнопки будут отображаться на этом игровом экране. 44 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = Внимание: Плагины могут скрывать свои иконки с любого игрового экрана, несмотря на выбраные здесь настройки. 45 | #TOOLBAR_UI_CLOSE = Закрыть 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /GameData/000_Toolbar/Localization/zh-cn.cfg: -------------------------------------------------------------------------------- 1 | Localization 2 | { 3 | 4 | zh-cn 5 | { 6 | #TOOLBAR_UI_OK = 确定 7 | #TOOLBAR_UI_CANCEL = 取消 8 | #TOOLBAR_UI_FOLDER_SETTINGS = 文件夹设置 9 | #TOOLBAR_UI_BUTTON_ICON = 按钮图标: 10 | #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= 按钮提示文本: 11 | #TOOLBAR_UI_SELECT_ICON = 选择图标 12 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = 配置可见按钮... 13 | #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS_HINT = 配置工具栏可见按钮 14 | 15 | #TOOLBAR_UI_CONFIGURE_SCALE = Configure Scaling... 16 | #TOOLBAR_UI_CONFIGURE_SCALE_HINT = Configure Button Size 17 | #TOOLBAR_UI_SCALE_VISIBLE_TITLE = Adjust Button Scaling 18 | #TOOLBAR_UI_SCALE_FOLLOW_APP_SCALE = Follow KSP App scale 19 | #TOOLBAR_UI_SCALE_FOLLOW_UI_SCALE = Follow KSP UI Scale 20 | #TOOLBAR_UI_SCALE_USE_SLIDER = Use slider to adjust scale 21 | 22 | #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = 解除位置和大小锁定 23 | #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = 开启位置和大小锁定 24 | #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = 解除按钮顺序锁定 25 | #TOOLBAR_UI_LOCK_BUTTON_ORDER = 开启按钮顺序锁定 26 | #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = 禁用贴边自动隐藏 27 | #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = 启用贴边自动隐藏 28 | #TOOLBAR_UI_HIDE_BORDER = 隐藏边框 29 | #TOOLBAR_UI_SHOW_BORDER = 显示边框 30 | #TOOLBAR_UI_UNITY_SKIN = 使用 Unity 'Smoke' 皮肤 31 | #TOOLBAR_UI_KSP_SKIN = 使用 KSP 皮肤 32 | #TOOLBAR_UI_CREATE_NEW_FOLDER = 新建文件夹... 33 | #TOOLBAR_UI_CREATE_NEW_TOOLBAR = 新建工具栏 34 | #TOOLBAR_UI_DELETE_TOOLBAR = 删除工具栏... 35 | #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = 删除工具栏 36 | #TOOLBAR_UI_DELETE_TOOLBAR_HINT = 删除当前工具栏? 37 | #TOOLBAR_UI_ABOUT = 关于工具栏插件... 38 | #TOOLBAR_UI_NEW_FOLDER = 新建文件夹 39 | #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = 修改文件夹设置 40 | #TOOLBAR_UI_DELETE_FOLDER = 删除文件夹 41 | #TOOLBAR_UI_DELETE_FOLDER_HINT = 是否删除当前文件夹? 文件夹内的按钮将被移动到主工具栏. 42 | #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = 工具栏按钮可见性 43 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = 配置当前游戏场景中应该显示哪些按钮. 44 | #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = 注意:虽然这些按钮在这里显示,但是插件依然可以决定隐藏游戏中的按钮. 45 | #TOOLBAR_UI_CLOSE = 关闭 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /GameData/000_Toolbar/README.md: -------------------------------------------------------------------------------- 1 | KSP Toolbar Plugin 2 | ================== 3 | 4 | This is a plugin for [Kerbal Space Program] that adds a common API for a buttons toolbar. 5 | Third-party plugin authors may use the API to add their buttons to the toolbar. 6 | 7 | For more information, please visit the [Forums Feedback Thread]. 8 | 9 | [Kerbal Space Program]: http://www.kerbalspaceprogram.com 10 | [Forums Feedback Thread]: http://forum.kerbalspaceprogram.com/threads/60066 11 | -------------------------------------------------------------------------------- /GameData/000_Toolbar/Toolbar.version: -------------------------------------------------------------------------------- 1 | { 2 | "NAME": "Toolbar", 3 | "URL": "http://ksp.spacetux.net/avc/Toolbar", 4 | "DOWNLOAD": "https://github.com/linuxgurugamer/ksp_toolbar/releases", 5 | "GITHUB": { 6 | "USERNAME": "linuxgurugamer", 7 | "REPOSITORY": "ksp_toolbar" 8 | }, 9 | "VERSION": { 10 | "MAJOR": 1, 11 | "MINOR": 8, 12 | "PATCH": 1, 13 | "BUILD": 0 14 | }, 15 | "KSP_VERSION": { 16 | "MAJOR": 1, 17 | "MINOR": 12, 18 | "PATCH": 5 19 | }, 20 | "KSP_VERSION_MIN": { 21 | "MAJOR": 1, 22 | "MINOR": 12, 23 | "PATCH": 0 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /GameData/000_Toolbar/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/GameData/000_Toolbar/folder.png -------------------------------------------------------------------------------- /GameData/000_Toolbar/move-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/GameData/000_Toolbar/move-cursor.png -------------------------------------------------------------------------------- /GameData/000_Toolbar/new-button-available.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/GameData/000_Toolbar/new-button-available.png -------------------------------------------------------------------------------- /GameData/000_Toolbar/resize-cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/GameData/000_Toolbar/resize-cursor.png -------------------------------------------------------------------------------- /GameData/000_Toolbar/stockLeftButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/GameData/000_Toolbar/stockLeftButton.png -------------------------------------------------------------------------------- /GameData/000_Toolbar/stockNormal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/GameData/000_Toolbar/stockNormal.png -------------------------------------------------------------------------------- /GameData/000_Toolbar/stockRightButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/GameData/000_Toolbar/stockRightButton.png -------------------------------------------------------------------------------- /GameData/000_Toolbar/toolbar-dropdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/GameData/000_Toolbar/toolbar-dropdown.png -------------------------------------------------------------------------------- /GameData/000_Toolbar/update-available.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/GameData/000_Toolbar/update-available.png -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014, Maik Schreiber 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /TestButtons/BoxDrawable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Toolbar; 6 | using UnityEngine; 7 | 8 | internal class BoxDrawable : IDrawable { 9 | private int width; 10 | private int height; 11 | 12 | internal BoxDrawable() { 13 | // random size for testing purposes 14 | changeSize(); 15 | } 16 | 17 | public void Update() { 18 | // nothing to do 19 | } 20 | 21 | public Vector2 Draw(Vector2 position) { 22 | GUILayout.BeginArea(new Rect(position.x, position.y, width, height), GUI.skin.box); 23 | GUILayout.FlexibleSpace(); 24 | GUILayout.BeginHorizontal(); 25 | GUILayout.FlexibleSpace(); 26 | GUILayout.Label("something useful here"); 27 | GUILayout.FlexibleSpace(); 28 | GUILayout.EndHorizontal(); 29 | GUILayout.FlexibleSpace(); 30 | GUILayout.EndArea(); 31 | 32 | return new Vector2(width, height); 33 | } 34 | 35 | internal void changeSize() { 36 | width = new System.Random().Next(200) + 50; 37 | height = new System.Random().Next(200) + 50; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /TestButtons/FlightMapVisibility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Toolbar; 6 | 7 | class FlightMapVisibility : IVisibility { 8 | internal static readonly FlightMapVisibility Instance = new FlightMapVisibility(); 9 | 10 | private static readonly IVisibility FLIGHT_VISIBILITY = new GameScenesVisibility(GameScenes.FLIGHT); 11 | 12 | public bool Visible { 13 | get { 14 | return FLIGHT_VISIBILITY.Visible && MapView.MapIsEnabled; 15 | } 16 | } 17 | 18 | private FlightMapVisibility() { 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /TestButtons/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 7 | // die mit einer Assembly verknüpft sind. 8 | [assembly: AssemblyTitle("Toolbar Testing Plugin for Kerbal Space Program")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TestButtons")] 13 | [assembly: AssemblyCopyright("Copyright © 2013-2016 Maik Schreiber")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar 18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von 19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. 20 | [assembly: ComVisible(false)] 21 | 22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 23 | [assembly: Guid("6f45f3d2-f5c5-483f-8700-8541f1d59107")] 24 | 25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 26 | // 27 | // Hauptversion 28 | // Nebenversion 29 | // Buildnummer 30 | // Revision 31 | // 32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern 33 | // übernehmen, indem Sie "*" eingeben: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("0.0.1.8")] 36 | [assembly: AssemblyFileVersion("0.0.1.0")] 37 | -------------------------------------------------------------------------------- /TestButtons/TestButtons.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {BDDFDD67-E023-41EA-B8F1-559996B9ADAE} 8 | Library 9 | Properties 10 | TestButtons 11 | TestButtons 12 | v4.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | false 25 | false 26 | false 27 | false 28 | false 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | false 38 | false 39 | false 40 | false 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | {e48dd7e6-5016-4ecf-a2c8-73a40beac326} 52 | Toolbar 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll 62 | 63 | 64 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll 65 | 66 | 67 | R:\KSP_1.3.0_dev\KSP_x64_Data\Managed\System.dll 68 | 69 | 70 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.dll 71 | 72 | 73 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 88 | 89 | -------------------------------------------------------------------------------- /TestButtons/TestButtons.csproj.173: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {BDDFDD67-E023-41EA-B8F1-559996B9ADAE} 8 | Library 9 | Properties 10 | TestButtons 11 | TestButtons 12 | v3.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | {e48dd7e6-5016-4ecf-a2c8-73a40beac326} 42 | Toolbar 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll 52 | 53 | 54 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll 55 | 56 | 57 | R:\KSP_1.3.0_dev\KSP_x64_Data\Managed\System.dll 58 | 59 | 60 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.dll 61 | 62 | 63 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 78 | -------------------------------------------------------------------------------- /TestButtons/TestButtons.csproj.orig: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {BDDFDD67-E023-41EA-B8F1-559996B9ADAE} 8 | Library 9 | Properties 10 | TestButtons 11 | TestButtons 12 | v3.5 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | {e48dd7e6-5016-4ecf-a2c8-73a40beac326} 42 | Toolbar 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\Assembly-CSharp.dll 52 | 53 | 54 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll 55 | 56 | 57 | R:\KSP_1.3.0_dev\KSP_x64_Data\Managed\System.dll 58 | 59 | 60 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.dll 61 | 62 | 63 | R:\KSP_1.3.1_dev\KSP_x64_Data\Managed\UnityEngine.UI.dll 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 78 | -------------------------------------------------------------------------------- /TestButtons/etc/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/TestButtons/etc/icon.png -------------------------------------------------------------------------------- /TestButtons/etc/img_buttonTypeMNode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/d109b9ebb1198adf81423018db28555fb09948ee/TestButtons/etc/img_buttonTypeMNode.png -------------------------------------------------------------------------------- /Toolbar.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26730.8 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Toolbar", "Toolbar\Toolbar.csproj", "{E48DD7E6-5016-4ECF-A2C8-73A40BEAC326}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestButtons", "TestButtons\TestButtons.csproj", "{BDDFDD67-E023-41EA-B8F1-559996B9ADAE}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wrapper", "Wrapper\Wrapper.csproj", "{E258AB2C-E2BB-4ACA-B902-C98582041F69}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{293FCA15-B1A7-48B1-80A4-85B8C1175783}" 13 | ProjectSection(SolutionItems) = preProject 14 | buildRelease.bat = buildRelease.bat 15 | Changelog.txt = Changelog.txt 16 | deploy.bat = deploy.bat 17 | jenkins.txt = jenkins.txt 18 | README.md = README.md 19 | Toolbar.version = Toolbar.version 20 | EndProjectSection 21 | EndProject 22 | Global 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 24 | Debug|Any CPU = Debug|Any CPU 25 | Release|Any CPU = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 28 | {E48DD7E6-5016-4ECF-A2C8-73A40BEAC326}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {E48DD7E6-5016-4ECF-A2C8-73A40BEAC326}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {E48DD7E6-5016-4ECF-A2C8-73A40BEAC326}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {E48DD7E6-5016-4ECF-A2C8-73A40BEAC326}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {BDDFDD67-E023-41EA-B8F1-559996B9ADAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {BDDFDD67-E023-41EA-B8F1-559996B9ADAE}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {BDDFDD67-E023-41EA-B8F1-559996B9ADAE}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {E258AB2C-E2BB-4ACA-B902-C98582041F69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {E258AB2C-E2BB-4ACA-B902-C98582041F69}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {E258AB2C-E2BB-4ACA-B902-C98582041F69}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | EndGlobalSection 39 | GlobalSection(SolutionProperties) = preSolution 40 | HideSolutionNode = FALSE 41 | EndGlobalSection 42 | GlobalSection(ExtensibilityGlobals) = postSolution 43 | SolutionGuid = {29A7462E-D1F5-4C97-8CFA-1604D1C86025} 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /Toolbar.version: -------------------------------------------------------------------------------- 1 | { 2 | "NAME": "Toolbar", 3 | "URL": "https://raw.githubusercontent.com/linuxgurugamer/ksp_toolbar/refs/heads/master/Toolbar.version", 4 | "DOWNLOAD": "https://github.com/linuxgurugamer/ksp_toolbar/releases", 5 | "GITHUB": { 6 | "USERNAME": "linuxgurugamer", 7 | "REPOSITORY": "ksp_toolbar" 8 | }, 9 | "VERSION": { 10 | "MAJOR": 1, 11 | "MINOR": 8, 12 | "PATCH": 1, 13 | "BUILD": 2 14 | }, 15 | "KSP_VERSION": { 16 | "MAJOR": 1, 17 | "MINOR": 12, 18 | "PATCH": 5 19 | }, 20 | "KSP_VERSION_MIN": { 21 | "MAJOR": 1, 22 | "MINOR": 12, 23 | "PATCH": 0 24 | }, 25 | "KSP_VERSION_MAX": { 26 | "MAJOR": 1, 27 | "MINOR": 12, 28 | "PATCH": 99 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Toolbar.version.1-12-3: -------------------------------------------------------------------------------- 1 | { 2 | "NAME": "Toolbar", 3 | "URL": "http://ksp.spacetux.net/avc/Toolbar", 4 | "DOWNLOAD": "https://github.com/linuxgurugamer/ksp_toolbar/releases", 5 | "GITHUB": { 6 | "USERNAME": "linuxgurugamer", 7 | "REPOSITORY": "ksp_toolbar" 8 | }, 9 | "VERSION": { 10 | "MAJOR": 1, 11 | "MINOR": 8, 12 | "PATCH": 0, 13 | "BUILD": 8 14 | }, 15 | "KSP_VERSION": { 16 | "MAJOR": 1, 17 | "MINOR": 12, 18 | "PATCH": 3 19 | }, 20 | "KSP_VERSION_MIN": { 21 | "MAJOR": 1, 22 | "MINOR": 12, 23 | "PATCH": 0 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Toolbar/API/ClickEvent.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | /// 33 | /// Event describing a click on a button. 34 | /// 35 | public partial class ClickEvent : EventArgs { 36 | /// 37 | /// The button that has been clicked. 38 | /// 39 | public readonly IButton Button; 40 | 41 | /// 42 | /// The mouse button which the button was clicked with. 43 | /// 44 | /// 45 | /// Is 0 for left mouse button, 1 for right mouse button, and 2 for middle mouse button. 46 | /// 47 | public readonly int MouseButton; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Toolbar/API/ClickHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | /// 33 | /// An event handler that is invoked whenever a button has been clicked. 34 | /// 35 | /// An event describing the button click. 36 | public delegate void ClickHandler(ClickEvent e); 37 | } 38 | -------------------------------------------------------------------------------- /Toolbar/API/FunctionDrawable.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | 32 | namespace Toolbar { 33 | public class FunctionDrawable : IDrawable { 34 | private Action updateAction; 35 | private Func drawFunction; 36 | 37 | public FunctionDrawable(Action updateAction, Func drawFunction) { 38 | this.updateAction = updateAction; 39 | this.drawFunction = drawFunction; 40 | } 41 | 42 | public void Update() { 43 | updateAction(); 44 | } 45 | 46 | public Vector2 Draw(Vector2 position) { 47 | return drawFunction(position); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Toolbar/API/FunctionVisibility.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | public class FunctionVisibility : IVisibility { 33 | public bool Visible { 34 | get { 35 | return function(); 36 | } 37 | } 38 | 39 | private Func function; 40 | 41 | public FunctionVisibility(Func function) { 42 | this.function = function; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Toolbar/API/GameScenesVisibility.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | /// 33 | /// Determines visibility of a button in relation to the currently running game scene. 34 | /// 35 | /// 36 | /// 37 | /// IButton button = ... 38 | /// button.Visibility = new GameScenesVisibility(GameScenes.EDITOR, GameScenes.FLIGHT); 39 | /// 40 | /// 41 | /// 42 | public class GameScenesVisibility : IVisibility { 43 | private GameScenes[] gameScenes; 44 | 45 | public bool Visible { 46 | get { 47 | return gameScenes.Contains(HighLogic.LoadedScene); 48 | } 49 | } 50 | 51 | public GameScenesVisibility(params GameScenes[] gameScenes) { 52 | this.gameScenes = gameScenes; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Toolbar/API/IDrawable.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | 32 | namespace Toolbar { 33 | /// 34 | /// A drawable that is tied to a particular button. This can be anything from a popup menu 35 | /// to an informational window. 36 | /// 37 | public interface IDrawable { 38 | /// 39 | /// Update any information. This is called once per frame. 40 | /// 41 | void Update(); 42 | 43 | /// 44 | /// Draws GUI widgets for this drawable. This is the equivalent to the OnGUI() message in 45 | /// . 46 | /// 47 | /// 48 | /// The drawable will be positioned near its parent toolbar according to the drawable's current 49 | /// width/height. 50 | /// 51 | /// The left/top position of where to draw this drawable. 52 | /// The current width/height of this drawable. 53 | Vector2 Draw(Vector2 position); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Toolbar/API/IToolbarManager.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | /// 33 | /// A toolbar manager. 34 | /// 35 | public interface IToolbarManager { 36 | /// 37 | /// Adds a new button. 38 | /// 39 | /// 40 | /// To replace an existing button, just add a new button using the old button's namespace and ID. 41 | /// Note that the new button will inherit the screen position of the old button. 42 | /// 43 | /// The new button's namespace. This is usually the plugin's name. Must not include special characters like '.' 44 | /// The new button's ID. This ID must be unique across all buttons in the namespace. Must not include special characters like '.' 45 | /// The button created. 46 | IButton add(string ns, string id); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Toolbar/API/IVisibility.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | /// 33 | /// Determines visibility of a button. 34 | /// 35 | /// 36 | public interface IVisibility { 37 | /// 38 | /// Whether a button is currently visible or not. 39 | /// 40 | /// 41 | bool Visible { 42 | get; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Toolbar/API/MouseEnterEvent.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | /// 33 | /// Event describing the mouse pointer entering a button's area. 34 | /// 35 | public partial class MouseEnterEvent : MouseMoveEvent { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Toolbar/API/MouseLeaveEvent.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | /// 33 | /// Event describing the mouse pointer leaving a button's area. 34 | /// 35 | public partial class MouseLeaveEvent : MouseMoveEvent { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Toolbar/API/MouseMoveEvent.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | /// 33 | /// Event describing the mouse pointer moving about a button. 34 | /// 35 | public abstract partial class MouseMoveEvent { 36 | /// 37 | /// The button in question. 38 | /// 39 | public readonly IButton button; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Toolbar/API/MouseMoveHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | /// 33 | /// An event handler that is invoked whenever the mouse pointer enters a button's area. 34 | /// 35 | /// An event describing the mouse pointer entering. 36 | public delegate void MouseEnterHandler(MouseEnterEvent e); 37 | 38 | /// 39 | /// An event handler that is invoked whenever the mouse pointer leaves a button's area. 40 | /// 41 | /// An event describing the mouse pointer leaving. 42 | public delegate void MouseLeaveHandler(MouseLeaveEvent e); 43 | } 44 | -------------------------------------------------------------------------------- /Toolbar/API/PopupMenuDrawable.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | 32 | namespace Toolbar { 33 | /// 34 | /// A drawable that draws a popup menu. 35 | /// 36 | public partial class PopupMenuDrawable : IDrawable { 37 | /// 38 | /// Event handler that can be registered with to receive "any menu option clicked" events. 39 | /// 40 | public event Action OnAnyOptionClicked { 41 | add { 42 | menu.OnAnyOptionClicked += value; 43 | } 44 | remove { 45 | menu.OnAnyOptionClicked -= value; 46 | } 47 | } 48 | 49 | public PopupMenuDrawable() { 50 | // clamping is done by Toolbar.drawDrawables() 51 | menu.AutoClampToScreen = false; 52 | } 53 | 54 | public void Update() { 55 | // nothing to do 56 | } 57 | 58 | public Vector2 Draw(Vector2 position) { 59 | menu.Rect.x = position.x; 60 | menu.Rect.y = position.y; 61 | 62 | // we're not using WindowList, so we need to draw here 63 | menu.draw(); 64 | 65 | return new Vector2(menu.Rect.width, menu.Rect.height); 66 | } 67 | 68 | /// 69 | /// Adds a new option to the popup menu. 70 | /// 71 | /// The text of the option. 72 | /// A button that can be used to register clicks on the menu option. 73 | public IButton AddOption(string text) { 74 | Button option = Button.createMenuOption(text); 75 | menu += option; 76 | return option.command; 77 | } 78 | 79 | /// 80 | /// Adds a separator to the popup menu. 81 | /// 82 | public void AddSeparator() { 83 | menu += Separator.Instance; 84 | } 85 | 86 | /// 87 | /// Destroys this drawable. This must always be called before disposing of this drawable. 88 | /// 89 | public void Destroy() { 90 | menu.destroy(); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Toolbar/API/ToolbarManager.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | 32 | namespace Toolbar { 33 | /// 34 | /// The global tool bar manager. 35 | /// 36 | public partial class ToolbarManager : MonoBehaviour, IToolbarManager { 37 | /// 38 | /// The global tool bar manager instance. 39 | /// 40 | public static IToolbarManager Instance { 41 | get; 42 | private set; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Toolbar/AssemblyVersion.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | // This code was generated by a tool. Any changes made manually will be lost 8 | // the next time this code is regenerated. 9 | // 10 | 11 | using System.Reflection; 12 | 13 | [assembly: AssemblyVersion("1.8.1.0")] 14 | [assembly: AssemblyFileVersion("1.8.1.0")] 15 | -------------------------------------------------------------------------------- /Toolbar/AssemblyVersion.tt: -------------------------------------------------------------------------------- 1 | <#@ template debug="false" hostspecific="true" language="C#" #> 2 | <#@ import namespace="System.IO" #> 3 | <#@ output extension=".cs" #> 4 | 5 | <#@ assembly name="EnvDTE" #><# /* This assembly provides access to Visual Studio project properties. */ #> 6 | <# 7 | 8 | // Instructions 9 | // 1. Add a new Text Template to the project 10 | // 2. Copy this file into the new template 11 | // 3. Update the string: versionfile with the complete path to the .version file 12 | // 4. Remove the following line from the file AssemblyInfo.cs (usually located in the "Property" folder inside your C# project): 13 | // [assembly: AssemblyFileVersion("1.0.0.0")] 14 | // 5. Add the following to the PreBuild steps: 15 | // set textTemplatingPath="%CommonProgramFiles(x86)%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe" 16 | // 17 | // if %textTemplatingPath%=="\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe" set textTemplatingPath="%CommonProgramFiles%\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\texttransform.exe" 18 | // 19 | // %textTemplatingPath% "%ProjectDir%AssemblyVersion.tt" 20 | 21 | int major = 0; 22 | int minor = 0; 23 | int build = 0; 24 | int patch = 0; 25 | bool versionSection = false; 26 | int i = 0; 27 | int i2 = 0; 28 | string s; 29 | 30 | 31 | // For Visual Studio / MSBuild Build-Time Template Resolution 32 | string RootDirectory = System.IO.Path.GetDirectoryName(Host.TemplateFile) + @"\..\"; 33 | 34 | // 35 | // Update the following with the name of the .version file which is in the root directory 36 | // 37 | string versionfile = RootDirectory + "Toolbar.version"; 38 | 39 | if (!File.Exists(versionfile)) 40 | { 41 | Write("File: " + versionfile + " missing\n"); 42 | } 43 | 44 | try 45 | { 46 | foreach (var line in File.ReadAllLines(versionfile)) 47 | { 48 | if (line != null) 49 | { 50 | if (!versionSection) 51 | { 52 | if (line.Contains("\"VERSION\"")) 53 | versionSection = true; 54 | } 55 | else 56 | { 57 | if (line.Contains("}")) 58 | versionSection = false; 59 | i = line.IndexOf(":"); 60 | i2 = line.IndexOf(","); 61 | if (i2 == -1) 62 | i2 = line.Length; 63 | if (i >= 0 && i2 >= 0) 64 | { 65 | s = line.Substring(i + 1, i2 - i - 1); 66 | 67 | if (line.Contains("MAJOR")) 68 | Int32.TryParse(s, out major); 69 | 70 | if (line.Contains("MINOR")) 71 | Int32.TryParse(s, out minor); 72 | 73 | if (line.Contains("PATCH")) 74 | Int32.TryParse(s, out patch); 75 | 76 | if (line.Contains("BUILD")) 77 | Int32.TryParse(s, out build); 78 | } 79 | } 80 | } 81 | } 82 | 83 | } 84 | catch 85 | { 86 | major = 1; 87 | minor = 0; 88 | patch = 0; 89 | build = 0; 90 | } 91 | //Write("File done"); 92 | 93 | #> 94 | // This code was generated by a tool. Any changes made manually will be lost 95 | // the next time this code is regenerated. 96 | // 97 | 98 | using System.Reflection; 99 | 100 | [assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= patch #>.<#= build #>")] 101 | [assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= patch #>.<#= build #>")] 102 | -------------------------------------------------------------------------------- /Toolbar/Internal/Extensions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.ComponentModel; 29 | using System.Linq; 30 | using System.Text; 31 | using UnityEngine; 32 | 33 | namespace Toolbar { 34 | internal static class Extensions { 35 | internal static Rect clampToScreen(this Rect rect) { 36 | return rect.clampToScreen(0); 37 | } 38 | 39 | internal static Rect clampToScreen(this Rect rect, float overscan) { 40 | return rect.clampToScreen(new Vector2(overscan, overscan)); 41 | } 42 | 43 | internal static Rect clampToScreen(this Rect rect, Vector2 overscan) { 44 | rect.width = Mathf.Clamp(rect.width, 0, Screen.width); 45 | rect.height = Mathf.Clamp(rect.height, 0, Screen.height); 46 | rect.x = Mathf.Clamp(rect.x, -overscan.x, Screen.width - rect.width + overscan.x); 47 | rect.y = Mathf.Clamp(rect.y, -overscan.y, Screen.height - rect.height + overscan.y); 48 | return rect; 49 | } 50 | 51 | internal static Vector2 clampToScreen(this Vector2 pos) { 52 | pos.x = Mathf.Clamp(pos.x, 0, Screen.width - 1); 53 | pos.y = Mathf.Clamp(pos.y, 0, Screen.height - 1); 54 | return pos; 55 | } 56 | 57 | internal static Rect shift(this Rect rect, Vector2 shiftBy) { 58 | return new Rect(rect.x + shiftBy.x, rect.y + shiftBy.y, rect.width, rect.height); 59 | } 60 | 61 | internal static ConfigNode getOrCreateNode(this ConfigNode configNode, string nodeName) { 62 | return configNode.HasNode(nodeName) ? configNode.GetNode(nodeName) : configNode.AddNode(nodeName); 63 | } 64 | 65 | internal static void overwrite(this ConfigNode configNode, string name, object value) { 66 | if (configNode.HasValue(name)) { 67 | configNode.RemoveValue(name); 68 | } 69 | configNode.AddValue(name, value); 70 | } 71 | 72 | internal static ConfigNode overwriteNode(this ConfigNode configNode, string nodeName) { 73 | if (configNode.HasNode(nodeName)) { 74 | configNode.RemoveNode(nodeName); 75 | } 76 | return configNode.AddNode(nodeName); 77 | } 78 | 79 | internal static T get(this ConfigNode configNode, string name, T defaultValue) { 80 | if (configNode.HasValue(name)) { 81 | Type type = typeof(T); 82 | TypeConverter converter = TypeDescriptor.GetConverter(type); 83 | string value = configNode.GetValue(name); 84 | return (T) converter.ConvertFromInvariantString(value); 85 | } else { 86 | return defaultValue; 87 | } 88 | } 89 | 90 | internal static long getSeconds(this DateTime date) { 91 | return date.Ticks / 10000; 92 | } 93 | 94 | internal static bool intersectsImportantGUI(this Rect rect) { 95 | return rect.intersectsAltimeter() || rect.intersectsNavBall(); 96 | } 97 | 98 | private static bool intersectsAltimeter(this Rect rect) { 99 | Rect altimeterRect = new Rect((Screen.width - 245) / 2, 0, 245, 66); 100 | return rect.intersects(altimeterRect); 101 | } 102 | 103 | private static bool intersectsNavBall(this Rect rect) { 104 | Rect navBallUpperRect = new Rect((Screen.width - 175) / 2, Screen.height - 151 - 38, 175, 38); 105 | Rect navBallLowerRect = new Rect((Screen.width - 215) / 2, Screen.height - 151, 215, 151); 106 | return rect.intersects(navBallUpperRect) || rect.intersects(navBallLowerRect); 107 | } 108 | 109 | private static bool intersects(this Rect rect, Rect r) { 110 | return (r.x <= (rect.x + rect.width - 1)) && (r.y <= (rect.y + rect.height - 1)) && 111 | ((r.x + r.width - 1) >= rect.x) && ((r.y + r.height - 1) >= rect.y); 112 | } 113 | 114 | internal static bool addOrUpdate(this Dictionary dict, K key, V value) { 115 | if (dict.ContainsKey(key)) { 116 | if (value != null) { 117 | dict[key] = value; 118 | } else { 119 | dict.Remove(key); 120 | } 121 | return true; 122 | } else { 123 | if (value != null) { 124 | dict.Add(key, value); 125 | } 126 | return false; 127 | } 128 | } 129 | 130 | internal static bool addOrUpdate(this Dictionary dict, K key, V valueToAdd, Func updateFunc) { 131 | if (dict.ContainsKey(key)) { 132 | if (updateFunc != null) { 133 | dict[key] = updateFunc(dict[key]); 134 | } else { 135 | dict.Remove(key); 136 | } 137 | return true; 138 | } else { 139 | if (valueToAdd != null) { 140 | dict.Add(key, valueToAdd); 141 | } 142 | return false; 143 | } 144 | } 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /Toolbar/Internal/FloatCurveXY.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | 32 | namespace Toolbar { 33 | internal class FloatCurveXY { 34 | private FloatCurve curveX; 35 | private FloatCurve curveY; 36 | 37 | internal FloatCurveXY() { 38 | } 39 | 40 | internal void add(float time, Vector2 xy) { 41 | if (curveX == null) { 42 | curveX = new FloatCurve(); 43 | } 44 | curveX.Add(time, xy.x); 45 | 46 | if (curveY == null) { 47 | curveY = new FloatCurve(); 48 | } 49 | curveY.Add(time, xy.y); 50 | } 51 | 52 | internal Vector2 evaluate(float time) { 53 | return new Vector2(curveX.Evaluate(time), curveY.Evaluate(time)); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Toolbar/Internal/GUI/AbstractWindow.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | using ClickThroughFix; 32 | 33 | namespace Toolbar { 34 | internal abstract class AbstractWindow { 35 | internal event Action OnDestroy; 36 | 37 | internal Rect Rect = new Rect(0, 0, 0, 0); 38 | internal bool Dialog; 39 | internal bool Modal; 40 | internal bool AutoClampToScreen = true; 41 | 42 | protected string Title; 43 | protected GUIStyle GUIStyle; 44 | protected GUILayoutOption[] GUILayoutOptions = {}; 45 | protected bool Draggable = true; 46 | 47 | private readonly int id = new System.Random().Next(int.MaxValue); 48 | private EditorLock editorLock; 49 | private bool useWindowList; 50 | 51 | internal AbstractWindow(bool useWindowList = true) { 52 | this.useWindowList = useWindowList; 53 | 54 | if (useWindowList) { 55 | WindowList.Instance.add(this); 56 | } 57 | 58 | editorLock = new EditorLock("Toolbar_window_" + id); 59 | } 60 | 61 | internal void destroy() { 62 | if (useWindowList) { 63 | WindowList.Instance.remove(this); 64 | } 65 | 66 | editorLock.draw(false); 67 | 68 | if (OnDestroy != null) { 69 | OnDestroy(); 70 | } 71 | } 72 | 73 | internal virtual void draw() { 74 | if (GUIStyle == null) { 75 | GUIStyle = GUI.skin.window; 76 | } 77 | 78 | Rect = ClickThruBlocker.GUILayoutWindow(id, AutoClampToScreen ? Rect.clampToScreen() : Rect, windowId => drawContentsInternal(), Title, GUIStyle, GUILayoutOptions); 79 | 80 | editorLock.draw(Modal || Rect.Contains(Utils.getMousePosition())); 81 | } 82 | 83 | internal bool contains(Vector2 pos) { 84 | return Rect.Contains(pos); 85 | } 86 | 87 | private void drawContentsInternal() { 88 | drawContents(); 89 | 90 | if (Draggable) { 91 | GUI.DragWindow(); 92 | } 93 | } 94 | 95 | internal abstract void drawContents(); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /Toolbar/Internal/GUI/ConfirmDialog.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | using KSP.Localization; 32 | 33 | namespace Toolbar { 34 | internal class ConfirmDialog : AbstractWindow { 35 | private string text; 36 | private Action onOk; 37 | private Action onCancel; 38 | private string okText; 39 | private string cancelText; 40 | // dictionary.cfg 41 | // #TOOLBAR_UI_OK = "OK" 42 | // #TOOLBAR_UI_CANCEL = "Cancel" 43 | // 44 | // eg : Localizer.Format("#ID") 45 | 46 | 47 | internal ConfirmDialog(string title, string text, Action onOk, Action onCancel, string okText = "OK", string cancelText = "Cancel") : base() 48 | { 49 | if (okText == "OK") 50 | okText = Localizer.Format("#TOOLBAR_UI_OK"); 51 | if (cancelText == "Cancel") 52 | cancelText = Localizer.Format("#TOOLBAR_UI_CANCEL"); 53 | 54 | Rect = new Rect(300, 300, Screen.width / 4, 0); 55 | Title = title; 56 | Dialog = true; 57 | Modal = true; 58 | 59 | this.text = text; 60 | this.onOk = onOk; 61 | this.onCancel = onCancel; 62 | this.okText = okText; 63 | this.cancelText = cancelText; 64 | } 65 | 66 | internal override void drawContents() { 67 | GUILayout.BeginVertical(); 68 | 69 | GUILayout.Label(text, GUILayout.ExpandWidth(true)); 70 | 71 | GUILayout.Space(15); 72 | 73 | GUILayout.BeginHorizontal(); 74 | GUILayout.FlexibleSpace(); 75 | if (GUILayout.Button(okText)) { 76 | onOk(); 77 | } 78 | if (GUILayout.Button(cancelText)) { 79 | onCancel(); 80 | } 81 | GUILayout.EndHorizontal(); 82 | 83 | GUILayout.EndVertical(); 84 | } 85 | 86 | // dictionary.cfg 87 | // #TOOLBAR_UI_OK = "OK" 88 | // #TOOLBAR_UI_CANCEL = "Cancel" 89 | // 90 | // eg : Localizer.Format("#ID") 91 | internal static void confirm(string title, string text, Action onOk, string okText = "OK", string cancelText = "Cancel") { 92 | ConfirmDialog dialog = null; 93 | if (okText == "OK") 94 | okText = Localizer.Format("#TOOLBAR_UI_OK"); 95 | if (cancelText == "Cancel") 96 | cancelText = Localizer.Format("#TOOLBAR_UI_CANCEL"); 97 | 98 | dialog = new ConfirmDialog(title, text, 99 | () => { 100 | dialog.destroy(); 101 | onOk(); 102 | }, 103 | () => dialog.destroy(), 104 | okText, cancelText); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Toolbar/Internal/GUI/CursorGrabbing.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | 32 | using Cursors; 33 | 34 | namespace Toolbar { 35 | internal interface ICursorGrabber { 36 | bool grabCursor(); 37 | } 38 | 39 | internal class CursorGrabbing { 40 | internal static readonly CursorGrabbing Instance = new CursorGrabbing(); 41 | 42 | private List grabbers = new List(); 43 | private bool cursorGrabbed; 44 | 45 | private CursorGrabbing() { 46 | } 47 | 48 | internal void update() { 49 | bool grabbed = false; 50 | if (Application.platform == RuntimePlatform.LinuxPlayer) 51 | return; 52 | 53 | foreach (ICursorGrabber grabber in grabbers) { 54 | if (grabber.grabCursor()) { 55 | grabbed = true; 56 | break; 57 | } 58 | } 59 | 60 | if (grabbed) { 61 | cursorGrabbed = true; 62 | } else if (cursorGrabbed) { 63 | //Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); 64 | //CursorController.Instance.ForceDefaultCursor(); 65 | //Cursor.SetCursor(Utils.GetTexture("000_Toolbar/stockNormal", false), new Vector2(0, 0), CursorMode.ForceSoftware); 66 | 67 | // public CursorItem AddCursor(string id, CustomCursor defaultCursor, CustomCursor leftClickCursor = null, CustomCursor rightClickCursor = null); 68 | cursorGrabbed = false; 69 | } 70 | } 71 | 72 | internal void add(ICursorGrabber grabber) { 73 | grabbers.Add(grabber); 74 | } 75 | 76 | internal void remove(ICursorGrabber grabber) { 77 | grabbers.Remove(grabber); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Toolbar/Internal/GUI/DragEvent.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | internal class DragEvent : EventArgs { 33 | internal readonly Draggable draggable; 34 | 35 | internal DragEvent(Draggable draggable) { 36 | this.draggable = draggable; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Toolbar/Internal/GUI/DragHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | internal delegate void DragHandler(DragEvent e); 33 | } 34 | -------------------------------------------------------------------------------- /Toolbar/Internal/GUI/Draggable.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | 32 | namespace Toolbar { 33 | internal class Draggable : ICursorGrabber { 34 | private const string CURSOR_TEXTURE = "000_Toolbar/move-cursor"; 35 | private const float CURSOR_HOT_SPOT_X = 10; 36 | private const float CURSOR_HOT_SPOT_Y = 10; 37 | 38 | internal bool Dragging { 39 | get; 40 | private set; 41 | } 42 | 43 | private bool enabled_; 44 | internal bool Enabled { 45 | set { 46 | if (value != enabled_) { 47 | enabled_ = value; 48 | 49 | if (!enabled_) { 50 | if (Dragging) { 51 | stopDragging(); 52 | fireDrag(); 53 | } 54 | 55 | cursorTexture_ = null; 56 | } 57 | } 58 | } 59 | get { 60 | return enabled_; 61 | } 62 | } 63 | 64 | internal event DragHandler OnDrag; 65 | 66 | private Texture2D cursorTexture_; 67 | private Texture2D CursorTexture { 68 | get { 69 | if (cursorTexture_ == null) { 70 | cursorTexture_ = Utils.GetTextureFromFile(cursorTexturePath, false); 71 | Log.info("CursorTexture, GetTextureFromfile, cursorTexturePath: " + cursorTexturePath); 72 | } 73 | return cursorTexture_; 74 | } 75 | } 76 | 77 | protected Rectangle rect; 78 | 79 | private float clampOverscan; 80 | private Func handleAreaCheck; 81 | private string cursorTexturePath; 82 | private Vector2 cursorHotSpot; 83 | private Rect startRect; 84 | private Vector2 startMousePos; 85 | 86 | internal Draggable(Rectangle initialPosition, float clampOverscan, Func handleAreaCheck, 87 | string cursorTexturePath = CURSOR_TEXTURE, float cursorHotSpotX = CURSOR_HOT_SPOT_X, float cursorHotSpotY = CURSOR_HOT_SPOT_Y) { 88 | 89 | this.rect = initialPosition; 90 | this.clampOverscan = clampOverscan; 91 | this.handleAreaCheck = handleAreaCheck; 92 | this.cursorTexturePath = cursorTexturePath; 93 | this.cursorHotSpot = new Vector2(cursorHotSpotX, cursorHotSpotY); 94 | } 95 | 96 | internal void update() { 97 | if (Enabled) { 98 | handleDrag(); 99 | } 100 | } 101 | 102 | private void handleDrag() { 103 | Vector2 mousePos = Utils.getMousePosition(); 104 | bool inArea = isInArea(mousePos) && ((handleAreaCheck == null) || handleAreaCheck(mousePos)); 105 | if (inArea && Input.GetMouseButtonDown(0)) { 106 | startDragging(mousePos); 107 | fireDrag(); 108 | } 109 | 110 | if (Dragging) { 111 | if (Input.GetMouseButton(0)) { 112 | rect.Rect = getNewRect(mousePos, startRect, startMousePos).clampToScreen(clampOverscan); 113 | } else { 114 | stopDragging(); 115 | } 116 | fireDrag(); 117 | } 118 | } 119 | 120 | protected virtual bool isInArea(Vector2 mousePos) { 121 | return rect.contains(mousePos); 122 | } 123 | 124 | protected virtual Rect getNewRect(Vector2 mousePos, Rect startRect, Vector2 startMousePos) { 125 | return new Rect(mousePos.x - rect.width / 2, mousePos.y - rect.height / 2, rect.width, rect.height); 126 | } 127 | 128 | public bool grabCursor() { 129 | if (Enabled) { 130 | Vector2 mousePos = Utils.getMousePosition(); 131 | bool inArea = isInArea(mousePos) && ((handleAreaCheck == null) || handleAreaCheck(mousePos)); 132 | bool setCursor = inArea || Dragging; 133 | if (setCursor) { 134 | Cursor.SetCursor(CursorTexture, cursorHotSpot, CursorMode.ForceSoftware); 135 | } 136 | return setCursor; 137 | } else { 138 | return false; 139 | } 140 | } 141 | 142 | private void startDragging(Vector2 mousePos) { 143 | Dragging = true; 144 | startRect = rect.Rect; 145 | startMousePos = mousePos; 146 | } 147 | 148 | private void stopDragging() { 149 | Dragging = false; 150 | } 151 | 152 | private void fireDrag() { 153 | if (OnDrag != null) { 154 | OnDrag(new DragEvent(this)); 155 | } 156 | } 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /Toolbar/Internal/GUI/DropMarker.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | 32 | namespace Toolbar { 33 | internal class DropMarker { 34 | internal const float MARKER_LINE_WIDTH = 2; 35 | 36 | private static readonly Rect NO_POSITION = new Rect(float.MinValue, float.MinValue, float.MinValue, float.MinValue); 37 | 38 | internal Rect Rect = NO_POSITION; 39 | internal bool Visible = true; 40 | 41 | private Texture2D orangeBgTex; 42 | private GUIStyle style; 43 | private bool styleInitialized; 44 | 45 | internal void draw() { 46 | if (Visible && !Rect.Equals(NO_POSITION)) { 47 | initStyle(); 48 | 49 | GUI.Label(Rect, (string) null, style); 50 | } 51 | } 52 | 53 | private void initStyle() { 54 | if (!styleInitialized) { 55 | orangeBgTex = new Texture2D(1, 1); 56 | orangeBgTex.SetPixel(0, 0, XKCDColors.DarkOrange); 57 | orangeBgTex.Apply(); 58 | 59 | style = new GUIStyle(GUI.skin.label); 60 | style.normal.background = orangeBgTex; 61 | style.border = new RectOffset(0, 0, 0, 0); 62 | style.padding = new RectOffset(0, 0, 0, 0); 63 | 64 | styleInitialized = true; 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Toolbar/Internal/GUI/EditorLock.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | 31 | namespace Toolbar { 32 | internal class EditorLock { 33 | private string lockId; 34 | private bool editorLocked; 35 | 36 | internal EditorLock(string lockId) { 37 | this.lockId = lockId; 38 | } 39 | 40 | internal void draw(bool lockEditor) { 41 | if (HighLogic.LoadedSceneIsEditor) { 42 | if (lockEditor && !editorLocked) { 43 | EditorLogic.fetch.Lock(true, true, true, lockId); 44 | editorLocked = true; 45 | } else if (!lockEditor && editorLocked) { 46 | EditorLogic.fetch.Unlock(lockId); 47 | editorLocked = false; 48 | } 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Toolbar/Internal/GUI/IPopupMenuOption.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | 32 | namespace Toolbar { 33 | internal interface IPopupMenuOption { 34 | event ClickHandler OnClick; 35 | 36 | void drawMenuOption(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Toolbar/Internal/GUI/IconPickerDialog.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013-2016, Maik Schreiber 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using System.Text; 30 | using UnityEngine; 31 | using KSP.Localization; 32 | 33 | namespace Toolbar { 34 | internal class IconPickerDialog : AbstractWindow { 35 | private const int BUTTON_TRIM = 4; 36 | private const int BUTTONS_PER_ROW = 8; 37 | // hardcoded in Button.Style 38 | private const int BUTTON_MARGIN = 1; 39 | private const int ROWS = 8; 40 | 41 | private Action onButtonSelected; 42 | private List