MacMainWindow.axaml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <Window
  2. BorderBrush="{DynamicResource SecondaryBackgroundColor}"
  3. BorderThickness="1"
  4. CanResize="{Binding MainWindow.CanResize.Value}"
  5. ExtendClientAreaChromeHints="SystemChrome"
  6. ExtendClientAreaTitleBarHeightHint="-1"
  7. MinHeight="{CompiledBinding MainWindow.WindowMinSize.Value}"
  8. MinWidth="{CompiledBinding MainWindow.WindowMinSize.Value}"
  9. SizeChanged="Control_OnSizeChanged"
  10. SizeToContent="{CompiledBinding MainWindow.SizeToContent.Value}"
  11. Title="{CompiledBinding PicViewer.WindowTitle.Value}"
  12. x:Class="PicView.Avalonia.MacOS.Views.MacMainWindow"
  13. x:DataType="viewModels:MainViewModel"
  14. xmlns="https://github.com/avaloniaui"
  15. xmlns:converters1="clr-namespace:PicView.Avalonia.Converters;assembly=PicView.Avalonia"
  16. xmlns:viewModels="clr-namespace:PicView.Avalonia.ViewModels;assembly=PicView.Avalonia"
  17. xmlns:views="clr-namespace:PicView.Avalonia.Views;assembly=PicView.Avalonia"
  18. xmlns:views1="clr-namespace:PicView.Avalonia.MacOS.Views"
  19. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  20. <Window.Resources>
  21. <converters1:SortFilesByToBoolConverter x:Key="EnumToBoolConverter" />
  22. </Window.Resources>
  23. <NativeMenu.Menu>
  24. <NativeMenu>
  25. <NativeMenuItem Header="{CompiledBinding Translation.File.Value}">
  26. <NativeMenu>
  27. <NativeMenuItem Command="{CompiledBinding Tools.OpenFileCommand}" Header="{CompiledBinding Translation.Open.Value, Mode=OneWay}" />
  28. <NativeMenuItem
  29. Command="{CompiledBinding Tools.OpenWithCommand}"
  30. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  31. FallbackValue=''}"
  32. Header="{CompiledBinding Translation.OpenWith,
  33. Mode=OneWay}" />
  34. <NativeMenuItem Command="{CompiledBinding Tools.SaveFileCommand}" Header="{CompiledBinding Translation.Save.Value, Mode=OneWay}" />
  35. <NativeMenuItem Command="{CompiledBinding Tools.SaveFileAsCommand}" Header="{CompiledBinding Translation.SaveAs.Value, Mode=OneWay}" />
  36. <NativeMenuItem
  37. Command="{CompiledBinding Tools.PrintCommand}"
  38. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value,
  39. FallbackValue=''}"
  40. Header="{CompiledBinding Translation.Print.Value,
  41. Mode=OneWay}"
  42. IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,
  43. Converter={x:Static ObjectConverters.IsNotNull}}" />
  44. <NativeMenuItem
  45. Command="{CompiledBinding Tools.LocateOnDiskCommand}"
  46. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  47. FallbackValue=''}"
  48. Header="{CompiledBinding Translation.ShowInFolder.Value,
  49. Mode=OneWay}"
  50. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  51. Converter={x:Static ObjectConverters.IsNotNull}}" />
  52. <NativeMenuItemSeparator />
  53. <NativeMenuItem
  54. Command="{CompiledBinding Tools.DeleteFilePermanentlyCommand}"
  55. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  56. FallbackValue=''}"
  57. Header="{CompiledBinding Translation.DeleteFile.Value,
  58. Mode=OneWay}"
  59. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  60. Converter={x:Static ObjectConverters.IsNotNull}}" />
  61. <NativeMenuItemSeparator />
  62. <NativeMenuItem
  63. Command="{CompiledBinding Navigation.ReloadCommand}"
  64. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  65. FallbackValue=''}"
  66. Header="{CompiledBinding Translation.Reload.Value,
  67. Mode=OneWay}"
  68. IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,
  69. Converter={x:Static ObjectConverters.IsNotNull}}" />
  70. <NativeMenuItem Command="{CompiledBinding Window.NewWindow}" Header="{CompiledBinding Translation.NewWindow.Value, Mode=OneWay}" />
  71. <NativeMenuItemSeparator />
  72. <NativeMenuItem
  73. Command="{CompiledBinding Tools.RenameCommand}"
  74. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  75. FallbackValue=''}"
  76. Header="{CompiledBinding Translation.RenameFile.Value,
  77. Mode=OneWay}"
  78. IsEnabled="{CompiledBinding PicViewer.FileInfo,
  79. Converter={x:Static ObjectConverters.IsNotNull}}" />
  80. <NativeMenuItemSeparator />
  81. <NativeMenuItem Command="{CompiledBinding Tools.PasteCommand}" Header="{CompiledBinding Translation.Paste.Value, Mode=OneWay}" />
  82. <NativeMenuItemSeparator />
  83. <NativeMenuItem
  84. Command="{CompiledBinding Tools.CopyFileCommand}"
  85. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  86. FallbackValue=''}"
  87. Header="{CompiledBinding Translation.CopyFile.Value,
  88. Mode=OneWay}"
  89. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  90. Converter={x:Static ObjectConverters.IsNotNull}}" />
  91. <NativeMenuItem
  92. Command="{CompiledBinding Tools.CopyImageCommand}"
  93. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  94. FallbackValue=''}"
  95. Header="{CompiledBinding Translation.CopyImage.Value,
  96. Mode=OneWay}"
  97. IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,
  98. Converter={x:Static ObjectConverters.IsNotNull}}" />
  99. <NativeMenuItem
  100. Command="{CompiledBinding Tools.CopyFilePathCommand}"
  101. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  102. FallbackValue=''}"
  103. Header="{CompiledBinding Translation.FileCopyPath.Value,
  104. Mode=OneWay}"
  105. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  106. Converter={x:Static ObjectConverters.IsNotNull}}" />
  107. <NativeMenuItem
  108. Command="{CompiledBinding Tools.DuplicateFileCommand}"
  109. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  110. FallbackValue=''}"
  111. Header="{CompiledBinding Translation.DuplicateFile.Value,
  112. Mode=OneWay}"
  113. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  114. Converter={x:Static ObjectConverters.IsNotNull}}" />
  115. </NativeMenu>
  116. </NativeMenuItem>
  117. <!-- Image -->
  118. <NativeMenuItem Header="{CompiledBinding Translation.Image.Value, Mode=OneWay}">
  119. <NativeMenu>
  120. <NativeMenuItem
  121. Command="{CompiledBinding RotateLeftCommand}"
  122. Header="{CompiledBinding Translation.RotateLeft.Value,
  123. Mode=OneWay}"
  124. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  125. Converter={x:Static ObjectConverters.IsNotNull}}" />
  126. <NativeMenuItem
  127. Command="{CompiledBinding RotateRightCommand}"
  128. Header="{CompiledBinding Translation.RotateRight.Value,
  129. Mode=OneWay}"
  130. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  131. Converter={x:Static ObjectConverters.IsNotNull}}" />
  132. <NativeMenuItem
  133. Command="{CompiledBinding FlipCommand}"
  134. Header="{CompiledBinding Translation.Flip.Value,
  135. Mode=OneWay}"
  136. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  137. Converter={x:Static ObjectConverters.IsNotNull}}" />
  138. <NativeMenuItemSeparator />
  139. <NativeMenuItem
  140. Command="{CompiledBinding CropCommand}"
  141. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  142. FallbackValue=''}"
  143. Header="{CompiledBinding Translation.Crop.Value,
  144. Mode=OneWay}"
  145. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  146. Converter={x:Static ObjectConverters.IsNotNull}}" />
  147. <NativeMenuItemSeparator />
  148. <NativeMenuItem
  149. Command="{CompiledBinding Tools.SetAsWallpaperCommand}"
  150. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  151. FallbackValue=''}"
  152. Header="{CompiledBinding Translation.SetAsWallpaper.Value,
  153. Mode=OneWay}"
  154. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  155. Converter={x:Static ObjectConverters.IsNotNull}}" />
  156. <NativeMenuItemSeparator />
  157. <NativeMenuItem Command="{CompiledBinding Window.ShowExifWindow}" Header="{CompiledBinding Translation.ImageInfo.Value, Mode=OneWay}" />
  158. <NativeMenuItem
  159. Command="{CompiledBinding Tools.FilePropertiesCommand}"
  160. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  161. FallbackValue=''}"
  162. Header="{CompiledBinding Translation.FileProperties.Value,
  163. Mode=OneWay}"
  164. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  165. Converter={x:Static ObjectConverters.IsNotNull}}" />
  166. <NativeMenuItemSeparator />
  167. <NativeMenuItem Command="{CompiledBinding Window.ShowSingleImageResizeWindow}" Header="{CompiledBinding Translation.ResizeImage.Value, Mode=OneWay}" />
  168. <NativeMenuItem Command="{CompiledBinding Window.ShowBatchResizeWindow}" Header="{CompiledBinding Translation.BatchResize.Value, Mode=OneWay}" />
  169. <NativeMenuItemSeparator />
  170. <NativeMenuItem
  171. Command="{CompiledBinding OptimizeImageCommand}"
  172. CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
  173. FallbackValue=''}"
  174. Header="{CompiledBinding Translation.OptimizeImage.Value,
  175. Mode=OneWay}"
  176. IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
  177. Converter={x:Static ObjectConverters.IsNotNull}}" />
  178. <NativeMenuItemSeparator />
  179. <NativeMenuItem Command="{CompiledBinding Window.ShowEffectsWindow}" Header="{CompiledBinding Translation.Effects.Value, Mode=OneWay}" />
  180. </NativeMenu>
  181. </NativeMenuItem>
  182. <!-- Navigation -->
  183. <NativeMenuItem Header="{CompiledBinding Translation.Navigation.Value, Mode=OneWay}">
  184. <NativeMenu>
  185. <NativeMenuItem
  186. Command="{CompiledBinding Tools.StartSlideShowTask}"
  187. CommandParameter="-1"
  188. Header="{CompiledBinding Translation.Slideshow.Value,
  189. Mode=OneWay}" />
  190. <NativeMenuItemSeparator />
  191. <NativeMenuItem Command="{CompiledBinding Navigation.FirstCommand}" Header="{CompiledBinding Translation.FirstImage.Value, Mode=OneWay}" />
  192. <NativeMenuItem Command="{CompiledBinding Navigation.LastCommand}" Header="{CompiledBinding Translation.LastImage.Value, Mode=OneWay}" />
  193. <NativeMenuItemSeparator />
  194. <NativeMenuItem Command="{CompiledBinding Navigation.Skip10Command}" Header="{CompiledBinding Translation.AdvanceBy10Images.Value, Mode=OneWay}" />
  195. <NativeMenuItem Command="{CompiledBinding Navigation.Skip100Command}" Header="{CompiledBinding Translation.AdvanceBy100Images.Value, Mode=OneWay}" />
  196. <NativeMenuItem Command="{CompiledBinding Navigation.Prev10Command}" Header="{CompiledBinding Translation.GoBackBy10Images.Value, Mode=OneWay}" />
  197. <NativeMenuItem Command="{CompiledBinding Navigation.Prev100Command}" Header="{CompiledBinding Translation.GoBackBy100Images.Value, Mode=OneWay}" />
  198. <NativeMenuItemSeparator />
  199. <NativeMenuItem Command="{CompiledBinding Navigation.NextFolderCommand}" Header="{CompiledBinding Translation.NextFolder.Value, Mode=OneWay}" />
  200. <NativeMenuItem Command="{CompiledBinding Navigation.PreviousFolderCommand}" Header="{CompiledBinding Translation.PrevFolder.Value, Mode=OneWay}" />
  201. </NativeMenu>
  202. </NativeMenuItem>
  203. <!-- Interface configuration -->
  204. <NativeMenuItem Header="{CompiledBinding Translation.InterfaceConfiguration.Value, Mode=OneWay}">
  205. <NativeMenu>
  206. <NativeMenuItem Command="{CompiledBinding MainWindow.ToggleFullscreenCommand}" Header="{CompiledBinding Translation.ToggleFullscreen.Value, Mode=OneWay}" />
  207. <NativeMenuItem
  208. Command="{CompiledBinding ChangeAutoFitCommand}"
  209. Header="{CompiledBinding Translation.AutoFitWindow.Value,
  210. Mode=OneWay}"
  211. IsChecked="{CompiledBinding GlobalSettings.IsAutoFit.Value}"
  212. ToggleType="CheckBox" />
  213. <NativeMenuItem Command="{CompiledBinding ToggleUICommand}" Header="{CompiledBinding Translation.IsShowingUI.Value, Mode=OneWay}" />
  214. <NativeMenuItem Command="{CompiledBinding Gallery.ToggleGalleryCommand}" Header="{CompiledBinding Translation.ShowImageGallery.Value, Mode=OneWay}" />
  215. </NativeMenu>
  216. </NativeMenuItem>
  217. <!-- Sort files -->
  218. <NativeMenuItem Header="{CompiledBinding Translation.SortFilesBy.Value, Mode=OneWay}">
  219. <NativeMenu>
  220. <NativeMenuItem
  221. Command="{CompiledBinding Sorting.SortFilesByNameCommand}"
  222. Header="{CompiledBinding Translation.FileName.Value,
  223. Mode=OneWay}"
  224. IsChecked="{CompiledBinding Sorting.SortOrder.Value,
  225. Converter={StaticResource EnumToBoolConverter},
  226. ConverterParameter=Name}"
  227. ToggleType="Radio" />
  228. <NativeMenuItem
  229. Command="{CompiledBinding Sorting.SortFilesBySizeCommand}"
  230. Header="{CompiledBinding Translation.FileSize.Value,
  231. Mode=OneWay}"
  232. IsChecked="{CompiledBinding Sorting.SortOrder.Value,
  233. Converter={StaticResource EnumToBoolConverter},
  234. ConverterParameter=FileSize}"
  235. ToggleType="Radio" />
  236. <NativeMenuItem
  237. Command="{CompiledBinding Sorting.SortFilesByExtensionCommand}"
  238. Header="{CompiledBinding Translation.FileExtension.Value,
  239. Mode=OneWay}"
  240. IsChecked="{CompiledBinding Sorting.SortOrder.Value,
  241. Converter={StaticResource EnumToBoolConverter},
  242. ConverterParameter=FileExtension}"
  243. ToggleType="Radio" />
  244. <NativeMenuItem
  245. Command="{CompiledBinding Sorting.SortFilesByCreationTimeCommand}"
  246. Header="{CompiledBinding Translation.Created.Value,
  247. Mode=OneWay}"
  248. IsChecked="{CompiledBinding Sorting.SortOrder.Value,
  249. Converter={StaticResource EnumToBoolConverter},
  250. ConverterParameter=Created}"
  251. ToggleType="Radio" />
  252. <NativeMenuItem
  253. Command="{CompiledBinding Sorting.SortFilesByLastAccessTimeCommand}"
  254. Header="{CompiledBinding Translation.LastAccessTime.Value,
  255. Mode=OneWay}"
  256. IsChecked="{CompiledBinding Sorting.SortOrder.Value,
  257. Converter={StaticResource EnumToBoolConverter},
  258. ConverterParameter=LastAccessTime}"
  259. ToggleType="Radio" />
  260. <NativeMenuItem
  261. Command="{CompiledBinding Sorting.SortFilesRandomlyCommand}"
  262. Header="{CompiledBinding Translation.Random.Value,
  263. Mode=OneWay}"
  264. IsChecked="{CompiledBinding Sorting.SortOrder.Value,
  265. Converter={StaticResource EnumToBoolConverter},
  266. ConverterParameter=Random}"
  267. ToggleType="Radio" />
  268. </NativeMenu>
  269. </NativeMenuItem>
  270. <!-- Settings -->
  271. <NativeMenuItem Header="{CompiledBinding Translation.Settings.Value, Mode=OneWay}">
  272. <NativeMenu>
  273. <NativeMenuItem Command="{CompiledBinding ChangeBackgroundCommand}" Header="{CompiledBinding Translation.ChangeBackground.Value, Mode=OneWay}" />
  274. <NativeMenuItemSeparator />
  275. <NativeMenuItem
  276. Command="{CompiledBinding ToggleLoopingCommand}"
  277. Header="{CompiledBinding Translation.IsLooping.Value,
  278. Mode=OneWay}"
  279. IsChecked="{CompiledBinding GlobalSettings.IsLooping.Value}"
  280. ToggleType="CheckBox" />
  281. <NativeMenuItem
  282. Command="{CompiledBinding StretchCommand}"
  283. Header="{CompiledBinding Translation.Stretch.Value,
  284. Mode=OneWay}"
  285. IsChecked="{CompiledBinding GlobalSettings.IsStretched.Value}"
  286. ToggleType="CheckBox" />
  287. <NativeMenuItem
  288. Command="{CompiledBinding ToggleScrollCommand}"
  289. Header="{CompiledBinding Translation.ToggleScroll.Value,
  290. Mode=OneWay}"
  291. IsChecked="{CompiledBinding GlobalSettings.IsScrollingEnabled.Value}"
  292. ToggleType="CheckBox" />
  293. <NativeMenuItemSeparator />
  294. <NativeMenuItem
  295. Command="{CompiledBinding ChangeTopMostCommand}"
  296. Header="{CompiledBinding Translation.StayTopMost.Value,
  297. Mode=OneWay}"
  298. IsChecked="{CompiledBinding GlobalSettings.IsTopMost.Value}"
  299. ToggleType="CheckBox" />
  300. <NativeMenuItemSeparator />
  301. <NativeMenuItem
  302. Command="{CompiledBinding ToggleSubdirectoriesCommand}"
  303. Header="{CompiledBinding Translation.SearchSubdirectory.Value,
  304. Mode=OneWay}"
  305. IsChecked="{CompiledBinding GlobalSettings.IsIncludingSubdirectories.Value}"
  306. ToggleType="CheckBox" />
  307. <NativeMenuItemSeparator />
  308. <NativeMenuItem Command="{CompiledBinding Window.ShowKeybindingsWindow}" Header="{CompiledBinding Translation.ApplicationShortcuts.Value, Mode=OneWay}" />
  309. <NativeMenuItemSeparator />
  310. <NativeMenuItem Command="{CompiledBinding Window.ShowAboutWindow}" Header="{CompiledBinding Translation.About.Value, Mode=OneWay}" />
  311. <NativeMenuItemSeparator />
  312. <NativeMenuItem Command="{CompiledBinding Window.ShowSettingsWindow}" Header="{CompiledBinding Translation.ShowAllSettingsWindow.Value, Mode=OneWay}" />
  313. </NativeMenu>
  314. </NativeMenuItem>
  315. <!-- Window -->
  316. <NativeMenuItem Header="{CompiledBinding Translation.Window.Value, Mode=OneWay}">
  317. <NativeMenu>
  318. <NativeMenuItem Command="{CompiledBinding Window.NewWindow}" Header="{CompiledBinding Translation.NewWindow.Value, Mode=OneWay, Mode=OneWay}" />
  319. <NativeMenuItemSeparator />
  320. <NativeMenuItem Command="{CompiledBinding MainWindow.MaximizeCommand}" Header="{CompiledBinding Translation.Maximize.Value, Mode=OneWay}" />
  321. <NativeMenuItem Command="{CompiledBinding MainWindow.ToggleFullscreenCommand}" Header="{CompiledBinding Translation.Fullscreen.Value, Mode=OneWay}" />
  322. </NativeMenu>
  323. </NativeMenuItem>
  324. </NativeMenu>
  325. </NativeMenu.Menu>
  326. <DockPanel LastChildFill="True">
  327. <views1:MacOSTitlebar DockPanel.Dock="Top" x:Name="Titlebar" />
  328. <views:BottomBar DockPanel.Dock="Bottom" x:Name="BottomBar" />
  329. <views:MainView Background="Transparent" x:Name="MainView" />
  330. </DockPanel>
  331. </Window>