Esempio n. 1
0
 public static void FireUp(ArrayList selectedphotos, DeskFlickrUI.ModeSelected mode)
 {
     new PhotoEditorUI(selectedphotos, mode);
 }
Esempio n. 2
0
    private PhotoEditorUI(ArrayList selectedphotos, DeskFlickrUI.ModeSelected mode)
    {
        Glade.XML gxml = new Glade.XML(null, "organizer.glade", "window2", null);
        gxml.Autoconnect(this);
        _isconflictmode = (mode == DeskFlickrUI.ModeSelected.ConflictMode);
        _isuploadmode   = (mode == DeskFlickrUI.ModeSelected.UploadMode);
        _isblogmode     = (mode == DeskFlickrUI.ModeSelected.BlogMode);
        if (mode == DeskFlickrUI.ModeSelected.BlogAndConflictMode)
        {
            _isconflictmode = true;
            _isblogmode     = true;
        }
        _tags         = new ArrayList();
        _comments     = new ArrayList();
        window2.Title = "Edit information for " + selectedphotos.Count + " photos";
        window2.SetIconFromFile(DeskFlickrUI.ICON_PATH);
        notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Information");
        notebook1.NextPage();
        notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Tags");
        notebook1.NextPage();
        notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Comments");

        tips = new Tooltips();
        SetCommentsToolBar();
        tips.Enable();
        SetCommentsTree();

        if (_isconflictmode)
        {
            notebook1.NextPage();
            notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Information at Server");
        }
        else
        {
            notebook1.RemovePage(3);
        }

        if (_isblogmode)
        {
            notebook1.NextPage();
            notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Blog Entry");
            notebook1.Page = 3;         // Default page is blog entry if editor is in Blog mode.
        }
        else
        {
            if (_isconflictmode)
            {
                notebook1.RemovePage(4);
            }
            else
            {
                notebook1.RemovePage(3);
            }
            notebook1.Page = 0;         // Default page is photo editing.
        }


        table1.SetColSpacing(0, 50);
        // Set Labels
        label6.Text = "Edit";
        label5.Text = "Title:";
        label4.Text = "Description:";
        label3.Text = "Visibility:";
        label2.Text = "License:";
        if (_isuploadmode)
        {
            label2.Sensitive = false;
        }
        // Labels for blog tab.
        label17.Text = "Title: ";
        label18.Text = "Description: ";

        // Search box
        label15.Markup  = "<span weight='bold'>Search: </span>";
        entry2.Changed += new EventHandler(OnFilterEntryChanged);

        // Revert button
        button9.Label    = "Revert Photo(s)";
        button9.Clicked += new EventHandler(OnRevertButtonClicked);

        // entry1.ModifyFont(Pango.FontDescription.FromString("FreeSerif 10"));
        SetPrivacyComboBox();
        SetLicenseComboBox();
        SetTagTreeView();

        // Make previous and next buttons insensitive. They'll become sensitive
        // only when the user ticks the 'Per Photo' checkbutton.
        button3.Sensitive     = false;
        button4.Sensitive     = false;
        checkbutton1.Toggled += new EventHandler(OnPerPageCheckToggled);
        button3.Clicked      += new EventHandler(OnPrevButtonClick);
        button4.Clicked      += new EventHandler(OnNextButtonClick);
        button5.Clicked      += new EventHandler(OnSaveButtonClick);
        button6.Clicked      += new EventHandler(OnCancelButtonClick);

        entry1.Changed           += new EventHandler(OnTitleChanged);
        textview5.Buffer.Changed += new EventHandler(OnDescChanged);

        combobox1.Changed += new EventHandler(OnPrivacyChanged);
        combobox2.Changed += new EventHandler(OnLicenseChanged);

        entry4.Changed           += new EventHandler(OnBlogTitleChanged);
        textview7.Buffer.Changed += new EventHandler(OnBlogDescChanged);

        textview3.Buffer.Changed += new EventHandler(OnTagsChanged);

        TextTag texttag = new TextTag("conflict");

        texttag.Font          = "Times Italic 10";
        texttag.WrapMode      = WrapMode.Word;
        texttag.ForegroundGdk = new Gdk.Color(0x99, 0, 0);
        textview4.Buffer.TagTable.Add(texttag);

        // Showing photos should be the last step.
        this._selectedphotos = selectedphotos;
        if (selectedphotos.Count == 1)
        {
            checkbutton1.Sensitive = false;
            ShowInformationForCurrentPhoto();
        }
        else
        {
            EmbedCommonInformation();
        }
        // Save a copy of the original photos, so that only those photos
        // which  have been edited, would have their dirty bit set. Advantage:
        // this would reduce the number of dirty photos, and hence there'll
        // be lesser photos to update when sycing with server.
        _originalphotos = new System.Collections.Generic.Dictionary <string, Photo>();
        foreach (DeskFlickrUI.SelectedPhoto sel in _selectedphotos)
        {
            Photo p = sel.photo;
            _originalphotos.Add(p.Id, new Photo(p));
        }

        eventbox5.ButtonPressEvent += OnLinkPressed;
        eventbox5.EnterNotifyEvent += MouseOnLink;
        eventbox5.LeaveNotifyEvent += MouseLeftLink;

        window2.ShowAll();
    }