浏览代码

ThePimp: add Fullscreen support, including the F11 binding.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3144 92316355-f0b4-4df1-b90c-862c8a59935f
master
sam 16 年前
父节点
当前提交
32f451e766
共有 3 个文件被更改,包括 40 次插入7 次删除
  1. +10
    -4
      ThePimp/gtk-gui/ThePimp.MainWindow.cs
  2. +12
    -3
      ThePimp/gtk-gui/gui.stetic
  3. +18
    -0
      ThePimp/src/MainWindow.cs

+ 10
- 4
ThePimp/gtk-gui/ThePimp.MainWindow.cs 查看文件

@@ -69,6 +69,8 @@ namespace ThePimp {
private Gtk.Action saveAsAction;
private Gtk.Action FullscreenAction;
private Gtk.VBox vbox1;
private Gtk.MenuBar menubar1;
@@ -181,6 +183,9 @@ namespace ThePimp {
w2.Add(this.helpAction, null);
this.saveAsAction = new Gtk.Action("saveAsAction", null, Mono.Unix.Catalog.GetString("Save active image "), "gtk-save-as");
w2.Add(this.saveAsAction, null);
this.FullscreenAction = new Gtk.Action("FullscreenAction", Mono.Unix.Catalog.GetString("Fullscreen"), null, "gtk-fullscreen");
this.FullscreenAction.ShortLabel = Mono.Unix.Catalog.GetString("Fullscreen");
w2.Add(this.FullscreenAction, null);
w1.InsertActionGroup(w2, 0);
this.AddAccelGroup(w1.AccelGroup);
this.Name = "ThePimp.MainWindow";
@@ -191,7 +196,7 @@ namespace ThePimp {
this.vbox1 = new Gtk.VBox();
this.vbox1.Name = "vbox1";
// Container child vbox1.Gtk.Box+BoxChild
w1.AddUiFromString("<ui><menubar name='menubar1'><menu action='FileAction'><menuitem action='NewAction'/><menuitem action='OpenAction'/><menuitem action='SaveAction'/><menuitem action='SaveAsAction'/><menuitem action='QuitAction'/></menu><menu action='EditAction'><menuitem action='UndoAction'/><menuitem action='RedoAction'/></menu><menu action='ViewAction'><menuitem action='ZoomInAction'/><menuitem action='ZoomOutAction'/><menuitem action='BestFitAction'/><menuitem action='NormalSizeAction'/></menu><menu action='HelpAction'><menuitem action='HelpAction1'/><menuitem action='AboutAction'/></menu></menubar></ui>");
w1.AddUiFromString("<ui><menubar name='menubar1'><menu action='FileAction'><menuitem action='NewAction'/><menuitem action='OpenAction'/><menuitem action='SaveAction'/><menuitem action='SaveAsAction'/><menuitem action='QuitAction'/></menu><menu action='EditAction'><menuitem action='UndoAction'/><menuitem action='RedoAction'/></menu><menu action='ViewAction'><menuitem action='ZoomInAction'/><menuitem action='ZoomOutAction'/><menuitem action='BestFitAction'/><menuitem action='NormalSizeAction'/><separator/><menuitem action='FullscreenAction'/></menu><menu action='HelpAction'><menuitem action='HelpAction1'/><menuitem action='AboutAction'/></menu></menubar></ui>");
this.menubar1 = ((Gtk.MenuBar)(w1.GetWidget("/menubar1")));
this.menubar1.Name = "menubar1";
this.vbox1.Add(this.menubar1);
@@ -219,7 +224,7 @@ namespace ThePimp {
this.vpaned1 = new Gtk.VPaned();
this.vpaned1.CanFocus = true;
this.vpaned1.Name = "vpaned1";
this.vpaned1.Position = 42;
this.vpaned1.Position = 41;
this.hpaned1.Add(this.vpaned1);
Gtk.Paned.PanedChild w5 = ((Gtk.Paned.PanedChild)(this.hpaned1[this.vpaned1]));
w5.Resize = false;
@@ -227,7 +232,7 @@ namespace ThePimp {
this.hpaned2 = new Gtk.HPaned();
this.hpaned2.CanFocus = true;
this.hpaned2.Name = "hpaned2";
this.hpaned2.Position = 883;
this.hpaned2.Position = 886;
// Container child hpaned2.Gtk.Paned+PanedChild
this.notebook1 = new Gtk.Notebook();
this.notebook1.CanFocus = true;
@@ -241,7 +246,7 @@ namespace ThePimp {
this.vpaned2 = new Gtk.VPaned();
this.vpaned2.CanFocus = true;
this.vpaned2.Name = "vpaned2";
this.vpaned2.Position = 42;
this.vpaned2.Position = 41;
this.hpaned2.Add(this.vpaned2);
Gtk.Paned.PanedChild w7 = ((Gtk.Paned.PanedChild)(this.hpaned2[this.vpaned2]));
w7.Resize = false;
@@ -277,6 +282,7 @@ namespace ThePimp {
this.QuitAction.Activated += new System.EventHandler(this.OnQuitActionActivated);
this.AboutAction.Activated += new System.EventHandler(this.OnAboutActionActivated);
this.saveAsAction.Activated += new System.EventHandler(this.OnSaveAsActionActivated);
this.FullscreenAction.Activated += new System.EventHandler(this.OnFullscreenActionActivated);
}
}
}

+ 12
- 3
ThePimp/gtk-gui/gui.stetic 查看文件

@@ -194,6 +194,13 @@
<property name="Tooltip" translatable="yes">Save active image </property>
<signal name="Activated" handler="OnSaveAsActionActivated" />
</action>
<action id="FullscreenAction">
<property name="Type">Action</property>
<property name="Label" translatable="yes">Fullscreen</property>
<property name="ShortLabel" translatable="yes">Fullscreen</property>
<property name="StockId">gtk-fullscreen</property>
<signal name="Activated" handler="OnFullscreenActionActivated" />
</action>
</action-group>
<property name="MemberName" />
<property name="Title" translatable="yes">The Pimp</property>
@@ -223,6 +230,8 @@
<node type="Menuitem" action="ZoomOutAction" />
<node type="Menuitem" action="BestFitAction" />
<node type="Menuitem" action="NormalSizeAction" />
<node type="Separator" />
<node type="Menuitem" action="FullscreenAction" />
</node>
<node type="Menu" action="HelpAction">
<node type="Menuitem" action="HelpAction1" />
@@ -274,7 +283,7 @@
<widget class="Gtk.VPaned" id="vpaned1">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Position">42</property>
<property name="Position">41</property>
<child>
<placeholder />
</child>
@@ -290,7 +299,7 @@
<widget class="Gtk.HPaned" id="hpaned2">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Position">883</property>
<property name="Position">886</property>
<child>
<widget class="Gtk.Notebook" id="notebook1">
<property name="MemberName" />
@@ -309,7 +318,7 @@
<widget class="Gtk.VPaned" id="vpaned2">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Position">42</property>
<property name="Position">41</property>
<child>
<placeholder />
</child>


+ 18
- 0
ThePimp/src/MainWindow.cs 查看文件

@@ -19,6 +19,8 @@ using ThePimp;

namespace ThePimp
{
[Gtk.Binding(Gdk.Key.F11, "ToggleFullScreen")]

public partial class MainWindow: Gtk.Window
{
public MainWindow (): base (Gtk.WindowType.Toplevel)
@@ -102,5 +104,21 @@ namespace ThePimp
protected virtual void OnSaveActionActivated (object sender, System.EventArgs e)
{
}

private bool _fullscreen = false;
protected virtual void ToggleFullScreen()
{
_fullscreen = !_fullscreen;

if(_fullscreen)
Fullscreen();
else
Unfullscreen();
}

protected virtual void OnFullscreenActionActivated (object sender, System.EventArgs e)
{
ToggleFullScreen();
}
}
}

正在加载...
取消
保存