added menu bar.

This commit is contained in:
morkt 2014-07-31 06:57:13 +04:00
parent e7ec8d21a1
commit cd9adb016b
4 changed files with 111 additions and 11 deletions

View File

@ -81,23 +81,41 @@
</MenuItem> </MenuItem>
--> -->
</ContextMenu> </ContextMenu>
<!--
<ItemsPanelTemplate x:Key="MenuPanelWithoutIcon">
<StackPanel Margin="-20,0,0,0" Background="{DynamicResource {x:Static SystemColors.MenuBrushKey}}"/>
</ItemsPanelTemplate>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="ItemsPanel" Value="{StaticResource MenuPanelWithoutIcon}"/>
</Style>
-->
</Window.Resources> </Window.Resources>
<DockPanel LastChildFill="True"> <DockPanel LastChildFill="True">
<Menu x:Name="MainMenuBar" DockPanel.Dock="Top" IsMainMenu="True" Visibility="Collapsed"> <Menu x:Name="MainMenuBar" DockPanel.Dock="Top" IsMainMenu="True" Visibility="Visible"
<MenuItem Header="File"> Background="{Binding Path=Background, ElementName=AppStatusBar}">
<MenuItem Header="Open..."/> <MenuItem Header="{x:Static s:guiStrings.MenuFile}">
<MenuItem Header="Recent files" ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MainWindow}, Path=RecentFiles, Mode=OneWay}"> <MenuItem Header="{x:Static s:guiStrings.MenuOpen}" Command="{x:Static local:Commands.OpenFile}" InputGestureText="Ctrl+O"/>
<MenuItem Header="{x:Static s:guiStrings.MenuRecent}" x:Name="RecentFilesMenu">
<MenuItem.ItemContainerStyle> <MenuItem.ItemContainerStyle>
<Style TargetType="MenuItem"> <Style TargetType="MenuItem">
<Setter Property="Header" Value="{Binding}"/> <Setter Property="Header" Value="{Binding Path=Item2}"/>
<Setter Property="Command" Value="{x:Static local:Commands.OpenRecent}"/>
<Setter Property="CommandParameter" Value="{Binding Path=Item1}"/>
</Style> </Style>
</MenuItem.ItemContainerStyle> </MenuItem.ItemContainerStyle>
</MenuItem> </MenuItem>
<Separator/> <Separator/>
<MenuItem Header="Exit" Command="{x:Static local:Commands.Exit}" InputGestureText="Ctrl+Q"/> <MenuItem Header="{x:Static s:guiStrings.MenuExit}" Command="{x:Static local:Commands.Exit}" InputGestureText="Ctrl+Q"/>
</MenuItem>
<MenuItem Header="{x:Static s:guiStrings.MenuHelp}">
<MenuItem Header="{x:Static s:guiStrings.MenuAbout}" Command="{x:Static local:Commands.About}"/>
</MenuItem> </MenuItem>
</Menu> </Menu>
<DockPanel Background="{Binding Path=Background, ElementName=MainMenuBar}" x:Name="MainToolBar" <Menu Visibility="Collapsed" x:Name="HelperMenuBar"/>
<Separator DockPanel.Dock="Top" Height="1" Margin="0"/>
<DockPanel Background="{Binding Path=Background, ElementName=HelperMenuBar}" x:Name="MainToolBar"
HorizontalAlignment="Stretch" DockPanel.Dock="Top"> HorizontalAlignment="Stretch" DockPanel.Dock="Top">
<DockPanel.Resources> <DockPanel.Resources>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"> <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
@ -146,16 +164,19 @@
</Button> </Button>
<Separator/> <Separator/>
<local:ExtAutoCompleteBox x:Name="pathLine" Height="22" Width="100"/> <local:ExtAutoCompleteBox x:Name="pathLine" Height="22" Width="100"/>
<Button ToolTip="{x:Static s:guiStrings.MenuAbout}" DockPanel.Dock="Right" Margin="0,2,10,2" Click="MenuAbout_Click"> <Button ToolTip="{x:Static s:guiStrings.MenuAbout}" DockPanel.Dock="Right" Margin="0,2,10,2"
Command="{x:Static local:Commands.About}">
<Image Source="{StaticResource Icon32x32Help}"/> <Image Source="{StaticResource Icon32x32Help}"/>
</Button> </Button>
<TextBlock Visibility="Hidden"/> <TextBlock Visibility="Hidden"/>
</DockPanel> </DockPanel>
<Separator DockPanel.Dock="Top" Height="1" Margin="0"/>
<StatusBar DockPanel.Dock="Bottom" x:Name="AppStatusBar"> <StatusBar DockPanel.Dock="Bottom" x:Name="AppStatusBar">
<StatusBarItem> <StatusBarItem>
<TextBlock x:Name="appStatusText"/> <TextBlock x:Name="appStatusText"/>
</StatusBarItem> </StatusBarItem>
</StatusBar> </StatusBar>
<Separator DockPanel.Dock="Bottom" Height="1" Margin="0"/>
<Grid x:Name="ContentGrid" DockPanel.Dock="Left" VerticalAlignment="Stretch" <Grid x:Name="ContentGrid" DockPanel.Dock="Left" VerticalAlignment="Stretch"
HorizontalAlignment="Stretch" ShowGridLines="False"> HorizontalAlignment="Stretch" ShowGridLines="False">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -163,7 +184,7 @@
<ColumnDefinition Width="1"/> <ColumnDefinition Width="1"/>
<ColumnDefinition Width="*" MinWidth="100"/> <ColumnDefinition Width="*" MinWidth="100"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<local:ListViewEx x:Name="CurrentDirectory" Grid.Column="0" <local:ListViewEx x:Name="CurrentDirectory" Grid.Column="0" BorderThickness="0"
ItemsSource="{Binding Source={StaticResource ListViewSource}}" ItemsSource="{Binding Source={StaticResource ListViewSource}}"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
BorderBrush="Transparent" SelectedValuePath="Name" BorderBrush="Transparent" SelectedValuePath="Name"
@ -259,6 +280,7 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
<Window.InputBindings> <Window.InputBindings>
<KeyBinding Gesture="Ctrl+O" Command="{x:Static local:Commands.OpenFile}"/>
<KeyBinding Gesture="Ctrl+Q" Command="{x:Static local:Commands.Exit}"/> <KeyBinding Gesture="Ctrl+Q" Command="{x:Static local:Commands.Exit}"/>
<KeyBinding Gesture="Backspace" Command="{x:Static local:Commands.GoBack}"/> <KeyBinding Gesture="Backspace" Command="{x:Static local:Commands.GoBack}"/>
<KeyBinding Gesture="Alt+Left" Command="{x:Static local:Commands.GoBack}"/> <KeyBinding Gesture="Alt+Left" Command="{x:Static local:Commands.GoBack}"/>
@ -266,6 +288,8 @@
</Window.InputBindings> </Window.InputBindings>
<Window.CommandBindings> <Window.CommandBindings>
<CommandBinding Command="{x:Static local:Commands.OpenItem}" Executed="OpenItemExec" CanExecute="CanExecuteOnSelected"/> <CommandBinding Command="{x:Static local:Commands.OpenItem}" Executed="OpenItemExec" CanExecute="CanExecuteOnSelected"/>
<CommandBinding Command="{x:Static local:Commands.OpenFile}" Executed="OpenFileExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.OpenRecent}" Executed="OpenRecentExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.ExtractItem}" Executed="ExtractItemExec" CanExecute="CanExecuteExtract"/> <CommandBinding Command="{x:Static local:Commands.ExtractItem}" Executed="ExtractItemExec" CanExecute="CanExecuteExtract"/>
<CommandBinding Command="{x:Static local:Commands.CreateArchive}" Executed="CreateArchiveExec" CanExecute="CanExecuteCreateArchive"/> <CommandBinding Command="{x:Static local:Commands.CreateArchive}" Executed="CreateArchiveExec" CanExecute="CanExecuteCreateArchive"/>
<CommandBinding Command="{x:Static local:Commands.DeleteItem}" Executed="DeleteItemExec" CanExecute="CanExecuteOnPhysicalFile" /> <CommandBinding Command="{x:Static local:Commands.DeleteItem}" Executed="DeleteItemExec" CanExecute="CanExecuteOnPhysicalFile" />
@ -275,6 +299,7 @@
<CommandBinding Command="{x:Static local:Commands.GoBack}" Executed="GoBackExec" CanExecute="CanExecuteGoBack"/> <CommandBinding Command="{x:Static local:Commands.GoBack}" Executed="GoBackExec" CanExecute="CanExecuteGoBack"/>
<CommandBinding Command="{x:Static local:Commands.GoForward}" Executed="GoForwardExec" CanExecute="CanExecuteGoForward"/> <CommandBinding Command="{x:Static local:Commands.GoForward}" Executed="GoForwardExec" CanExecute="CanExecuteGoForward"/>
<CommandBinding Command="{x:Static local:Commands.Refresh}" Executed="RefreshExec" CanExecute="CanExecuteAlways"/> <CommandBinding Command="{x:Static local:Commands.Refresh}" Executed="RefreshExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.About}" Executed="AboutExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.Exit}" Executed="ExitExec" CanExecute="CanExecuteAlways"/> <CommandBinding Command="{x:Static local:Commands.Exit}" Executed="ExitExec" CanExecute="CanExecuteAlways"/>
</Window.CommandBindings> </Window.CommandBindings>
</Window> </Window>

View File

@ -322,7 +322,7 @@ namespace GARbro.GUI.Strings {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to About. /// Looks up a localized string similar to About Game Resource browser.
/// </summary> /// </summary>
public static string MenuAbout { public static string MenuAbout {
get { get {
@ -330,6 +330,51 @@ namespace GARbro.GUI.Strings {
} }
} }
/// <summary>
/// Looks up a localized string similar to E_xit.
/// </summary>
public static string MenuExit {
get {
return ResourceManager.GetString("MenuExit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _File.
/// </summary>
public static string MenuFile {
get {
return ResourceManager.GetString("MenuFile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Help.
/// </summary>
public static string MenuHelp {
get {
return ResourceManager.GetString("MenuHelp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open....
/// </summary>
public static string MenuOpen {
get {
return ResourceManager.GetString("MenuOpen", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Recent files.
/// </summary>
public static string MenuRecent {
get {
return ResourceManager.GetString("MenuRecent", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Choose files to extract. /// Looks up a localized string similar to Choose files to extract.
/// </summary> /// </summary>

View File

@ -205,7 +205,7 @@
<value>files</value> <value>files</value>
</data> </data>
<data name="MenuAbout" xml:space="preserve"> <data name="MenuAbout" xml:space="preserve">
<value>About</value> <value>About Game Resource browser</value>
</data> </data>
<data name="MsgDeletedItem" xml:space="preserve"> <data name="MsgDeletedItem" xml:space="preserve">
<value>Deleted {0}</value> <value>Deleted {0}</value>
@ -330,7 +330,22 @@ Overwrite?</value>
<data name="MsgCreatingArchive" xml:space="preserve"> <data name="MsgCreatingArchive" xml:space="preserve">
<value>Creating archive {0}</value> <value>Creating archive {0}</value>
</data> </data>
<data name="MenuOpen" xml:space="preserve">
<value>Open...</value>
</data>
<data name="MenuRecent" xml:space="preserve">
<value>Recent files</value>
</data>
<data name="MsgChooseFiles" xml:space="preserve"> <data name="MsgChooseFiles" xml:space="preserve">
<value>Choose files to extract</value> <value>Choose files to extract</value>
</data> </data>
<data name="MenuExit" xml:space="preserve">
<value>E_xit</value>
</data>
<data name="MenuFile" xml:space="preserve">
<value>_File</value>
</data>
<data name="MenuHelp" xml:space="preserve">
<value>_Help</value>
</data>
</root> </root>

View File

@ -342,7 +342,22 @@
<data name="Type_script" xml:space="preserve"> <data name="Type_script" xml:space="preserve">
<value>сценарий</value> <value>сценарий</value>
</data> </data>
<data name="MenuOpen" xml:space="preserve">
<value>Открыть...</value>
</data>
<data name="MenuRecent" xml:space="preserve">
<value>Недавние файлы</value>
</data>
<data name="MsgChooseFiles" xml:space="preserve"> <data name="MsgChooseFiles" xml:space="preserve">
<value>Выберите файлы для извлечения</value> <value>Выберите файлы для извлечения</value>
</data> </data>
<data name="MenuExit" xml:space="preserve">
<value>Выход</value>
</data>
<data name="MenuFile" xml:space="preserve">
<value>_Файл</value>
</data>
<data name="MenuHelp" xml:space="preserve">
<value>_Справка</value>
</data>
</root> </root>