static void ColorSet_cb(IntPtr inst)
 {
     try {
         ColorButton __obj = GLib.Object.GetObject(inst, false) as ColorButton;
         __obj.OnColorSet();
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
		public ColorEditor(object @object, PropertyInfo info) : base(@object, info) {
			HBox box = new HBox();
			box.Spacing = 6;
			box.Show();
			
			this.mColorButton = new ColorButton();
			this.mColorButton.Show();
			box.PackStart(this.mColorButton, false, true, 0);
			
			this.mAlphaScale = new HScale(0, 1, 0.0001);
			this.mAlphaScale.Show();
			box.PackStart(this.mAlphaScale, true, true, 0);
			
			this.Add(box);
			
			this.Revert();
			
			this.mColorButton.ColorSet += this.OnDirtyAction;
			this.mAlphaScale.ValueChanged += this.OnDirtyAction;
		}
        private Gtk.Widget MakeAppearancePage()
        {
            VBox vbox = new VBox(false, 6);

            vbox.BorderWidth = 10;

            VBox  sectionVBox = new VBox(false, 4);
            Label l           = new Label();

            l.Markup = string.Format("<span size=\"large\" weight=\"bold\">{0}</span>",
                                     Catalog.GetString("Color Management"));
            l.UseUnderline = false;
            l.UseMarkup    = true;
            l.Wrap         = false;
            l.Xalign       = 0;

            l.Show();
            sectionVBox.PackStart(l, false, false, 0);

            HBox  hbox = new HBox(false, 6);
            Label lblTodaysTaskColor = new Label();

            lblTodaysTaskColor.Text         = Catalog.GetString("Today:");
            lblTodaysTaskColor.Xalign       = 0;
            lblTodaysTaskColor.WidthRequest = 75;
            lblTodaysTaskColor.Show();

            IPreferences prefs = application.Preferences;

            txtTodaysTaskColor          = new Entry();
            txtTodaysTaskColor.Text     = prefs.Get(PreferencesKeys.TodayTaskTextColor);
            txtTodaysTaskColor.Changed += OnTxtTodaysTaskColorChanged;
            txtTodaysTaskColor.Show();

            btnChangeTodaysTaskColor = new ColorButton();
            string todayTasksColor = prefs.Get(PreferencesKeys.TodayTaskTextColor);

            Gdk.Color currentColor = new Gdk.Color();
            Gdk.Color.Parse(todayTasksColor, ref currentColor);
            btnChangeTodaysTaskColor.Color = currentColor;

            btnChangeTodaysTaskColor.ColorSet += OnBtnChangeTodaysTaskColorColorSet;
            btnChangeTodaysTaskColor.Show();

            hbox.PackStart(lblTodaysTaskColor, false, false, 0);
            hbox.PackStart(txtTodaysTaskColor, false, false, 0);
            hbox.PackStart(btnChangeTodaysTaskColor, false, false, 0);
            hbox.Show();

            HBox hbox2 = new HBox(false, 6);

            Label lblOverdueTaskColor = new Label();

            lblOverdueTaskColor.Text         = Catalog.GetString("Overdue:");
            lblOverdueTaskColor.WidthRequest = 75;
            lblOverdueTaskColor.Xalign       = 0;
            lblOverdueTaskColor.Show();

            txtOverdueTaskColor          = new Entry();
            txtOverdueTaskColor.Text     = prefs.Get(PreferencesKeys.OverdueTaskTextColor);
            txtOverdueTaskColor.Changed += OnTxtOverdueTaskColorChanged;
            txtOverdueTaskColor.Show();

            btnChangeOverdueTaskColor = new ColorButton();
            string overdueTasksColor = prefs.Get(PreferencesKeys.OverdueTaskTextColor);

            Gdk.Color overdueColor = new Gdk.Color();
            Gdk.Color.Parse(overdueTasksColor, ref overdueColor);
            btnChangeOverdueTaskColor.Color = overdueColor;

            btnChangeOverdueTaskColor.ColorSet += OnBtnChangeOverdueTaskColorColorSet;
            btnChangeOverdueTaskColor.Show();

            hbox2.PackStart(lblOverdueTaskColor, false, false, 0);
            hbox2.PackStart(txtOverdueTaskColor, false, false, 0);
            hbox2.PackStart(btnChangeOverdueTaskColor, false, false, 0);
            hbox2.Show();

            sectionVBox.PackStart(hbox, false, false, 0);
            sectionVBox.PackStart(hbox2, false, false, 0);
            sectionVBox.Show();

            vbox.PackStart(sectionVBox, false, false, 0);

            return(vbox);
        }
		void SetColorToButton (ColorButton button, Cairo.Color color)
		{
			button.Color = (HslColor)color;
			button.Alpha = (ushort)(color.A * ushort.MaxValue);
		}
		Cairo.Color GetColorFromButton (ColorButton button)
		{
			return new Cairo.Color (button.Color.Red / (double)ushort.MaxValue, button.Color.Green / (double)ushort.MaxValue, button.Color.Blue / (double)ushort.MaxValue, button.Alpha / (double)ushort.MaxValue);
		}
Exemple #6
0
        private Gtk.VBox GenerateResults()

        {
            VBox box = new VBox();

            Gdk.Color white = new Gdk.Color(255, 255, 255);

            Gdk.Color black = new Gdk.Color(0, 0, 0);

            Gdk.Color blue = new Gdk.Color(0, 0, 255);



            // Match Colors

            btnMatchForeColor = new ColorButton(blue);

            btnMatchBackColor = new ColorButton(white);

            btnMatchForeColor.ColorSet += new EventHandler(btnMatchForeColor_ColorSet);

            btnMatchBackColor.ColorSet += new EventHandler(btnMatchBackColor_ColorSet);



            Frame matchFrame = new Frame("Results Match");

            matchFrame.BorderWidth = 5;

            HBox frameBox = new HBox();

            frameBox.BorderWidth = 5;



            HBox foreBox = new HBox(false, 3);

            btnMatchForeColor.WidthRequest = 100;

            foreBox.PackStart(new Label("Fore Color"), false, false, 3);

            foreBox.PackStart(btnMatchForeColor, false, true, 3);



            HBox backBox = new HBox(false, 3);

            btnMatchBackColor.WidthRequest = 100;

            backBox.PackStart(new Label("Back Color"), false, false, 3);

            backBox.PackStart(btnMatchBackColor, false, true, 3);



            frameBox.PackStart(foreBox, true, true, 5);

            frameBox.PackStart(backBox, true, true, 5);

            matchFrame.Add(frameBox);



            // Window Colors

            btnResultsForeColor = new ColorButton(black);

            btnResultsBackColor = new ColorButton(white);

            btnResultsForeColor.ColorSet += new EventHandler(btnResultsForeColor_ColorSet);

            btnResultsBackColor.ColorSet += new EventHandler(btnResultsBackColor_ColorSet);



            Frame resultsFrame = new Frame("Results Window");

            resultsFrame.BorderWidth = 5;

            frameBox = new HBox();

            frameBox.BorderWidth = 5;



            foreBox = new HBox(false, 3);

            btnResultsForeColor.WidthRequest = 100;

            foreBox.PackStart(new Label("Fore Color"), false, false, 3);

            foreBox.PackStart(btnResultsForeColor, false, true, 3);



            backBox = new HBox(false, 3);

            btnResultsBackColor.WidthRequest = 100;

            backBox.PackStart(new Label("Back Color"), false, false, 3);

            backBox.PackStart(btnResultsBackColor, false, true, 3);



            frameBox.PackStart(foreBox, true, true, 5);

            frameBox.PackStart(backBox, true, true, 5);

            resultsFrame.Add(frameBox);



            // Results display

            Frame results = new Frame("Results Preview");

            results.BorderWidth = 5;

            Frame ScrolledWindowFrm = new Gtk.Frame();

            ScrolledWindowFrm.Shadow = ShadowType.In;

            ScrolledWindowFrm.BorderWidth = 5;

            txtResults = new TextView();

            txtResults.Buffer.Text = "(21)  Example results line and, match, displayed";
            txtResults.Editable    = false;

            ScrolledWindowFrm.HeightRequest = 50;

            ScrolledWindowFrm.Add(txtResults);

            results.Add(ScrolledWindowFrm);



            box.PackStart(matchFrame, false, true, 3);

            box.PackStart(resultsFrame, false, true, 3);

            box.PackEnd(results, false, true, 3);

            return(box);
        }
Exemple #7
0
        private Gtk.Widget MakeAppearancePage()
        {
            VBox vbox = new VBox (false, 6);
            vbox.BorderWidth = 10;

            VBox sectionVBox = new VBox (false, 4);
            Label l = new Label ();
            l.Markup = string.Format ("<span size=\"large\" weight=\"bold\">{0}</span>",
                                      Catalog.GetString ("Color Management"));
            l.UseUnderline = false;
            l.UseMarkup = true;
            l.Wrap = false;
            l.Xalign = 0;

            l.Show ();
            sectionVBox.PackStart (l, false, false, 0);

            HBox hbox = new HBox (false, 6);
            Label lblTodaysTaskColor = new Label ();
            lblTodaysTaskColor.Text = Catalog.GetString ("Today:");
            lblTodaysTaskColor.Xalign = 0;
            lblTodaysTaskColor.WidthRequest = 75;
            lblTodaysTaskColor.Show ();

            IPreferences prefs = application.Preferences;
            txtTodaysTaskColor = new Entry();
            txtTodaysTaskColor.Text = prefs.Get (PreferencesKeys.TodayTaskTextColor);
            txtTodaysTaskColor.Changed += OnTxtTodaysTaskColorChanged;
            txtTodaysTaskColor.Show ();

            btnChangeTodaysTaskColor = new ColorButton();
            string todayTasksColor = prefs.Get (PreferencesKeys.TodayTaskTextColor);
            Gdk.Color currentColor = new Gdk.Color();
            Gdk.Color.Parse (todayTasksColor, ref currentColor);
            btnChangeTodaysTaskColor.Color = currentColor;

            btnChangeTodaysTaskColor.ColorSet += OnBtnChangeTodaysTaskColorColorSet;
            btnChangeTodaysTaskColor.Show ();

            hbox.PackStart (lblTodaysTaskColor, false, false, 0);
            hbox.PackStart (txtTodaysTaskColor, false, false, 0);
            hbox.PackStart (btnChangeTodaysTaskColor, false, false, 0);
            hbox.Show ();

            HBox hbox2 = new HBox (false, 6);

            Label lblOverdueTaskColor = new Label ();
            lblOverdueTaskColor.Text = Catalog.GetString ("Overdue:");
            lblOverdueTaskColor.WidthRequest = 75;
            lblOverdueTaskColor.Xalign = 0;
            lblOverdueTaskColor.Show ();

            txtOverdueTaskColor = new Entry();
            txtOverdueTaskColor.Text = prefs.Get (PreferencesKeys.OverdueTaskTextColor);
            txtOverdueTaskColor.Changed += OnTxtOverdueTaskColorChanged;
            txtOverdueTaskColor.Show ();

            btnChangeOverdueTaskColor = new ColorButton();
            string overdueTasksColor = prefs.Get (PreferencesKeys.OverdueTaskTextColor);
            Gdk.Color overdueColor = new Gdk.Color();
            Gdk.Color.Parse (overdueTasksColor, ref overdueColor);
            btnChangeOverdueTaskColor.Color = overdueColor;

            btnChangeOverdueTaskColor.ColorSet += OnBtnChangeOverdueTaskColorColorSet;
            btnChangeOverdueTaskColor.Show();

            hbox2.PackStart (lblOverdueTaskColor, false, false, 0);
            hbox2.PackStart (txtOverdueTaskColor, false, false, 0);
            hbox2.PackStart (btnChangeOverdueTaskColor, false, false, 0);
            hbox2.Show ();

            sectionVBox.PackStart (hbox, false, false, 0);
            sectionVBox.PackStart (hbox2, false, false, 0);
            sectionVBox.Show();

            vbox.PackStart (sectionVBox, false, false, 0);

            return vbox;
        }
Exemple #8
0
        private Gtk.VBox GenerateResults()
        {
            VBox box = new VBox();
             Gdk.Color white = new Gdk.Color(255,255,255);
             Gdk.Color black = new Gdk.Color(0,0,0);
             Gdk.Color blue = new Gdk.Color(0,0,255);

             // Match Colors
             btnMatchForeColor = new ColorButton(blue);
             btnMatchBackColor = new ColorButton(white);
             btnMatchForeColor.ColorSet += new EventHandler(btnMatchForeColor_ColorSet);
             btnMatchBackColor.ColorSet += new EventHandler(btnMatchBackColor_ColorSet);

             Frame matchFrame = new Frame("Results Match");
             matchFrame.BorderWidth = 5;
             HBox frameBox = new HBox();
             frameBox.BorderWidth = 5;

             HBox foreBox = new HBox(false, 3);
             btnMatchForeColor.WidthRequest = 100;
             foreBox.PackStart(new Label("Fore Color"), false, false, 3);
             foreBox.PackStart(btnMatchForeColor, false, true, 3);

             HBox backBox = new HBox(false, 3);
             btnMatchBackColor.WidthRequest = 100;
             backBox.PackStart(new Label("Back Color"), false, false, 3);
             backBox.PackStart(btnMatchBackColor, false, true, 3);

             frameBox.PackStart(foreBox, true, true, 5);
             frameBox.PackStart(backBox, true, true, 5);
             matchFrame.Add(frameBox);

             // Window Colors
             btnResultsForeColor = new ColorButton(black);
             btnResultsBackColor = new ColorButton(white);
             btnResultsForeColor.ColorSet += new EventHandler(btnResultsForeColor_ColorSet);
             btnResultsBackColor.ColorSet += new EventHandler(btnResultsBackColor_ColorSet);

             Frame resultsFrame = new Frame("Results Window");
             resultsFrame.BorderWidth = 5;
             frameBox = new HBox();
             frameBox.BorderWidth = 5;

             foreBox = new HBox(false, 3);
             btnResultsForeColor.WidthRequest = 100;
             foreBox.PackStart(new Label("Fore Color"), false, false, 3);
             foreBox.PackStart(btnResultsForeColor, false, true, 3);

             backBox = new HBox(false, 3);
             btnResultsBackColor.WidthRequest = 100;
             backBox.PackStart(new Label("Back Color"), false, false, 3);
             backBox.PackStart(btnResultsBackColor, false, true, 3);

             frameBox.PackStart(foreBox, true, true, 5);
             frameBox.PackStart(backBox, true, true, 5);
             resultsFrame.Add(frameBox);

             // Results display
             Frame results = new Frame("Results Preview");
             results.BorderWidth = 5;
             Frame ScrolledWindowFrm = new Gtk.Frame();
             ScrolledWindowFrm.Shadow = ShadowType.In;
             ScrolledWindowFrm.BorderWidth = 5;
             txtResults = new TextView();
             txtResults.Buffer.Text = "(21)  Example results line and, match, displayed";
             txtResults.Editable = false;
             ScrolledWindowFrm.HeightRequest = 50;
             ScrolledWindowFrm.Add(txtResults);
             results.Add(ScrolledWindowFrm);

             box.PackStart(matchFrame, false, true, 3);
             box.PackStart(resultsFrame, false, true, 3);
             box.PackEnd(results, false, true, 3);
             return box;
        }
Exemple #9
0
        public SplashScreenForm(bool showSetting)
            : base(Gtk.WindowType.Toplevel)
        {
            Console.WriteLine("splash.bild.start-{0}",DateTime.Now);
            waitingSplash =showSetting;

            AppPaintable = true;
            this.Decorated = false;
            this.WindowPosition = WindowPosition.Center;
            this.TypeHint = Gdk.WindowTypeHint.Splashscreen;
            try {
                bitmap = new Gdk.Pixbuf(System.IO.Path.Combine( MainClass.Paths.ResDir, "moscrif.png"));
            } catch (Exception ex) {
                Tool.Logger.Error(ex.Message);
                Tool.Logger.Error("Can't load splash screen pixbuf 'moscrif.png'.");
            }
            progress = new ProgressBar();
            progress.Fraction = 0.00;
            progress.HeightRequest = 6;

            vbox = new VBox();
            vbox.BorderWidth = 12;
            label = new Gtk.Label();
            label.UseMarkup = true;
            label.Xalign = 0;
            //vbox.PackEnd(progress, false, true, 0);

            if(showSetting){

                Table table= new Table(3,3,false);

                Label lbl1 = new Label("Color Scheme :");
                Label lbl2 = new Label("Keybinding :");

                table.Attach(lbl1,0,1,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0);
                table.Attach(lbl2,0,1,1,2,AttachOptions.Shrink,AttachOptions.Shrink,0,0);

                cbBackground = new ColorButton();
                table.Attach(cbBackground,1,2,0,1,AttachOptions.Fill,AttachOptions.Shrink,0,0);

                cbKeyBinding = Gtk.ComboBox.NewText ();//new ComboBox();
                cbKeyBinding.Name="cbKeyBinding";

                if(MainClass.Settings.BackgroundColor==null){
                    MainClass.Settings.BackgroundColor = new Moscrif.IDE.Option.Settings.BackgroundColors(218,218,218);
                    /*if(MainClass.Platform.IsMac)
                        MainClass.Settings.BackgroundColor = new Moscrif.IDE.Settings.Settings.BackgroundColors(218,218,218);
                    else
                        MainClass.Settings.BackgroundColor = new Moscrif.IDE.Settings.Settings.BackgroundColors(224,41,47);
                        */
                }

                cbKeyBinding.AppendText(WIN);
                cbKeyBinding.AppendText(MACOSX);
                cbKeyBinding.AppendText(JAVA);
                cbKeyBinding.AppendText(VisualC);

                if(MainClass.Platform.IsMac){
                    cbKeyBinding.Active = 1;
                } else {
                    cbKeyBinding.Active = 0;
                }

                Gdk.Pixbuf default_pixbuf = null;
                string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png");
                //if (System.IO.File.Exists(file)) {

                    try {
                        default_pixbuf = new Gdk.Pixbuf(file);
                    } catch (Exception ex) {
                        Tool.Logger.Error(ex.Message);
                    }

                    popupColor = new Gtk.Menu();
                    CreateMenu();

                    Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf));
                    btnClose.TooltipText = MainClass.Languages.Translate("select_color");
                    btnClose.Relief = Gtk.ReliefStyle.None;
                    btnClose.CanFocus = false;
                    btnClose.WidthRequest = btnClose.HeightRequest = 22;

                    popupColor.AttachToWidget(btnClose,new Gtk.MenuDetachFunc(DetachWidget));
                    btnClose.Clicked += delegate {
                        popupColor.Popup(null,null, new Gtk.MenuPositionFunc (GetPosition) ,3,Gtk.Global.CurrentEventTime);
                    };
                    table.Attach(btnClose,2,3,0,1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
                    popupColor.ShowAll();
                //}

                cbBackground.Color = new Gdk.Color(MainClass.Settings.BackgroundColor.Red,
                            MainClass.Settings.BackgroundColor.Green,MainClass.Settings.BackgroundColor.Blue);

                table.Attach(cbKeyBinding,1,2,1,2,AttachOptions.Fill,AttachOptions.Shrink,0,0);

                btnOk = new Gtk.Button();
                btnOk.Label = "_Ok";
                btnOk.UseUnderline = true;
                btnOk.Clicked+=  OnButtonOkClicked;

                table.Attach(btnOk,0,1,2,3,AttachOptions.Fill,AttachOptions.Shrink,0,0);

                vbox.PackEnd(table, false, true, 3);
            }
            vbox.PackEnd(label, false, true, 3);
            this.Add(vbox);

            if (bitmap != null)
                this.Resize(bitmap.Width, bitmap.Height);
            Console.WriteLine("splash.bild.end-{0}",DateTime.Now);
            this.ShowAll();
        }