Пример #1
0
    public VirtualPaperUI(Program p) : 
            base("Virtual Paper", "Virtual Paper")
    {
        program = p;

        DeleteEvent += new DeleteEventHandler(HandleDelete);

        handwriting = new Handwriting();

        ui.AddUiFromResource("UILayout.xml");
        PopulateActionGroups();
        
        Menus        = ui.GetWidget("/MainMenu")   as MenuBar;
        Toolbar = TB = ui.GetWidget("/ControlBar") as Toolbar;

        AddColorToolButton();

        Contents = handwriting;

        handwriting.PaperColor = Handwriting.White;
        handwriting.Changed += delegate {
            updateUndo();
        };
        
        updateUndo();

        ShowAll();
        program.Run();
    }
Пример #2
0
		void OnMenuItemActivated (object sender, EventArgs args)
		{
			// Insert a new Sketching Widget at the current cursor position
			SketchingTextTag tag = (SketchingTextTag)
				Note.TagTable.CreateDynamicTag ("sketch");

			// FIXME: Create a dynamic name for a sketch file that will
			// be stored in the note's attachments directory.
			tag.Uri = "test";
            Handwriting h = new Handwriting(new Paper(new Cairo.Color(1.0,1.0,1.0,1.0)));
            h.SetSizeRequest(500,500);
            tag.Widget = h;

			// Insert the sketch tag at the current cursor position
			Gtk.TextIter cursor = Buffer.GetIterAtMark (Buffer.InsertMark);
			Gtk.TextTag[] tags = {tag};
			Buffer.InsertWithTags (ref cursor, String.Empty, tags);
		}