public Navbar (Gtk.IconSize size)
		{
			address = new Entry ("address");
			// FIXME: this doesnt't seem to work yet
			// address.Completion = new EntryCompletion ();
			address.WidthChars = 50;
			address.Activated += new EventHandler (OnGoUrl);

			ActionEntry[] actions = new ActionEntry[]
			{
				new ActionEntry ("back", Gtk.Stock.GoBack, null, null, GettextCatalog.GetString ("Go back"), new EventHandler (OnBackClicked)),
				new ActionEntry ("forward", Gtk.Stock.GoForward, null, null, GettextCatalog.GetString ("Go forward"), new EventHandler (OnForwardClicked)),
				new ActionEntry ("stop", Gtk.Stock.Stop, null, null, GettextCatalog.GetString ("Stop loading"), new EventHandler (OnStopClicked)),
				new ActionEntry ("reload", Gtk.Stock.Refresh, null, null, GettextCatalog.GetString ("Address"), new EventHandler (OnReloadClicked)),
				new ActionEntry ("go", Gtk.Stock.Ok, null, null, GettextCatalog.GetString ("Load address"), new EventHandler (OnGoUrl))
			};

			ActionGroup ag = new ActionGroup ("navbarGroup");
			ag.Add (actions);

			UIManager uim = new UIManager ();
			uim.InsertActionGroup (ag, 0);
			uim.AddWidget += new AddWidgetHandler (OnAddWidget);
			uim.AddUiFromString (uiInfo);

			ToolItem item = new ToolItem ();
			item.Add (address);
	
			Toolbar tb = uim.GetWidget ("/ui/toolbar") as Toolbar;
			tb.IconSize = size;
			tb.Add (item);
			this.ShowAll ();
		}
Beispiel #2
0
		/// <summary>
		/// Sets up the DashPatternBox in the Toolbar.
		/// 
		/// Note that the dash pattern change event response code must be created manually outside of the DashPatternBox
		/// (using the returned Gtk.ComboBox from the SetupToolbar method) so that each tool that uses it
		/// can react to the change in pattern according to its usage.
		/// 
		/// Returns null if the DashPatternBox has already been setup; otherwise, returns the DashPatternBox itself.
		/// </summary>
		/// <param name="tb">The Toolbar to add the DashPatternBox to.</param>
		/// <returns>null if the DashPatternBox has already been setup; otherwise, returns the DashPatternBox itself.</returns>
		public Gtk.ComboBox SetupToolbar(Toolbar tb)
		{
			if (dashPatternSep == null)
			{
				dashPatternSep = new SeparatorToolItem();
			}

			tb.AppendItem(dashPatternSep);

			if (dashPatternLabel == null)
			{
				dashPatternLabel = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Dash")));
			}

			tb.AppendItem(dashPatternLabel);

			if (comboBox == null)
			{
				comboBox = new ToolBarComboBox(100, 0, true,
					"-", " -", " --", " ---", "  -", "   -", " - --", " - - --------", " - - ---- - ----");
			}

			tb.AppendItem(comboBox);

			if (dashChangeSetup)
			{
				return null;
			}
			else
			{
				dashChangeSetup = true;

				return comboBox.ComboBox;
			}
		}
 public static void AddWidgetItem(this Toolbar tb, Widget w)
 {
     w.Show ();
     ToolItem ti = new ToolItem ();
     ti.Add (w);
     ti.Show ();
     tb.Insert (ti, tb.NItems);
 }
Beispiel #4
0
 static void ToolbarReconfigured_cb(IntPtr inst)
 {
     try {
         ToolItem __obj = GLib.Object.GetObject(inst, false) as ToolItem;
         __obj.OnToolbarReconfigured();
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
Beispiel #5
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();

        radioButtons.Add(this.radTest1);
        radioButtons.Add(this.radTest2);
        radioButtons.Add(this.radiobutton1);
        radioButtons.Add(this.radiobutton2);

        string uiaQaPath = UiaAtkBridgeTest.Misc.LookForParentDir("*.gif");

        Gtk.Image img1 = new Gtk.Image();
        img1.File = System.IO.Path.Combine(uiaQaPath, "opensuse60x38.gif");
        img1.Show();
        this.btnWithImg.Image = img1;

        Gtk.Image img2 = new Gtk.Image();
        img2.File = System.IO.Path.Combine(uiaQaPath, "soccerball.gif");
        img2.Show();
        this.checkbutton1.Image = img2;

        Gtk.Image img3 = new Gtk.Image();
        img3.File = System.IO.Path.Combine(uiaQaPath, "apple-red.png");
        img3.Show();
        this.radTest2.Image = img3;

        this.imgTest1.File = System.IO.Path.Combine(uiaQaPath, "goalie.gif");

        this.imgTest2.File = System.IO.Path.Combine(uiaQaPath, "apple-red.png");

        this.maskedEntry.Visibility = false;


        this.hscrollbar1.Adjustment.Lower         = 0;   //Value tested in AtkTester.InterfaceValue
        this.hscrollbar1.Adjustment.Upper         = 100; //Value tested in AtkTester.InterfaceValue
        this.hscrollbar1.Adjustment.PageSize      = 1;
        this.hscrollbar1.Adjustment.StepIncrement = 1;

        this.vscrollbar1.Adjustment.Lower         = 0;   //Value tested in AtkTester.InterfaceValue
        this.vscrollbar1.Adjustment.Upper         = 100; //Value tested in AtkTester.InterfaceValue
        this.vscrollbar1.Adjustment.PageSize      = 1;
        this.vscrollbar1.Adjustment.StepIncrement = 1;

        //Used when testing Atk.Action.GetKeybinding
        this.btnWithImg.UseUnderline = true;
        this.btnTest1.UseUnderline   = true;

        this.WindowPosition = WindowPosition.CenterAlways;

        Gtk.ToolItem item = new Gtk.ToolItem();
        item.Add(new Gtk.Entry("TEST TEXT"));
        this.toolbar1.Insert(item, 3);
        this.toolbar1.ShowAll();
    }
Beispiel #6
0
	public MainWindow (): base (Gtk.WindowType.Toplevel)
	{
		Build ();
		
		radioButtons.Add (this.radTest1);
		radioButtons.Add (this.radTest2);
		radioButtons.Add (this.radiobutton1);
		radioButtons.Add (this.radiobutton2);
		
		string uiaQaPath = UiaAtkBridgeTest.Misc.LookForParentDir ("*.gif");
		Gtk.Image img1 = new Gtk.Image ();
		img1.File = System.IO.Path.Combine (uiaQaPath, "opensuse60x38.gif");
		img1.Show ();
		this.btnWithImg.Image = img1;
		
		Gtk.Image img2 = new Gtk.Image ();
		img2.File = System.IO.Path.Combine (uiaQaPath, "soccerball.gif");
		img2.Show ();
		this.checkbutton1.Image = img2;

		Gtk.Image img3 = new Gtk.Image ();
		img3.File = System.IO.Path.Combine (uiaQaPath, "apple-red.png");
		img3.Show ();
		this.radTest2.Image = img3;

		this.imgTest1.File = System.IO.Path.Combine (uiaQaPath, "goalie.gif");

		this.imgTest2.File = System.IO.Path.Combine (uiaQaPath, "apple-red.png");

		this.maskedEntry.Visibility = false;

		 
		this.hscrollbar1.Adjustment.Lower = 0; //Value tested in AtkTester.InterfaceValue
		this.hscrollbar1.Adjustment.Upper = 100; //Value tested in AtkTester.InterfaceValue
		this.hscrollbar1.Adjustment.PageSize = 1;
		this.hscrollbar1.Adjustment.StepIncrement = 1;

		this.vscrollbar1.Adjustment.Lower = 0; //Value tested in AtkTester.InterfaceValue
		this.vscrollbar1.Adjustment.Upper = 100; //Value tested in AtkTester.InterfaceValue
		this.vscrollbar1.Adjustment.PageSize = 1;
		this.vscrollbar1.Adjustment.StepIncrement = 1;

		//Used when testing Atk.Action.GetKeybinding
		this.btnWithImg.UseUnderline = true;
		this.btnTest1.UseUnderline = true;

		this.WindowPosition = WindowPosition.CenterAlways;

		Gtk.ToolItem item = new Gtk.ToolItem ();
		item.Add (new Gtk.Entry ("TEST TEXT"));
		this.toolbar1.Insert (item, 3);
		this.toolbar1.ShowAll ();
	}
Beispiel #7
0
 static bool CreateMenuProxy_cb(IntPtr inst)
 {
     try {
         ToolItem __obj = GLib.Object.GetObject(inst, false) as ToolItem;
         bool     __result;
         __result = __obj.OnCreateMenuProxy();
         return(__result);
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, true);
         // NOTREACHED: above call does not return.
         throw e;
     }
 }
Beispiel #8
0
        private void CreateExprBar()
        {
            // UrlEntry
            expr_entry            = new Gtk.Entry();
            expr_entry.Activated += new EventHandler(on_expr_activate);

            Gtk.ToolItem expr_item = new Gtk.ToolItem();
            expr_item.Expand = true;
            expr_item.Add(expr_entry);

            // Toolbar
            exprbar = new Toolbar();
            exprbar.ToolbarStyle = ToolbarStyle.Icons;
            exprbar.Orientation  = Orientation.Horizontal;
            exprbar.ShowArrow    = true;

            // Toolbar Itens
            exprbar.Add(expr_item);
            exprbar.Add(action_expr.CreateToolItem());
        }
Beispiel #9
0
		public WidgetActionBar (WidgetDesignerFrontend frontend, Stetic.Wrapper.Widget rootWidget)
		{
			this.frontend = frontend;
			
			editors = new Hashtable ();
			wrappers = new Hashtable ();
			sensitives = new Hashtable ();
			invisibles = new Hashtable ();
			toggles = new ArrayList ();

			IconSize = IconSize.Menu;
			Orientation = Orientation.Horizontal;
			ToolbarStyle = ToolbarStyle.BothHoriz;

			combo = new WidgetTreeCombo ();
			comboItem = new ToolItem ();
			comboItem.Add (combo);
			comboItem.ShowAll ();
			Insert (comboItem, -1);
			ShowAll ();
			RootWidget = rootWidget;
		}
Beispiel #10
0
        private void CreateFindbar()
        {
            // FindEntry
            find_entry = new Gtk.Entry();
            //find_entry.Activated += new EventHandler(on_uri_activate);

            Gtk.ToolItem find_item = new Gtk.ToolItem();
            //find_item.Expand = true;
            find_item.Add(find_entry);

            // Toolbar
            findbar = new Toolbar();
            findbar.ToolbarStyle = ToolbarStyle.Icons;
            findbar.Orientation  = Orientation.Horizontal;
            findbar.ShowArrow    = true;

            // Toolbar Itens
            findbar.Add(action_stop.CreateToolItem());
            findbar.Add(find_item);
            findbar.Add(action_back.CreateToolItem());
            findbar.Add(action_forward.CreateToolItem());
        }
Beispiel #11
0
        private void CreateToolbar()
        {
            // UrlEntry
            uri_entry            = new Gtk.Entry();
            uri_entry.Activated += new EventHandler(on_uri_activate);

            Gtk.ToolItem uri_item = new Gtk.ToolItem();
            uri_item.Expand = true;
            uri_item.Add(uri_entry);

            // Toolbar
            toolbar = new Toolbar();
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.Orientation  = Orientation.Horizontal;
            toolbar.ShowArrow    = true;

            // Toolbar Itens
            toolbar.Add(action_back.CreateToolItem());
            toolbar.Add(action_forward.CreateToolItem());
            toolbar.Add(action_reload.CreateToolItem());
            toolbar.Add(action_stop.CreateToolItem());
            toolbar.Add(uri_item);
            toolbar.Add(action_jump.CreateToolItem());
        }
Beispiel #12
0
        private void CreateFindbar()
        {
            // FindEntry
            find_entry = new Gtk.Entry ();
            //find_entry.Activated += new EventHandler(on_uri_activate);

            Gtk.ToolItem find_item = new Gtk.ToolItem ();
            //find_item.Expand = true;
            find_item.Add (find_entry);

            // Toolbar
            findbar = new Toolbar ();
            findbar.ToolbarStyle = ToolbarStyle.Icons;
            findbar.Orientation = Orientation.Horizontal;
            findbar.ShowArrow = true;

            // Toolbar Itens
            findbar.Add (action_stop.CreateToolItem());
            findbar.Add (find_item);
            findbar.Add (action_back.CreateToolItem());
            findbar.Add (action_forward.CreateToolItem());
        }
Beispiel #13
0
        private void CreateToolbar()
        {
            // UrlEntry
            uri_entry = new Gtk.Entry ();
            uri_entry.Activated += new EventHandler(on_uri_activate);

            Gtk.ToolItem uri_item = new Gtk.ToolItem ();
            uri_item.Expand = true;
            uri_item.Add (uri_entry);

            // Toolbar
            toolbar = new Toolbar ();
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.Orientation = Orientation.Horizontal;
            toolbar.ShowArrow = true;

            // Toolbar Itens
            toolbar.Add (action_back.CreateToolItem());
            toolbar.Add (action_forward.CreateToolItem());
            toolbar.Add (action_reload.CreateToolItem());
            toolbar.Add (action_stop.CreateToolItem());
            toolbar.Add (uri_item);
            toolbar.Add (action_jump.CreateToolItem());
        }
Beispiel #14
0
		/// <summary>
		/// Builds the toolbar.
		/// </summary>
		private void BuildToolBar ()
		{
			PortBox = new ComboBox ();
			PortBox.WidthRequest = 200;
			PortBox.Visible = true;

			EventBox eb = new EventBox ();

			PortBox.Changed += (sender, e) =>
			{
				ArduinoController.SerialPortName = PortBox.ActiveText;
				ArduinoController.Setup ();	
//				UpdatePortBox ();
			};

			PortBox.ButtonPressEvent += (o, args) => UpdatePortBox ();
			eb.ButtonPressEvent += (o, args) =>	UpdatePortBox ();

			var label = new Label ("Connect to:");
			label.Xalign = 0;

			var vbox = new VBox ();

			vbox.PackStart (label, true, true, 0);
			vbox.PackStart (PortBox, false, false, 0);

			eb.Add (vbox);

			var item = new ToolItem ();
			item.Expand = false;
			item.Add (eb);

			this.toolbarMain.Remove (this.toolbarMain.GetNthItem (4));

			this.toolbarMain.Insert (item, 4);
			this.toolbarMain.ShowAll ();

			UpdatePortBox ();
		}
		public SqlQueryView ()
		{
			stoppedQueries = new List<object> ();
			MonoDevelop.SourceEditor.Extension.TemplateExtensionNodeLoader.Init ();
			this.UntitledName = string.Concat (AddinCatalog.GetString ("Untitled Sql Script"), ".sql");
			
			vbox = new VBox (false, 6);
			vbox.BorderWidth = 6;
			
			Toolbar toolbar = new Toolbar ();
			toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
			
			buttonExecute = new ToolButton (ImageService.GetImage ("md-db-execute", IconSize.SmallToolbar),
			                                AddinCatalog.GetString ("_Execute"));
			buttonExecute.Label = AddinCatalog.GetString ("Execute");
			buttonExecute.Sensitive = false;
			buttonExecute.TooltipMarkup = AddinCatalog.GetString ("Execute Query");
			buttonExecute.IsImportant = true;
			buttonExecute.Clicked += new EventHandler (ExecuteClicked);

			buttonStop = new ToolButton ("gtk-stop");
			buttonStop.TooltipText = AddinCatalog.GetString ("Stop Query Execution");
			buttonStop.Sensitive = false;
			buttonStop.Clicked += new EventHandler (StopClicked);
			
			buttonClear = new ToolButton (ImageService.GetImage ("gtk-clear", IconSize.Button), 
			                              AddinCatalog.GetString ("Clear Results"));
			buttonClear.TooltipText = AddinCatalog.GetString ("Clear Results");
			buttonClear.Clicked += new EventHandler (ClearClicked);
			
			comboConnections = new DatabaseConnectionContextComboBox ();
			selectedConnection = comboConnections.DatabaseConnection;
			comboConnections.Changed += new EventHandler (ConnectionChanged);
			ToolItem comboItem = new ToolItem ();
			comboItem.Child = comboConnections;
			
			toolbar.Add (buttonExecute);
			toolbar.Add (buttonStop);
			toolbar.Add (buttonClear);
			toolbar.Add (new SeparatorToolItem ());
			toolbar.Add (comboItem);
			
			pane = new VPaned ();

			// Sql History Window
			ScrolledWindow windowHistory = new ScrolledWindow ();
			history = new SqlEditorWidget ();
			history.Editable = false;
			windowHistory.AddWithViewport (history);
			
			// Status of the Last Query
			ScrolledWindow windowStatus = new ScrolledWindow ();
			status = new TextView ();
			windowStatus.Add (status);
			
			notebook = new Notebook ();
			notebook.AppendPage (windowStatus, new Label (AddinCatalog.GetString ("Status")));
			notebook.AppendPage (windowHistory, new Label (AddinCatalog.GetString ("Query History")));
			
			pane.Pack2 (notebook, true, true);
			vbox.PackStart (toolbar, false, true, 0);
			vbox.PackStart (pane, true, true, 0);
			this.Document.TextReplaced += SqlChanged;
			vbox.ShowAll ();
			Document.DocumentUpdated += delegate (object sender, EventArgs args) {
				// Default mime type or a provider defined.
				if (selectedConnection == null)
					Document.MimeType = "text/x-sql";
				else 
					Document.MimeType = GetMimeType ();
				
			};
			notebook.Hide ();
		}
Beispiel #16
0
 public static void AppendItem(this Toolbar tb, ToolItem item)
 {
     item.Show ();
     tb.Insert (item, tb.NItems);
 }
Beispiel #17
0
        public ImageToolBarControl(ImageCanvas ic)
        {
            this.ic = ic;
            btnShowHideBarier = new ToggleToolButton("barier-show.png");//RadioToolButton(group1);//,"barier-show.png");
            btnShowHideBarier.Label = MainClass.Languages.Translate("show_barier_layer");
            btnShowHideBarier.Name = "btnShowHideBarier";
            //btnShowHideBarier.Relief = ReliefStyle.None;
            btnShowHideBarier.CanFocus = false;
            btnShowHideBarier.BorderWidth = 1;
            //btnShowHideBarier.WidthRequest = 75;
            btnShowHideBarier.TooltipText = MainClass.Languages.Translate("show_barier_layer_tt");

            btnShowHideBarier.Events = Gdk.EventMask.AllEventsMask;// | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask
            btnShowHideBarier.Toggled+= delegate(object sender, EventArgs e) {

                this.ic.ShowBarierLayer =  btnShowHideBarier.Active;
                SetSensitive(btnShowHideBarier.Active);
                //Console.WriteLine("btnShowHideBarier.Toggled");

            };

            btnEditBarierPoint =  new ToggleToolButton("barier-add.png");//new RadioToolButton(group2,"barier-add.png");
            btnEditBarierPoint.Name = "btnEditBarierPoint";
            btnEditBarierPoint.Label = MainClass.Languages.Translate("edit_barier_point");
            //btnEditBarierPoint.Relief = ReliefStyle.None;
            btnEditBarierPoint.CanFocus = false;
            btnEditBarierPoint.BorderWidth = 1;
            btnEditBarierPoint.TooltipText = MainClass.Languages.Translate("edit_barier_point_tt");
            btnEditBarierPoint.Toggled+= delegate(object sender, EventArgs e) {
                if(btnEditBarierPoint.Active){
                    btnDeleteBarierPoint.Active = false;
                    //btnMovieBarierPoint.Active = false;
                }
            };

            btnDeleteBarierPoint = new ToggleToolButton("barier-delete.png");//new RadioToolButton(group2,"barier-delete.png");
            btnDeleteBarierPoint.Name = "btnDeleteBarierPoint";
            btnDeleteBarierPoint.Label = MainClass.Languages.Translate("delete_barier_point");
            //btnDeleteBarierPoint.Relief = ReliefStyle.None;
            btnDeleteBarierPoint.CanFocus = false;
            btnDeleteBarierPoint.BorderWidth = 1;
            btnDeleteBarierPoint.TooltipText = MainClass.Languages.Translate("delete_barier_point_tt");
            btnDeleteBarierPoint.Toggled+= delegate(object sender, EventArgs e) {
                if(btnDeleteBarierPoint.Active){
                    btnEditBarierPoint.Active = false;
                    //btnAddBarierPoint.Active = false;
                    //btnMovieBarierPoint.Active = false;
                }
            };

            btnDeleteBarier = new ToolButton("barier-delete-all.png");
            btnDeleteBarier.Name = "btnDeleteBarier";

            btnDeleteBarier.Label =MainClass.Languages.Translate("delete_barier");
            btnDeleteBarier.CanFocus = false;
            btnDeleteBarier.BorderWidth = 1;
            btnDeleteBarier.TooltipText = MainClass.Languages.Translate("delete_barier_tt");
            btnDeleteBarier.Clicked += delegate(object sender, EventArgs e) {
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, "", MainClass.Languages.Translate("delete_barier_question"), Gtk.MessageType.Question);
                int result = md.ShowDialog();

                if (result != (int)Gtk.ResponseType.Yes){
                    return;
                }

                if(DeleteBarierLayerEvent!= null)
                    DeleteBarierLayerEvent(null,null);

            };

            SetSensitive(false);

            this.Insert (btnShowHideBarier, 0);

            this.Insert (btnEditBarierPoint, 1);
            this.Insert (btnDeleteBarierPoint, 2);
            this.Insert (btnDeleteBarier, 3);

            Gtk.ToolButton btnZoomIn = new Gtk.ToolButton("zoom-in.png");
            btnZoomIn.Label = MainClass.Languages.Translate("zoom_in");
            btnZoomIn.TooltipText = MainClass.Languages.Translate("zoom_in");
            //btnZoomIn.Relief = Gtk.ReliefStyle.None;
            btnZoomIn.CanFocus = false;
            btnZoomIn.Clicked+= delegate {
                ZoomIn();
            };

            Gtk.ToolButton btnZoomOriginal = new Gtk.ToolButton("zoom-original.png");
            btnZoomOriginal.Label = MainClass.Languages.Translate("zoom_original");
            btnZoomOriginal.TooltipText = MainClass.Languages.Translate("zoom_original");
            //btnZoomOriginal.Relief = Gtk.ReliefStyle.None;
            btnZoomOriginal.CanFocus = false;
            btnZoomOriginal.Clicked+= delegate {
                cbeZoom.Active = 11;
            };
            //btnZoomOriginal.WidthRequest = btnZoomOriginal.HeightRequest = 19;

            Gtk.ToolButton btnZoomOut = new Gtk.ToolButton("zoom-out.png");
            btnZoomOut.TooltipText = MainClass.Languages.Translate("zoom_out");
            btnZoomOut.Label = MainClass.Languages.Translate("zoom_out");
            //btnZoomOut.Relief = Gtk.ReliefStyle.None;
            btnZoomOut.CanFocus = false;
            btnZoomOut.Clicked+= delegate {
                ZoomOut();

            };

            string[] zoomCollection = new string[] { "3600%", "2400%", "1600%", "1200%", "800%", "700%", "600%", "500%", "400%", "300%", "200%", "100%", "66%", "50%", "33%", "25%", "16%", "12%", "8%", "5%" };
            cbeZoom = new ComboBoxEntry(zoomCollection);
            cbeZoom.Active = 11;
            cbeZoom.WidthRequest = 70;
            cbeZoom.Changed+= delegate(object sender, EventArgs e) {
                UpdateScale();
            };

            cbeZoom.Entry.FocusOutEvent+= delegate(object o, FocusOutEventArgs args) {
                //Console.WriteLine("FocusOutEvent");
                UpdateScale();
            };

            cbeZoom.Entry.FocusInEvent+= delegate(object o, FocusInEventArgs args) {

            };
            cbeZoom.Entry.Changed+= delegate(object sender, EventArgs e) {

                //UpdateScale();
            };

            ToolItem tic = new ToolItem();
            tic.Add(cbeZoom);

            this.Insert(new SeparatorToolItem(),4);
            this.Insert(btnZoomIn,5);
            this.Insert(btnZoomOut,6);
            this.Insert(tic,7);
            this.Insert(btnZoomOriginal,8);
        }
Beispiel #18
0
		public LogWidget (VersionControlDocumentInfo info)
		{
			this.Build ();
			this.info = info;
			if (info.Document != null)
				this.preselectFile = info.Document.FileName;
			
			revertButton = new Gtk.ToolButton (new Gtk.Image ("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString ("Revert changes from this revision"));
			revertButton.IsImportant = true;
//			revertButton.Sensitive = false;
			revertButton.Clicked += new EventHandler (RevertRevisionClicked);
			CommandBar.Insert (revertButton, -1);
			
			revertToButton = new Gtk.ToolButton (new Gtk.Image ("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString ("Revert to this revision"));
			revertToButton.IsImportant = true;
//			revertToButton.Sensitive = false;
			revertToButton.Clicked += new EventHandler (RevertToRevisionClicked);
			CommandBar.Insert (revertToButton, -1);
			
			Gtk.ToolItem item = new Gtk.ToolItem ();
			Gtk.HBox a = new Gtk.HBox ();
			item.Add (a);
			searchEntry = new SearchEntry ();
			searchEntry.WidthRequest = 200;
			searchEntry.ForceFilterButtonVisible = true;
			searchEntry.EmptyMessage = GettextCatalog.GetString ("Search");
			searchEntry.Changed += HandleSearchEntryFilterChanged;
			searchEntry.Ready = true;
			searchEntry.Show ();
			a.PackEnd (searchEntry, false, false, 0);
			CommandBar.Insert (item, -1);
			((Gtk.Toolbar.ToolbarChild)CommandBar[item]).Expand = true;
			
			CommandBar.ShowAll ();
			
			messageRenderer.Ellipsize = Pango.EllipsizeMode.End;
			TreeViewColumn colRevMessage = new TreeViewColumn ();
			colRevMessage.Title = GettextCatalog.GetString ("Message");
			var graphRenderer = new RevisionGraphCellRenderer ();
			colRevMessage.PackStart (graphRenderer, false);
			colRevMessage.SetCellDataFunc (graphRenderer, GraphFunc);
			
			colRevMessage.PackStart (messageRenderer, true);
			colRevMessage.SetCellDataFunc (messageRenderer, MessageFunc);
			colRevMessage.Sizing = TreeViewColumnSizing.Autosize;
			
			treeviewLog.AppendColumn (colRevMessage);
			colRevMessage.MinWidth = 350;
			colRevMessage.Resizable = true;
			
			
			TreeViewColumn colRevDate = new TreeViewColumn (GettextCatalog.GetString ("Date"), textRenderer);
			colRevDate.SetCellDataFunc (textRenderer, DateFunc);
			colRevDate.Resizable = true;
			treeviewLog.AppendColumn (colRevDate);
			
			TreeViewColumn colRevAuthor = new TreeViewColumn ();
			colRevAuthor.Title = GettextCatalog.GetString ("Author");
			colRevAuthor.PackStart (pixRenderer, false);
			colRevAuthor.PackStart (textRenderer, true);
			colRevAuthor.SetCellDataFunc (textRenderer, AuthorFunc);
			colRevAuthor.SetCellDataFunc (pixRenderer, AuthorIconFunc);
			colRevAuthor.Resizable = true;
			treeviewLog.AppendColumn (colRevAuthor);

			TreeViewColumn colRevNum = new TreeViewColumn (GettextCatalog.GetString ("Revision"), textRenderer);
			colRevNum.SetCellDataFunc (textRenderer, RevisionFunc);
			colRevNum.Resizable = true;
			treeviewLog.AppendColumn (colRevNum);

			treeviewLog.Model = logstore;
			treeviewLog.Selection.Changed += TreeSelectionChanged;
			
			treeviewFiles = new FileTreeView ();
			treeviewFiles.DiffLineActivated += HandleTreeviewFilesDiffLineActivated;
			scrolledwindowFiles.Child = treeviewFiles;
			scrolledwindowFiles.ShowAll ();
			
			changedpathstore = new TreeStore (typeof(Gdk.Pixbuf), typeof (string), // icon/file name
				typeof(Gdk.Pixbuf), typeof (string), // icon/operation
				typeof (string), // path
				typeof (string), // revision path (invisible)
				typeof (string[]) // diff
				);
			
			TreeViewColumn colChangedFile = new TreeViewColumn ();
			var crp = new CellRendererPixbuf ();
			var crt = new CellRendererText ();
			colChangedFile.Title = GettextCatalog.GetString ("File");
			colChangedFile.PackStart (crp, false);
			colChangedFile.PackStart (crt, true);
			colChangedFile.AddAttribute (crp, "pixbuf", 2);
			colChangedFile.AddAttribute (crt, "text", 3);
			treeviewFiles.AppendColumn (colChangedFile);
			
			TreeViewColumn colOperation = new TreeViewColumn ();
			colOperation.Title = GettextCatalog.GetString ("Operation");
			colOperation.PackStart (crp, false);
			colOperation.PackStart (crt, true);
			colOperation.AddAttribute (crp, "pixbuf", 0);
			colOperation.AddAttribute (crt, "text", 1);
			treeviewFiles.AppendColumn (colOperation);
			
			TreeViewColumn colChangedPath = new TreeViewColumn ();
			colChangedPath.Title = GettextCatalog.GetString ("Path");
			
			diffRenderer.DrawLeft = true;
			colChangedPath.PackStart (diffRenderer, true);
			colChangedPath.SetCellDataFunc (diffRenderer, SetDiffCellData);
			treeviewFiles.AppendColumn (colChangedPath);
			treeviewFiles.Model = changedpathstore;
			treeviewFiles.TestExpandRow += HandleTreeviewFilesTestExpandRow;
			treeviewFiles.Events |= Gdk.EventMask.PointerMotionMask;
			
			textviewDetails.WrapMode = Gtk.WrapMode.Word;
			
			labelAuthor.Text = "";
			labelDate.Text = "";
			labelRevision.Text = "";
		}
Beispiel #19
0
 public ToolItem GetWidget()
 {
     UpdateText ();
     ToolItem item = new ToolItem ();
     HBox box = new HBox ();
     box.Add (label);
     item.Child = box;
     return item;
 }
        public ModelerCanvasWidget(ModelerCanvas owner, modelController controller)
        {
            this.Build ();
            _owner = owner;
            _controller = controller;
            VBox mainVbox = new VBox (false, 6);
            mainVbox.BorderWidth = 6;
            this.Add(mainVbox);

            //Create Toolbar
            Toolbar toolbar = new Toolbar ();
            toolbar.Name = "toolbar";
            toolbar.ShowArrow = true;
            toolbar.IconSize = Gtk.IconSize.LargeToolbar;
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.Sensitive=true;
            toolbar.Activate();
            mainVbox.Add(toolbar);
            Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(mainVbox[toolbar]));
            w1.Position = 0;
            w1.Expand = false;
            w1.Fill = true;

            //Create SCrollWindow
            mainScrolledWindow = new ScrolledWindow();
            mainScrolledWindow.Activate();
            mainScrolledWindow.SetPolicy( Gtk.PolicyType.Always,Gtk.PolicyType.Always);
            mainScrolledWindow.CanFocus = true;
            mainScrolledWindow.Name = "mainScrolledWindow";
            mainScrolledWindow.ShadowType = ((Gtk.ShadowType)(1));
            mainVbox.Add(mainScrolledWindow);
            Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(mainVbox[mainScrolledWindow]));
             			w2.Position = 1;
            w2.Fill=true;
            w2.Expand=true;

            //Create Toolbar Buttons

            //Add New Table
            buttonNew = new ToolButton(new Gtk.Image (Gtk.Stock.New, IconSize.Button),"Add Table");
            buttonNew.Sensitive = true;
            buttonNew.TooltipMarkup = "Add a new empty table";
            buttonNew.IsImportant = true;
            buttonNew.Clicked += new EventHandler (OnbuttonNewActionActivated);
            buttonNew.Activate();
            buttonNew.Show();
            toolbar.Add (buttonNew);
            //Create a Relationship between two tables
            buttonRelationship = new ToolButton(new Gtk.Image (Gtk.Stock.New, IconSize.Button),"Relationship");
            buttonRelationship.Sensitive = true;
            buttonRelationship.TooltipMarkup = "Add a new relationship between tables";
            buttonRelationship.IsImportant = true;
            buttonRelationship.Clicked += new EventHandler (OnbuttonRelationshipActivated);
            buttonRelationship.Activate();
            buttonRelationship.Show();
            toolbar.Add (buttonRelationship);
            //Delete Selected Figure(s)
            buttonDelete = new ToolButton(new Gtk.Image (Gtk.Stock.New, IconSize.Button),"Remove");
            buttonDelete.Sensitive = true;
                buttonDelete.TooltipMarkup = "Remove selected figure(s) from diagram (table or relationship)";
            buttonDelete.IsImportant = true;
            buttonDelete.Clicked += new EventHandler (buttonDeleteRelationshipActivated);
            buttonDelete.Activate();
            buttonDelete.Show();
            toolbar.Add (buttonDelete);
            //Select Active Database
            comboConnections = new DatabaseConnectionContextComboBox ();
            selectedConnection = comboConnections.DatabaseConnection;
            comboConnections.Changed += new EventHandler (ConnectionChanged);
            ToolItem comboItem = new ToolItem ();
            comboItem.Child = comboConnections;
            comboItem.Show();
            toolbar.Add (new SeparatorToolItem ());
            toolbar.Add (comboItem);
            //Show all items
            mainVbox.ShowAll ();
        }
Beispiel #21
0
        private void BuildStatusBar()
        {
            statusToolbar.ShowArrow = false;
            statusToolbar.ToolbarStyle = ToolbarStyle.BothHoriz;

            SpeedLimitMenu menu = BuildSpeedsPopup ();

            SeparatorToolItem sep;
            ToolItem item = new ToolItem ();
            EventBox eventBox = new EventBox ();
            HBox box = new HBox ();
            statusDownButton = new Label ();

            box.Add (Gtk.Image.NewFromIconName(Gtk.Stock.GoDown, IconSize.Menu));
            box.Add (statusDownButton);
            eventBox.Child = box;
            eventBox.ButtonPressEvent += Event.Wrap ((ButtonPressEventHandler) delegate(object o, ButtonPressEventArgs args) {
                menu.ShowAll ();
                menu.IsUpload = false;
                menu.CalculateSpeeds (EngineSettings.GlobalMaxDownloadSpeed);
                menu.Popup ();
            });
            item.Child = eventBox;
            statusToolbar.Insert (item, 0);

            sep = new SeparatorToolItem ();
            sep.Draw = false;

            statusToolbar.Insert (sep, 1);

            eventBox = new EventBox ();
            box = new HBox ();
            statusUpButton = new Label ();

            box.Add (Gtk.Image.NewFromIconName(Gtk.Stock.GoUp, IconSize.Menu));
            box.Add (statusUpButton);
            eventBox.Child = box;
            eventBox.ButtonPressEvent += Event.Wrap ((ButtonPressEventHandler) delegate(object o, ButtonPressEventArgs args) {
                menu.ShowAll ();
                menu.IsUpload = true;
                menu.CalculateSpeeds (EngineSettings.GlobalMaxUploadSpeed);
                menu.Popup ();
            });
            item = new ToolItem ();
            item.Child = eventBox;
            statusToolbar.Insert (item, 2);

            sep = new SeparatorToolItem ();
            sep.Draw = false;
            sep.WidthRequest = 20;
            statusToolbar.Insert (sep, 3);

            statusToolbar.ShowAll ();
        }
Beispiel #22
0
        private void Build()
        {
            // toolbar
            toolbar = new Toolbar();
            //			toolbar.MarginLeft = 10;
            this.Add (toolbar);
            var toolbarBox = (Gtk.Box.BoxChild)this [toolbar];
            toolbarBox.Fill = false;
            toolbarBox.Expand = false;
            toolbarBox.Position = 0;

            // toolbar choose database dropdown
            Gtk.Label l = new Gtk.Label(string.Format("Current database: {0}", this.ServerConnection.Name));
            ToolItem lTi = new ToolItem ();
            lTi.Add (l);
            toolbar.Insert (lTi, 0);

            // toolbar exec button
            ToolButton execBtn = new ToolButton (Gtk.Stock.MediaPlay);
            execBtn.Clicked += (sender, e) => this.ExecuteCommand();
            toolbar.Insert (execBtn, 1);

            // vpaned
            vpaned = new VPaned();
            this.Add (vpaned);

            // Sql area textbox wrapped in a scrolled window
            ScrolledWindow sqlAreaScroll = new ScrolledWindow();
            vpaned.Add1 (sqlAreaScroll);
            sqlArea = new Mono.TextEditor.TextEditor();
            sqlArea.Text = string.Format ("{0}{0}", System.Environment.NewLine);
            sqlArea.SetCaretTo (1, 1);
            sqlArea.CanFocus = true;
            sqlArea.IsFocus = true;

            var syntaxMode = loadSyntaxMode ();
            sqlArea.Document.SyntaxMode = syntaxMode;

            sqlAreaScroll.Add (sqlArea);

            // result tabs
            resultNoteBook = new Notebook ();
            sqlResultContainer = new Gtk.ScrolledWindow ();
            resultNoteBook.Add (sqlResultContainer);
            resultNoteBook.SetTabLabel (sqlResultContainer, new Label ("Results"));

            outputView = new TextView ();
            outputView.Editable = false;
            resultNoteBook.Add (outputView);
            resultNoteBook.SetTabLabel (outputView, new Label ("Output"));

            vpaned.Add2 (resultNoteBook);

            vpaned.Position = 180;
        }
Beispiel #23
0
        //
        // Constructor
        //
        public MainWindow(Db db)
        {
            foreach (ServiceNode service in AddinManager.GetExtensionNodes ("/FSpot/Services")) {
                try {
                    service.Initialize ();
                    service.Start ();
                } catch (Exception e) {
                    Log.Warning ("Something went wrong while starting the {0} extension.", service.Id);
                    Log.DebugException (e);
                }
            }

            #if GSD_2_24
            Log.Information ("Hack for gnome-settings-daemon engaged");
            int max_age, max_size;
            if (Preferences.TryGet<int> (Preferences.GSD_THUMBS_MAX_AGE, out max_age)) {
                if (max_age < 0)
                    Log.Debug ("maximum_age check already disabled, good");
                else if (max_age == 0)
                    Log.Warning ("maximum_age is 0 (tin-hat mode), not overriding");
                else if (max_age < 180) {
                    Log.Debug ("Setting maximum_age to a saner value");
                    Preferences.Set (Preferences.GSD_THUMBS_MAX_AGE, 180);
                }
            }

            if (Preferences.TryGet<int> (Preferences.GSD_THUMBS_MAX_SIZE, out max_size)) {
                int count = App.Instance.Database.Photos.Count ("photos");
                // average thumbs are taking 70K, so this will push the threshold
                //if f-spot takes more than 70% of the thumbs space
                int size = count / 10;
                if (max_size < 0)
                    Log.Debug ("maximum_size check already disabled, good");
                else if (max_size == 0)
                    Log.Warning ("maximum_size is 0 (tin-hat mode), not overriding");
                else if (max_size < size) {
                    Log.Debug ("Setting maximum_size to a saner value ({0}MB), according to your db size", size);
                    Preferences.Set (Preferences.GSD_THUMBS_MAX_SIZE, size);
                }
            }

            #endif
            Database = db;

            if (Toplevel == null)
                Toplevel = this;

            GtkBeans.Builder builder = new GtkBeans.Builder ("main_window.ui");
            builder.Autoconnect (this);

            //Set the global DefaultColormap. Allows transparency according
            //to the theme (work on murrine engine)
            Gdk.Colormap colormap = ((Widget)main_window).Screen.RgbaColormap;
            if (colormap == null) {
                Log.Debug ("Your screen doesn't support alpha channels!");
                colormap = ((Widget)main_window).Screen.RgbColormap;
            }
            Gtk.Widget.DefaultColormap = colormap;

            LoadPreference (Preferences.MAIN_WINDOW_WIDTH);
            LoadPreference (Preferences.MAIN_WINDOW_X);
            LoadPreference (Preferences.MAIN_WINDOW_MAXIMIZED);
            main_window.ShowAll ();

            LoadPreference (Preferences.SIDEBAR_POSITION);
            LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);

            pagesetup_menu_item.Activated += HandlePageSetupActivated;

            toolbar = new Gtk.Toolbar ();
            toolbar_vbox.PackStart (toolbar);

            ToolButton import_button = GtkUtil.ToolButtonFromTheme ("gtk-add", Catalog.GetString ("Import"), true);
            import_button.Clicked += HandleImportCommand;
            import_button.SetTooltip (ToolTips, Catalog.GetString ("Import new images"), null);
            toolbar.Insert (import_button, -1);

            toolbar.Insert (new SeparatorToolItem (), -1);

            rl_button = GtkUtil.ToolButtonFromTheme ("object-rotate-left", Catalog.GetString ("Rotate Left"), false);
            rl_button.Clicked += HandleRotate270Command;
            toolbar.Insert (rl_button, -1);

            rr_button = GtkUtil.ToolButtonFromTheme ("object-rotate-right", Catalog.GetString ("Rotate Right"), false);
            rr_button.Clicked += HandleRotate90Command;
            toolbar.Insert (rr_button, -1);

            toolbar.Insert (new SeparatorToolItem (), -1);

            browse_button = new ToggleToolButton ();
            browse_button.Label = Catalog.GetString ("Browse");
            browse_button.IconName = "mode-browse";
            browse_button.IsImportant = true;
            browse_button.Toggled += HandleToggleViewBrowse;
            browse_button.SetTooltip (ToolTips, Catalog.GetString ("Browse many photos simultaneously"), null);
            toolbar.Insert (browse_button, -1);

            edit_button = new ToggleToolButton ();
            edit_button.Label = Catalog.GetString ("Edit Image");
            edit_button.IconName = "mode-image-edit";
            edit_button.IsImportant = true;
            edit_button.Toggled += HandleToggleViewPhoto;
            edit_button.SetTooltip (ToolTips, Catalog.GetString ("View and edit a photo"), null);
            toolbar.Insert (edit_button, -1);

            toolbar.Insert (new SeparatorToolItem (), -1);

            ToolButton fs_button = GtkUtil.ToolButtonFromTheme ("view-fullscreen", Catalog.GetString ("Fullscreen"), false);
            fs_button.Clicked += HandleViewFullscreen;
            fs_button.SetTooltip (ToolTips, Catalog.GetString ("View photos fullscreen"), null);
            toolbar.Insert (fs_button, -1);

            ToolButton ss_button = GtkUtil.ToolButtonFromTheme ("media-playback-start", Catalog.GetString ("Slideshow"), false);
            ss_button.Clicked += HandleViewSlideShow;
            ss_button.SetTooltip (ToolTips, Catalog.GetString ("View photos in a slideshow"), null);
            toolbar.Insert (ss_button, -1);

            SeparatorToolItem white_space = new SeparatorToolItem ();
            white_space.Draw = false;
            white_space.Expand = true;
            toolbar.Insert (white_space, -1);

            ToolItem label_item = new ToolItem ();
            count_label = new Label (String.Empty);
            label_item.Child = count_label;
            toolbar.Insert (label_item, -1);

            display_previous_button = new ToolButton (Stock.GoBack);
            toolbar.Insert (display_previous_button, -1);
            display_previous_button.SetTooltip (ToolTips, Catalog.GetString ("Previous photo"), String.Empty);
            display_previous_button.Clicked += new EventHandler (HandleDisplayPreviousButtonClicked);

            display_next_button = new ToolButton (Stock.GoForward);
            toolbar.Insert (display_next_button, -1);
            display_next_button.SetTooltip (ToolTips, Catalog.GetString ("Next photo"), String.Empty);
            display_next_button.Clicked += new EventHandler (HandleDisplayNextButtonClicked);

            Sidebar = new Sidebar ();
            ViewModeChanged += Sidebar.HandleMainWindowViewModeChanged;
            sidebar_vbox.Add (Sidebar);

            tag_selection_scrolled = new ScrolledWindow ();
            tag_selection_scrolled.ShadowType = ShadowType.In;

            tag_selection_widget = new TagSelectionWidget (Database.Tags);
            tag_selection_scrolled.Add (tag_selection_widget);

            Sidebar.AppendPage (tag_selection_scrolled, Catalog.GetString ("Tags"), "tag");

            AddinManager.AddExtensionNodeHandler ("/FSpot/Sidebar", OnSidebarExtensionChanged);

            Sidebar.Context = ViewContext.Library;

            Sidebar.CloseRequested += HideSidebar;
            Sidebar.Show ();

            InfoBox = new InfoBox ();
            ViewModeChanged += InfoBox.HandleMainWindowViewModeChanged;
            InfoBox.VersionIdChanged += delegate (InfoBox box, uint version_id) { UpdateForVersionIdChange (version_id);};
            sidebar_vbox.PackEnd (InfoBox, false, false, 0);

            InfoBox.Context = ViewContext.Library;

            tag_selection_widget.Selection.Changed += HandleTagSelectionChanged;
            tag_selection_widget.KeyPressEvent += HandleTagSelectionKeyPress;
            tag_selection_widget.ButtonPressEvent += HandleTagSelectionButtonPressEvent;
            tag_selection_widget.PopupMenu += HandleTagSelectionPopupMenu;
            tag_selection_widget.RowActivated += HandleTagSelectionRowActivated;

            LoadPreference (Preferences.TAG_ICON_SIZE);

            try {
                query = new FSpot.PhotoQuery (Database.Photos);
            } catch (System.Exception e) {
                //FIXME assume any exception here is due to a corrupt db and handle that.
                new RepairDbDialog (e, Database.Repair (), main_window);
                query = new FSpot.PhotoQuery (Database.Photos);
            }

            UpdateStatusLabel ();
            query.Changed += HandleQueryChanged;

            Database.Photos.ItemsChanged += HandleDbItemsChanged;
            Database.Tags.ItemsChanged += HandleTagsChanged;
            Database.Tags.ItemsAdded += HandleTagsChanged;
            Database.Tags.ItemsRemoved += HandleTagsChanged;
            #if SHOW_CALENDAR
            FSpot.SimpleCalendar cal = new FSpot.SimpleCalendar (query);
            cal.DaySelected += HandleCalendarDaySelected;
            left_vbox.PackStart (cal, false, true, 0);
            #endif

            group_selector = new FSpot.GroupSelector ();
            group_selector.Adaptor = new FSpot.TimeAdaptor (query, Preferences.Get<bool> (Preferences.GROUP_ADAPTOR_ORDER_ASC));

            group_selector.ShowAll ();

            if (zoom_scale != null) {
                zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
            }

            view_vbox.PackStart (group_selector, false, false, 0);
            view_vbox.ReorderChild (group_selector, 0);

            find_bar = new FindBar (query, tag_selection_widget.Model);
            view_vbox.PackStart (find_bar, false, false, 0);
            view_vbox.ReorderChild (find_bar, 1);
            main_window.KeyPressEvent += HandleKeyPressEvent;

            query_widget = new FSpot.QueryWidget (query, Database);
            query_widget.Logic.Changed += HandleQueryLogicChanged;
            view_vbox.PackStart (query_widget, false, false, 0);
            view_vbox.ReorderChild (query_widget, 2);

            icon_view = new QueryView (query);
            icon_view.ZoomChanged += HandleZoomChanged;
            LoadPreference (Preferences.ZOOM);
            LoadPreference (Preferences.SHOW_TAGS);
            LoadPreference (Preferences.SHOW_DATES);
            LoadPreference (Preferences.SHOW_RATINGS);
            icon_view_scrolled.Add (icon_view);
            icon_view.DoubleClicked += HandleDoubleClicked;
            icon_view.Vadjustment.ValueChanged += HandleIconViewScroll;
            icon_view.GrabFocus ();

            new FSpot.PreviewPopup (icon_view);

            Gtk.Drag.SourceSet (icon_view, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
                        icon_source_target_table, DragAction.Copy | DragAction.Move);

            icon_view.DragBegin += HandleIconViewDragBegin;
            icon_view.DragDataGet += HandleIconViewDragDataGet;

            TagMenu tag_menu = new TagMenu (null, Database.Tags);
            tag_menu.NewTagHandler += delegate { HandleCreateTagAndAttach (this, null); };
            tag_menu.TagSelected += HandleAttachTagMenuSelected;
            tag_menu.Populate();
            (uimanager.GetWidget("/ui/menubar1/edit2/attach_tag") as MenuItem).Submenu = tag_menu;

            PhotoTagMenu pmenu = new PhotoTagMenu ();
            pmenu.TagSelected += HandleRemoveTagMenuSelected;
            (uimanager.GetWidget("/ui/menubar1/edit2/remove_tag") as MenuItem).Submenu = pmenu;

            Gtk.Drag.DestSet (icon_view, DestDefaults.All, icon_dest_target_table,
                      DragAction.Copy | DragAction.Move);

            //		icon_view.DragLeave += new DragLeaveHandler (HandleIconViewDragLeave);
            icon_view.DragMotion += HandleIconViewDragMotion;
            icon_view.DragDrop += HandleIconViewDragDrop;
            icon_view.DragDataReceived += HandleIconViewDragDataReceived;
            icon_view.KeyPressEvent += HandleIconViewKeyPressEvent;

            photo_view = new PhotoView (query);
            photo_box.Add (photo_view);

            photo_view.DoubleClicked += HandleDoubleClicked;
            photo_view.KeyPressEvent += HandlePhotoViewKeyPressEvent;
            photo_view.UpdateStarted += HandlePhotoViewUpdateStarted;
            photo_view.UpdateFinished += HandlePhotoViewUpdateFinished;

            photo_view.View.ZoomChanged += HandleZoomChanged;

            // Tag typing: focus the tag entry if the user starts typing a tag
            icon_view.KeyPressEvent += HandlePossibleTagTyping;
            photo_view.KeyPressEvent += HandlePossibleTagTyping;
            tag_entry = new TagEntry (Database.Tags);
            tag_entry.KeyPressEvent += HandleTagEntryKeyPressEvent;
            tag_entry.TagsAttached += HandleTagEntryTagsAttached;
            tag_entry.TagsRemoved += HandleTagEntryRemoveTags;
            tag_entry.Activated += HandleTagEntryActivate;
            tag_entry_container.Add (tag_entry);

            Gtk.Drag.DestSet (photo_view, DestDefaults.All, tag_target_table,
                      DragAction.Copy | DragAction.Move);

            photo_view.DragMotion += HandlePhotoViewDragMotion;
            photo_view.DragDrop += HandlePhotoViewDragDrop;
            photo_view.DragDataReceived += HandlePhotoViewDragDataReceived;

            view_notebook.SwitchPage += HandleViewNotebookSwitchPage;
            group_selector.Adaptor.GlassSet += HandleAdaptorGlassSet;
            group_selector.Adaptor.Changed += HandleAdaptorChanged;
            LoadPreference (Preferences.GROUP_ADAPTOR_ORDER_ASC);
            LoadPreference (Preferences.FILMSTRIP_ORIENTATION);

            Selection = new MainSelection (this);
            Selection.Changed += HandleSelectionChanged;
            Selection.ItemsChanged += HandleSelectionItemsChanged;
            Selection.Changed += Sidebar.HandleSelectionChanged;
            Selection.ItemsChanged += Sidebar.HandleSelectionItemsChanged;

            Mono.Addins.AddinManager.ExtensionChanged += PopulateExtendableMenus;
            PopulateExtendableMenus (null, null);

            UpdateMenus ();

            main_window.ShowAll ();

            tagbar.Hide ();
            find_bar.Hide ();

            UpdateFindByTagMenu ();

            LoadPreference (Preferences.SHOW_TOOLBAR);
            LoadPreference (Preferences.SHOW_SIDEBAR);
            LoadPreference (Preferences.SHOW_TIMELINE);
            LoadPreference (Preferences.SHOW_FILMSTRIP);

            LoadPreference (Preferences.GNOME_MAILTO_ENABLED);

            Preferences.SettingChanged += OnPreferencesChanged;

            main_window.DeleteEvent += HandleDeleteEvent;

            query_widget.HandleChanged (query);
            query_widget.Close ();

            // When the icon_view is loaded, set it's initial scroll position
            icon_view.SizeAllocated += HandleIconViewReady;

            export.Activated += HandleExportActivated;
            UpdateToolbar ();

            (uimanager.GetWidget("/ui/menubar1/file1/close1") as MenuItem).Hide ();

            Banshee.Kernel.Scheduler.Resume ();
        }
        public FullScreenView(IBrowsableCollection collection, Gtk.Window parent)
            : base("Full Screen Mode")
        {
            //going fullscreen on the same screen the parent window
            Gdk.Screen screen = Screen;
            int monitor = screen.GetMonitorAtWindow (parent.GdkWindow);
            Gdk.Rectangle bounds = screen.GetMonitorGeometry (monitor);
            Move (bounds.X, bounds.Y);

            string style = "style \"test\" {\n" +
                "GtkToolbar::shadow_type = GTK_SHADOW_NONE\n" +
                "}\n" +
                "class \"GtkToolbar\" style \"test\"";

            Gtk.Rc.ParseString (style);

            Name = "FullscreenContainer";
            try {
                //scroll = new Gtk.ScrolledWindow (null, null);
                actions = new ActionGroup ("joe");

                actions.Add (new ActionEntry [] {
                    new ActionEntry (HideToolbar, Stock.Close,
                             Catalog.GetString ("Hide"),
                             null,
                             Catalog.GetString ("Hide toolbar"),
                             HideToolbarAction)});

                actions.Add (new ToggleActionEntry [] {
                    new ToggleActionEntry (Info,
                                   Stock.Info,
                                   Catalog.GetString ("Info"),
                                   null,
                                   Catalog.GetString ("Image information"),
                                   InfoAction,
                                   false)});

                Gtk.Action exit_full_screen = new Gtk.Action (ExitFullScreen,
                    Catalog.GetString ("Exit fullscreen"),
                    null,
                    null);
                exit_full_screen.IconName = "view-restore";
                exit_full_screen.Activated += ExitAction;
                actions.Add (exit_full_screen);

                Gtk.Action slide_show = new Gtk.Action (SlideShow,
                    Catalog.GetString ("Slideshow"),
                    Catalog.GetString ("Start slideshow"),
                    null);
                slide_show.IconName = "media-playback-start";
                slide_show.Activated += SlideShowAction;
                actions.Add (slide_show);

                new WindowOpacityFader (this, 1.0, 600);
                notebook = new Notebook ();
                notebook.ShowBorder = false;
                notebook.ShowTabs = false;
                notebook.Show ();

                scroll = new ScrolledView ();
                scroll.ScrolledWindow.SetPolicy (PolicyType.Never, PolicyType.Never);
                view = new PhotoImageView (collection);
                // FIXME this should be handled by the new style setting code
                view.ModifyBg (Gtk.StateType.Normal, this.Style.Black);
                this.Add (notebook);
                view.Show ();
                view.MotionNotifyEvent += HandleViewMotion;
                view.PointerMode = PointerMode.Scroll;

                scroll.ScrolledWindow.Add (view);

                Toolbar tbar = new Toolbar ();
                tbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz;

                tbar.ShowArrow = false;
                tbar.BorderWidth = 15;

                ToolItem t_item = (actions [ExitFullScreen]).CreateToolItem () as ToolItem;
                t_item.IsImportant = true;
                tbar.Insert (t_item, -1);

                Gtk.Action action = new PreviousPictureAction (view.Item);
                actions.Add (action);
                tbar.Insert (action.CreateToolItem () as ToolItem, -1);

                play_pause_button = (actions [SlideShow]).CreateToolItem () as ToolButton;
                tbar.Insert (play_pause_button, -1);

                action = new NextPictureAction (view.Item);
                actions.Add (action);
                tbar.Insert (action.CreateToolItem () as ToolItem, -1);

                t_item = new ToolItem ();
                t_item.Child = new Label (Catalog.GetString ("Slide transition:"));
                tbar.Insert (t_item, -1);

                display = new SlideShow (view.Item);
                display.AddEvents ((int) (Gdk.EventMask.PointerMotionMask));
                display.ModifyBg (Gtk.StateType.Normal, this.Style.Black);
                display.MotionNotifyEvent += HandleViewMotion;
                display.Show ();

                t_item = new ToolItem ();
                ComboBox combo = ComboBox.NewText ();
                foreach (var transition in display.Transitions)
                    combo.AppendText (transition.Name);
                combo.Active = 0;
                combo.Changed += HandleTransitionChanged;
                t_item.Child = combo;
                tbar.Insert (t_item, -1);

                action = new RotateLeftAction (view.Item);
                actions.Add (action);
                tbar.Insert (action.CreateToolItem () as ToolItem, -1);

                action = new RotateRightAction (view.Item);
                actions.Add (action);
                tbar.Insert (action.CreateToolItem () as ToolItem, -1);

                info_button = (ToggleToolButton) ((actions [Info]).CreateToolItem () as ToolItem);
                tbar.Insert (info_button, -1);

                tbar.Insert ((actions [HideToolbar]).CreateToolItem () as ToolItem, -1);

                notebook.AppendPage (scroll, null);
                notebook.AppendPage (display, null);

                tbar.ShowAll ();

                scroll.Show ();
                this.Decorated = false;
                this.Fullscreen ();
                this.ButtonPressEvent += HandleButtonPressEvent;

                view.Item.Changed += HandleItemChanged;
                view.GrabFocus ();

                hide_cursor_delay = new DelayedOperation (3000, new GLib.IdleHandler (HideCursor));
                hide_cursor_delay.Start ();

                controls = new ControlOverlay (this);
                controls.Add (tbar);
                controls.Dismiss ();

                notebook.CurrentPage = 0;
            } catch (System.Exception e) {
                Log.Exception (e);
            }
        }
Beispiel #25
0
        private void CreateExprBar()
        {
            // UrlEntry
            expr_entry = new Gtk.Entry ();
            expr_entry.Activated += new EventHandler(on_expr_activate);

            Gtk.ToolItem expr_item = new Gtk.ToolItem ();
            expr_item.Expand = true;
            expr_item.Add (expr_entry);

            // Toolbar
            exprbar = new Toolbar ();
            exprbar.ToolbarStyle = ToolbarStyle.Icons;
            exprbar.Orientation = Orientation.Horizontal;
            exprbar.ShowArrow = true;

            // Toolbar Itens
            exprbar.Add (expr_item);
            exprbar.Add (action_expr.CreateToolItem());
        }
Beispiel #26
0
 protected void InsertSeparator()
 {
     Gtk.ToolItem item = new ToolItem ();
     item.Child = new VSeparator ();
     Insert (item, -1);
 }
Beispiel #27
0
        public LogWidget(VersionControlDocumentInfo info)
        {
            this.Build();
            this.info = info;
            if (info.Document != null)
            {
                this.preselectFile = info.Item.Path;
            }

            revertButton             = new Gtk.ToolButton(new Gtk.Image("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString("Revert changes from this revision"));
            revertButton.IsImportant = true;
//			revertButton.Sensitive = false;
            revertButton.Clicked += new EventHandler(RevertRevisionClicked);
            CommandBar.Insert(revertButton, -1);

            revertToButton             = new Gtk.ToolButton(new Gtk.Image("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString("Revert to this revision"));
            revertToButton.IsImportant = true;
//			revertToButton.Sensitive = false;
            revertToButton.Clicked += new EventHandler(RevertToRevisionClicked);
            CommandBar.Insert(revertToButton, -1);

            Gtk.ToolItem item = new Gtk.ToolItem();
            Gtk.HBox     a    = new Gtk.HBox();
            item.Add(a);
            searchEntry = new SearchEntry();
            searchEntry.WidthRequest             = 200;
            searchEntry.ForceFilterButtonVisible = true;
            searchEntry.EmptyMessage             = GettextCatalog.GetString("Search");
            searchEntry.Changed += HandleSearchEntryFilterChanged;
            searchEntry.Ready    = true;
            searchEntry.Show();
            a.PackEnd(searchEntry, false, false, 0);
            CommandBar.Insert(item, -1);
            ((Gtk.Toolbar.ToolbarChild)CommandBar[item]).Expand = true;

            CommandBar.ShowAll();

            messageRenderer.Ellipsize = Pango.EllipsizeMode.End;
            TreeViewColumn colRevMessage = new TreeViewColumn();

            colRevMessage.Title = GettextCatalog.GetString("Message");
            var graphRenderer = new RevisionGraphCellRenderer();

            colRevMessage.PackStart(graphRenderer, false);
            colRevMessage.SetCellDataFunc(graphRenderer, GraphFunc);

            colRevMessage.PackStart(messageRenderer, true);
            colRevMessage.SetCellDataFunc(messageRenderer, MessageFunc);
            colRevMessage.Sizing = TreeViewColumnSizing.Autosize;

            treeviewLog.AppendColumn(colRevMessage);
            colRevMessage.MinWidth  = 350;
            colRevMessage.Resizable = true;


            TreeViewColumn colRevDate = new TreeViewColumn(GettextCatalog.GetString("Date"), textRenderer);

            colRevDate.SetCellDataFunc(textRenderer, DateFunc);
            colRevDate.Resizable = true;
            treeviewLog.AppendColumn(colRevDate);

            TreeViewColumn colRevAuthor = new TreeViewColumn();

            colRevAuthor.Title = GettextCatalog.GetString("Author");
            colRevAuthor.PackStart(pixRenderer, false);
            colRevAuthor.PackStart(textRenderer, true);
            colRevAuthor.SetCellDataFunc(textRenderer, AuthorFunc);
            colRevAuthor.SetCellDataFunc(pixRenderer, AuthorIconFunc);
            colRevAuthor.Resizable = true;
            treeviewLog.AppendColumn(colRevAuthor);

            TreeViewColumn colRevNum = new TreeViewColumn(GettextCatalog.GetString("Revision"), textRenderer);

            colRevNum.SetCellDataFunc(textRenderer, RevisionFunc);
            colRevNum.Resizable = true;
            treeviewLog.AppendColumn(colRevNum);

            treeviewLog.Model              = logstore;
            treeviewLog.Selection.Changed += TreeSelectionChanged;

            treeviewFiles = new FileTreeView();
            treeviewFiles.DiffLineActivated += HandleTreeviewFilesDiffLineActivated;
            scrolledwindowFiles.Child        = treeviewFiles;
            scrolledwindowFiles.ShowAll();

            changedpathstore = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), // icon/file name
                                             typeof(Gdk.Pixbuf), typeof(string), // icon/operation
                                             typeof(string),                     // path
                                             typeof(string),                     // revision path (invisible)
                                             typeof(string[])                    // diff
                                             );

            TreeViewColumn colChangedFile = new TreeViewColumn();
            var            crp            = new CellRendererPixbuf();
            var            crt            = new CellRendererText();

            colChangedFile.Title = GettextCatalog.GetString("File");
            colChangedFile.PackStart(crp, false);
            colChangedFile.PackStart(crt, true);
            colChangedFile.AddAttribute(crp, "pixbuf", 2);
            colChangedFile.AddAttribute(crt, "text", 3);
            treeviewFiles.AppendColumn(colChangedFile);

            TreeViewColumn colOperation = new TreeViewColumn();

            colOperation.Title = GettextCatalog.GetString("Operation");
            colOperation.PackStart(crp, false);
            colOperation.PackStart(crt, true);
            colOperation.AddAttribute(crp, "pixbuf", 0);
            colOperation.AddAttribute(crt, "text", 1);
            treeviewFiles.AppendColumn(colOperation);

            TreeViewColumn colChangedPath = new TreeViewColumn();

            colChangedPath.Title = GettextCatalog.GetString("Path");

            diffRenderer.DrawLeft = true;
            colChangedPath.PackStart(diffRenderer, true);
            colChangedPath.SetCellDataFunc(diffRenderer, SetDiffCellData);
            treeviewFiles.AppendColumn(colChangedPath);
            treeviewFiles.Model          = changedpathstore;
            treeviewFiles.TestExpandRow += HandleTreeviewFilesTestExpandRow;
            treeviewFiles.Events        |= Gdk.EventMask.PointerMotionMask;

            textviewDetails.WrapMode = Gtk.WrapMode.Word;

            labelAuthor.Text   = "";
            labelDate.Text     = "";
            labelRevision.Text = "";
        }
        public SearchResultsPage(FileSearch search)
        {
            VPaned         paned;
            TreeViewColumn column;
            ToolItem       spacerItem;
            ToolItem       filterItem;
            Alignment      filterAlignment;
            ToolButton     searchAgainToolButton;

            this.search = search;

            downloadToolButton = new ToolButton(new Image("gtk-save", IconSize.LargeToolbar), "Download");
            downloadToolButton.IsImportant = true;
            downloadToolButton.Sensitive = false;
            downloadToolButton.Clicked += DownloadToolButtonClicked;

            searchAgainToolButton = new ToolButton(new Image("gtk-refresh", IconSize.LargeToolbar), "Search Again");
            searchAgainToolButton.IsImportant = true;
            searchAgainToolButton.Clicked += SearchAgainToolButtonClicked;

            spacerItem = new ToolItem();
            spacerItem.Expand = true;

            filterButton = new ToggleButton("Filter Results");
            filterButton.Image = new Image(Gui.LoadIcon(16, "application-x-executable"));
            filterButton.Toggled += delegate (object o, EventArgs args) {
                this.ShowFilter = filterButton.Active;
            };

            filterAlignment = new Alignment(0.5f, 0.5f, 0, 0);
            filterAlignment.Add(filterButton);

            filterItem = new ToolItem();
            filterItem.Add(filterAlignment);

            browseToolButton = new ToolButton(new Image("gtk-open", IconSize.LargeToolbar), "Browse");
            browseToolButton.IsImportant = true;
            browseToolButton.Sensitive = false;
            browseToolButton.Clicked += BrowseToolButtonClicked;

            toolbar = new Toolbar();
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.Insert(downloadToolButton, -1);
            toolbar.Insert(browseToolButton, -1);
            toolbar.Insert(spacerItem, -1);
            toolbar.Insert(filterItem, -1);
            toolbar.Insert(new SeparatorToolItem(), -1);
            toolbar.Insert(searchAgainToolButton, -1);
            toolbar.ShowAll();

            this.PackStart(toolbar, false, false, 0);

            resultCountByTypeCache = new Dictionary<FilterType, int>();

            Gdk.Pixbuf audioPixbuf = Gui.LoadIcon(16, "audio-x-generic");
            Gdk.Pixbuf videoPixbuf = Gui.LoadIcon(16, "video-x-generic");
            Gdk.Pixbuf imagePixbuf = Gui.LoadIcon(16, "image-x-generic");
            Gdk.Pixbuf docPixbuf = Gui.LoadIcon(16, "x-office-document");
            unknownPixbuf = Gui.LoadIcon(16, "text-x-generic");
            folderPixbuf = Gui.LoadIcon(16, "folder");

            typeStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(FilterType));
            typeStore.AppendValues(null, "All Results", FilterType.All);
            typeStore.AppendValues(null, "-");
            typeStore.AppendValues(audioPixbuf, "Audio", FilterType.Audio);
            typeStore.AppendValues(videoPixbuf, "Video", FilterType.Video);
            typeStore.AppendValues(imagePixbuf, "Images", FilterType.Image);
            typeStore.AppendValues(docPixbuf, "Documents", FilterType.Document);
            typeStore.AppendValues(folderPixbuf, "Folders", FilterType.Folder);
            typeStore.AppendValues(unknownPixbuf, "Other", FilterType.Other);

            typeTree = new TreeView();
            typeTree.HeadersVisible = false;
            typeTree.RowSeparatorFunc = delegate (TreeModel m, TreeIter i) {
                string text = (string)m.GetValue(i, 1);
                return (text == "-");
            };
            typeTree.Selection.Changed += TypeSelectionChanged;

            typeTree.Model = typeStore;

            CellRendererPixbuf pixbufCell = new CellRendererPixbuf();
            CellRendererText textCell = new CellRendererText();
            CellRendererText countTextCell = new CellRendererText();
            countTextCell.Sensitive = false;
            countTextCell.Alignment = Pango.Alignment.Right;
            countTextCell.Xalign = 1;

            column = new TreeViewColumn();
            column.PackStart(pixbufCell, false);
            column.PackStart(textCell, true);
            column.PackStart(countTextCell, false);
            column.AddAttribute(pixbufCell, "pixbuf", 0);
            column.AddAttribute(textCell, "text", 1);
            column.SetCellDataFunc(countTextCell, new TreeCellDataFunc(TypeCountCellFunc));

            typeTree.AppendColumn(column);

            TreeView artistTree = new TreeView();
            artistTree.HeadersVisible = false;

            TreeView albumTree = new TreeView();
            albumTree.HeadersVisible = false;

            HBox topBox = new HBox();
            topBox.PackStart(Gui.AddScrolledWindow(typeTree), true, true, 0);
            topBox.PackStart(Gui.AddScrolledWindow(artistTree), true, true, 1);
            topBox.PackStart(Gui.AddScrolledWindow(albumTree), true, true, 0);
            topBox.Homogeneous = true;

            resultsStore = new ListStore(typeof(SearchResult));
            resultsStore.RowInserted += delegate {
                Refilter();
            };
            resultsStore.RowDeleted += delegate {
                Refilter();
            };
            resultsTree = new TreeView();
            resultsTree.RowActivated += resultsTree_RowActivated;
            resultsTree.ButtonPressEvent += resultsTree_ButtonPressEvent;
            resultsTree.Selection.Changed += ResultsTreeSelectionChanged;

            imageColumns = new List<TreeViewColumn>();
            audioColumns = new List<TreeViewColumn>();
            videoColumns = new List<TreeViewColumn>();
            fileOnlyColumns = new List<TreeViewColumn>();
            folderOnlyColumns = new List<TreeViewColumn>();

            column = new TreeViewColumn();
            column.Title = "File Name";
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Autosize;
            column.Resizable = true;
            column.SortColumnId = 0;
            //resultsTree.ExpanderColumn = column;

            CellRenderer cell = new CellRendererPixbuf();
            column.PackStart(cell, false);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(IconFunc));

            cell = new CellRendererText();
            column.PackStart(cell, true);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(FileNameFunc));

            resultsTree.AppendColumn(column);

            column = resultsTree.AppendColumn("Codec", new CellRendererText(), new TreeCellDataFunc(CodecFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 120;
            column.Resizable = true;
            column.SortColumnId = 1;
            videoColumns.Add(column);

            column = resultsTree.AppendColumn("Format", new CellRendererText(), new TreeCellDataFunc(FormatFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 90;
            column.Resizable = true;
            column.SortColumnId = 2;
            imageColumns.Add(column);

            column = resultsTree.AppendColumn("Resolution", new CellRendererText(), new TreeCellDataFunc(ResolutionFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 90;
            column.Resizable = true;
            column.SortColumnId = 3;
            videoColumns.Add(column);
            imageColumns.Add(column);

            column = resultsTree.AppendColumn("Artist", new CellRendererText(), new TreeCellDataFunc(ArtistFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 110;
            column.Resizable = true;
            column.SortColumnId = 4;
            audioColumns.Add(column);

            column = resultsTree.AppendColumn("Album", new CellRendererText(), new TreeCellDataFunc(AlbumFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 110;
            column.Resizable = true;
            column.SortColumnId = 5;
            audioColumns.Add(column);

            column = resultsTree.AppendColumn("Bitrate", new CellRendererText(), new TreeCellDataFunc(BitrateFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 70;
            column.Resizable = true;
            column.SortColumnId = 6;
            audioColumns.Add(column);

            column = resultsTree.AppendColumn("Size", new CellRendererText(), new TreeCellDataFunc(SizeFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 70;
            column.SortColumnId = 7;
            column.Resizable = true;
            fileOnlyColumns.Add(column);

            column = resultsTree.AppendColumn("Sources", new CellRendererText(), new TreeCellDataFunc(SourcesFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 85;
            column.SortColumnId = 8;
            column.Resizable = true;
            fileOnlyColumns.Add(column);

            column = resultsTree.AppendColumn("User", new CellRendererText(), new TreeCellDataFunc(UserFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 85;
            column.SortColumnId = 8;
            column.Resizable = true;
            folderOnlyColumns.Add(column);

            column = resultsTree.AppendColumn("Full Path", new CellRendererText(), new TreeCellDataFunc(FullPathFunc));
            column.Clickable = true;
            column.Resizable = true;
            column.SortColumnId = 9;

            column = resultsTree.AppendColumn("Info Hash", new CellRendererText(), new TreeCellDataFunc(InfoHashFunc));
            column.Clickable = true;
            column.Resizable = true;
            column.SortColumnId = 10;
            fileOnlyColumns.Add(column);

            resultsFilter = new TreeModelFilter(resultsStore, null);
            resultsFilter.VisibleFunc = resultsFilterFunc;

            resultsSort = new TreeModelSort(resultsFilter);
            for (int x = 0; x < resultsTree.Columns.Length; x++) {
                resultsSort.SetSortFunc(x, resultsSortFunc);
            }
            resultsTree.Model = resultsSort;

            ScrolledWindow resultsTreeSW = new ScrolledWindow();
            resultsTreeSW.Add(resultsTree);

            paned = new VPaned();
            paned.Add1(topBox);
            paned.Add2(resultsTreeSW);
            paned.Position = 160;
            paned.ShowAll();

            filterWidget = new FilterWidget(search);
            filterWidget.FiltersChanged += filterWidget_FiltersChanged;
            filterWidget.Hidden += filterWidget_Hidden;

            this.PackStart(filterWidget, false, false, 0);
            this.PackStart(paned, true, true, 0);

            TypeSelectionChanged(typeTree, EventArgs.Empty);

            search.NewResults += (NewResultsEventHandler)DispatchService.GuiDispatch(new NewResultsEventHandler(search_NewResults));
            search.ClearedResults += (EventHandler)DispatchService.GuiDispatch(new EventHandler(search_ClearedResults));

            resultPopupMenu = new Menu();

            browseResultMenuItem = new ImageMenuItem("Browse");
            browseResultMenuItem.Image = new Image(Gui.LoadIcon(16, "document-open"));
            browseResultMenuItem.Activated += BrowseToolButtonClicked;
            resultPopupMenu.Append(browseResultMenuItem);

            downloadResultMenuItem = new ImageMenuItem("Download");
            downloadResultMenuItem.Image = new Image(Gui.LoadIcon(16, "go-down"));
            downloadResultMenuItem.Activated += DownloadToolButtonClicked;
            resultPopupMenu.Append(downloadResultMenuItem);

            resultPropertiesMenuItem = new ImageMenuItem(Gtk.Stock.Properties, null);
            resultPropertiesMenuItem.Activated += FilePropertiesButtonClicked;
            resultPopupMenu.Append(resultPropertiesMenuItem);
        }
Beispiel #29
0
        protected virtual void OnBuildToolBar(Toolbar tb)
        {
            if (tool_label == null)
                tool_label = new ToolBarLabel (" Tool:  ");

            tb.AppendItem (tool_label);

            if (tool_image == null)
                tool_image = new ToolBarImage (Icon);

            tb.AppendItem (tool_image);

            if (tool_sep == null)
                tool_sep = new SeparatorToolItem ();

            tb.AppendItem (tool_sep);
        }
Beispiel #30
0
        public MainWindow()
        {
            ToolItem        spacerItem;
            FileSearchEntry searchEntry;
            ToolItem        searchEntryItem;
            Alignment       searchEntryBox;

            object[] attrs= Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), true);
            AssemblyTitleAttribute attr = (AssemblyTitleAttribute)attrs[0];
            AssemblyName asmName = Assembly.GetExecutingAssembly().GetName();

            string title = String.Format ("{0} (BETA) {1} (Protocol Version: {2})",
                                      attr.Title, asmName.Version,
                                      Core.ProtocolVersion);

            // Create the interface
            window = new Window (title);
            window.SetDefaultSize (850, 550);
            window.DeleteEvent += on_win_delete;
            window.ConfigureEvent += on_MainWindow_configure_event;
            window.FocusInEvent += window_FocusInEvent;

            ((ToggleAction)Runtime.BuiltinActions["ToggleMainToolbar"]).Active = Gui.Settings.ShowToolbar;
            Runtime.BuiltinActions["ToggleMainToolbar"].Activated += ToggleMainToolbar_Activated;

            ((ToggleAction)Runtime.BuiltinActions["ToggleMainStatusbar"]).Active = Gui.Settings.ShowStatusBar;
            Runtime.BuiltinActions["ToggleMainStatusbar"].Activated += ToggleMainStatusbar_Activated;
            window.AddAccelGroup (Runtime.UIManager.AccelGroup);

            mainVBox = new VBox ();
            window.Add (mainVBox);
            mainVBox.Show ();

            if (Common.OSName == "Darwin") {
                MenuBar menubar = (MenuBar) Runtime.UIManager.GetWidget ("/OSXAppMenu");

                Imendio.MacIntegration.Menu.SetMenuBar(menubar);

                MenuItem preferencesItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/Preferences");
                MenuItem aboutItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/About");

                IntPtr group = Imendio.MacIntegration.Menu.AddAppMenuGroup();

                Imendio.MacIntegration.Menu.AddAppMenuItem(group, aboutItem, "About Meshwork");

                group = Imendio.MacIntegration.Menu.AddAppMenuGroup();

                Imendio.MacIntegration.Menu.AddAppMenuItem(group, preferencesItem, "Preferences");

                MenuItem quitItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/Quit");
                Imendio.MacIntegration.Menu.SetQuitMenuItem(quitItem);
            } else {
                MenuBar menubar = (MenuBar) Runtime.UIManager.GetWidget ("/MainWindowMenuBar");
                mainVBox.PackStart (menubar, false, false, 0);
                menubar.Show ();
            }

            toolbar = (Toolbar) Runtime.UIManager.GetWidget ("/MainWindowToolbar");
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.IconSize = IconSize.LargeToolbar;

            spacerItem = new ToolItem();
            spacerItem.Expand = true;
            toolbar.Insert(spacerItem, -1);
            spacerItem.Show();

            searchEntry = new FileSearchEntry();

            searchEntryBox = new Alignment(0.5f, 0.5f, 0, 0);
            searchEntryBox.LeftPadding = 4;
            searchEntryBox.RightPadding = 1;
            searchEntryBox.Add(searchEntry);

            searchEntryItem = new ToolItem();
            searchEntryItem.Add(searchEntryBox);

            toolbar.Insert(searchEntryItem, -1);
            searchEntryItem.ShowAll();

            mainVBox.PackStart (toolbar, false, false, 0);

            mainPaned = new HPaned();
            mainPaned.Mapped += delegate (object sender, EventArgs args) {
                // XXX: Remember the user's last setting instead
                mainPaned.Position = 190;

                // Set some colors
                //infoBoxSeparator.ModifyBg(StateType.Normal, GtkHelper.DarkenColor (mainbar.Style.Background(StateType.Normal), 2));
                //infoSwitcherTree.ModifyBase(StateType.Normal, infoSwitcherTree.Style.Base(StateType.Active));
                //infoSwitcherTree.ModifyBase(StateType.Active, infoBoxSeparator.Style.Base(StateType.Selected));
            };
            mainPaned.Show();
            mainVBox.PackStart (mainPaned, true, true, 0);

            // Create page notebook
            pageNotebook = new Notebook();
            pageNotebook.ShowTabs = false;
            pageNotebook.ShowBorder = false;
            mainPaned.Pack2(pageNotebook, true, true);
            pageNotebook.ShowAll();

            // Create sidebar
            sidebar = new MainSidebar();
            sidebar.ItemAdded += sidebar_ItemAdded;
            sidebar.SelectedItemChanged += sidebar_SelectedItemChanged;
            sidebar.AddBuiltinItems();

            mainPaned.Pack1(sidebar, false, false);
            sidebar.ShowAll();

            CreateStatusbar ();

            // Apply "view" settings
            toolbar.Visible = Gui.Settings.ShowToolbar;
            statusBar.Visible = Gui.Settings.ShowStatusBar;

            // Hook up Core events
            Core.ShareBuilder.StartedIndexing  += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StartedIndexing));
            Core.ShareBuilder.FinishedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_FinishedIndexing));
            Core.ShareBuilder.StoppedIndexing  += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StoppedIndexing));
            Core.ShareBuilder.ErrorIndexing    += (ErrorEventHandler)DispatchService.GuiDispatch(new ErrorEventHandler(sb_ErrorIndexing));
            Core.ShareHasher.StartedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished));
            Core.ShareHasher.FinishedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished));
            Core.ShareHasher.QueueChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sh_QueueChanged));

            Core.FileSearchManager.SearchAdded   += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchAdded));
            Core.FileSearchManager.SearchRemoved += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchRemoved));

            window.Resize (Gui.Settings.WindowSize.Width, Gui.Settings.WindowSize.Height);
            window.Move (Gui.Settings.WindowPosition.X, Gui.Settings.WindowPosition.Y);

            SelectedPage = NetworkOverviewPage.Instance;
        }
Beispiel #31
0
        protected virtual void OnBuildToolBar(Toolbar tb)
        {
            if (tool_label == null)
                tool_label = new ToolBarLabel (string.Format (" {0}:  ", Catalog.GetString ("Tool")));

            tb.AppendItem (tool_label);

            if (tool_image == null)
                tool_image = new ToolBarImage (Icon);

            tb.AppendItem (tool_image);

            if (tool_sep == null)
                tool_sep = new SeparatorToolItem ();

            tb.AppendItem (tool_sep);
        }
        private void SwapSeekSlider()
        {
            // ripped off of Moblin extension

            // First grab the type and instance of the primary window
            // and make sure we're only hacking the Nereid UI
            var pwin = elements_service.PrimaryWindow;
            var pwin_type = pwin.GetType ();
            if (pwin_type.FullName != "Nereid.PlayerInterface") {
                return;
            }

            // Find ConnectedSeekSlider
            pwin_toolbar = (Toolbar)pwin_type.GetProperty ("HeaderToolbar").GetValue (pwin, null);
            foreach (var child in pwin_toolbar.Children) {
                if (child.GetType ().FullName.StartsWith ("Banshee.Widgets.GenericToolItem")) {
                    var c = child as Container;
                    if (c != null && c.Children[0] is ConnectedSeekSlider) {
                        connected_toolitem = child as ToolItem;
                        break;
                    }
                }
            }

            // swap original ConnectedSeekSlider with new ConnectedMoodSeekSlider
            var pos = pwin_toolbar.GetItemIndex (connected_toolitem as ToolItem);
            pwin_toolbar.Remove (connected_toolitem as Gtk.ToolItem);

            ConnectedMoodbarSeekSlider connected_moodbar_seek_slider;
            connected_moodbar_seek_slider = new ConnectedMoodbarSeekSlider ();
            connected_moodbar_seek_slider.Show ();

            moodbar_toolitem = new GenericToolItem<ConnectedMoodbarSeekSlider> (connected_moodbar_seek_slider);
            moodbar_toolitem.Show ();
            pwin_toolbar.Insert (moodbar_toolitem, pos);
        }
Beispiel #33
0
        /// <summary>
        /// Populate the main menu tool strip.
        /// We rebuild the contents from scratch
        /// </summary>
        /// <param name="menuDescriptions">Menu descriptions for each menu item.</param>
        public void PopulateMainToolStrip(List<MenuDescriptionArgs> menuDescriptions)
        {
            foreach (Widget child in toolStrip.Children)
                toolStrip.Remove(child);
            foreach (MenuDescriptionArgs description in menuDescriptions)
            {
                if (!hasResource(description.ResourceNameForImage))
                {
                    MessageDialog md = new MessageDialog(MainWidget.Toplevel as Window, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
                        "Program error. Could not locate the resource named " + description.ResourceNameForImage);
                    md.Run();
                    md.Destroy();
                }
                else
                {

                    Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(null, description.ResourceNameForImage, 20, 20);
                    ToolButton button = new ToolButton(new Gtk.Image(pixbuf), description.Name);
                    button.Homogeneous = false;
                    button.LabelWidget = new Label(description.Name);
                    Pango.FontDescription font = new Pango.FontDescription();
                    font.Size = (int)(8 * Pango.Scale.PangoScale);
                    button.LabelWidget.ModifyFont(font);
                    if (description.OnClick != null)
                        button.Clicked += description.OnClick;
                    toolStrip.Add(button);
                }
            }
            ToolItem item = new ToolItem();
            item.Expand = true;
            toolbarlabel = new Label();
            toolbarlabel.Xalign = 1.0F;
            toolbarlabel.Xpad = 10;
            toolbarlabel.ModifyFg(StateType.Normal, new Gdk.Color(0x99, 0x99, 0x99));
            item.Add(toolbarlabel);
            toolbarlabel.Visible = false;
            toolStrip.Add(item);
            toolStrip.ShowAll();
        }
Beispiel #34
0
		Toolbar CreateToolbar () 
		{
			Toolbar toolbar = new Toolbar ();
			toolbar.IconSize = IconSize.SmallToolbar;
			toolbar.ToolbarStyle = ToolbarStyle.Icons;

			ToolButton button1 = new Gtk.ToolButton (Stock.New); 
			button1.SetTooltip (tooltips1, "New", "New");
			button1.Clicked += new EventHandler(OnToolbar_FileNew);
			toolbar.Insert (button1, -1); 

			ToolButton button2 = new ToolButton (Stock.Open); 
			button2.SetTooltip (tooltips1, "Open", "Open");
			button2.Clicked += new EventHandler(OnToolbar_FileOpen);
			toolbar.Insert (button2, -1); 
						
			ToolButton button3 = new ToolButton (Stock.Save); 
			button3.SetTooltip (tooltips1, "Save", "Save");
			button3.Clicked += new EventHandler(OnToolbar_FileSave);
			toolbar.Insert (button3, -1); 
			
			Gtk.ToolButton button4 = new Gtk.ToolButton (Stock.Close); 
			button4.SetTooltip (tooltips1, "Close", "Close");
			button4.Clicked += new EventHandler(OnToolbar_FileClose);
			toolbar.Insert (button4, -1); 
			
			SeparatorToolItem sep = new SeparatorToolItem ();
			toolbar.Insert (sep, -1); 

			ToolButton button5 = new ToolButton (Stock.Execute); 
			button5.SetTooltip (tooltips1, "Execute Command\tF5", "Execute Command");
			button5.Clicked += new EventHandler(OnToolbar_ExecuteCommand);
			toolbar.Insert (button5, -1); 

			ToolButton button6 = new ToolButton (Stock.Execute); 
			button6.SetTooltip (tooltips1, "Execute Script", "Execute Script");
			button6.Clicked += new EventHandler(OnToolbar_ExecuteScript);
			toolbar.Insert (button6, -1); 
			
			ToolButton button7 = new ToolButton (Stock.GoDown); 
			button7.SetTooltip (tooltips1, "Output", "Output");
			button7.Clicked += new EventHandler(OnToolbar_ToggleResultsOutput);
			toolbar.Insert (button7, -1); 
			
			Gtk.ToolButton button8 = new Gtk.ToolButton (Stock.GoUp); 
			button8.SetTooltip (tooltips1, "Query Mode", "Query Mode");
			button8.Clicked += new EventHandler(OnToolbar_ToggleQueryMode);
			toolbar.Insert (button8, -1); 

			combo = ComboHelper.NewComboBox ();
			combo.Changed += new EventHandler (OnDataSourceChanged);
			combo.AppendText (NotConnected);
			ComboHelper.SetActiveText (combo, NotConnected);
			combo.Active = 0;
			ToolItem ti = new ToolItem();
			ti.Child = combo;
			toolbar.Insert (ti, -1); 

			return toolbar;
		}
Beispiel #35
0
		//
		// Constructor
		//
		public MainWindow (Db db)
		{
			foreach (ServiceNode service in AddinManager.GetExtensionNodes ("/FSpot/Services")) {
				try {
					service.Initialize ();
					service.Start ();
				} catch (Exception e) {
					Log.WarningFormat ("Something went wrong while starting the {0} extension.", service.Id);
					Log.DebugException (e);
				}
			}

			Database = db;

			GtkBeans.Builder builder = new GtkBeans.Builder ("main_window.ui");
			builder.Autoconnect (this);

			//Set the global DefaultColormap. Allows transparency according
			//to the theme (work on murrine engine)
			Gdk.Colormap colormap = ((Widget)main_window).Screen.RgbaColormap;
			if (colormap == null) {
				Log.Debug ("Your screen doesn't support alpha channels!");
				colormap = ((Widget)main_window).Screen.RgbColormap;
			}
			Gtk.Widget.DefaultColormap = colormap;

			LoadPreference (Preferences.MAIN_WINDOW_WIDTH);
			LoadPreference (Preferences.MAIN_WINDOW_X);
			LoadPreference (Preferences.MAIN_WINDOW_MAXIMIZED);
			main_window.ShowAll ();

			LoadPreference (Preferences.SIDEBAR_POSITION);
			LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);

			pagesetup_menu_item.Activated += HandlePageSetupActivated;

			toolbar = new Gtk.Toolbar ();
			toolbar_vbox.PackStart (toolbar);

			ToolButton import_button = GtkUtil.ToolButtonFromTheme ("gtk-add", Catalog.GetString ("Import Photos…"), true);
			import_button.Clicked += (o, args) => StartImport (null);
			import_button.TooltipText = Catalog.GetString ("Import new photos");
			toolbar.Insert (import_button, -1);

			toolbar.Insert (new SeparatorToolItem (), -1);

			rl_button = GtkUtil.ToolButtonFromTheme ("object-rotate-left", Catalog.GetString ("Rotate Left"), false);
			rl_button.Clicked += HandleRotate270Command;
			toolbar.Insert (rl_button, -1);

			rr_button = GtkUtil.ToolButtonFromTheme ("object-rotate-right", Catalog.GetString ("Rotate Right"), false);
			rr_button.Clicked += HandleRotate90Command;
			toolbar.Insert (rr_button, -1);

			toolbar.Insert (new SeparatorToolItem (), -1);

			browse_button = new ToggleToolButton ();
			browse_button.Label = Catalog.GetString ("Browsing");
			browse_button.IconName = "mode-browse";
			browse_button.IsImportant = true;
			browse_button.Toggled += HandleToggleViewBrowse;
			browse_button.TooltipText = Catalog.GetString ("Browse your photo library");
			toolbar.Insert (browse_button, -1);

			edit_button = new ToggleToolButton ();
			edit_button.Label = Catalog.GetString ("Editing");
			edit_button.IconName = "mode-image-edit";
			edit_button.IsImportant = true;
			edit_button.Toggled += HandleToggleViewPhoto;
			edit_button.TooltipText = Catalog.GetString ("Edit your photos");
			toolbar.Insert (edit_button, -1);

			toolbar.Insert (new SeparatorToolItem (), -1);

			ToolButton fs_button = GtkUtil.ToolButtonFromTheme ("view-fullscreen", Catalog.GetString ("Fullscreen"), false);
			fs_button.Clicked += HandleViewFullscreen;
			fs_button.TooltipText = Catalog.GetString ("View photos fullscreen");
			toolbar.Insert (fs_button, -1);

			ToolButton ss_button = GtkUtil.ToolButtonFromTheme ("media-playback-start", Catalog.GetString ("Slideshow"), false);
			ss_button.Clicked += HandleViewSlideShow;
			ss_button.TooltipText = Catalog.GetString ("View photos in a slideshow");
			toolbar.Insert (ss_button, -1);

			SeparatorToolItem white_space = new SeparatorToolItem ();
			white_space.Draw = false;
			white_space.Expand = true;
			toolbar.Insert (white_space, -1);

			ToolItem label_item = new ToolItem ();
			count_label = new Label (String.Empty);
			label_item.Child = count_label;
			toolbar.Insert (label_item, -1);

			display_previous_button = new ToolButton (Stock.GoBack);
			toolbar.Insert (display_previous_button, -1);
			display_previous_button.TooltipText = Catalog.GetString ("Previous photo");
			display_previous_button.Clicked += new EventHandler (HandleDisplayPreviousButtonClicked);

			display_next_button = new ToolButton (Stock.GoForward);
			toolbar.Insert (display_next_button, -1);
			display_next_button.TooltipText = Catalog.GetString ("Next photo");
			display_next_button.Clicked += new EventHandler (HandleDisplayNextButtonClicked);

			Sidebar = new Sidebar ();
			ViewModeChanged += Sidebar.HandleMainWindowViewModeChanged;
			sidebar_vbox.Add (Sidebar);

			tag_selection_scrolled = new Gtk.ScrolledWindow ();
			tag_selection_scrolled.ShadowType = ShadowType.In;

			tag_selection_widget = new TagSelectionWidget (Database.Tags);
			tag_selection_scrolled.Add (tag_selection_widget);

			Sidebar.AppendPage (tag_selection_scrolled, Catalog.GetString ("Tags"), "tag");

			AddinManager.AddExtensionNodeHandler ("/FSpot/Sidebar", OnSidebarExtensionChanged);

			Sidebar.Context = ViewContext.Library;

			Sidebar.CloseRequested += HideSidebar;
			Sidebar.Show ();

			InfoBox = new InfoBox ();
			ViewModeChanged += InfoBox.HandleMainWindowViewModeChanged;
			InfoBox.VersionChanged += delegate (InfoBox box, IPhotoVersion version) {
				UpdateForVersionChange (version);
			};
			sidebar_vbox.PackEnd (InfoBox, false, false, 0);

			InfoBox.Context = ViewContext.Library;

			tag_selection_widget.Selection.Changed += HandleTagSelectionChanged;
			tag_selection_widget.KeyPressEvent += HandleTagSelectionKeyPress;
			tag_selection_widget.ButtonPressEvent += HandleTagSelectionButtonPressEvent;
			tag_selection_widget.PopupMenu += HandleTagSelectionPopupMenu;
			tag_selection_widget.RowActivated += HandleTagSelectionRowActivated;

			LoadPreference (Preferences.TAG_ICON_SIZE);

			try {
				query = new PhotoQuery (Database.Photos);
			} catch (System.Exception e) {
				//FIXME assume any exception here is due to a corrupt db and handle that.
				new RepairDbDialog (e, Database.Repair (), main_window);
				query = new PhotoQuery (Database.Photos);
			}

			UpdateStatusLabel ();
			query.Changed += HandleQueryChanged;

			Database.Photos.ItemsChanged += HandleDbItemsChanged;
			Database.Tags.ItemsChanged += HandleTagsChanged;
			Database.Tags.ItemsAdded += HandleTagsChanged;
			Database.Tags.ItemsRemoved += HandleTagsChanged;

			group_selector = new GroupSelector ();
			group_selector.Adaptor = new TimeAdaptor (query, Preferences.Get<bool> (Preferences.GROUP_ADAPTOR_ORDER_ASC));

			group_selector.ShowAll ();

			if (zoom_scale != null) {
				zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
			}

			view_vbox.PackStart (group_selector, false, false, 0);
			view_vbox.ReorderChild (group_selector, 0);

			find_bar = new FindBar (query, tag_selection_widget.Model);
			view_vbox.PackStart (find_bar, false, false, 0);
			view_vbox.ReorderChild (find_bar, 1);
			main_window.KeyPressEvent += HandleKeyPressEvent;

			query_widget = new QueryWidget (query, Database);
			query_widget.Logic.Changed += HandleQueryLogicChanged;
			view_vbox.PackStart (query_widget, false, false, 0);
			view_vbox.ReorderChild (query_widget, 2);

			MenuItem findByTag = uimanager.GetWidget ("/ui/menubar1/find/find_by_tag") as MenuItem;
			query_widget.Hidden += delegate {
				((Gtk.Label)findByTag.Child).TextWithMnemonic = Catalog.GetString ("Show _Find Bar");
			};
			query_widget.Shown += delegate {
				((Gtk.Label)findByTag.Child).TextWithMnemonic = Catalog.GetString ("Hide _Find Bar");
			};

			icon_view = new QueryView (query);
			icon_view.ZoomChanged += HandleZoomChanged;
			LoadPreference (Preferences.ZOOM);
			LoadPreference (Preferences.SHOW_TAGS);
			LoadPreference (Preferences.SHOW_DATES);
			LoadPreference (Preferences.SHOW_RATINGS);
			icon_view_scrolled.Add (icon_view);
			icon_view.DoubleClicked += HandleDoubleClicked;
			icon_view.Vadjustment.ValueChanged += HandleIconViewScroll;
			icon_view.GrabFocus ();

			preview_popup = new PreviewPopup (icon_view);

			icon_view.DragBegin += HandleIconViewDragBegin;
			icon_view.DragEnd += HandleIconViewDragEnd;
			icon_view.DragDataGet += HandleIconViewDragDataGet;
			icon_view.DragMotion += HandleIconViewDragMotion;
			icon_view.DragDrop += HandleIconViewDragDrop;
			// StartDrag is fired by IconView
			icon_view.StartDrag += HandleIconViewStartDrag;

			TagMenu tag_menu = new TagMenu (null, Database.Tags);
			tag_menu.NewTagHandler += delegate {
				HandleCreateTagAndAttach (this, null);
			};
			tag_menu.TagSelected += HandleAttachTagMenuSelected;
			tag_menu.Populate ();
			(uimanager.GetWidget ("/ui/menubar1/edit2/attach_tag") as MenuItem).Submenu = tag_menu;

			PhotoTagMenu pmenu = new PhotoTagMenu ();
			pmenu.TagSelected += HandleRemoveTagMenuSelected;
			(uimanager.GetWidget ("/ui/menubar1/edit2/remove_tag") as MenuItem).Submenu = pmenu;

			Gtk.Drag.DestSet (icon_view, DestDefaults.All, (TargetEntry[])iconDestTargetList,
				DragAction.Copy | DragAction.Move);

			icon_view.DragDataReceived += HandleIconViewDragDataReceived;
			icon_view.KeyPressEvent += HandleIconViewKeyPressEvent;

			photo_view = new PhotoView (query);
			photo_box.Add (photo_view);

			photo_view.DoubleClicked += HandleDoubleClicked;
			photo_view.KeyPressEvent += HandlePhotoViewKeyPressEvent;
			photo_view.UpdateStarted += HandlePhotoViewUpdateStarted;
			photo_view.UpdateFinished += HandlePhotoViewUpdateFinished;

			photo_view.View.ZoomChanged += HandleZoomChanged;

			// Tag typing: focus the tag entry if the user starts typing a tag
			icon_view.KeyPressEvent += HandlePossibleTagTyping;
			photo_view.KeyPressEvent += HandlePossibleTagTyping;
			tag_entry = new TagEntry (Database.Tags);
			tag_entry.KeyPressEvent += HandleTagEntryKeyPressEvent;
			tag_entry.TagsAttached += HandleTagEntryTagsAttached;
			tag_entry.TagsRemoved += HandleTagEntryRemoveTags;
			tag_entry.Activated += HandleTagEntryActivate;
			tag_entry_container.Add (tag_entry);

			Gtk.Drag.DestSet (photo_view, DestDefaults.All, tag_target_table,
				DragAction.Copy | DragAction.Move);

			photo_view.DragMotion += HandlePhotoViewDragMotion;
			photo_view.DragDrop += HandlePhotoViewDragDrop;
			photo_view.DragDataReceived += HandlePhotoViewDragDataReceived;

			view_notebook.SwitchPage += HandleViewNotebookSwitchPage;
			group_selector.Adaptor.GlassSet += HandleAdaptorGlassSet;
			group_selector.Adaptor.Changed += HandleAdaptorChanged;
			LoadPreference (Preferences.GROUP_ADAPTOR_ORDER_ASC);
			LoadPreference (Preferences.FILMSTRIP_ORIENTATION);

			Selection = new MainSelection (this);
			Selection.Changed += HandleSelectionChanged;
			Selection.ItemsChanged += HandleSelectionItemsChanged;
			Selection.Changed += Sidebar.HandleSelectionChanged;
			Selection.ItemsChanged += Sidebar.HandleSelectionItemsChanged;

			AddinManager.ExtensionChanged += PopulateExtendableMenus;
			PopulateExtendableMenus (null, null);

			UpdateMenus ();

			main_window.ShowAll ();

			tagbar.Hide ();
			find_bar.Hide ();

			UpdateFindByTagMenu ();

			LoadPreference (Preferences.SHOW_TOOLBAR);
			LoadPreference (Preferences.SHOW_SIDEBAR);
			LoadPreference (Preferences.SHOW_TIMELINE);
			LoadPreference (Preferences.SHOW_FILMSTRIP);

			LoadPreference (Preferences.GNOME_MAILTO_ENABLED);

			Preferences.SettingChanged += OnPreferencesChanged;

			main_window.DeleteEvent += HandleDeleteEvent;

			// When the icon_view is loaded, set it's initial scroll position
			icon_view.SizeAllocated += HandleIconViewReady;

			export.Activated += HandleExportActivated;
			UpdateToolbar ();

			(uimanager.GetWidget ("/ui/menubar1/file1/close1") as MenuItem).Hide ();

			Banshee.Kernel.Scheduler.Resume ();
		}
Beispiel #36
0
        private void CreateStatusbar()
        {
            statusBar = new Toolbar();
            statusBar.ShowArrow = false;
            statusBar.ToolbarStyle = ToolbarStyle.BothHoriz;
            statusBar.ExposeEvent +=  StatusBarExposeEvent;

            statusLabel = new Label();
            statusLabel.Xalign = 0;
            statusLabel.Xpad = 6;

            ToolItem statusLabelItem = new ToolItem();
            Alignment statusAlign = new Alignment(0.5f, 0.5f, 1.0f, 1.0f);
            statusLabelItem.Add(statusLabel);
            statusLabelItem.Expand = true;
            statusBar.Insert(statusLabelItem, -1);
            statusLabelItem.ShowAll();

            taskStatusIcon = new Hyena.Widgets.AnimatedImage();
            taskStatusIcon.Pixbuf = Gui.LoadIcon(22, "process-working");
            taskStatusIcon.FrameHeight = 22;
            taskStatusIcon.FrameWidth = 22;
            taskStatusIcon.Load();

            EventBox taskStatusIconBox = new EventBox();
            taskStatusIconBox.MotionNotifyEvent += delegate {
                UpdateTaskStatusIcon();
            };
            taskStatusIconBox.ButtonReleaseEvent += delegate {
                IndexingStatusWindow.Instance.Show();
            };
            taskStatusIconBox.SizeAllocated += delegate (object o, SizeAllocatedArgs args) {
                statusAlign.LeftPadding = (uint)args.Allocation.Width;
            };
            taskStatusIconBox.SetSizeRequest(22, 22);
            taskStatusIconBox.Add(taskStatusIcon);
            taskStatusIconBox.Show();

            ToolItem taskStatusIconItem = new ToolItem();
            taskStatusIconItem.Add(taskStatusIconBox);
            statusBar.Insert(taskStatusIconItem, -1);
            taskStatusIconItem.Show();

            mainVBox.PackStart(statusBar, false, false, 0);

            UpdateTaskStatusIcon();
            UpdateStatusText();
        }
Beispiel #37
0
 public static Gtk.ToolItem CreateToolBarItem(this Gtk.Action action)
 {
     Gtk.ToolItem item = (Gtk.ToolItem)action.CreateToolItem();
     item.TooltipText = action.Label;
     return(item);
 }
Beispiel #38
0
        public ForumView(Forum site, String forum)
        {
            this.site = site;
            this.forum = forum;
            this.Destroyed += delegate(object sender, EventArgs e) {
                if (iconThread != null)
                if (iconThread.IsAlive)
                    iconThread.Abort ();
            };
            topicWindow = new ScrolledWindow ();
            topicWindow.ShadowType = ShadowType.EtchedIn;
            topicWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);

            treeviewTopics = new TreeView ();
            treeviewTopics.BorderWidth = 0;

            treeviewTopics.AppendColumn ("", new CellRendererPixbuf (), "pixbuf", 5);
            CellRendererText cellTopic = new CellRendererText ();
            TreeViewColumn topicCol = treeviewTopics.AppendColumn ("Topic", cellTopic, "text", 1);
            topicCol.SetCellDataFunc (cellTopic, new Gtk.TreeCellDataFunc (renderTopic));
            topicCol.Resizable = true;
            treeviewTopics.AppendColumn ("Author", new CellRendererText (), "text", 2).Resizable = true;
            ;
            treeviewTopics.AppendColumn ("Replies", new CellRendererText (), "text", 3).Resizable = true;
            ;
            treeviewTopics.AppendColumn ("Last Reply", new CellRendererText (), "text", 4).Resizable = true;
            ;
            // Use treeView.Selection.Changed?
            treeviewTopics.RowActivated += treeviewTopics_RowActivated;
            treeviewTopics.ButtonPressEvent += treeviewTopics_ButtonPress;

            topicWindow.Add (treeviewTopics);
            this.Add1 (topicWindow);

            contentBox = new VBox (false, 0);
            Toolbar toolbar = new Toolbar ();
            toolbar.HeightRequest = 38;
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.BorderWidth = 0;
            firstbtn = new ToolButton (Stock.GotoFirst);
            firstbtn.TooltipText = "First page";
            firstbtn.Sensitive = false;
            firstbtn.Clicked += firstbtn_Clicked;
            prevbtn = new ToolButton (Stock.GoBack);
            prevbtn.TooltipText = "Previous page";
            prevbtn.Sensitive = false;
            prevbtn.Clicked += prevbtn_Clicked;
            nextbtn = new ToolButton (Stock.GoForward);
            nextbtn.TooltipText = "Next page";
            nextbtn.Sensitive = false;
            nextbtn.Clicked += nextbtn_Clicked;
            lastbtn = new ToolButton (Stock.GotoLast);
            lastbtn.TooltipText = "Last page";
            lastbtn.Sensitive = false;
            lastbtn.Clicked += lastbtn_Clicked;

            Image tmpimage = new Image ();
            tmpimage.Pixbuf = new Gdk.Pixbuf (".images/icon_up.png");
            upbtn = new ToolButton (tmpimage, "");
            upbtn.TooltipText = "Expand view to top";
            upbtn.Clicked += upbtn_Clicked;
            Image tmpimage2 = new Image ();
            tmpimage2.Pixbuf = new Gdk.Pixbuf (".images/icon_down.png");
            downbtn = new ToolButton (tmpimage2, "");
            downbtn.TooltipText = "Split view";
            downbtn.Clicked += downbtn_Clicked;
            closebtn = new ToolButton (Stock.Close);
            closebtn.TooltipText = "Close image view";
            closebtn.Clicked += closebtn_Clicked;
            Image tmpimage3 = new Image ();
            tmpimage3.Pixbuf = new Gdk.Pixbuf (".images/rotate_16.png");
            rotatebtn = new ToolButton (tmpimage3, "");
            rotatebtn.TooltipText = "Rotate image clockwise";
            rotatebtn.Clicked += rotatebtn_Clicked;
            Image tmpimage4 = new Image ();
            tmpimage4.Pixbuf = new Gdk.Pixbuf (".images/icon_save.png");
            savebtn = new ToolButton (tmpimage4, "");
            savebtn.TooltipText = "Download image";
            savebtn.Clicked += savebtn_Clicked;
            pageLabel = new Label ("");
            ToolItem textItem = new ToolItem ();
            textItem.Expand = false;
            textItem.Add (pageLabel);
            imageviewbtn = new ToggleToolButton (Stock.ZoomFit);
            imageviewbtn.TooltipText = "Image view";
            imageviewbtn.Toggled += imageviewbtn_Toggled;
            textviewbtn = new ToggleToolButton (Stock.Properties);
            textviewbtn.TooltipText = "Thread view";
            textviewbtn.Active = true;
            textviewbtn.Toggled += textviewbtn_Toggled;
            SeparatorToolItem sepSpacer = new SeparatorToolItem ();
            sepSpacer.Expand = true;
            sepSpacer.Draw = false;
            sepFullsize = new SeparatorToolItem ();
            imageSortAscending = new ToggleToolButton (Stock.SortAscending);
            imageSortAscending.TooltipText = "Show earliest images first";
            imageSortAscending.Active = true;
            imageSortAscending.Toggled += imageSortAscending_Toggled;
            imageSortDescending = new ToggleToolButton (Stock.SortDescending);
            imageSortDescending.TooltipText = "Show latest images first";
            imageSortDescending.Toggled += imageSortDescending_Toggled;
            imageLoadingProgress = new ProgressBar ();
            ToolItem progressItem = new ToolItem ();
            progressItem.Expand = false;
            progressItem.Add (imageLoadingProgress);
            imageLoadingProgress.Fraction = 0;
            toolbar.Add (imageSortAscending);
            toolbar.Add (imageSortDescending);
            toolbar.Add (progressItem);
            toolbar.Add (firstbtn);
            toolbar.Add (prevbtn);
            toolbar.Add (textItem);
            toolbar.Add (nextbtn);
            toolbar.Add (lastbtn);
            toolbar.Add (sepFullsize);
            toolbar.Add (savebtn);
            toolbar.Add (rotatebtn);
            toolbar.Add (sepSpacer);
            toolbar.Add (imageviewbtn);
            toolbar.Add (textviewbtn);
            toolbar.Add (closebtn);
            toolbar.Add (upbtn);
            toolbar.Add (downbtn);
            threadwindow = new ScrolledWindow ();
            threadbrowser = new WebView ();
            threadbrowser.Editable = false;
            threadbrowser.NavigationRequested += threadbrowser_NavigationRequested;
            threadwindow.Add (threadbrowser);

            iconStore = new ListStore (typeof(string), typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(int), typeof(int));
            iconview = new IconView (iconStore);
            iconview.Margin = 1;
            iconview.Spacing = 1;
            iconview.BorderWidth = 0;
            iconview.ColumnSpacing = 1;
            iconview.RowSpacing = 1;
            iconview.PixbufColumn = 1;
            iconview.TooltipColumn = 2;
            iconview.SelectionMode = SelectionMode.Multiple;
            iconview.ItemActivated += iconview_ItemActivated;
            iconview.ButtonPressEvent += iconView_ButtonPress;
            iconview.Model = iconStore;
            iconview.ModifyBase (StateType.Normal, new Gdk.Color (0x66, 0x66, 0x66));
            iconwindow = new ScrolledWindow ();
            iconwindow.ShadowType = ShadowType.EtchedIn;
            iconwindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            iconwindow.Add (iconview);

            imagewindow = new EventBox ();
            fullSizeImage = new Image ();
            // JICE TEST
            fullsizeLayout = new Layout (null, null);
            fullsizeLayout.Add (fullSizeImage);
            fullsizeLayout.SizeRequested += fullsizeLayout_SizeRequested;
            imagewindow.ModifyBase (StateType.Normal, new Gdk.Color (0x66, 0x66, 0x66));
            imagewindow.Add (fullsizeLayout);
            imagewindow.CanFocus = true;
            imagewindow.KeyPressEvent += imagewindow_keyPressEvent;
            imagewindow.SizeRequested += imagewindow_sizeAllocated;

            //			imagewindow.Add(fullSizeImage);

            contentBox.PackStart (toolbar, false, false, 0);
            contentBox.PackStart (iconwindow);
            contentBox.PackStart (imagewindow);
            contentBox.PackStart (threadwindow);
            this.Add2 (contentBox);
            this.ShowAll ();
            imageSortAscending.Hide ();
            imageSortDescending.Hide ();
            iconwindow.Hide ();
            imagewindow.Hide ();
            closebtn.Hide ();
            rotatebtn.Hide ();
            savebtn.Hide ();
            sepFullsize.Hide ();
            downbtn.Hide ();
            imageLoadingProgress.Hide ();

            String favouriteThreads = UserSettings.getValue ("Site" + site.forumName + ".Forum" + forum + ".Favourites");
            favThreads = favouriteThreads.Split (';');

            treestoreTopics = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Gdk.Pixbuf));

            topicsLoaded = 0;
            loadTopics ();
            treeviewTopics.Model = treestoreTopics;
        }